version bump
[public/netxms.git] / configure.ac
CommitLineData
8e76f8aa 1# $Id$
d16cf8a5 2#
ef0c727b
VK
3# NetXMS - Network Management System
4# Configure script
d16cf8a5
AK
5#
6
300bec18 7AC_INIT([NetXMS], [1.2.6], [bugs@netxms.org])
ba1d810c 8AC_CONFIG_AUX_DIR(config)
8e7f84bf 9AC_CONFIG_HEADERS(config.h)
d16cf8a5 10AM_INIT_AUTOMAKE
09867021 11m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
d16cf8a5 12
aa24418a 13AC_CONFIG_MACRO_DIR([m4])
5387ff75 14
ef0c727b
VK
15#--------------------------------------------------------------------
16# Functions
17#--------------------------------------------------------------------
5387ff75 18
ef0c727b
VK
19check_substr()
20{
1010cff7 21 for w in $1; do
ef0c727b
VK
22 if test "x$w" = "x$2"; then
23 return 0;
24 fi
25 done
26 return 1
27}
16dff090 28
d3c8926d 29
ef0c727b
VK
30#--------------------------------------------------------------------
31# Initialize variables
32#--------------------------------------------------------------------
d3c8926d 33
ef0c727b
VK
34PLATFORM=`uname -s`
35COMPONENTS=""
36DISABLE_ICONV="no"
37DISABLE_ENCRYPTION="no"
4050bafb 38DISABLE_LMSENSORS="no"
f974a50a 39ENABLE_DEBUG="no"
25ae8377 40ENABLE_WERROR="no"
ef0c727b 41STATIC_BUILD="no"
c1165d33 42ALL_STATIC="no"
ef0c727b
VK
43DBDRIVER_SELECTED="no"
44USE_PTH="no"
45BUILD_SERVER="no"
46BUILD_AGENT="no"
47BUILD_CLIENT="no"
ef0c727b
VK
48BUILD_STATIC_AGENT="no"
49NEED_ZLIB="no"
f65df2b1 50MODULES="libnetxms tools install"
ef0c727b 51STATIC_SUBAGENT_LIST=""
c1165d33 52PROPOSED_STATIC_SUBAGENTS="default"
ef0c727b
VK
53SUBAGENT_DIRS=""
54SUBAGENT_LIBS=""
7c48e2aa 55SERVER_LIBS=""
ef0c727b
VK
56SERVER_TOOLS=""
57TOP_LEVEL_MODULES=""
58CONTRIB_MODULES=""
c2612d83 59CLIENT_COMPONENTS=""
8b86c5dc 60BUILD_UNICODE="no"
7d8c91ef 61ORACLE_LIBS=""
6fce76d8
VK
62PGSQL_LIBS=""
63MYSQL_LIBS=""
64ODBC_LIBS=""
467c489f 65FORCE_INTERNAL_EXPAT="no"
17b35ccc
VK
66USE_INTERNAL_LIBTRE="no"
67FORCE_INTERNAL_LIBTRE="no"
1fd41bcd
VK
68USE_INTERNAL_ZLIB="no"
69FORCE_INTERNAL_ZLIB="no"
cc297a70 70FORCE_32BIT_BUILD="no"
df9812a9 71FORCE_INTERNAL_GETOPT="no"
545bda2d
VK
72LDFLAGS_PREFIX=""
73LDFLAGS_SUFFIX=""
1ef5e57a
VK
74LTINIT_CC=""
75LTINIT_CXX=""
d3c8926d 76
16dff090 77
ef0c727b 78#--------------------------------------------------------------------
fecf6a2b
VK
79# Common compilation flags
80#--------------------------------------------------------------------
81
842c22f4 82CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DTRE_WCHAR=1"
fecf6a2b
VK
83
84
85#--------------------------------------------------------------------
ef0c727b
VK
86# Parse command line parameters
87#--------------------------------------------------------------------
7c9c94a7 88
ef0c727b
VK
89AC_ARG_WITH(server,
90[AS_HELP_STRING(--with-server,build server)],
91[
8817f620 92 COMPONENTS="$COMPONENTS sqlite snmp server agent"
c5c0f362
VK
93])
94
95AC_ARG_WITH(snmp,
96[AS_HELP_STRING(--with-snmp,build SNMP library and tools)],
97[
98 COMPONENTS="$COMPONENTS snmp"
ef0c727b 99])
7c9c94a7 100
ef0c727b
VK
101AC_ARG_WITH(client,
102[AS_HELP_STRING(--with-client,build client library and tools)],
103[
104 COMPONENTS="$COMPONENTS client"
105])
d16cf8a5 106
c2612d83 107AC_ARG_WITH(agent,
ef0c727b
VK
108[AS_HELP_STRING(--with-agent,build agent)],
109[
8817f620 110 COMPONENTS="$COMPONENTS sqlite agent"
ef0c727b 111])
d16cf8a5 112
ef0c727b
VK
113AC_ARG_WITH(static-agent,
114[AS_HELP_STRING(--with-static-agent,build statically linked agent)],
115[
8817f620 116 COMPONENTS="$COMPONENTS sqlite static-agent"
ef0c727b 117])
d16cf8a5 118
ef0c727b
VK
119AC_ARG_WITH(ipso-agent,
120[AS_HELP_STRING(--with-ipso-agent,build statically linked IPSO agent)],
121[
971abf4f 122 COMPONENTS="$COMPONENTS ipso-agent"
ef0c727b 123])
521d90e7 124
ef0c727b
VK
125AC_ARG_WITH(mdebug,
126[AS_HELP_STRING(--with-mdebug,use debug version of memory allocation functions)],
127[
128 CPPFLAGS="$CPPFLAGS -DNETXMS_MEMORY_DEBUG"
129])
d16cf8a5 130
467c489f
VK
131AC_ARG_WITH(internal-libexpat,
132[AS_HELP_STRING(--with-internal-libexpat,force use of bundled libexpat)],
133[
134 FORCE_INTERNAL_EXPAT="yes"
135])
136
17b35ccc
VK
137AC_ARG_WITH(internal-libtre,
138[AS_HELP_STRING(--with-internal-libtre,force use of bundled libtre)],
139[
140 FORCE_INTERNAL_LIBTRE="yes"
141])
142
1fd41bcd
VK
143AC_ARG_WITH(internal-zlib,
144[AS_HELP_STRING(--with-internal-zlib,force use of bundled zlib)],
145[
146 FORCE_INTERNAL_ZLIB="yes"
147])
148
df9812a9
VK
149AC_ARG_WITH(internal-getopt,
150[AS_HELP_STRING(--with-internal-getopt,force use of bundled getopt)],
151[
152 FORCE_INTERNAL_GETOPT="yes"
153])
154
c1165d33
VK
155AC_ARG_WITH(all-static,
156[AS_HELP_STRING(--with-all-static,use -all-static flag for linking executables)],
157[
158 ALL_STATIC="yes"
159])
160
161AC_ARG_WITH(static-subagents,
162[AS_HELP_STRING(--with-static-subagents=list,define list of static subagents (separated by spaces))],
163[
164 PROPOSED_STATIC_SUBAGENTS="$withval"
165])
166
9486b324
VK
167AC_ARG_WITH(sqlite,
168[AS_HELP_STRING(--with-sqlite,build SQLite database driver)],
169[ if test "x$withval" != "xno" ; then
8817f620 170 COMPONENTS="$COMPONENTS sqlite_drv"
ef0c727b 171 DBDRIVER_SELECTED="yes"
9486b324
VK
172fi ])
173
c4b88c3d
VK
174AC_ARG_WITH(odbc,
175[AS_HELP_STRING(--with-odbc,build ODBC database driver)],
176[ if test "x$withval" != "xno" ; then
177 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
178 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
179 LDFLAGS="$LDFLAGS -L${withval}/lib"
180 CPPFLAGS="$CPPFLAGS -I${withval}/include"
ef0c727b
VK
181 fi
182 COMPONENTS="$COMPONENTS odbc"
183 DBDRIVER_SELECTED="yes"
c4b88c3d
VK
184fi ])
185
41b4790d
VK
186AC_ARG_WITH(oracle,
187[AS_HELP_STRING(--with-oracle,build Oracle database driver)],
188[ if test "x$withval" != "xno" ; then
189 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
7d8c91ef
VK
190 if test -x "$withval/lib" ; then
191 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
192 LDFLAGS="$LDFLAGS -L${withval}/lib"
193 else
194 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
195 LDFLAGS="$LDFLAGS -L${withval}"
196 fi
197 if test -x "$withval/include" ; then
198 CPPFLAGS="$CPPFLAGS -I${withval}/include"
199 fi
200 if test -x "$withval/sdk/include" ; then
201 CPPFLAGS="$CPPFLAGS -I${withval}/sdk/include"
202 fi
41b4790d
VK
203 fi
204 COMPONENTS="$COMPONENTS oracle"
205 DBDRIVER_SELECTED="yes"
206fi ])
207
d16cf8a5 208AC_ARG_WITH(mysql,
c4b88c3d 209[AS_HELP_STRING(--with-mysql,build MySQL database driver)],
d16cf8a5
AK
210[ if test "x$withval" != "xno" ; then
211 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
212 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
213 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/mysql -L${withval}/mysql/lib"
6693a1d0 214 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include"
d16cf8a5 215 else
007ae516
VK
216 LD_RUN_PATH="/usr/local/mysql/lib:/usr/local/mysql/lib/mysql:/usr/lib64/mysql:/usr/lib/mysql:/usr/mysql/lib:/usr/mysql/lib/mysql:/usr/local/lib/mysql:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
217 LDFLAGS="$LDFLAGS -L/usr/local/mysql/lib -L/usr/lib64/mysql -L/usr/lib/mysql -L/usr/mysql/lib -L/usr/local/lib/mysql -L/usr/local/mysql/lib/mysql -L/usr/mysql/lib/mysql"
6693a1d0 218 CPPFLAGS="$CPPFLAGS -I/usr/local/mysql/include -I/usr/include/mysql -I/usr/mysql/include -I/usr/local/include/mysql -I/usr/local/mysql/include/mysql -I/usr/mysql/include/mysql"
d16cf8a5 219 fi
ef0c727b
VK
220 COMPONENTS="$COMPONENTS mysql"
221 DBDRIVER_SELECTED="yes"
6693a1d0 222fi ])
d16cf8a5
AK
223
224AC_ARG_WITH(pgsql,
c4b88c3d 225[AS_HELP_STRING(--with-pgsql,build PostgreSQL database driver)],
d16cf8a5 226[ if test "x$withval" != "xno" ; then
6693a1d0
AK
227 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
228 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
229 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/pgsql -L${withval}/lib/postgresql -L${withval}/pgsql/lib -L${withval}/postgresql/lib"
230 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/pgsql -I${withval}/include/postgresql -I${withval}/pgsql/include -I${withval}/postgresql/include"
231 else
007ae516
VK
232 LD_RUN_PATH="/usr/local/pgsql/lib:/usr/local/pgsql/lib/pgsql:/usr/lib64/pgsql:/usr/lib/pgsql:/usr/pgsql/lib:/usr/pgsql/lib/pgsql:/usr/local/lib/pgsql:/usr/local/postgresql/lib:/usr/local/postgresql/lib/postgresql:/usr/lib/postgresql:/usr/postgresql/lib:/usr/postgresql/lib/postgresql:/usr/local/lib/postgresql:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
233 LDFLAGS="$LDFLAGS -L/usr/local/pgsql/lib -L/usr/lib64/pgsql -L/usr/lib/pgsql -L/usr/pgsql/lib -L/usr/local/lib/pgsql -L/usr/local/pgsql/lib/pgsql -L/usr/pgsql/lib/pgsql -L/usr/local/postgresql/lib -L/usr/lib/postgresql -L/usr/postgresql/lib -L/usr/local/lib/postgresql -L/usr/local/postgresql/lib/postgresql -L/usr/postgresql/lib/postgresql"
6693a1d0
AK
234 CPPFLAGS="$CPPFLAGS -I/usr/local/pgsql/include -I/usr/include/pgsql -I/usr/pgsql/include -I/usr/local/include/pgsql -I/usr/local/pgsql/include/pgsql -I/usr/pgsql/include/pgsql -I/usr/local/postgresql/include -I/usr/include/postgresql -I/usr/postgresql/include -I/usr/local/include/postgresql -I/usr/local/postgresql/include/postgresql -I/usr/postgresql/include/postgresql"
235 fi
ef0c727b
VK
236 COMPONENTS="$COMPONENTS pgsql"
237 DBDRIVER_SELECTED="yes"
6693a1d0 238fi ])
d16cf8a5 239
84277a0f
AK
240AC_ARG_WITH(db2,
241[AS_HELP_STRING(--with-db2,build DB2 database driver)],
242[ if test "x$withval" != "xno" ; then
243 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
244 if test `uname -m` = 'i386' || test `uname -m` = 'i686'; then
245 DB2_LIB_DIR=lib32
246 else
247 DB2_LIB_DIR=lib64
248 fi
249 if test -x "$withval/${DB2_LIB_DIR}" ; then
250 LD_RUN_PATH="${withval}/${DB2_LIB_DIR}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
251 LDFLAGS="$LDFLAGS -L${withval}/${DB2_LIB_DIR}"
252 else
253 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
254 LDFLAGS="$LDFLAGS -L${withval}"
255 fi
256 if test -x "$withval/include" ; then
257 CPPFLAGS="$CPPFLAGS -I${withval}/include"
258 fi
259
260 unset DB2_LIB_DIR
261 fi
262 COMPONENTS="$COMPONENTS db2"
263 DBDRIVER_SELECTED="yes"
264fi ])
265
37861c72
VK
266AC_ARG_WITH(informix,
267[AS_HELP_STRING(--with-informix,build Informix database driver)],
268[ if test "x$withval" != "xno" ; then
269 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
270 if test -x "$withval/lib/cli" ; then
271 LD_RUN_PATH="${withval}/lib/cli${LD_RUN_PATH:+:}${LD_RUN_PATH}"
272 LDFLAGS="$LDFLAGS -L${withval}/lib/cli"
273 if test -x "$withval/lib/esql" ; then
274 LD_RUN_PATH="${withval}/lib/esql${LD_RUN_PATH:+:}${LD_RUN_PATH}"
275 LDFLAGS="$LDFLAGS -L${withval}/lib/esql"
276 fi
277 else
278 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
279 LDFLAGS="$LDFLAGS -L${withval}"
280 fi
281 if test -x "$withval/incl/cli" ; then
282 CPPFLAGS="$CPPFLAGS -I${withval}/incl/cli"
283 fi
284 fi
285 COMPONENTS="$COMPONENTS informix"
286 DBDRIVER_SELECTED="yes"
287fi ])
288
ef0c727b 289AC_ARG_WITH(openssl,
1010cff7
VK
290[AS_HELP_STRING(--with-openssl,specify OpenSSL location)],
291[
292 if test "x$withval" != "xno" ; then
293 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
294 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
295 LDFLAGS="$LDFLAGS -L${withval}/lib"
296 CPPFLAGS="$CPPFLAGS -I${withval}/include"
297 else
298 LD_RUN_PATH="/usr/local/lib:/opt/openssl/lib:/usr/local/ssl/lib:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
299 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/opt/openssl/lib"
4d37b0c5 300 CPPFLAGS="$CPPFLAGS -I/opt/openssl/include"
ef0c727b 301 fi
1010cff7
VK
302 fi
303 REQUIRE_ENCRYPTION="yes"
304])
ef0c727b
VK
305
306AC_ARG_ENABLE(iconv,
307[AS_HELP_STRING(--disable-iconv,do not use iconv() for text conversions)],
3a7ce527 308[
ef0c727b 309 DISABLE_ICONV="yes"
3a7ce527 310])
3a7ce527 311
ef0c727b
VK
312AC_ARG_ENABLE(encryption,
313[AS_HELP_STRING(--disable-encryption,disable encryption support)],
e0760102 314[
ef0c727b 315 DISABLE_ENCRYPTION="yes"
e0760102
VK
316])
317
4050bafb
VK
318AC_ARG_ENABLE(lmsensors,
319[AS_HELP_STRING(--disable-lmsensors,disable lmsensors support)],
320[
321 DISABLE_LMSENSORS="yes"
322])
323
a67fa146
VK
324AC_ARG_ENABLE(unicode,
325[AS_HELP_STRING(--enable-unicode,enable UNICODE build)],
326[
327 BUILD_UNICODE="yes"
842c22f4 328 CPPFLAGS="$CPPFLAGS -DUNICODE"
76b1d3d8 329 FORCE_INTERNAL_LIBTRE="yes"
a67fa146
VK
330])
331
f974a50a
VK
332AC_ARG_ENABLE(debug,
333[AS_HELP_STRING(--enable-debug,enable additional debugging functionality)],
334[
335 ENABLE_DEBUG="yes"
336])
337
25ae8377
VK
338AC_ARG_ENABLE(werror,
339[AS_HELP_STRING(--enable-werror,threat all warnings as errors)],
340[
341 ENABLE_WERROR="yes"
342])
343
cc297a70 344AC_ARG_ENABLE(64bit,
e5be5b83 345[AS_HELP_STRING(--disable-64bit,disable 64bit build (force 32bit build on 64bit machine))],
cc297a70
VK
346[
347 FORCE_32BIT_BUILD="yes"
348])
349
ef0c727b
VK
350AC_ARG_WITH(dist,
351[AS_HELP_STRING(--with-dist,for maintainers only)],
87f1fff0 352 DB_DRIVERS=" mysql pgsql odbc mssql sqlite oracle db2 informix"
147cb615 353 MODULES="libexpat libtre zlib libnetxms install sqlite snmp libnxsl libnxlp db server agent libnxmap libnxcl client nxscript tools"
cf52e714 354 SUBAGENT_DIRS="linux freebsd openbsd netbsd sunos aix ipso hpux odbcquery informix oracle lmsensors darwin"
ef0c727b
VK
355 NXCONFIG="nxconfig"
356 TOP_LEVEL_MODULES="sql images"
357 CONTRIB_MODULES="mibs backgrounds"
9cb6c12f 358 CLIENT_COMPONENTS="nxalarm nxevent nxlexer nxpush nxsms scilexer windows"
ef0c727b
VK
359 SERVER_TOOLS="nxconfig"
360)
361
d8ca9c03 362
ef0c727b
VK
363#--------------------------------------------------------------------
364# Validate command line parameters and set various checking options
365#--------------------------------------------------------------------
366
8817f620
VK
367check_substr "$COMPONENTS" "sqlite"
368if test $? = 0; then
369 MODULES="$MODULES sqlite"
370fi
371
ef0c727b 372check_substr "$COMPONENTS" "static-agent"
1010cff7 373if test $? = 0; then
971abf4f
VK
374 if test "x$COMPONENTS" != "x sqlite static-agent"; then
375 AC_MSG_ERROR(Static agent and other components are mutually exclusive.)
ef0c727b
VK
376 fi
377 STATIC_BUILD="yes"
378 BUILD_STATIC_AGENT="yes"
60a1159a 379 MODULES="$MODULES libnxlp db agent"
3a6979cf 380 DISABLE_ICONV="yes"
ef0c727b 381 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT"
c1165d33
VK
382 if test "x$PROPOSED_STATIC_SUBAGENTS" = "xdefault"; then
383 STATIC_SUBAGENT_LIST="ecs logwatch ping portcheck ups"
384 else
385 STATIC_SUBAGENT_LIST="$PROPOSED_STATIC_SUBAGENTS"
386 fi
60a1159a 387
c1165d33 388 SUBAGENT_LIBS="../subagents/ecs/ecs.la ../subagents/logwatch/logwatch.la ../subagents/ping/ping.la ../subagents/portCheck/portcheck.la ../subagents/ups/ups.la"
e8636669 389
60a1159a
VK
390 check_substr "$STATIC_SUBAGENT_LIST" "odbcquery"
391 if test $? = 0; then
392 COMPONENTS="$COMPONENTS odbc"
393 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/odbcquery/odbcquery.la"
394 fi
395
396 check_substr "$STATIC_SUBAGENT_LIST" "oracle"
397 if test $? = 0; then
398 COMPONENTS="$COMPONENTS oracle"
399 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/oracle/oracle.la"
400 fi
401
402 check_substr "$STATIC_SUBAGENT_LIST" "informix"
403 if test $? = 0; then
404 COMPONENTS="$COMPONENTS informix"
405 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/informix/informix.la"
406 fi
407
ef0c727b 408 case "$PLATFORM" in
e8636669
VK
409 Linux)
410 SUBAGENT_DIRS="linux"
c1165d33 411 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/linux/linux.la"
d0b5a098 412 STATIC_SUBAGENT_LIST="linux $STATIC_SUBAGENT_LIST"
e8636669
VK
413 ;;
414 FreeBSD)
415 SUBAGENT_DIRS="freebsd"
c1165d33 416 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/freebsd/freebsd.la"
d0b5a098 417 STATIC_SUBAGENT_LIST="freebsd $STATIC_SUBAGENT_LIST"
e8636669 418 ;;
992ba479
AK
419 OpenBSD)
420 SUBAGENT_DIRS="openbsd"
c1165d33 421 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/openbsd/openbsd.la"
992ba479
AK
422 STATIC_SUBAGENT_LIST="openbsd $STATIC_SUBAGENT_LIST"
423 ;;
ad0f1ada
VK
424 NetBSD)
425 SUBAGENT_DIRS="netbsd"
c1165d33 426 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/netbsd/netbsd.la"
ad0f1ada
VK
427 STATIC_SUBAGENT_LIST="netbsd $STATIC_SUBAGENT_LIST"
428 ;;
e8636669
VK
429 SunOS)
430 SUBAGENT_DIRS="sunos"
c1165d33 431 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/sunos/sunos.la"
d0b5a098
VK
432 STATIC_SUBAGENT_LIST="sunos $STATIC_SUBAGENT_LIST"
433 ;;
434 AIX)
435 SUBAGENT_DIRS="aix"
c1165d33 436 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/aix/aix.la"
d0b5a098 437 STATIC_SUBAGENT_LIST="aix $STATIC_SUBAGENT_LIST"
e8636669 438 ;;
c29360a9
VK
439 HP-UX)
440 SUBAGENT_DIRS="hpux"
c1165d33 441 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/hpux/hpux.la"
c29360a9
VK
442 STATIC_SUBAGENT_LIST="hpux $STATIC_SUBAGENT_LIST"
443 ;;
cf52e714
AK
444 Darwin)
445 SUBAGENT_DIRS="darwin"
446 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/darwin/darwin.la"
447 STATIC_SUBAGENT_LIST="darwin $STATIC_SUBAGENT_LIST"
448 ;;
e8636669
VK
449 *)
450 # unknown
451 ;;
452 esac
ef0c727b 453fi
2b23dc1e 454
ef0c727b 455check_substr "$COMPONENTS" "ipso-agent"
1010cff7 456if test $? = 0; then
fd5a401b 457 if test "x$COMPONENTS" != "x ipso-agent"; then
971abf4f 458 AC_MSG_ERROR(IPSO agent and other components are mutually exclusive.)
ef0c727b
VK
459 fi
460 STATIC_BUILD="yes"
461 BUILD_STATIC_AGENT="yes"
3a6979cf 462 DISABLE_ICONV="yes"
ef0c727b 463 USE_PTH="yes"
60a1159a 464 MODULES="$MODULES libnxlp db agent"
aa24418a 465 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT -D_IPSO -D_USE_GNU_PTH -DSQLITE_THREADSAFE=0 -I/usr/local/include"
ef0c727b 466 LDFLAGS="$LDFLAGS -all-static"
971abf4f 467 STATIC_SUBAGENT_LIST="ecs ipso logwatch ping portcheck ups"
ef0c727b 468 SUBAGENT_DIRS="ipso"
c1165d33 469 SUBAGENT_LIBS="../subagents/ecs/ecs.la ../subagents/ipso/ipso.la ../subagents/logwatch/logwatch.la ../subagents/ping/ping.la ../subagents/portCheck/portcheck.la ../subagents/ups/ups.la"
ef0c727b 470fi
c688d2a7 471
c5c0f362
VK
472check_substr "$COMPONENTS" "snmp"
473if test $? = 0; then
474 NEED_ZLIB="yes"
475 MODULES="$MODULES snmp"
476fi
477
ef0c727b 478check_substr "$COMPONENTS" "server"
1010cff7 479if test $? = 0; then
ef0c727b
VK
480 if test "x$DBDRIVER_SELECTED" != "xyes"; then
481 AC_MSG_ERROR(You must select at least one database driver when building server.)
482 fi
483 BUILD_SERVER="yes"
d1834406 484 MODULES="$MODULES libnxmap libnxsl libnxlp db server nxscript"
ef0c727b
VK
485 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES sql images"
486 CONTRIB_MODULES="$CONTRIB_MODULES mibs backgrounds"
487fi
dff54fed 488
e44986e5
VK
489check_substr "$COMPONENTS" "client"
490if test $? = 0; then
491 BUILD_CLIENT="yes"
492 NEED_ZLIB="yes"
aa24418a 493 MODULES="$MODULES libnxmap libnxcl client"
36ad9f45 494 CLIENT_COMPONENTS="$CLIENT_COMPONENTS nxalarm nxevent nxpush nxsms"
e44986e5
VK
495fi
496
ef0c727b 497check_substr "$COMPONENTS" "agent"
1010cff7 498if test $? = 0; then
ef0c727b 499 BUILD_AGENT="yes"
28ba6824 500 MODULES="$MODULES libnxlp db agent"
1010cff7
VK
501
502 case "$PLATFORM" in
503 Linux)
504 SUBAGENT_DIRS="linux"
505 ;;
506 FreeBSD)
507 SUBAGENT_DIRS="freebsd"
508 ;;
509 OpenBSD)
510 SUBAGENT_DIRS="openbsd"
511 ;;
ad0f1ada
VK
512 NetBSD)
513 SUBAGENT_DIRS="netbsd"
514 ;;
1010cff7
VK
515 SunOS)
516 SUBAGENT_DIRS="sunos"
517 ;;
518 AIX)
519 SUBAGENT_DIRS="aix"
520 ;;
521 HP-UX)
522 SUBAGENT_DIRS="hpux"
cf52e714
AK
523 ;;
524 Darwin)
525 SUBAGENT_DIRS="darwin"
1010cff7
VK
526 ;;
527 *)
528 # unknown
529 ;;
530 esac
ef0c727b 531fi
b97191d2 532
ef0c727b 533check_substr "$COMPONENTS" "mysql"
1010cff7 534if test $? = 0; then
ef0c727b 535 DB_DRIVERS="$DB_DRIVERS mysql"
b67a9e12 536fi
6619a6b0 537
ef0c727b 538check_substr "$COMPONENTS" "pgsql"
1010cff7 539if test $? = 0; then
ef0c727b
VK
540 DB_DRIVERS="$DB_DRIVERS pgsql"
541fi
e8636669 542
8817f620 543check_substr "$COMPONENTS" "sqlite_drv"
1010cff7 544if test $? = 0; then
ef0c727b 545 DB_DRIVERS="$DB_DRIVERS sqlite"
e8636669
VK
546fi
547
ef0c727b 548check_substr "$COMPONENTS" "odbc"
1010cff7 549if test $? = 0; then
ef0c727b 550 DB_DRIVERS="$DB_DRIVERS odbc"
80e96a82 551 SUBAGENT_DIRS="$SUBAGENT_DIRS odbcquery"
ef0c727b
VK
552fi
553
41b4790d
VK
554check_substr "$COMPONENTS" "oracle"
555if test $? = 0; then
556 DB_DRIVERS="$DB_DRIVERS oracle"
4d1753cd 557 SUBAGENT_DIRS="$SUBAGENT_DIRS oracle"
41b4790d
VK
558fi
559
84277a0f
AK
560check_substr "$COMPONENTS" "db2"
561if test $? = 0; then
562 DB_DRIVERS="$DB_DRIVERS db2"
563fi
564
87f1fff0
VK
565check_substr "$COMPONENTS" "informix"
566if test $? = 0; then
567 DB_DRIVERS="$DB_DRIVERS informix"
80e96a82 568 SUBAGENT_DIRS="$SUBAGENT_DIRS informix"
87f1fff0
VK
569fi
570
ef0c727b
VK
571
572#--------------------------------------------------------------------
573# Check for programs
574#--------------------------------------------------------------------
575
576if test "x$PLATFORM" = "xHP-UX"; then
e7d9c4ae 577 AC_CHECK_PROG([CCC], [aCC], [aCC])
ef0c727b 578fi
df9812a9
VK
579if test "x$PLATFORM" = "xAIX"; then
580 AC_CHECK_PROG([CCC], [xlC_r], [xlC_r])
581fi
582AC_PROG_CC(aCC xlC_r gcc cc cl)
ef0c727b
VK
583AC_PROG_CPP
584AC_PROG_CXX
c3cfc039 585if test "x$CXX" = "xg++"; then
753206b5
AK
586 AC_CHECK_PROG([GPLUSPLUS], [g++], [yes], [no])
587 if test "x$GPLUSPLUS" = "xno"; then
c3cfc039
VK
588 AC_MSG_ERROR([*** FATAL: Cannot find any usable C++ compiler])
589 fi
590fi
ef0c727b
VK
591AC_PROG_INSTALL
592AC_PROG_LEX
76154a95 593AC_CHECK_PROGS(YACC,bison byacc,yacc)
ef0c727b
VK
594AC_PROG_LN_S
595
596AC_ARG_VAR(PERL,local path to the perl interpreter)
597perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin"
598AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path)
599
600
601#--------------------------------------------------------------------
ef0c727b
VK
602# C/C++ capabilities
603#--------------------------------------------------------------------
604
605AC_C_CONST
606AC_PROG_GCC_TRADITIONAL
1d9cc60e 607AC_C_BIGENDIAN
ef0c727b
VK
608
609
610#--------------------------------------------------------------------
611# Platform-dependent settings
612#--------------------------------------------------------------------
613
614case "$PLATFORM" in
615 AIX)
545bda2d 616 LDFLAGS_PREFIX="-no-undefined -Wl,-brtl $LDFLAGS"
ef0c727b
VK
617 ;;
618 HP-UX)
53c96e2d 619 CPPFLAGS="$CPPFLAGS -D_HPUX -D_HPUX_SOURCE -D_POSIX_PTHREAD_SEMANTICS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 -D_REENTRANT -D_INCLUDE_LONGLONG"
ef0c727b 620 if test "x$CXX" = "xaCC"; then
53c96e2d 621 CFLAGS="$CFLAGS -AC99"
cfd95c74 622 CXXFLAGS="-mt $CXXFLAGS +W749 +W829"
ef0c727b
VK
623 LDFLAGS="$LDFLAGS -mt"
624 fi
625 ;;
75c30ed4 626 SunOS)
27ed5b1d 627 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
75c30ed4
VK
628 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
629 export LD_LIBRARY_PATH
630 ;;
56b2f755
VK
631 Linux)
632 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
633 ;;
ef0c727b
VK
634 *)
635 ;;
636esac
637
638
639#--------------------------------------------------------------------
c90d3610 640# C++ compiler tuning:
cc297a70 641# * Disable C++ exceptions and RTTI
779ce551 642# * Turn on 64bit mode on HP-UX/Itanium
cc297a70 643# * Turn on 64bit mode on AIX
d358c73f 644# * Turn on 64bit mode on Solaris
ef0c727b
VK
645#--------------------------------------------------------------------
646
647if test "x$CC" = "xgcc" ; then
648
649 AC_LANG_PUSH([C++])
650
651 AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti)
e6b112bc 652 OLD_CXXFLAGS="$CXXFLAGS"
ef0c727b
VK
653 CXXFLAGS="$CXXFLAGS -fno-rtti"
654 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
655 [ AC_MSG_RESULT(yes) ],
656 [
657 CXXFLAGS="$OLD_CXXFLAGS"
658 AC_MSG_RESULT(no)
659 ])
660
661 AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions)
e6b112bc 662 OLD_CXXFLAGS="$CXXFLAGS"
ef0c727b
VK
663 CXXFLAGS="$CXXFLAGS -fno-exceptions"
664 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
665 [ AC_MSG_RESULT(yes) ],
666 [
667 CXXFLAGS="$OLD_CXXFLAGS"
668 AC_MSG_RESULT(no)
669 ])
670
671 AC_LANG_POP([C++])
672
779ce551 673 if test "x$PLATFORM" = "xHP-UX"; then
cc297a70
VK
674 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
675 AC_MSG_CHECKING(whether C compiler accepts -milp32)
676 OLD_CPPFLAGS="$CPPFLAGS"
677 CPPFLAGS="$CPPFLAGS -milp32"
678 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
679 [
680 LDFLAGS="-milp32 $LDFLAGS"
681 AC_MSG_RESULT(yes)
682 ],
683 [
684 CPPFLAGS="$OLD_CPPFLAGS"
685 AC_MSG_RESULT(no)
686 ])
687 else
688 AC_MSG_CHECKING(whether C compiler accepts -mlp64)
689 OLD_CPPFLAGS="$CPPFLAGS"
690 CPPFLAGS="$CPPFLAGS -mlp64"
691 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
692 [
693 LDFLAGS="-mlp64 -L/usr/lib/hpux64 -L/usr/local/lib/hpux64 $LDFLAGS"
694 AC_MSG_RESULT(yes)
695 ],
696 [
697 CPPFLAGS="$OLD_CPPFLAGS"
698 AC_MSG_RESULT(no)
699 ])
700 fi
701 fi
702
703 if test "x$PLATFORM" = "xAIX"; then
704 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
705 AC_MSG_CHECKING(whether C compiler accepts -maix32)
706 OLD_CPPFLAGS="$CPPFLAGS"
707 CPPFLAGS="$CPPFLAGS -maix32"
fecf6a2b 708 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
709 [
710 LDFLAGS="-maix32 $LDFLAGS"
1ef5e57a
VK
711 LTINIT_CC="gcc -maix32"
712 LTINIT_CXX="g++ -maix32"
1c45282c 713 OBJECT_MODE=32
cc297a70
VK
714 AC_MSG_RESULT(yes)
715 ],
716 [
717 CPPFLAGS="$OLD_CPPFLAGS"
718 AC_MSG_RESULT(no)
719 ])
720 else
721 AC_MSG_CHECKING(whether C compiler accepts -maix64)
722 OLD_CPPFLAGS="$CPPFLAGS"
723 CPPFLAGS="$CPPFLAGS -maix64"
fecf6a2b 724 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
725 [
726 LDFLAGS="-maix64 $LDFLAGS"
1ef5e57a
VK
727 LTINIT_CC="gcc -maix64"
728 LTINIT_CXX="g++ -maix64"
1c45282c 729 OBJECT_MODE=64
cc297a70
VK
730 AC_MSG_RESULT(yes)
731 ],
732 [
733 CPPFLAGS="$OLD_CPPFLAGS"
734 AC_MSG_RESULT(no)
735 ])
736 fi
779ce551 737 fi
d358c73f
VK
738
739 if test "x$PLATFORM" = "xSunOS"; then
740 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
741 AC_MSG_CHECKING(whether C compiler accepts -m32)
742 OLD_CPPFLAGS="$CPPFLAGS"
743 CPPFLAGS="$CPPFLAGS -m32"
744 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
745 [
746 LDFLAGS="-m32 $LDFLAGS"
747 AC_MSG_RESULT(yes)
748 ],
749 [
750 CPPFLAGS="$OLD_CPPFLAGS"
751 AC_MSG_RESULT(no)
752 ])
753 else
754 AC_MSG_CHECKING(whether C compiler accepts -m64)
755 OLD_CPPFLAGS="$CPPFLAGS"
756 CPPFLAGS="$CPPFLAGS -m64"
757 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
758 [
759 LDFLAGS="-m64 $LDFLAGS"
760 AC_MSG_RESULT(yes)
761 ],
762 [
763 CPPFLAGS="$OLD_CPPFLAGS"
764 AC_MSG_RESULT(no)
765 ])
766 fi
767 fi
779ce551 768
ce5592b2
VK
769 if test "x$ENABLE_DEBUG" = "xyes"; then
770 CPPFLAGS="$CPPFLAGS -ggdb3"
771 fi
ef0c727b
VK
772fi
773
cfd95c74
VK
774if test "x$CXX" = "xaCC" ; then
775 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
776 AC_MSG_CHECKING(whether C compiler accepts +DD32)
4d37b0c5 777 OLD_CPPFLAGS="$CPPFLAGS"
cfd95c74
VK
778 CPPFLAGS="+DD32 $CPPFLAGS"
779 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
780 [
781 LDFLAGS="+DD32 $LDFLAGS"
782 AC_MSG_RESULT(yes)
783 ],
784 [
4d37b0c5
VK
785 CPPFLAGS="$OLD_CPPFLAGS"
786 AC_MSG_RESULT(no)
cfd95c74 787 ])
4d37b0c5 788 else
cfd95c74
VK
789 AC_MSG_CHECKING(whether C compiler accepts +DD64)
790 OLD_CPPFLAGS="$CPPFLAGS"
791 CPPFLAGS="+DD64 $CPPFLAGS"
792 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
793 [
794 LDFLAGS="+DD64 $LDFLAGS"
795 AC_MSG_RESULT(yes)
796 ],
797 [
798 CPPFLAGS="$OLD_CPPFLAGS"
799 AC_MSG_RESULT(no)
800 ])
4d37b0c5 801 fi
ef0c727b
VK
802fi
803
df9812a9 804if test "x$CXX" = "xxlC_r" ; then
9b99f1c0
VK
805 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
806 AC_MSG_CHECKING(whether C compiler accepts -q32)
807 OLD_CPPFLAGS="$CPPFLAGS"
808 CPPFLAGS="-q32 $CPPFLAGS"
809 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
810 [
811 LDFLAGS="-q32 $LDFLAGS"
df9812a9 812 OBJECT_MODE=32
9b99f1c0
VK
813 AC_MSG_RESULT(yes)
814 ],
815 [
816 CPPFLAGS="$OLD_CPPFLAGS"
817 AC_MSG_RESULT(no)
818 ])
819 else
820 AC_MSG_CHECKING(whether C compiler accepts -q64)
821 OLD_CPPFLAGS="$CPPFLAGS"
822 CPPFLAGS="-q64 $CPPFLAGS"
823 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
824 [
825 LDFLAGS="-q64 $LDFLAGS"
df9812a9 826 OBJECT_MODE=64
9b99f1c0
VK
827 AC_MSG_RESULT(yes)
828 ],
829 [
830 CPPFLAGS="$OLD_CPPFLAGS"
831 AC_MSG_RESULT(no)
832 ])
833 fi
834fi
835
edb018d7
VK
836
837#--------------------------------------------------------------------
838# Initialize libtool
839#--------------------------------------------------------------------
840
841if test "x$STATIC_BUILD" = "xyes"; then
842 enable_shared=no
843 enable_static=yes
844else
845 enable_shared=yes
846 enable_static=no
847fi
1ef5e57a
VK
848
849if test "x$LTINIT_CC" != "x"; then
850 SAVED_CC="$CC"
851 CC="$LTINIT_CC"
852fi
853if test "x$LTINIT_CXX" != "x"; then
854 SAVED_CXX="$CXX"
855 CXX="$LTINIT_CXX"
856fi
857
ff12e2f1 858LT_PREREQ([2.2])
1ef5e57a
VK
859LT_INIT([dlopen])
860
861if test "x$SAVED_CC" != "x"; then
862 CC="$SAVED_CC"
863fi
864if test "x$SAVED_CXX" != "x"; then
865 CXX="$SAVED_CXX"
866fi
edb018d7
VK
867
868
cfd95c74
VK
869#--------------------------------------------------------------------
870# Additional include and library directories
871#--------------------------------------------------------------------
ef0c727b 872
cfd95c74
VK
873if test "x$CXX" != "xaCC"; then
874 if test -d /usr/local/include; then
875 if test "x$CC" = "xgcc"; then
876 AC_MSG_CHECKING(whether -I/usr/local/include needed)
877 OLD_CPPFLAGS="$CPPFLAGS"
878 CPPFLAGS="$CPPFLAGS -Werror -I/usr/local/include"
879 AC_TRY_COMPILE([],[],
880 [
881 CPPFLAGS="$OLD_CPPFLAGS -I/usr/local/include"
882 AC_MSG_RESULT(yes)
883 ],
884 [
885 CPPFLAGS="$OLD_CPPFLAGS"
886 AC_MSG_RESULT(no)
887 ]
888 )
889 else
890 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
891 fi
892 fi
893
894 if test -d /usr/kerberos/include; then
895 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
896 fi
ef0c727b 897
cfd95c74
VK
898 if test -d /usr/local/lib; then
899 LDFLAGS="$LDFLAGS -L/usr/local/lib"
900 fi
901fi
ef0c727b
VK
902
903#--------------------------------------------------------------------
904# Check for threads library - either POSIX or GNU
905#--------------------------------------------------------------------
906
907if test "x$USE_PTH" = "xyes"; then
908 AC_CHECK_HEADER(pth.h,,AC_MSG_ERROR([*** GNU Pth thread support not installed - please install first ***]))
909else
910 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
911
912 if test "x$CXX" = "xaCC"; then
913 PTHREAD_LIBS=""
914 else
915 PTHREAD_LIBS="error"
916 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
917 AC_EGREP_CPP(yes,
918 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
919 yes
920 #endif
921 ], AC_MSG_RESULT(yes)
fecf6a2b 922 PTHREAD_LIBS="-pthread",
ef0c727b
VK
923 AC_MSG_RESULT(no))
924 if test "x$PTHREAD_LIBS" = "xerror"; then
925 AC_CHECK_LIB(pthread, pthread_attr_init,
926 PTHREAD_LIBS="-lpthread")
927 fi
f725c1b7 928 # On HP-UX (at least 11.00) pthread library contains
b041c587 929 # __pthread_attr_init_system instead of pthread_attr_init
f725c1b7 930 if test "x$PTHREAD_LIBS" = "xerror"; then
b041c587 931 AC_CHECK_LIB(pthread, __pthread_attr_init_system,
f725c1b7
VK
932 PTHREAD_LIBS="-lpthread")
933 fi
ef0c727b
VK
934 if test "x$PTHREAD_LIBS" = "xerror"; then
935 AC_CHECK_LIB(pthreads, pthread_attr_init,
936 PTHREAD_LIBS="-lpthreads")
937 fi
938 if test "x$PTHREAD_LIBS" = "xerror"; then
939 AC_CHECK_FUNC(pthread_attr_init,
940 PTHREAD_LIBS="")
941 fi
942 fi
943
944 if test "x$PTHREAD_LIBS" = "xerror"; then
945 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
946 fi
8d131dda 947 LIBS="$LIBS $PTHREAD_LIBS"
ef0c727b
VK
948
949 # Extensions to posix threads
950 AC_CHECK_HEADERS([pthread_np.h],,,[
9c29f76e 951#include <pthread.h>
ef0c727b
VK
952 ])
953 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
954
955 # Check for recursive mutexes
39086394
VK
956 AC_CHECK_FUNCS([pthread_mutexattr_settype __pthread_mutexattr_settype pthread_mutexattr_setkind_np])
957 AC_CHECK_DECLS([pthread_mutexattr_settype, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
9c29f76e
VK
958#include <pthread.h>
959#if HAVE_PTHREAD_NP_H
960#include <pthread_np.h>
961#endif
ef0c727b
VK
962 ])
963
964 # Check for read/write locks
965 # On Linux, rwlock functions declared always, but pthread_rwlock_t may need
966 # additional defines
967 AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
968 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
969 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
9c29f76e
VK
970 [AC_TRY_COMPILE([
971#include <sys/types.h>
972#include <pthread.h>
973 ],
ef0c727b
VK
974 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
975 ac_cv_struct_pthread_rw=yes, [
9c29f76e
VK
976 AC_TRY_COMPILE([
977#define _XOPEN_SOURCE 500
978#include <sys/types.h>
979#include <pthread.h>
980 ],
ef0c727b
VK
981 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
982 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
983 if test "$ac_cv_struct_pthread_rw" = "yes"; then
984 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
985 fi
986 ])])
987 if test "$ac_cv_struct_pthread_rw" = "yes"; then
988 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
989 fi
990 fi
991
992fi
993
994
995#--------------------------------------------------------------------
996# Checks for OpenSSL
997#--------------------------------------------------------------------
998
999if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
1000 AC_CHECK_LIB(crypto, RSA_new,
1001 [
1002 AC_DEFINE(WITH_OPENSSL,,[with openssl])
1003 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
1004 [], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
1005 AC_CHECK_LIB(crypto, EVP_bf_cbc,
1006 [], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
1007 AC_CHECK_LIB(crypto, EVP_idea_cbc,
1008 [], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
1009 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
1010 [], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
1011 ],
1012 [
1013 if test "x$REQUIRE_ENCRYPTION" = "xyes"; then
1014 AC_MSG_ERROR(libcrypto is required for encryption support)
1015 else
1016 AC_MSG_RESULT(libcrypto is required for encryption support)
1017 fi
1018 ])
1019fi
1020
1021
1022#--------------------------------------------------------------------
0322eed7
VK
1023# Checks for header files
1024#--------------------------------------------------------------------
1025
1026AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h alloca.h])
2e98cdb4 1027AC_CHECK_HEADERS([sys/int_types.h time.h sys/time.h sys/utsname.h sys/wait.h])
0322eed7
VK
1028AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h net/nh.h sys/socket.h])
1029AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
1030AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
1031AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h])
df9812a9 1032AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h])
f09c2d05 1033AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
0322eed7
VK
1034[[#ifdef HAVE_SYS_TYPES_H
1035# include <sys/types.h>
1036#endif
1037#ifdef HAVE_SYS_TIME_H
1038# include <sys/time.h>
1039#endif
1040#ifdef HAVE_SYS_SOCKET_H
1041# include <sys/socket.h>
1042#endif
1043]])
1044
1045
1046#--------------------------------------------------------------------
ef0c727b
VK
1047# Checks for other libs.
1048#--------------------------------------------------------------------
d16cf8a5 1049
779ce551 1050AC_CHECK_LIB(xnet, accept)
521d90e7 1051AC_CHECK_LIB(socket, if_nameindex)
87bb64a7 1052AC_CHECK_LIB(dl, dlopen)
1b3c0ef0 1053AC_CHECK_LIB(kstat, kstat_open)
d16cf8a5 1054
e0760102 1055if test "x$BUILD_SERVER" = "xyes" ; then
7c48e2aa
VK
1056 AC_CHECK_LIB(termcap, tgetstr, [SERVER_LIBS="$SERVER_LIBS -ltermcap"], [AC_CHECK_LIB(ncurses, tgetstr, [SERVER_LIBS="$SERVER_LIBS -lncurses"], AC_CHECK_LIB(curses, tgetstr, [SERVER_LIBS="$SERVER_LIBS -lcurses"]))])
1057 AC_CHECK_LIB(readline, readline, [SERVER_LIBS="$SERVER_LIBS -lreadline"], [AC_CHECK_LIB(edit, readline, [SERVER_LIBS="$SERVER_LIBS -ledit"])])
1058 SAVED_LDFLAGS="$LDFLAGS"
1059 LDFLAGS="$LDFLAGS $SERVER_LIBS"
1060
0322eed7
VK
1061 AC_CHECK_FUNCS([readline])
1062
1063 # Check if passing rl_insert to rl_bind_key needs cast
1064 if test "$ac_cv_func_readline" = "yes"; then
1065 AC_LANG_PUSH([C++])
1066
1067 AC_MSG_CHECKING(for rl_insert cast)
1068
1069 AC_TRY_COMPILE(
1070 [
1071#include <stdio.h>
1072#include <readline/readline.h>
1073 ],[ rl_bind_key('\t', (Function *)rl_insert); ],
1074 [
1075 AC_MSG_RESULT((Function *))
1076 AC_DEFINE(RL_INSERT_CAST,(Function *),Required cast for rl_insert)
1077 ],[
1078 AC_TRY_COMPILE(
1079 [
1080#include <stdio.h>
1081#include <readline/readline.h>
1082 ],[ rl_bind_key('\t', (rl_command_func_t *)rl_insert); ],
1083 [
1084 AC_MSG_RESULT((rl_command_func_t *))
1085 AC_DEFINE(RL_INSERT_CAST,(rl_command_func_t *),Required cast for rl_insert)
1086 ],[
1087 AC_MSG_RESULT(not needed)
1088 AC_DEFINE(RL_INSERT_CAST,,Required cast for rl_insert)
1089 ]
1090 )
1091 ]
1092 )
1093
1094 AC_LANG_POP([C++])
1095 fi
7c48e2aa 1096 LDFLAGS="$SAVED_LDFLAGS"
e0760102
VK
1097fi
1098
ef0c727b 1099if test "x$NEED_ZLIB" = "xyes"; then
1fd41bcd
VK
1100 if test "x$FORCE_INTERNAL_ZLIB" = "xyes"; then
1101 HAVE_ZLIB=no
1102 else
1103 HAVE_ZLIB=yes
1104 AC_CHECK_HEADER(zlib.h,,HAVE_ZLIB=no)
1105 if test "x$HAVE_ZLIB" = "xyes"; then
1106 AC_CHECK_LIB(z, deflate, [], [ HAVE_ZLIB=no ])
1107 fi
1108 fi
1109 if test "x$HAVE_ZLIB" = "xno"; then
1110 MODULES="zlib $MODULES"
1111 fi
ef0c727b
VK
1112fi
1113
467c489f
VK
1114if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
1115 HAVE_LIBEXPAT=no
1116else
1117 HAVE_LIBEXPAT=yes
1118 AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
1119 AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
1120fi
80ce37ac
VK
1121if test "x$HAVE_LIBEXPAT" = "xno"; then
1122 MODULES="libexpat $MODULES"
1bb6b449 1123fi
ef0c727b 1124
17b35ccc
VK
1125if test "x$FORCE_INTERNAL_LIBTRE" = "xyes"; then
1126 HAVE_LIBTRE=no
1127else
1128 HAVE_LIBTRE=yes
1129 AC_CHECK_HEADER(tre/regex.h,,HAVE_LIBTRE=no)
1130 AC_CHECK_LIB(tre, tre_compile, [], [ HAVE_LIBTRE=no ])
1131fi
1132if test "x$HAVE_LIBTRE" = "xno"; then
1133 MODULES="libtre $MODULES"
1134 AC_DEFINE(USE_BUNDLED_LIBTRE,1,Define to 1 if bundled libtre is used)
a67fa146 1135
720c23d0
VK
1136 tre_version_1='0'
1137 tre_version_2='8'
1138 tre_version_3='0'
a67fa146
VK
1139 tre_version=$tre_version_1.$tre_version_2.$tre_version_3
1140 AC_DEFINE_UNQUOTED(TRE_VERSION, "$tre_version", [ TRE version string. ])
1141 AC_DEFINE_UNQUOTED(TRE_VERSION_1, $tre_version_1, [ TRE version level 1. ])
1142 AC_DEFINE_UNQUOTED(TRE_VERSION_2, $tre_version_2, [ TRE version level 2. ])
1143 AC_DEFINE_UNQUOTED(TRE_VERSION_3, $tre_version_3, [ TRE version level 3. ])
1144 AC_SUBST(TRE_VERSION, $tre_version)
1145
1146 AC_DEFINE(TRE_REGEX_T_FIELD,value,[Define to a field in the regex_t struct where TRE should store a pointer to the internal tre_tnfa_t structure])
1147 AC_DEFINE(TRE_APPROX, 1, [ Define if you want to enable approximate matching functionality. ])
17b35ccc 1148fi
ef0c727b 1149
4050bafb
VK
1150if test "x$DISABLE_LMSENSORS" = "xno"; then
1151 HAVE_LMSENSORS=yes
1152 AC_CHECK_HEADER(sensors/sensors.h,,HAVE_LMSENSORS=no)
1153 if test "x$HAVE_LMSENSORS" = "xyes"; then
1154 AC_CHECK_LIB(sensors, sensors_init, [ DUMMY="" ], [ HAVE_LMSENSORS=no ])
1155 fi
1156 if test "x$HAVE_LMSENSORS" = "xyes"; then
1157 SUBAGENT_DIRS="$SUBAGENT_DIRS lmsensors"
1158 fi
38bfa5da
AK
1159fi
1160
ef0c727b
VK
1161#--------------------------------------------------------------------
1162# Checks for data types
1163#--------------------------------------------------------------------
1164
d16cf8a5
AK
1165AC_CHECK_SIZEOF(short)
1166AC_CHECK_SIZEOF(int)
1167AC_CHECK_SIZEOF(long)
1168AC_CHECK_SIZEOF(long long)
1169
1170AC_TYPE_PID_T
1171AC_TYPE_SIGNAL
1172AC_TYPE_SIZE_T
1173AC_STRUCT_TIMEZONE
1174
3071f10a 1175AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t])
51128b42 1176AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
4c779d83
VK
1177#if HAVE_SYS_TYPES_H
1178#include <sys/types.h>
1179#endif
1180#if HAVE_SYS_SOCKET_H
1181#include <sys/socket.h>
1182#endif
1183])
e0293f7f
VK
1184AC_CHECK_TYPES([struct stat64],,,[
1185#if HAVE_SYS_STAT_H
1186#include <sys/stat.h>
1187#endif
1188])
521d90e7 1189
e25cadc9 1190
ef0c727b
VK
1191#--------------------------------------------------------------------
1192# Checks for functions
1193#--------------------------------------------------------------------
d16cf8a5
AK
1194
1195AC_FUNC_ERROR_AT_LINE
d16cf8a5 1196AC_FUNC_MEMCMP
d16cf8a5
AK
1197AC_FUNC_SELECT_ARGTYPES
1198AC_FUNC_STRFTIME
1199AC_FUNC_STRTOD
1200AC_FUNC_VPRINTF
1201
80ce37ac 1202AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
55e62b45 1203AC_CHECK_FUNCS([strrchr strlwr strtol strtoul strtoll strtoull])
467e30e1 1204AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
c601fc15 1205AC_CHECK_FUNCS([usleep nanosleep gmtime_r localtime_r stat64 fstat64 lstat64])
aa24418a
VK
1206
1207AC_CHECK_DECLS([nanosleep])
be6467e9 1208
b0823d06
VK
1209# Check if strerror_r is POSIX-compliant
1210if test "$ac_cv_func_strerror_r" = "yes"; then
1211 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
1212 AC_LANG_PUSH([C++])
1213 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7f9423af
VK
1214#if HAVE_STRING_H
1215#include <string.h>
1216#endif
1217#if HAVE_ERRNO_H
1218#include <errno.h>
1219#endif
b0823d06 1220 ]],[[
7f9423af
VK
1221 int e;
1222 char buffer[256];
1223 e = strerror_r(1, buffer, 256);
1224 return e;
b0823d06
VK
1225 ]])
1226 ],[
1227 AC_MSG_RESULT(yes)
1228 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
1229 ],[
1230 AC_MSG_RESULT(no)
1231 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
1232 ])
1233 AC_LANG_POP([C++])
1234fi
1235
be6467e9
VK
1236# Check if timezone is a function
1237AC_MSG_CHECKING(for timezone function)
1238AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1239#if HAVE_TIME_H
1240#include <time.h>
1241#endif
1242#if HAVE_SYS_TIME_H
1243#include <sys/time.h>
1244#endif
1245]],[[
be6467e9 1246 timezone(0, 0);
be6467e9
VK
1247]])
1248],[
1249AC_MSG_RESULT(yes)
1250AC_DEFINE(HAVE_TIMEZONE,1,Define to 1 if timezone function is available)
1251],[
1252AC_MSG_RESULT(no)
445cba33
VK
1253AC_CHECK_DECLS([timezone],,,[
1254#if HAVE_TIME_H
1255#include <time.h>
1256#endif
1257#if HAVE_SYS_TIME_H
1258#include <sys/time.h>
1259#endif
1260])
be6467e9
VK
1261])
1262
1263# Check if struct tm has tm_gmtoff member
1264AC_MSG_CHECKING(for struct tm.tm_gmtoff)
1265AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1266#if HAVE_TIME_H
1267#include <time.h>
1268#endif
1269#if HAVE_SYS_TIME_H
1270#include <sys/time.h>
1271#endif
1272]],[[
be6467e9
VK
1273 struct tm t;
1274 return t.tm_gmtoff;
be6467e9
VK
1275]])
1276],[
1277AC_MSG_RESULT(yes)
1278AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
1279],[
1280AC_MSG_RESULT(no)
1281])
d16cf8a5 1282
f91feddc 1283AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
70fed300
AK
1284AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
1285
d16cf8a5
AK
1286# sockets/resolver (probably for solaris)
1287AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
1288AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
1289AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
1290
1291if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
1292 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
1293fi
1294
1295if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
1296 AC_MSG_CHECKING([if we can include libnsl + libsocket])
1297 LIBS="-lnsl -lsocket $LIBS"
1298 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
1299 if test "$my_ac_link_result" = "no" ; then
1300 AC_MSG_RESULT([failure])
1301 AC_MSG_ERROR([unable to use gethostbyname()])
1302 else
1303 AC_MSG_RESULT([success])
1304 fi
1305fi
1306
c6491611
VK
1307# asprintf, scprintf, etc.
1308AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
1309AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
1310
1311AC_MSG_CHECKING(whether snprintf returns required buffer size)
1312AC_RUN_IFELSE(
1313 [AC_LANG_PROGRAM([
1314#include <stdio.h>
1315#include <string.h>
1316 ], [
1317 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
1318 ])
1319 ],
1320 [ AC_MSG_RESULT(yes)
1321 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
1322 ],
1323 [ AC_MSG_RESULT(no) ],
1324 [ AC_MSG_RESULT(no) ]
1325)
1326
1327
dff54fed 1328
ef0c727b
VK
1329#--------------------------------------------------------------------
1330# Checks for macros and definitions
1331#--------------------------------------------------------------------
dff54fed 1332
ef0c727b
VK
1333AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
1334#ifdef HAVE_SYS_TYPES_H
99e50bb7 1335#include <sys/types.h>
ef0c727b
VK
1336#endif
1337#if HAVE_BYTESWAP_H
1338#include <byteswap.h>
1339#endif
1340#if HAVE_NETINET_IN_H
1341#include <netinet/in.h>
1342#endif
1343#if HAVE_NET_NH_H
1344#include <net/nh.h>
1345#endif
1346])
aa24418a
VK
1347AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
1348#ifdef HAVE_UNISTD_H
1349#include <unistd.h>
1350#endif
1351#ifdef HAVE_DLFCN_H
1352#include <dlfcn.h>
1353#endif
1354])
ce7565e7
VK
1355AC_CHECK_DECLS([va_copy, __va_copy],,,[
1356#ifdef HAVE_UNISTD_H
1357#include <unistd.h>
1358#endif
1359#ifdef HAVE_STDARG_H
1360#include <stdarg.h>
1361#endif
1362#ifdef HAVE_STDLIB_H
1363#include <stdlib.h>
1364#endif
1365])
dff54fed 1366
dff54fed 1367
ef0c727b 1368#--------------------------------------------------------------------
df9812a9
VK
1369# getopt
1370#--------------------------------------------------------------------
1371
1372if test "x$FORCE_INTERNAL_GETOPT" = "xyes"; then
1373 AC_DEFINE([USE_BUNDLED_GETOPT], [1], [Define to 1 if bundled getopt must be used])
1374else
1375 AC_CHECK_HEADERS([getopt.h])
1376 AC_CHECK_LIB(gnugetopt, getopt_long)
1377 AC_CHECK_DECLS([getopt_long],,,[
1378#if HAVE_GETOPT_H
1379#include <getopt.h>
1380#endif
1381 ])
1382fi
1383
1384
1385#--------------------------------------------------------------------
ef0c727b
VK
1386# AIX specific checks
1387#--------------------------------------------------------------------
d16cf8a5 1388
ef0c727b
VK
1389if test "x$PLATFORM" = "xAIX"; then
1390 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
df9812a9
VK
1391 AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64],,,[
1392#if HAVE_PROCINFO_H
1393#include <procinfo.h>
1394#endif
1395 ])
ef0c727b
VK
1396 AC_CHECK_FUNCS([getprocs64],,,[
1397#if HAVE_PROCINFO_H
1398#include <procinfo.h>
6cd41ceb 1399#endif
ef0c727b 1400 ])
7e56bf2e
VK
1401fi
1402
cd4c8ca3 1403
ef0c727b 1404#--------------------------------------------------------------------
ba8db57b
VK
1405# HP-UX specific checks
1406#--------------------------------------------------------------------
1407
1408if test "x$PLATFORM" = "xHP-UX"; then
f09c2d05
VK
1409 AC_CHECK_HEADERS([sys/mib.h],,,[[ ]])
1410 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
1411#if HAVE_NET_IF_H
1412#include <net/if.h>
1413#endif
1414 ])
1415 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
1416#if HAVE_SYS_MIB_H
1417#include <sys/mib.h>
1418#endif
1419 ])
cfd95c74
VK
1420
1421 AC_MSG_CHECKING(if pst_diskinfo has read/write stats fields)
1422 AC_LANG_PUSH([C++])
1423 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1424#include <sys/pstat.h>
1425 ]], [[
1426pst_diskinfo d;
1427int x;
1428x = (int)d.psd_dkread;
1429x = (int)d.psd_dkwrite;
1430 ]])],
1431 [
1432 AC_DEFINE([HAVE_DISKINFO_RWSTATS],[1],[Define to 1 if pst_diskinfo has read/write stats fields])
1433 AC_MSG_RESULT(yes)
1434 ],
1435 [
1436 AC_MSG_RESULT(no)
1437 ])
1438 AC_LANG_POP([C++])
ba8db57b
VK
1439fi
1440
1441
1442#--------------------------------------------------------------------
aa24418a
VK
1443# *BSD specific checks
1444#--------------------------------------------------------------------
1445
1446AC_CHECK_LIB(kvm, kvm_open)
1447AC_CHECK_FUNCS([kvm_getswapinfo])
1448AC_CHECK_TYPES([struct kinfo_proc2],,,[
1449#if HAVE_SYS_SYSCTL_H
1450#include <sys/sysctl.h>
1451#endif
1452])
1453
1454
28ba6824
VK
1455#--------------------------------------------------------------------
1456# FreeBSD specific checks
1457#--------------------------------------------------------------------
1458
1459if test "x$PLATFORM" = "xFreeBSD"; then
61f58c11
VK
1460 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
1461#if HAVE_SYS_TYPES_H
1462#include <sys/types.h>
1463#endif
1464#if HAVE_SYS_SOCKET_H
1465#include <sys/socket.h>
1466#endif
1467#include <net/route.h>
1468 ])
28ba6824
VK
1469fi
1470
1471
aa24418a 1472#--------------------------------------------------------------------
ea6615cf
VK
1473# OpenBSD specific checks
1474#--------------------------------------------------------------------
1475
1476if test "x$PLATFORM" = "xOpenBSD"; then
1477 AC_MSG_CHECKING(if kvm_getprocs requires sizeof kinfo_proc argument)
1478 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1479#include <sys/param.h>
1480#include <sys/proc.h>
1481#include <kvm.h>
1482#include <sys/user.h>
1483 ]],[[
1484 int count;
1485 kvm_getprocs(NULL, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
1486 return 0;
1487 ]])
1488 ],[
1489 AC_MSG_RESULT(yes)
1490 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,1,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1491 ],[
1492 AC_MSG_RESULT(no)
1493 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,0,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1494 ])
1495
1496 AC_MSG_CHECKING(if struct kinfo_proc has member kp_proc)
1497 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1498#include <sys/param.h>
1499#include <sys/proc.h>
1500#include <kvm.h>
1501#include <sys/user.h>
1502 ]],[[
1503 struct kinfo_proc p;
1504 return p.kp_proc.p_pid;
1505 ]])
1506 ],[
1507 AC_MSG_RESULT(yes)
1508 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,1,Define to 1 if struct kinfo_proc has member kp_proc)
1509 ],[
1510 AC_MSG_RESULT(no)
1511 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,0,Define to 1 if struct kinfo_proc has member kp_proc)
1512 ])
1513fi
1514
1515
1516#--------------------------------------------------------------------
ef0c727b
VK
1517# Check for UNICODE stuff
1518#--------------------------------------------------------------------
3e39fcde 1519
8b86c5dc 1520AC_CHECK_HEADERS([wchar.h wctype.h iconv.h])
aa24418a 1521AC_CHECK_TYPES([wchar_t, wint_t],,,[
6b93c954
VK
1522#if HAVE_WCHAR_H
1523#include <wchar.h>
1524#endif
1525])
3e39fcde 1526AC_CHECK_SIZEOF(wchar_t)
aa24418a 1527AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper wcserror wcserror_r])
d6217efa 1528AC_CHECK_FUNCS([wfopen fputws wopen wstat waccess wgetenv wrename wunlink wremove])
f3387429 1529AC_CHECK_FUNCS([wchdir wmkdir wrmdir wsystem wmkstemp wpopen wctime wchmod])
dff54fed 1530
3265ba38 1531if test "x$DISABLE_ICONV" != "xyes"; then
75c30ed4 1532 AC_CHECK_LIB(iconv, libiconv_open,
dff54fed 1533 [ ac_found_iconv=yes
8d131dda 1534 LIBS="$LIBS -liconv"
75c30ed4
VK
1535 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
1536 ],
1537 [
1538 AC_CHECK_LIB(iconv, iconv,
1539 [ ac_found_iconv=yes
8d131dda 1540 LIBS="$LIBS -liconv"
75c30ed4
VK
1541 ])
1542 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
1543 ])
dff54fed
VK
1544else
1545 ac_found_iconv=no
ef0c727b 1546 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
dff54fed 1547fi
93571e7f
VK
1548
1549AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
1550AC_RUN_IFELSE(
1551 [AC_LANG_PROGRAM([
1552#if HAVE_ICONV_H
1553#include <iconv.h>
1554#endif
1555 ], [
1556 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
1557 ])
1558 ],
1559 [ AC_MSG_RESULT(yes)
1560 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
1561 valid_ucs2_code="UCS-2-INTERNAL"
1562 ],
1563 [ AC_MSG_RESULT(no) ],
1564 [ AC_MSG_RESULT(no) ]
1565)
1566
1567AC_MSG_CHECKING(whether iconv supports UCS-2)
1568AC_RUN_IFELSE(
1569 [AC_LANG_PROGRAM([
1570#if HAVE_ICONV_H
1571#include <iconv.h>
1572#endif
1573 ], [
1574 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
1575 ])
1576 ],
1577 [ AC_MSG_RESULT(yes)
1578 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
1579 valid_ucs2_code="UCS-2"
1580 ],
1581 [ AC_MSG_RESULT(no) ],
8b86c5dc 1582 [ AC_MSG_RESULT(no) ]
93571e7f
VK
1583)
1584
1585AC_MSG_CHECKING(whether iconv supports UCS2)
1586AC_RUN_IFELSE(
1587 [AC_LANG_PROGRAM([
1588#if HAVE_ICONV_H
1589#include <iconv.h>
1590#endif
1591 ], [
1592 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
1593 ])
1594 ],
1595 [ AC_MSG_RESULT(yes)
1596 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
1597 valid_ucs2_code="UCS2"
1598 ],
1599 [ AC_MSG_RESULT(no) ],
1600 [ AC_MSG_RESULT(no) ]
1601)
1602
44bccbbc
VK
1603AC_MSG_CHECKING(whether iconv supports UCS-2BE)
1604AC_RUN_IFELSE(
1605 [AC_LANG_PROGRAM([
1606#if HAVE_ICONV_H
1607#include <iconv.h>
1608#endif
1609 ], [
1610 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
1611 ])
1612 ],
1613 [ AC_MSG_RESULT(yes)
1614 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
1615 valid_ucs2_code="UCS-2BE"
1616 ],
1617 [ AC_MSG_RESULT(no) ],
1618 [ AC_MSG_RESULT(no) ]
1619)
1620
6e17f325
VK
1621AC_MSG_CHECKING(whether iconv supports UCS-2LE)
1622AC_RUN_IFELSE(
1623 [AC_LANG_PROGRAM([
1624#if HAVE_ICONV_H
1625#include <iconv.h>
1626#endif
1627 ], [
1628 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
1629 ])
1630 ],
1631 [ AC_MSG_RESULT(yes)
1632 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
1633 valid_ucs2_code="UCS-2LE"
1634 ],
1635 [ AC_MSG_RESULT(no) ],
1636 [ AC_MSG_RESULT(no) ]
1637)
1638
4a4e1feb
VK
1639AC_MSG_CHECKING(whether iconv supports UTF-16)
1640AC_RUN_IFELSE(
1641 [AC_LANG_PROGRAM([
1642#if HAVE_ICONV_H
1643#include <iconv.h>
1644#endif
1645 ], [
1646 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
1647 ])
1648 ],
1649 [ AC_MSG_RESULT(yes)
1650 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
1651 valid_ucs2_code="UTF-16"
1652 ],
1653 [ AC_MSG_RESULT(no) ],
1654 [ AC_MSG_RESULT(no) ]
1655)
1656
8b86c5dc
VK
1657AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
1658AC_RUN_IFELSE(
1659 [AC_LANG_PROGRAM([
1660#if HAVE_ICONV_H
1661#include <iconv.h>
1662#endif
1663 ], [
1664 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
1665 ])
1666 ],
1667 [ AC_MSG_RESULT(yes)
1668 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
1669 valid_ucs4_code="UCS-4-INTERNAL"
1670 ],
1671 [ AC_MSG_RESULT(no) ],
1672 [ AC_MSG_RESULT(no) ]
1673)
1674
1675AC_MSG_CHECKING(whether iconv supports UCS-4)
1676AC_RUN_IFELSE(
1677 [AC_LANG_PROGRAM([
1678#if HAVE_ICONV_H
1679#include <iconv.h>
1680#endif
1681 ], [
1682 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
1683 ])
1684 ],
1685 [ AC_MSG_RESULT(yes)
1686 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
1687 valid_ucs4_code="UCS-4"
1688 ],
1689 [ AC_MSG_RESULT(no) ],
1690 [ AC_MSG_RESULT(no) ]
1691)
1692
1693AC_MSG_CHECKING(whether iconv supports UCS4)
1694AC_RUN_IFELSE(
1695 [AC_LANG_PROGRAM([
1696#if HAVE_ICONV_H
1697#include <iconv.h>
1698#endif
1699 ], [
1700 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
1701 ])
1702 ],
1703 [ AC_MSG_RESULT(yes)
1704 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
1705 valid_ucs4_code="UCS4"
1706 ],
1707 [ AC_MSG_RESULT(no) ],
1708 [ AC_MSG_RESULT(no) ]
1709)
1710
1711AC_MSG_CHECKING(whether iconv supports UCS-4BE)
1712AC_RUN_IFELSE(
1713 [AC_LANG_PROGRAM([
1714#if HAVE_ICONV_H
1715#include <iconv.h>
1716#endif
1717 ], [
1718 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
1719 ])
1720 ],
1721 [ AC_MSG_RESULT(yes)
1722 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
1723 valid_ucs4_code="UCS-4BE"
1724 ],
1725 [ AC_MSG_RESULT(no) ],
1726 [ AC_MSG_RESULT(no) ]
1727)
1728
6e17f325
VK
1729AC_MSG_CHECKING(whether iconv supports UCS-4LE)
1730AC_RUN_IFELSE(
1731 [AC_LANG_PROGRAM([
1732#if HAVE_ICONV_H
1733#include <iconv.h>
1734#endif
1735 ], [
1736 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
1737 ])
1738 ],
1739 [ AC_MSG_RESULT(yes)
1740 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
1741 valid_ucs4_code="UCS-4LE"
1742 ],
1743 [ AC_MSG_RESULT(no) ],
1744 [ AC_MSG_RESULT(no) ]
1745)
1746
4a4e1feb
VK
1747AC_MSG_CHECKING(whether iconv supports UTF-32)
1748AC_RUN_IFELSE(
1749 [AC_LANG_PROGRAM([
1750#if HAVE_ICONV_H
1751#include <iconv.h>
1752#endif
1753 ], [
1754 return iconv_open("UTF-8","UTF-32")==(iconv_t)(-1);
1755 ])
1756 ],
1757 [ AC_MSG_RESULT(yes)
1758 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
1759 valid_ucs4_code="UTF-32"
1760 ],
1761 [ AC_MSG_RESULT(no) ],
1762 [ AC_MSG_RESULT(no) ]
1763)
1764
5e40a69e
VK
1765AC_MSG_CHECKING(whether iconv supports ISO8859-1)
1766AC_RUN_IFELSE(
1767 [AC_LANG_PROGRAM([
1768#if HAVE_ICONV_H
1769#include <iconv.h>
1770#endif
1771 ], [
1772 return iconv_open("UTF-8","ISO8859-1")==(iconv_t)(-1);
1773 ])
1774 ],
1775 [ AC_MSG_RESULT(yes)
1776 AC_DEFINE(HAVE_ICONV_ISO8859_1, 1, Define to 1 if iconv supports ISO8859-1)
1777 ],
1778 [ AC_MSG_RESULT(no) ],
1779 [ AC_MSG_RESULT(no) ]
1780)
1781
1782AC_MSG_CHECKING(whether iconv supports ISO-8859-1)
1783AC_RUN_IFELSE(
1784 [AC_LANG_PROGRAM([
1785#if HAVE_ICONV_H
1786#include <iconv.h>
1787#endif
1788 ], [
1789 return iconv_open("UTF-8","ISO-8859-1")==(iconv_t)(-1);
1790 ])
1791 ],
1792 [ AC_MSG_RESULT(yes)
1793 AC_DEFINE(HAVE_ICONV_ISO_8859_1, 1, Define to 1 if iconv supports ISO-8859-1)
1794 ],
1795 [ AC_MSG_RESULT(no) ],
1796 [ AC_MSG_RESULT(no) ]
1797)
1798
1799AC_MSG_CHECKING(whether iconv supports ASCII)
1800AC_RUN_IFELSE(
1801 [AC_LANG_PROGRAM([
1802#if HAVE_ICONV_H
1803#include <iconv.h>
1804#endif
1805 ], [
1806 return iconv_open("UTF-8","ASCII")==(iconv_t)(-1);
1807 ])
1808 ],
1809 [ AC_MSG_RESULT(yes)
1810 AC_DEFINE(HAVE_ICONV_ASCII, 1, Define to 1 if iconv supports ASCII)
1811 ],
1812 [ AC_MSG_RESULT(no) ],
1813 [ AC_MSG_RESULT(no) ]
1814)
1815
93571e7f
VK
1816AC_MSG_CHECKING(whether iconv supports //IGNORE)
1817AC_RUN_IFELSE(
1818 [AC_LANG_PROGRAM([
1819#if HAVE_ICONV_H
1820#include <iconv.h>
1821#endif
1822 ], [
1823 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
1824 ])
1825 ],
1826 [ AC_MSG_RESULT(yes)
1827 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
1828 ],
1829 [ AC_MSG_RESULT(no) ],
1830 [ AC_MSG_RESULT(no) ]
1831)
3e39fcde 1832
19619a35
AK
1833# taken from ZSH's configure
1834# Check if iconv uses const in prototype declaration
24b1570c 1835if test "x$ac_found_iconv" = "xyes"; then
53c96e2d 1836 AC_LANG_PUSH([C++])
19619a35 1837 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
7f9423af
VK
1838 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1839#include <stdlib.h>
f6a2136d 1840#if HAVE_ICONV_H
7f9423af 1841#include <iconv.h>
f6a2136d 1842#endif
f6a2136d
VK
1843 ]],
1844 [[
3e51d371
VK
1845 char **p = NULL;
1846 iconv(0, (const char **)p, 0, 0, 0);
7f9423af 1847 ]])],
3e51d371
VK
1848 [ac_cv_iconv_const=const],
1849 [ac_cv_iconv_const=])])
53c96e2d 1850 AC_LANG_POP([C++])
19619a35
AK
1851 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
1852 [Define as const if the declaration of iconv() needs const.])
1853fi
1854
a67fa146
VK
1855if test "x$ac_cv_type_wchar_t" = "xyes"; then
1856 if test $ac_cv_sizeof_wchar_t -eq 2; then
1857 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
1858 fi
8b86c5dc 1859
a67fa146
VK
1860 if test $ac_cv_sizeof_wchar_t -eq 4; then
1861 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
1862 fi
1863
1864 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
1865 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
1866 fi
1867else
1868 if test "x$BUILD_UNICODE" = "xyes"; then
1869 AC_MSG_ERROR(wchar_t is required for UNICODE build)
1870 fi
8b86c5dc
VK
1871fi
1872
c29360a9 1873
ef0c727b 1874#--------------------------------------------------------------------
ca0f4ea3
VK
1875# MySQL
1876#--------------------------------------------------------------------
1877
1878check_substr "$COMPONENTS" "mysql"
1879if test $? = 0; then
6fce76d8 1880 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
ca0f4ea3 1881 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
aa7794f0 1882
8d131dda
VK
1883 OLD_LIBS="$LIBS"
1884 LIBS="$LIBS $MYSQL_LIBS"
aa7794f0 1885
9c29f76e
VK
1886 AC_MSG_CHECKING(whether mysql clients can run)
1887 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1888#include <stdio.h>
1889#include <mysql.h>
1890int main(void)
1891{
1892 MYSQL *a = mysql_init(NULL);
1893 return 0;
1894}
1895 ]])],[],[
1896 AC_MSG_RESULT(no)
1897 AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)
1898 ],[])
ca0f4ea3 1899 AC_MSG_RESULT(yes)
6fce76d8 1900
ca0f4ea3 1901 AC_CHECK_FUNCS(mysql_real_escape_string)
8d131dda 1902 LIBS="$OLD_LIBS"
ca0f4ea3
VK
1903fi
1904
1905
1906#--------------------------------------------------------------------
58ed4897
VK
1907# PostgreSQL
1908#--------------------------------------------------------------------
1909
203458b7 1910check_substr "$COMPONENTS" "pgsql"
58ed4897
VK
1911if test $? = 0; then
1912 AC_CHECK_LIB(m, floor)
6fce76d8 1913 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"],
58ed4897 1914 [AC_MSG_ERROR(libpq is required for PostgreSQL support)])
6fce76d8
VK
1915
1916 AC_MSG_CHECKING(whether postgresql clients can run)
8d131dda
VK
1917 OLD_LIBS="$LIBS"
1918 LIBS="$LIBS $PGSQL_LIBS"
6fce76d8
VK
1919 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1920 #include <stdio.h>
1921 #include <libpq-fe.h>
1922 int main(void)
1923 {
1924 PGconn *a = PQconnectdb("");
1925 return 0;
1926 }
1927 ]])],[AC_MSG_RESULT(yes)],[
58ed4897
VK
1928 AC_MSG_RESULT(no)
1929 AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
1930 ],[])
8d131dda 1931 LIBS="$OLD_LIBS"
7070538d 1932 AC_CHECK_LIB(pq, PQfformat, [ AC_DEFINE(HAVE_PQFFORMAT, 1, PQfformat not exist in 7.3) ])
58ed4897
VK
1933fi
1934
1935
1936#--------------------------------------------------------------------
9c29f76e
VK
1937# ODBC
1938#--------------------------------------------------------------------
1939
1940check_substr "$COMPONENTS" "odbc"
1941if test $? = 0; then
6fce76d8 1942 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
9c29f76e 1943 [AC_MSG_ERROR(libodbc is required for ODBC support)])
60a1159a
VK
1944 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
1945 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
1946 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
1947 fi
9c29f76e
VK
1948fi
1949
1950
1951#--------------------------------------------------------------------
41b4790d
VK
1952# Oracle
1953#--------------------------------------------------------------------
1954
1955check_substr "$COMPONENTS" "oracle"
1956if test $? = 0; then
1957 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
7d8c91ef
VK
1958 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
1959 [
1960 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
1961 ], [-lclntsh])
1962 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
1963 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
045845e5 1964 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
60a1159a
VK
1965 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
1966 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
1967 fi
41b4790d
VK
1968fi
1969
84277a0f
AK
1970#--------------------------------------------------------------------
1971# DB2
1972#--------------------------------------------------------------------
1973
1974check_substr "$COMPONENTS" "db2"
1975if test $? = 0; then
1976 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
1977 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
1978 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
1979fi
41b4790d
VK
1980
1981#--------------------------------------------------------------------
37861c72
VK
1982# Informix
1983#--------------------------------------------------------------------
1984
1985check_substr "$COMPONENTS" "informix"
1986if test $? = 0; then
1987 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
4f2e8e9b
VK
1988 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
1989 [AC_MSG_ERROR(libthcli is required for Informix support)])
60a1159a
VK
1990 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
1991 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
1992 fi
37861c72
VK
1993fi
1994
c3cfc039
VK
1995
1996#--------------------------------------------------------------------
ca0f4ea3
VK
1997# Other settings
1998#--------------------------------------------------------------------
1999
b07c50cc
VK
2000if test "x${BUILD_UNICODE}" = "xyes"; then
2001 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\""
2002else
2003 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\""
2004fi
545bda2d 2005LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $LDFLAGS_SUFFIX"
ca0f4ea3 2006
25ae8377
VK
2007if test "x${ENABLE_WERROR}" = "xyes"; then
2008 CPPFLAGS="$CPPFLAGS -Werror"
2009fi
2010
551ec9ca 2011AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
17b35ccc 2012AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
1fd41bcd 2013AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$NEED_ZLIB/$HAVE_ZLIB" = "yes/no"])
c1165d33
VK
2014AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
2015AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
8b86c5dc 2016
ca0f4ea3
VK
2017
2018#--------------------------------------------------------------------
ef0c727b
VK
2019# Substitute variables
2020#--------------------------------------------------------------------
82fa7c5d 2021
ef0c727b
VK
2022AC_SUBST(DB_DRIVERS)
2023AC_SUBST(MODULES)
2024AC_SUBST(SUBAGENT_DIRS)
7c48e2aa 2025AC_SUBST(SERVER_LIBS)
ef0c727b
VK
2026AC_SUBST(SERVER_TOOLS)
2027AC_SUBST(TOP_LEVEL_MODULES)
2028AC_SUBST(CONTRIB_MODULES)
c2612d83 2029AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
2030AC_SUBST(STATIC_SUBAGENT_LIST)
2031AC_SUBST(SUBAGENT_LIBS)
2032AC_SUBST(BUILD_SERVER)
6fce76d8
VK
2033AC_SUBST(MYSQL_LIBS)
2034AC_SUBST(PGSQL_LIBS)
7d8c91ef 2035AC_SUBST(ORACLE_LIBS)
6fce76d8 2036AC_SUBST(ODBC_LIBS)
84277a0f 2037AC_SUBST(DB2_LIBS)
87f1fff0 2038AC_SUBST(INFORMIX_LIBS)
11ce9a66 2039AC_SUBST(OBJECT_MODE)
d16cf8a5 2040
ef0c727b
VK
2041#--------------------------------------------------------------------
2042# Shared libs versions
d16cf8a5
AK
2043#
2044# versioning scheme: current:revision:age
2045#
2046# current
2047# The number of the current interface exported by the library. A current
2048# value of `0', means that you are calling the interface exported by this
2049# library interface 0.
2050#
2051# revision
2052# The implementation number of the most recent interface exported by this
2053# library. In this case, a revision value of `0' means that this is the
2054# first implementation of the interface.
2055# If the next release of this library exports the same interface, but has a
2056# different implementation (perhaps some bugs have been fixed), the revision
2057# number will be higher, but current number will be the same. In that case,
2058# when given a choice, the library with the highest revision will always
2059# be used by the runtime loader.
2060#
2061# age
2062# The number of previous additional interfaces supported by this library.
2063# If age were `2', then this library can be linked into executables which
2064# were built with a release of this library that exported the current
2065# interface number, current, or any of the previous two interfaces.
2066# By definition age must be less than or equal to current. At the outset,
2067# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 2068#--------------------------------------------------------------------
d16cf8a5 2069
17b35ccc 2070NETXMS_LIBRARY_VERSION=1:0:0
c7d14846 2071AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 2072
ef0c727b
VK
2073
2074#--------------------------------------------------------------------
2075# Generate output files
2076#--------------------------------------------------------------------
d16cf8a5
AK
2077
2078AC_CONFIG_FILES([
ef0c727b 2079 README
0c3c0c39
AK
2080 Makefile
2081 contrib/Makefile
36874eca
VK
2082 contrib/backgrounds/Makefile
2083 contrib/integration/Makefile
2084 contrib/integration/HP_EVA/Makefile
2085 contrib/mibs/Makefile
0c3c0c39 2086 contrib/startup/Makefile
fa66d60c 2087 contrib/startup/debian/Makefile
daaefaaf 2088 contrib/startup/gentoo/Makefile
7483d0bf 2089 contrib/startup/hp-ux/Makefile
0c3c0c39 2090 contrib/startup/redhat/Makefile
5de3893d 2091 contrib/startup/suse/Makefile
9993edf4 2092 contrib/startup/ubuntu/Makefile
6adf3219 2093 contrib/startup/solaris/Makefile
0c3c0c39 2094 doc/Makefile
a48203d2
VK
2095 doc/internal/Makefile
2096 doc/manuals/Makefile
2097 doc/misc/Makefile
0c3c0c39
AK
2098 images/Makefile
2099 include/Makefile
2100 m4/Makefile
0c3c0c39 2101 src/Makefile
9191f6ad 2102 src/agent/Makefile
6ac698ed 2103 src/agent/appagent/Makefile
9191f6ad
VK
2104 src/agent/core/Makefile
2105 src/agent/install/Makefile
a2a24e9d 2106 src/agent/libnxsd/Makefile
9191f6ad 2107 src/agent/subagents/Makefile
9191f6ad 2108 src/agent/subagents/aix/Makefile
80e96a82 2109 src/agent/subagents/ecs/Makefile
9191f6ad 2110 src/agent/subagents/freebsd/Makefile
80e96a82
VK
2111 src/agent/subagents/hpux/Makefile
2112 src/agent/subagents/informix/Makefile
9191f6ad 2113 src/agent/subagents/ipso/Makefile
80e96a82
VK
2114 src/agent/subagents/linux/Makefile
2115 src/agent/subagents/logwatch/Makefile
2116 src/agent/subagents/netbsd/Makefile
2117 src/agent/subagents/odbcquery/Makefile
2118 src/agent/subagents/openbsd/Makefile
4d1753cd 2119 src/agent/subagents/oracle/Makefile
9191f6ad 2120 src/agent/subagents/ping/Makefile
80e96a82 2121 src/agent/subagents/portCheck/Makefile
9191f6ad 2122 src/agent/subagents/sms/Makefile
80e96a82 2123 src/agent/subagents/sunos/Makefile
9191f6ad 2124 src/agent/subagents/ups/Makefile
80e96a82
VK
2125 src/agent/subagents/winnt/Makefile
2126 src/agent/subagents/winperf/Makefile
2127 src/agent/subagents/wmi/Makefile
38bfa5da 2128 src/agent/subagents/lmsensors/Makefile
cf52e714 2129 src/agent/subagents/darwin//Makefile
0bd64860 2130 src/agent/tools/Makefile
6ac698ed 2131 src/agent/tools/nxappget/Makefile
0bd64860 2132 src/agent/tools/nxapush/Makefile
c2612d83 2133 src/client/Makefile
551592f4 2134 src/client/install/Makefile
c94fa5c2 2135 src/client/nxalarm/Makefile
e84701c5 2136 src/client/nxevent/Makefile
9cb6c12f 2137 src/client/nxlexer/Makefile
e84701c5 2138 src/client/nxpush/Makefile
59ffa5b7 2139 src/client/nxsms/Makefile
9cb6c12f
VK
2140 src/client/scilexer/Makefile
2141 src/client/windows/Makefile
2142 src/client/windows/nxav/Makefile
2143 src/client/windows/nxav/res/Makefile
23c8c53e
AK
2144 src/client/windows/nxcon/Makefile
2145 src/client/windows/nxcon/icons/Makefile
2146 src/client/windows/nxcon/res/Makefile
23c8c53e
AK
2147 src/client/windows/nxnotify/Makefile
2148 src/client/windows/nxnotify/res/Makefile
9cb6c12f
VK
2149 src/client/windows/nxuilib/Makefile
2150 src/client/windows/nxuilib/res/Makefile
2151 src/client/windows/nxuilib/sounds/Makefile
d1834406
VK
2152 src/db/Makefile
2153 src/db/dbdrv/Makefile
87f1fff0
VK
2154 src/db/dbdrv/db2/Makefile
2155 src/db/dbdrv/informix/Makefile
d1834406
VK
2156 src/db/dbdrv/odbc/Makefile
2157 src/db/dbdrv/mssql/Makefile
2158 src/db/dbdrv/mysql/Makefile
87f1fff0 2159 src/db/dbdrv/oracle/Makefile
d1834406
VK
2160 src/db/dbdrv/pgsql/Makefile
2161 src/db/dbdrv/sqlite/Makefile
d1834406 2162 src/db/libnxdb/Makefile
9191f6ad
VK
2163 src/install/Makefile
2164 src/install/windows/Makefile
2165 src/libexpat/Makefile
2166 src/libexpat/libexpat/Makefile
2167 src/libnetxms/Makefile
2168 src/libnxcl/Makefile
2169 src/libnxlp/Makefile
2170 src/libnxmap/Makefile
2171 src/libnxsl/Makefile
a67fa146
VK
2172 src/libtre/Makefile
2173 src/libtre/win32/Makefile
9191f6ad 2174 src/nxscript/Makefile
0c3c0c39
AK
2175 src/server/Makefile
2176 src/server/core/Makefile
644f97f5
VK
2177 src/server/drivers/Makefile
2178 src/server/drivers/baystack/Makefile
b1bd1fb2 2179 src/server/drivers/cat2900xl/Makefile
910846cc 2180 src/server/drivers/catalyst/Makefile
fce03ab9 2181 src/server/drivers/cisco-esw/Makefile
8bdfaed8 2182 src/server/drivers/dell-pwc/Makefile
a548def4 2183 src/server/drivers/dlink/Makefile
644f97f5 2184 src/server/drivers/ers8000/Makefile
4e592faf
VK
2185 src/server/drivers/lib/Makefile
2186 src/server/drivers/lib/avaya-ers/Makefile
b1bd1fb2 2187 src/server/drivers/lib/cisco/Makefile
81ecaf38 2188 src/server/drivers/netscreen/Makefile
9b13553b 2189 src/server/drivers/procurve/Makefile
d770a97c
VK
2190 src/server/include/Makefile
2191 src/server/libnxsrv/Makefile
2192 src/server/netxmsd/Makefile
d8f2e39b
VK
2193 src/server/smsdrv/Makefile
2194 src/server/smsdrv/generic/Makefile
91369aca 2195 src/server/smsdrv/nxagent/Makefile
aab8a8b6 2196 src/server/smsdrv/portech/Makefile
80a30c53 2197 src/server/smsdrv/dummy/Makefile
0c3c0c39 2198 src/server/tools/Makefile
0c3c0c39
AK
2199 src/server/tools/nxaction/Makefile
2200 src/server/tools/nxadm/Makefile
9191f6ad 2201 src/server/tools/nxap/Makefile
5b0c7d0d
VK
2202 src/server/tools/nxconfig/Makefile
2203 src/server/tools/nxconfig/res/Makefile
f90d7fc5 2204 src/server/tools/nxdbmgr/Makefile
4e2debcc 2205 src/server/tools/nxencpasswd/Makefile
9191f6ad 2206 src/server/tools/nxget/Makefile
d24fdaf4 2207 src/server/tools/nxupload/Makefile
c5c0f362
VK
2208 src/snmp/Makefile
2209 src/snmp/libnxsnmp/Makefile
2210 src/snmp/nxmibc/Makefile
2211 src/snmp/nxsnmpget/Makefile
2212 src/snmp/nxsnmpset/Makefile
2213 src/snmp/nxsnmpwalk/Makefile
9191f6ad 2214 src/sqlite/Makefile
f65df2b1 2215 src/tools/Makefile
f65df2b1 2216 src/tools/nxdevcfg/Makefile
1fd41bcd 2217 src/zlib/Makefile
9191f6ad 2218 sql/Makefile
0c3c0c39 2219 tools/Makefile
d16cf8a5
AK
2220])
2221
12249937
VK
2222AC_OUTPUT
2223
ef0c727b 2224echo "Updating libtool"
5cecf50e
AK
2225sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2226
779ce551
VK
2227# On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
2228if test "x$CC" = "xgcc" && test "x$PLATFORM" = "xHP-UX"; then
2229 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2230fi
2231
b677ef59
VK
2232# On AIX, correct OBJECT_MODE must be set before linking
2233# To avoid manual setting by user, we add this to libtool script
2234if test "x$PLATFORM" = "xAIX"; then
2235 head -n 1 ./libtool > ./libtool.new
2236 echo "export OBJECT_MODE=$OBJECT_MODE" >> ./libtool.new
2237 tail -n +2 ./libtool >> ./libtool.new
2238 mv libtool.new libtool
2239 chmod +x ./libtool
2240fi
2241
ef0c727b
VK
2242#--------------------------------------------------------------------
2243# Print summary
2244#--------------------------------------------------------------------
a7442678 2245
a7442678
AK
2246echo
2247echo
2248echo
2249echo '---------------------------------------------------------------------'
2250echo ' Configure results'
2251echo '---------------------------------------------------------------------'
2252echo
8b86c5dc 2253 echo "Prefix : ${prefix}"
a7442678 2254if test "x${BUILD_SERVER}" = "xyes"; then
8b86c5dc 2255 echo "Build Server : YES"
7c48e2aa 2256 echo "Server libs : ${SERVER_LIBS}"
a7442678 2257else
8b86c5dc 2258 echo "Build Server : NO"
a7442678
AK
2259fi
2260if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
8b86c5dc 2261 echo "Encryption enabled : YES"
a7442678 2262else
8b86c5dc 2263 echo "Encryption enabled : NO"
a7442678
AK
2264fi
2265if test "x${DB_DRIVERS}" != "x"; then
8b86c5dc 2266 echo "Build DB-Drivers :${DB_DRIVERS}"
a7442678 2267else
8b86c5dc 2268 echo "Build DB-Drivers : NO"
a7442678
AK
2269fi
2270if test "x${BUILD_CLIENT}" = "xyes"; then
8b86c5dc 2271 echo "Build Clients : YES"
a7442678 2272else
8b86c5dc 2273 echo "Build Clients : NO"
a7442678
AK
2274fi
2275if test "x${BUILD_AGENT}" = "xyes"; then
8b86c5dc
VK
2276 echo "Build Agent : YES"
2277 echo "Subagents list : ${SUBAGENT_DIRS}"
a7442678 2278else
8b86c5dc 2279 echo "Build Agent : NO"
a7442678 2280fi
e8636669 2281if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
8b86c5dc
VK
2282 echo "Build Static Agent : YES"
2283 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
e8636669 2284else
8b86c5dc 2285 echo "Build Static Agent : NO"
e8636669 2286fi
8b86c5dc 2287if test "x${BUILD_UNICODE}" = "xyes"; then
a67fa146 2288 echo "UNICODE build : YES"
8b86c5dc 2289else
a67fa146 2290 echo "UNICODE build : NO"
8b86c5dc 2291fi
551ec9ca
VK
2292if test "x${HAVE_LIBEXPAT}" = "xno"; then
2293 echo "Use internal libexpat : YES"
1bb6b449 2294else
551ec9ca 2295 echo "Use internal libexpat : NO"
1bb6b449 2296fi
17b35ccc
VK
2297if test "x${HAVE_LIBTRE}" = "xno"; then
2298 echo "Use internal libtre : YES"
2299else
2300 echo "Use internal libtre : NO"
2301fi
1fd41bcd
VK
2302if test "x${NEED_ZLIB}" = "xyes"; then
2303 if test "x${HAVE_ZLIB}" = "xno"; then
2304 echo "Use internal zlib : YES"
2305 else
2306 echo "Use internal zlib : NO"
2307 fi
2308fi
cc297a70
VK
2309if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
2310 echo "Force 32bit build : YES"
2311else
2312 echo "Force 32bit build : NO"
2313fi
7d8c91ef
VK
2314
2315echo "CPPFLAGS : ${CPPFLAGS}"
2316echo "CXXFLAGS : ${CXXFLAGS}"
2317echo "CFLAGS : ${CFLAGS}"
2318echo "LDFLAGS : ${LDFLAGS}"
8d131dda 2319echo "LIBS : ${LIBS}"
7d8c91ef 2320
6fce76d8
VK
2321if test "x${MYSQL_LIBS}" != "x"; then
2322 echo "MySQL libs : ${MYSQL_LIBS}"
2323fi
2324if test "x${PGSQL_LIBS}" != "x"; then
2325 echo "PostgreSQL libs : ${PGSQL_LIBS}"
2326fi
7d8c91ef
VK
2327if test "x${ORACLE_LIBS}" != "x"; then
2328 echo "Oracle libs : ${ORACLE_LIBS}"
2329fi
6fce76d8
VK
2330if test "x${ODBC_LIBS}" != "x"; then
2331 echo "ODBC libs : ${ODBC_LIBS}"
2332fi
84277a0f
AK
2333if test "x${DB2_LIBS}" != "x"; then
2334 echo "DB2 libs : ${DB2_LIBS}"
2335fi
37861c72
VK
2336if test "x${INFORMIX_LIBS}" != "x"; then
2337 echo "Informix libs : ${INFORMIX_LIBS}"
2338fi
ecbed20c
VK
2339
2340FLAGS_CPP="src/tools/nxdevcfg/flags.cpp"
2341echo "/* Automatically generated by configure */" > $FLAGS_CPP
d541b129
VK
2342echo "#include <nms_common.h>" >> $FLAGS_CPP
2343echo "const TCHAR *g_cppFlags = _T(\"${CPPFLAGS}\");" >> $FLAGS_CPP
2344echo "const TCHAR *g_cFlags = _T(\"${CFLAGS}\");" >> $FLAGS_CPP
2345echo "const TCHAR *g_cxxFlags = _T(\"${CXXFLAGS}\");" >> $FLAGS_CPP
2346echo "const TCHAR *g_ldFlags = _T(\"${LDFLAGS}\");" >> $FLAGS_CPP
2347echo "const TCHAR *g_libs = _T(\"${LIBS}\");" >> $FLAGS_CPP