version number updated
[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
588fb98e 7AC_INIT([NetXMS], [3.0-M0], [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
b535eed6
VK
29find_existing_dir()
30{
31 for d in "$@"; do
32 if test -d "$d"; then
33 __dir="$d"
34 return 0;
35 fi
36 done
37 return 1
38}
39
d3c8926d 40
ef0c727b
VK
41#--------------------------------------------------------------------
42# Initialize variables
43#--------------------------------------------------------------------
d3c8926d 44
ef0c727b 45PLATFORM=`uname -s`
c3900dbb 46CPUTYPE=`uname -p`
ef0c727b
VK
47COMPONENTS=""
48DISABLE_ICONV="no"
49DISABLE_ENCRYPTION="no"
4050bafb 50DISABLE_LMSENSORS="no"
f32b0155 51DISABLE_SSH="no"
f974a50a 52ENABLE_DEBUG="no"
25ae8377 53ENABLE_WERROR="no"
ef0c727b 54STATIC_BUILD="no"
c1165d33 55ALL_STATIC="no"
ef0c727b
VK
56DBDRIVER_SELECTED="no"
57USE_PTH="no"
58BUILD_SERVER="no"
59BUILD_AGENT="no"
60BUILD_CLIENT="no"
ef0c727b 61BUILD_STATIC_AGENT="no"
447350a9 62BUILD_SDK="no"
f65df2b1 63MODULES="libnetxms tools install"
ef0c727b 64STATIC_SUBAGENT_LIST=""
c1165d33 65PROPOSED_STATIC_SUBAGENTS="default"
ef0c727b
VK
66SUBAGENT_DIRS=""
67SUBAGENT_LIBS=""
c7c6ce77 68AGENT_DIRS=""
7c48e2aa 69SERVER_LIBS=""
ef0c727b 70SERVER_TOOLS=""
7dda4453 71SERVER_INCLUDE=""
31b0f68b 72SMSDRV_DIRS=""
6fad8870 73HDLINK_DIRS=""
52a2232c 74PDSDRV_DIRS=""
ef0c727b
VK
75TOP_LEVEL_MODULES=""
76CONTRIB_MODULES=""
c2612d83 77CLIENT_COMPONENTS=""
25a19da6 78BUILD_UNICODE="yes"
467c489f 79FORCE_INTERNAL_EXPAT="no"
25a19da6 80FORCE_INTERNAL_LIBTRE="yes"
17b35ccc
VK
81USE_INTERNAL_LIBTRE="no"
82FORCE_INTERNAL_LIBTRE="no"
f5393033 83FORCE_INTERNAL_JANSSON="no"
1fd41bcd 84FORCE_INTERNAL_ZLIB="no"
3d2bc3ae 85FORCE_INTERNAL_SQLITE="no"
cc297a70 86FORCE_32BIT_BUILD="no"
df9812a9 87FORCE_INTERNAL_GETOPT="no"
545bda2d
VK
88LDFLAGS_PREFIX=""
89LDFLAGS_SUFFIX=""
1ef5e57a
VK
90LTINIT_CC=""
91LTINIT_CXX=""
9113e749 92SQLFLAGS=""
a5a95ac8 93RUNTIME_PREFIX=""
6ecea6ef 94RUNTIME_STATE_DIR=""
6dde8627 95HPUX_HPPA="no"
058bf6fc 96XMPP_SUPPORT="yes"
6688966e 97ZEROMQ_SUPPORT="no"
ca026ade 98ZEROMQ_REQUIRED="no"
7fcdcb0c
VK
99ZEROMQ_CPPFLAGS=""
100ZEROMQ_LDFLAGS=""
e6316fe0
VK
101MQTT_SUPPORT="no"
102DISABLE_MQTT="no"
123800f4
VK
103MQTT_CPPFLAGS=""
104MQTT_LDFLAGS=""
fab0916b 105MQTT_LIBS=""
e6316fe0 106DISABLE_CURL="no"
2cfe4482 107LDAP_SUPPORT="yes"
25a19da6 108DISABLE_READLINE="yes"
6d14d0b0 109TUXEDO_LIBS=""
c7c6ce77 110TUXEDO_TPINIT=""
d6235717 111MONGODB_LIBS=""
1647762a
VK
112VMGR_CPPFLAGS=""
113VMGR_LDFLAGS=""
b7c8729b 114VMGR_LIBS=""
442297fa 115LIBVIRT_BASE=""
1647762a
VK
116XEN_CPPFLAGS=""
117XEN_LDFLAGS=""
118XEN_LIBS=""
b8adb0f2
VK
119DISABLE_IPV6="no"
120IPV6_SUPPORT="no"
b5e5849b 121INSTALL_LIBPATH=""
9c3bf7f4
VK
122WITH_ENCRYPTION="no"
123DISABLE_COMMONCRYPTO="no"
096e561b
VK
124OPENSSL_LIBSSL="ssl"
125OPENSSL_LIBCRYPTO="crypto"
d3c8926d 126
16dff090 127
ef0c727b 128#--------------------------------------------------------------------
fecf6a2b
VK
129# Common compilation flags
130#--------------------------------------------------------------------
131
842c22f4 132CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DTRE_WCHAR=1"
fecf6a2b
VK
133
134
135#--------------------------------------------------------------------
ef0c727b
VK
136# Parse command line parameters
137#--------------------------------------------------------------------
7c9c94a7 138
a5a95ac8 139AC_ARG_WITH(runtime-prefix,
125543aa 140[AS_HELP_STRING(--with-runtime-prefix=prefix,installation prefix to be used at run time)],
a5a95ac8
VK
141[
142 RUNTIME_PREFIX="$withval"
54df06e2 143 RUNTIME_STATE_DIR="$RUNTIME_PREFIX/var"
6ecea6ef
VK
144])
145
146AC_ARG_WITH(runtime-state-dir,
147[AS_HELP_STRING(--with-runtime-state-dir=path,state directory to be used at run time)],
148[
149 RUNTIME_STATE_DIR="$withval"
a5a95ac8
VK
150])
151
ef0c727b
VK
152AC_ARG_WITH(server,
153[AS_HELP_STRING(--with-server,build server)],
154[
231b0aad 155 COMPONENTS="$COMPONENTS sqlite snmp server agent sqlite_drv"
c5c0f362
VK
156])
157
158AC_ARG_WITH(snmp,
159[AS_HELP_STRING(--with-snmp,build SNMP library and tools)],
160[
161 COMPONENTS="$COMPONENTS snmp"
ef0c727b 162])
7c9c94a7 163
ef0c727b
VK
164AC_ARG_WITH(client,
165[AS_HELP_STRING(--with-client,build client library and tools)],
166[
167 COMPONENTS="$COMPONENTS client"
168])
d16cf8a5 169
a7a03ffd
VK
170AC_ARG_WITH(client-proxy,
171[AS_HELP_STRING(--with-client-proxy,build client proxy)],
172[
173 COMPONENTS="$COMPONENTS client-proxy"
174])
175
c2612d83 176AC_ARG_WITH(agent,
ef0c727b
VK
177[AS_HELP_STRING(--with-agent,build agent)],
178[
231b0aad 179 COMPONENTS="$COMPONENTS sqlite snmp agent sqlite_drv"
ef0c727b 180])
d16cf8a5 181
ef0c727b
VK
182AC_ARG_WITH(static-agent,
183[AS_HELP_STRING(--with-static-agent,build statically linked agent)],
184[
231b0aad 185 COMPONENTS="$COMPONENTS sqlite snmp static-agent sqlite_drv"
fb12fd54 186 FORCE_INTERNAL_EXPAT="yes"
fb12fd54 187 FORCE_INTERNAL_JANSSON="yes"
3d2bc3ae
VK
188 FORCE_INTERNAL_LIBTRE="yes"
189 FORCE_INTERNAL_SQLITE="yes"
fb12fd54 190 FORCE_INTERNAL_ZLIB="yes"
ef0c727b 191])
d16cf8a5 192
ef0c727b
VK
193AC_ARG_WITH(ipso-agent,
194[AS_HELP_STRING(--with-ipso-agent,build statically linked IPSO agent)],
195[
971abf4f 196 COMPONENTS="$COMPONENTS ipso-agent"
ef0c727b 197])
521d90e7 198
7dda4453
VK
199AC_ARG_WITH(sdk,
200[AS_HELP_STRING(--with-sdk,build and install files necessary for extension development)],
201[
b550188f 202 COMPONENTS="$COMPONENTS sqlite sdk"
7dda4453
VK
203 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES include"
204 SERVER_INCLUDE="include"
447350a9 205 BUILD_SDK="yes"
4671448c
VK
206])
207
208AC_ARG_WITH(static-sdk,
209[AS_HELP_STRING(--with-static-sdk,build and install files necessary for extension development (static libs only))],
210[
b550188f 211 COMPONENTS="$COMPONENTS sqlite sdk"
4671448c
VK
212 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES include"
213 SERVER_INCLUDE="include"
214 BUILD_SDK="yes"
215 STATIC_BUILD="yes"
7dda4453
VK
216])
217
ef0c727b
VK
218AC_ARG_WITH(mdebug,
219[AS_HELP_STRING(--with-mdebug,use debug version of memory allocation functions)],
220[
221 CPPFLAGS="$CPPFLAGS -DNETXMS_MEMORY_DEBUG"
222])
d16cf8a5 223
b82ad936
AK
224AC_ARG_WITH(profiler,
225[AS_HELP_STRING(--with-profiler,link with libprofiler from gperftools)],
226[
227 LDFLAGS="$LDFLAGS -lprofiler"
228])
229
467c489f
VK
230AC_ARG_WITH(internal-libexpat,
231[AS_HELP_STRING(--with-internal-libexpat,force use of bundled libexpat)],
232[
233 FORCE_INTERNAL_EXPAT="yes"
234])
235
17b35ccc
VK
236AC_ARG_WITH(internal-libtre,
237[AS_HELP_STRING(--with-internal-libtre,force use of bundled libtre)],
238[
239 FORCE_INTERNAL_LIBTRE="yes"
240])
241
f5393033
VK
242AC_ARG_WITH(internal-libjansson,
243[AS_HELP_STRING(--with-internal-libjansson,force use of bundled libjansson)],
244[
245 FORCE_INTERNAL_JANSSON="yes"
246])
247
1fd41bcd
VK
248AC_ARG_WITH(internal-zlib,
249[AS_HELP_STRING(--with-internal-zlib,force use of bundled zlib)],
250[
251 FORCE_INTERNAL_ZLIB="yes"
252])
253
3d2bc3ae
VK
254AC_ARG_WITH(internal-sqlite,
255[AS_HELP_STRING(--with-internal-sqlite,force use of bundled sqlite)],
256[
257 FORCE_INTERNAL_SQLITE="yes"
258])
259
df9812a9
VK
260AC_ARG_WITH(internal-getopt,
261[AS_HELP_STRING(--with-internal-getopt,force use of bundled getopt)],
262[
263 FORCE_INTERNAL_GETOPT="yes"
264])
265
c1165d33
VK
266AC_ARG_WITH(all-static,
267[AS_HELP_STRING(--with-all-static,use -all-static flag for linking executables)],
268[
269 ALL_STATIC="yes"
270])
271
272AC_ARG_WITH(static-subagents,
919e2dce 273[AS_HELP_STRING(--with-static-subagents-list,define list of static subagents (separated by spaces))],
c1165d33
VK
274[
275 PROPOSED_STATIC_SUBAGENTS="$withval"
276])
277
50e4bc8c
VK
278AC_ARG_WITH(jdk,
279[AS_HELP_STRING(--with-jdk,build Java-dependent components)],
280[ if test "x$withval" != "xno" ; then
281 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
282 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
283 LDFLAGS="$LDFLAGS -L${withval}/lib"
284 CPPFLAGS="$CPPFLAGS -I${withval}/include"
a041dc13
VK
285 if test -d "${withval}/include/linux"; then
286 CPPFLAGS="$CPPFLAGS -I${withval}/include/linux"
287 fi
e2e3ce85
VK
288 if test -d "${withval}/include/solaris"; then
289 CPPFLAGS="$CPPFLAGS -I${withval}/include/solaris"
290 fi
1de39d9e 291 AC_DEFINE_UNQUOTED([JDK_LOCATION],["$withval"],[JDK location])
50e4bc8c
VK
292 fi
293 COMPONENTS="$COMPONENTS java"
294fi ])
295
b14c3f22
VK
296AC_ARG_WITH(tuxedo,
297[AS_HELP_STRING(--with-tuxedo,build Tuxedo-dependent components)],
298[ if test "x$withval" != "xno" ; then
299 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
300 TUXEDO_BASE="$withval"
301 fi
302 COMPONENTS="$COMPONENTS tuxedo"
303fi ])
304
cac05a70 305AC_ARG_WITH(zeromq,
123800f4 306[AS_HELP_STRING(--with-zeromq,build with ZeroMQ)],
cac05a70 307[ if test "x$withval" != "xno" ; then
308 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
309 ZEROMQ_BASE="$withval"
ca026ade 310 ZEROMQ_REQUIRED=yes
cac05a70 311 fi
312 COMPONENTS="$COMPONENTS zeromq"
ca026ade
VK
313 ZEROMQ_SUPPORT=yes
314else
315 ZEROMQ_SUPPORT=no
cac05a70 316fi ])
317
e6316fe0
VK
318AC_ARG_WITH(mosquitto,
319[AS_HELP_STRING(--with-mosquitto,specify mosquitto library location)],
123800f4
VK
320[ if test "x$withval" != "xno" ; then
321 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
e6316fe0 322 MOSQUITTO_BASE="$withval"
123800f4 323 fi
123800f4
VK
324fi ])
325
e6316fe0
VK
326AC_ARG_ENABLE(mqtt,
327[AS_HELP_STRING(--disable-mqtt,disable MQTT support)],
328[
329 if test "x$enableval" = "xno"; then
330 DISABLE_MQTT="yes"
331 fi
332])
333
67fc78d2
VK
334AC_ARG_WITH(curl,
335[AS_HELP_STRING(--without-curl,build without curl)],
336[
8a4f46c2 337 if test "x$withval" = "xno"; then
67fc78d2
VK
338 DISABLE_CURL="yes"
339 fi
340])
341
d6235717 342AC_ARG_WITH(mongodb,
343[AS_HELP_STRING(--with-mongodb,build MongoDB-dependent components)],
344[ if test "x$withval" != "xno" ; then
345 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
346 MONGODB_BASE="$withval"
347 fi
348 COMPONENTS="$COMPONENTS mongodb"
349fi ])
350
b7c8729b 351AC_ARG_WITH(vmgr,
442297fa
VK
352[AS_HELP_STRING(--with-vmgr,build VirtualHost management subagent)],
353[ if test "x$withval" != "xno" ; then
354 COMPONENTS="$COMPONENTS vmgr"
355fi ])
356
357AC_ARG_WITH(libvirt,
358[AS_HELP_STRING(--with-libvirt,provide libvirt location)],
b7c8729b 359[ if test "x$withval" != "xno" ; then
360 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
442297fa 361 LIBVIRT_BASE="$withval"
b7c8729b 362 fi
b7c8729b 363fi ])
364
1647762a
VK
365AC_ARG_WITH(xen,
366[AS_HELP_STRING(--with-xen,build XEN subagent)],
367[ if test "x$withval" != "xno" ; then
368 COMPONENTS="$COMPONENTS xen"
369fi ])
370
9486b324
VK
371AC_ARG_WITH(sqlite,
372[AS_HELP_STRING(--with-sqlite,build SQLite database driver)],
373[ if test "x$withval" != "xno" ; then
8817f620 374 COMPONENTS="$COMPONENTS sqlite_drv"
ef0c727b 375 DBDRIVER_SELECTED="yes"
9486b324
VK
376fi ])
377
c4b88c3d
VK
378AC_ARG_WITH(odbc,
379[AS_HELP_STRING(--with-odbc,build ODBC database driver)],
380[ if test "x$withval" != "xno" ; then
381 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
2cfe4482
VK
382 ODBC_LD_RUN_PATH="${withval}/lib"
383 ODBC_LDFLAGS="-L${withval}/lib"
384 ODBC_CPPFLAGS="-I${withval}/include"
ef0c727b
VK
385 fi
386 COMPONENTS="$COMPONENTS odbc"
387 DBDRIVER_SELECTED="yes"
c4b88c3d
VK
388fi ])
389
ed77e726 390AC_ARG_WITH(oracle,
41b4790d
VK
391[AS_HELP_STRING(--with-oracle,build Oracle database driver)],
392[ if test "x$withval" != "xno" ; then
df5afcf1 393 ORABASE="$ORACLE_HOME"
41b4790d 394 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
df5afcf1
VK
395 ORABASE="$withval"
396 fi
397 if test "x$ORABASE" != "x"; then
06d9dfbc 398 if test -x "$ORABASE/lib" ; then
df5afcf1
VK
399 ORACLE_LD_RUN_PATH="${ORABASE}/lib"
400 ORACLE_LDFLAGS="-L${ORABASE}/lib"
7d8c91ef 401 else
df5afcf1
VK
402 ORACLE_LD_RUN_PATH="${ORABASE}"
403 ORACLE_LDFLAGS="-L${ORABASE}"
7d8c91ef 404 fi
06d9dfbc 405 if test -x "$ORABASE/include" ; then
df5afcf1 406 ORACLE_CPPFLAGS="-I${ORABASE}/include"
7d8c91ef 407 fi
06d9dfbc 408 if test -x "$ORABASE/sdk/include" ; then
df5afcf1 409 ORACLE_CPPFLAGS="-I${ORABASE}/sdk/include"
7d8c91ef 410 fi
06d9dfbc 411 if test -x "$ORABASE/rdbms/public" ; then
df5afcf1 412 ORACLE_CPPFLAGS="-I${ORABASE}/rdbms/public"
2f6e6064 413 fi
41b4790d
VK
414 fi
415 COMPONENTS="$COMPONENTS oracle"
416 DBDRIVER_SELECTED="yes"
417fi ])
418
d16cf8a5 419AC_ARG_WITH(mysql,
c4b88c3d 420[AS_HELP_STRING(--with-mysql,build MySQL database driver)],
d16cf8a5
AK
421[ if test "x$withval" != "xno" ; then
422 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
9f1ea006
VK
423 if find_existing_dir "${withval}/lib" "${withval}/lib/mysql" "${withval}/mysql/lib"; then
424 MYSQL_LD_RUN_PATH="$__dir$"
425 MYSQL_LDFLAGS="-L$__dir"
426 fi
427 if find_existing_dir "${withval}/include" "${withval}/include/mysql" "${withval}/mysql/include"; then
428 MYSQL_CPPFLAGS="-I$__dir"
429 fi
d16cf8a5 430 else
9f1ea006
VK
431 if find_existing_dir "/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"; then
432 MYSQL_LD_RUN_PATH="$__dir$"
433 MYSQL_LDFLAGS="-L$__dir"
434 fi
e99f8e86 435 if find_existing_dir "/usr/local/mysql/include" "/usr/include/mysql" "/usr/mysql/include" "/usr/local/include/mysql" "/usr/local/mysql/include/mysql" "/usr/mysql/include/mysql" "/usr/include/mariadb"; then
9f1ea006
VK
436 MYSQL_CPPFLAGS="-I$__dir"
437 fi
d16cf8a5 438 fi
ef0c727b
VK
439 COMPONENTS="$COMPONENTS mysql"
440 DBDRIVER_SELECTED="yes"
6693a1d0 441fi ])
d16cf8a5 442
c6030457
VK
443AC_ARG_WITH(mariadb,
444[AS_HELP_STRING(--with-mariadb,build MariaDB database driver)],
445[ if test "x$withval" != "xno" ; then
446 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
447 if find_existing_dir "${withval}/lib" "${withval}/lib/mariadb" "${withval}/mariadb/lib"; then
448 MARIADB_LD_RUN_PATH="$__dir$"
449 MARIADB_LDFLAGS="-L$__dir"
450 fi
451 if find_existing_dir "${withval}/include" "${withval}/include/mariadb" "${withval}/mariadb/include"; then
452 MARIADB_CPPFLAGS="-I$__dir"
453 fi
454 else
455 if find_existing_dir "/usr/local/mariadb/lib"; then
456 MARIADB_LD_RUN_PATH="$__dir$"
457 MARIADB_LDFLAGS="-L$__dir"
458 fi
459 if find_existing_dir "/usr/local/mariadb/include" "/usr/include/mariadb" "/usr/local/include/mariadb"; then
460 MARIADB_CPPFLAGS="-I$__dir"
461 fi
462 fi
463 COMPONENTS="$COMPONENTS mariadb"
464 DBDRIVER_SELECTED="yes"
465fi ])
466
d16cf8a5 467AC_ARG_WITH(pgsql,
c4b88c3d 468[AS_HELP_STRING(--with-pgsql,build PostgreSQL database driver)],
d16cf8a5 469[ if test "x$withval" != "xno" ; then
6693a1d0 470 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
b535eed6
VK
471 if find_existing_dir "${withval}/lib" "${withval}/lib/pgsql" "${withval}/lib/postgresql" "${withval}/pgsql/lib" "${withval}/postgresql/lib"; then
472 PGSQL_LD_RUN_PATH="$__dir$"
473 PGSQL_LDFLAGS="-L$__dir"
474 fi
475 if find_existing_dir "${withval}/include" "${withval}/include/pgsql" "${withval}/include/postgresql" "${withval}/pgsql/include" "${withval}/postgresql/include"; then
476 PGSQL_CPPFLAGS="-I$__dir"
477 fi
6693a1d0 478 else
b535eed6
VK
479 if find_existing_dir "/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"; then
480 PGSQL_LD_RUN_PATH="$__dir$"
481 PGSQL_LDFLAGS="-L$__dir"
482 fi
483 if find_existing_dir "/usr/local/pgsql/include" "/usr/include/pgsql" "/usr/pgsql/include" "/usr/local/include/pgsql" "/usr/local/pgsql/include/pgsql" "/usr/pgsql/include/pgsql" "/usr/local/postgresql/include" "/usr/include/postgresql" "/usr/postgresql/include" "/usr/local/include/postgresql" "/usr/local/postgresql/include/postgresql" "/usr/postgresql/include/postgresql"; then
484 PGSQL_CPPFLAGS="-I$__dir"
485 fi
6693a1d0 486 fi
ef0c727b
VK
487 COMPONENTS="$COMPONENTS pgsql"
488 DBDRIVER_SELECTED="yes"
6693a1d0 489fi ])
d16cf8a5 490
84277a0f
AK
491AC_ARG_WITH(db2,
492[AS_HELP_STRING(--with-db2,build DB2 database driver)],
493[ if test "x$withval" != "xno" ; then
494 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
495 if test `uname -m` = 'i386' || test `uname -m` = 'i686'; then
496 DB2_LIB_DIR=lib32
497 else
498 DB2_LIB_DIR=lib64
499 fi
500 if test -x "$withval/${DB2_LIB_DIR}" ; then
501 LD_RUN_PATH="${withval}/${DB2_LIB_DIR}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
502 LDFLAGS="$LDFLAGS -L${withval}/${DB2_LIB_DIR}"
503 else
504 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
505 LDFLAGS="$LDFLAGS -L${withval}"
506 fi
507 if test -x "$withval/include" ; then
508 CPPFLAGS="$CPPFLAGS -I${withval}/include"
509 fi
510
511 unset DB2_LIB_DIR
512 fi
513 COMPONENTS="$COMPONENTS db2"
514 DBDRIVER_SELECTED="yes"
515fi ])
516
37861c72
VK
517AC_ARG_WITH(informix,
518[AS_HELP_STRING(--with-informix,build Informix database driver)],
519[ if test "x$withval" != "xno" ; then
520 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
521 if test -x "$withval/lib/cli" ; then
522 LD_RUN_PATH="${withval}/lib/cli${LD_RUN_PATH:+:}${LD_RUN_PATH}"
523 LDFLAGS="$LDFLAGS -L${withval}/lib/cli"
524 if test -x "$withval/lib/esql" ; then
525 LD_RUN_PATH="${withval}/lib/esql${LD_RUN_PATH:+:}${LD_RUN_PATH}"
526 LDFLAGS="$LDFLAGS -L${withval}/lib/esql"
527 fi
528 else
529 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
530 LDFLAGS="$LDFLAGS -L${withval}"
531 fi
532 if test -x "$withval/incl/cli" ; then
533 CPPFLAGS="$CPPFLAGS -I${withval}/incl/cli"
534 fi
535 fi
536 COMPONENTS="$COMPONENTS informix"
537 DBDRIVER_SELECTED="yes"
538fi ])
539
ef0c727b 540AC_ARG_WITH(openssl,
1010cff7
VK
541[AS_HELP_STRING(--with-openssl,specify OpenSSL location)],
542[
543 if test "x$withval" != "xno" ; then
544 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
545 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
546 LDFLAGS="$LDFLAGS -L${withval}/lib"
547 CPPFLAGS="$CPPFLAGS -I${withval}/include"
548 else
549 LD_RUN_PATH="/usr/local/lib:/opt/openssl/lib:/usr/local/ssl/lib:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
550 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/opt/openssl/lib"
4d37b0c5 551 CPPFLAGS="$CPPFLAGS -I/opt/openssl/include"
ef0c727b 552 fi
1010cff7 553 fi
1010cff7 554])
ef0c727b 555
9c3bf7f4
VK
556AC_ARG_ENABLE(commoncrypto,
557[AS_HELP_STRING(--disable-commoncrypto,disable CommonCrypto usage on Mac OS X)],
558[
559 if test "x$enableval" = "xno"; then
560 DISABLE_COMMONCRYPTO="yes"
561 fi
562])
563
096e561b
VK
564AC_ARG_WITH(bundled-openssl,
565[AS_HELP_STRING(--with-bundled-openssl,use bundled OpenSSL libraries with product-specific prefix)],
566[
567 OPENSSL_LIBSSL="nxssl"
568 OPENSSL_LIBCRYPTO="nxcrypto"
569])
570
f32b0155
VK
571AC_ARG_ENABLE(ssh,
572[AS_HELP_STRING(--disable-ssh,disable SSH support)],
573[
574 if test "x$enableval" = "xno"; then
575 DISABLE_SSH="yes"
576 fi
577])
578
b5e5849b
VK
579AC_ARG_WITH(jemalloc,
580[AS_HELP_STRING(--with-jemalloc,specify libjemalloc location)],
581[
582 if test "x$withval" != "xno" ; then
583 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
584 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
585 LDFLAGS="$LDFLAGS -L${withval}/lib"
586 CPPFLAGS="$CPPFLAGS -I${withval}/include"
587 INSTALL_LIBPATH="${withval}/lib${INSTALL_LIBPATH:+:}${INSTALL_LIBPATH}"
588 fi
589 fi
590])
591
ef0c727b
VK
592AC_ARG_ENABLE(iconv,
593[AS_HELP_STRING(--disable-iconv,do not use iconv() for text conversions)],
3a7ce527 594[
25a19da6
VK
595 if test "x$$enableval" = "xno"; then
596 DISABLE_ICONV="yes"
597 fi
3a7ce527 598])
3a7ce527 599
b8adb0f2
VK
600AC_ARG_ENABLE(ipv6,
601[AS_HELP_STRING(--disable-ipv6,disable IPv6 support)],
602[
25a19da6
VK
603 if test "x$$enableval" = "xno"; then
604 DISABLE_IPV6="yes"
605 fi
b8adb0f2
VK
606])
607
bd96aa53
VK
608AC_ARG_ENABLE(iconv-cache,
609[AS_HELP_STRING([--enable-iconv-cache=@<:@yes/no/auto@:>@],
610[cache iconv descriptors [default=auto]])],,
611[enable_iconv_cache=auto])
612
65834be3
VK
613AC_ARG_ENABLE(readline,
614[AS_HELP_STRING(--disable-readline,do not use libreadline)],
615[
25a19da6
VK
616 if test "x$$enableval" = "xno"; then
617 DISABLE_READLINE="yes"
618 fi
65834be3
VK
619])
620
ef0c727b
VK
621AC_ARG_ENABLE(encryption,
622[AS_HELP_STRING(--disable-encryption,disable encryption support)],
e0760102 623[
25a19da6
VK
624 if test "x$$enableval" = "xno"; then
625 DISABLE_ENCRYPTION="yes"
626 XMPP_SUPPORT="no"
627 fi
e0760102
VK
628])
629
4050bafb
VK
630AC_ARG_ENABLE(lmsensors,
631[AS_HELP_STRING(--disable-lmsensors,disable lmsensors support)],
632[
25a19da6
VK
633 if test "x$$enableval" = "xno"; then
634 DISABLE_LMSENSORS="yes"
635 fi
4050bafb
VK
636])
637
058bf6fc
VK
638AC_ARG_ENABLE(xmpp,
639[AS_HELP_STRING(--disable-xmpp,disable XMPP support)],
640[
25a19da6
VK
641 if test "x$$enableval" = "xno"; then
642 XMPP_SUPPORT="no"
643 fi
058bf6fc
VK
644])
645
e6316fe0
VK
646AC_ARG_WITH(rpi-agent,
647[AS_HELP_STRING(--with-rpi-agent,build Raspberry Pi agent)],
648[
649 COMPONENTS="$COMPONENTS raspberrypi"
650])
651
2cfe4482
VK
652AC_ARG_ENABLE(ldap,
653[AS_HELP_STRING(--disable-ldap,disable LDAP support)],
654[
25a19da6
VK
655 if test "x$$enableval" = "xno"; then
656 LDAP_SUPPORT="no"
657 fi
2cfe4482
VK
658])
659
a67fa146 660AC_ARG_ENABLE(unicode,
25a19da6 661[AS_HELP_STRING(--disable-unicode,disable UNICODE build)],
a67fa146 662[
25a19da6
VK
663 if test "x$enableval" = "xno"; then
664 BUILD_UNICODE="no"
665 FORCE_INTERNAL_LIBTRE="no"
666 DISABLE_READLINE="no"
667 fi
a67fa146
VK
668])
669
f974a50a
VK
670AC_ARG_ENABLE(debug,
671[AS_HELP_STRING(--enable-debug,enable additional debugging functionality)],
672[
25a19da6
VK
673 if test "x$enableval" = "xyes"; then
674 ENABLE_DEBUG="yes"
675 fi
f974a50a
VK
676])
677
25ae8377
VK
678AC_ARG_ENABLE(werror,
679[AS_HELP_STRING(--enable-werror,threat all warnings as errors)],
680[
25a19da6
VK
681 if test "x$enableval" = "xyes"; then
682 ENABLE_WERROR="yes"
683 fi
25ae8377
VK
684])
685
cc297a70 686AC_ARG_ENABLE(64bit,
e5be5b83 687[AS_HELP_STRING(--disable-64bit,disable 64bit build (force 32bit build on 64bit machine))],
cc297a70 688[
25a19da6
VK
689 if test "x$enableval" = "xno"; then
690 FORCE_32BIT_BUILD="yes"
691 fi
cc297a70
VK
692])
693
ef0c727b
VK
694AC_ARG_WITH(dist,
695[AS_HELP_STRING(--with-dist,for maintainers only)],
c6030457 696 DB_DRIVERS="mysql mariadb pgsql odbc mssql sqlite oracle db2 informix"
90a9e65e 697 MODULES="appagent jansson libexpat libstrophe libtre zlib libnetxms libnxjava install sqlite snmp libnxsl libnxmb libnxlp libnxcc db server smsdrv agent client nxscript nxcproxy nxlptest tools"
24c44589 698 SUBAGENT_DIRS="linux ds18x20 freebsd openbsd minix mqtt mysql netbsd sunos aix ipso hpux odbcquery informix oracle lmsensors darwin rpi java jmx bind9 ubntlw netsvc db2 tuxedo mongodb ssh vmgr xen lorawan"
c7c6ce77 699 AGENT_DIRS="libnxtux"
f841b121 700 SMSDRV_DIRS="anysms kannel mymobile nexmo nxagent slack smseagle text2reach websms"
2a0a6a2b 701 HDLINK_DIRS="jira redmine"
52a2232c 702 PDSDRV_DIRS="rrdtool"
ef0c727b 703 NXCONFIG="nxconfig"
33a10d92 704 TOP_LEVEL_MODULES="include sql images tests"
7dda4453 705 SERVER_INCLUDE="include"
03b96461 706 CONTRIB_MODULES="mibs backgrounds music templates"
11f1babb 707 CLIENT_COMPONENTS="nxalarm nxevent nxpush nxshell nxsms"
ef0c727b
VK
708 SERVER_TOOLS="nxconfig"
709)
710
33a10d92
VK
711AC_ARG_WITH(tests,
712[AS_HELP_STRING(--with-tests,build tests)],
713[
714 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES tests"
715])
716
d8ca9c03 717
ef0c727b 718#--------------------------------------------------------------------
12313882
VK
719# Set LD_LIBRARY_PATH from LD_RUN_PATH because on some systems
720# LD_RUN_PATH ignored by linker and some tests may fail
721#--------------------------------------------------------------------
722
e5cceced 723export LD_RUN_PATH
12313882
VK
724if test "x$LD_RUN_PATH" != "x"; then
725 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}${LD_RUN_PATH}"
726 export LD_LIBRARY_PATH
727fi
728
729
730#--------------------------------------------------------------------
ef0c727b
VK
731# Validate command line parameters and set various checking options
732#--------------------------------------------------------------------
733
bc9361fd
VK
734check_substr "$COMPONENTS" "snmp"
735if test $? = 0; then
bc9361fd
VK
736 MODULES="$MODULES snmp"
737fi
738
90a9e65e
VK
739check_substr "$COMPONENTS" "java"
740if test $? = 0; then
741 MODULES="$MODULES libnxjava"
742 SUBAGENT_DIRS="$SUBAGENT_DIRS java bind9 jmx ubntlw"
743fi
744
ef0c727b 745check_substr "$COMPONENTS" "static-agent"
1010cff7 746if test $? = 0; then
e528af2b 747 if test "x$COMPONENTS" != "x sqlite snmp static-agent sqlite_drv"; then
971abf4f 748 AC_MSG_ERROR(Static agent and other components are mutually exclusive.)
ef0c727b
VK
749 fi
750 STATIC_BUILD="yes"
751 BUILD_STATIC_AGENT="yes"
ec1e303f 752 MODULES="$MODULES appagent libnxlp libnxmb db agent"
3a6979cf 753 DISABLE_ICONV="yes"
ef0c727b 754 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT"
c1165d33 755 if test "x$PROPOSED_STATIC_SUBAGENTS" = "xdefault"; then
52056835 756 STATIC_SUBAGENT_LIST="ecs filemgr logwatch ping portcheck ups"
c1165d33
VK
757 else
758 STATIC_SUBAGENT_LIST="$PROPOSED_STATIC_SUBAGENTS"
759 fi
60a1159a 760
52056835 761 SUBAGENT_LIBS="../subagents/ecs/ecs.la ../subagents/filemgr/filemgr.la ../subagents/logwatch/logwatch.la ../subagents/ping/ping.la ../subagents/portCheck/portcheck.la ../subagents/ups/ups.la"
e8636669 762
60a1159a
VK
763 check_substr "$STATIC_SUBAGENT_LIST" "odbcquery"
764 if test $? = 0; then
765 COMPONENTS="$COMPONENTS odbc"
766 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/odbcquery/odbcquery.la"
767 fi
768
769 check_substr "$STATIC_SUBAGENT_LIST" "oracle"
770 if test $? = 0; then
771 COMPONENTS="$COMPONENTS oracle"
772 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/oracle/oracle.la"
773 fi
774
405fb3ad
VK
775 check_substr "$STATIC_SUBAGENT_LIST" "informix"
776 if test $? = 0; then
777 COMPONENTS="$COMPONENTS informix"
778 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/informix/informix.la"
779 fi
6afe141e 780
781 check_substr "$STATIC_SUBAGENT_LIST" "db2"
60a1159a 782 if test $? = 0; then
6afe141e 783 COMPONENTS="$COMPONENTS db2"
405fb3ad
VK
784 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/db2/db2.la"
785 fi
786
787 check_substr "$STATIC_SUBAGENT_LIST" "mysql"
788 if test $? = 0; then
789 COMPONENTS="$COMPONENTS mysql"
790 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/mysql/mysql.la"
60a1159a
VK
791 fi
792
ef0c727b 793 case "$PLATFORM" in
e8636669 794 Linux)
e58b0f75
VK
795 SUBAGENT_DIRS="linux ds18x20"
796 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/linux/linux.la ../subagents/ds18x20/ds18x20.la"
797 STATIC_SUBAGENT_LIST="linux ds18x20 $STATIC_SUBAGENT_LIST"
e8636669
VK
798 ;;
799 FreeBSD)
800 SUBAGENT_DIRS="freebsd"
c1165d33 801 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/freebsd/freebsd.la"
d0b5a098 802 STATIC_SUBAGENT_LIST="freebsd $STATIC_SUBAGENT_LIST"
e8636669 803 ;;
992ba479
AK
804 OpenBSD)
805 SUBAGENT_DIRS="openbsd"
c1165d33 806 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/openbsd/openbsd.la"
992ba479
AK
807 STATIC_SUBAGENT_LIST="openbsd $STATIC_SUBAGENT_LIST"
808 ;;
ad0f1ada
VK
809 NetBSD)
810 SUBAGENT_DIRS="netbsd"
c1165d33 811 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/netbsd/netbsd.la"
ad0f1ada
VK
812 STATIC_SUBAGENT_LIST="netbsd $STATIC_SUBAGENT_LIST"
813 ;;
e8636669
VK
814 SunOS)
815 SUBAGENT_DIRS="sunos"
c1165d33 816 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/sunos/sunos.la"
d0b5a098
VK
817 STATIC_SUBAGENT_LIST="sunos $STATIC_SUBAGENT_LIST"
818 ;;
819 AIX)
820 SUBAGENT_DIRS="aix"
c1165d33 821 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/aix/aix.la"
d0b5a098 822 STATIC_SUBAGENT_LIST="aix $STATIC_SUBAGENT_LIST"
e8636669 823 ;;
c29360a9
VK
824 HP-UX)
825 SUBAGENT_DIRS="hpux"
c1165d33 826 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/hpux/hpux.la"
c29360a9
VK
827 STATIC_SUBAGENT_LIST="hpux $STATIC_SUBAGENT_LIST"
828 ;;
cf52e714
AK
829 Darwin)
830 SUBAGENT_DIRS="darwin"
831 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/darwin/darwin.la"
832 STATIC_SUBAGENT_LIST="darwin $STATIC_SUBAGENT_LIST"
833 ;;
cfcfdd2b
VK
834 Minix)
835 SUBAGENT_DIRS="minix"
836 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/minix/minix.la"
837 STATIC_SUBAGENT_LIST="minix $STATIC_SUBAGENT_LIST"
838 ;;
e8636669
VK
839 *)
840 # unknown
841 ;;
842 esac
ef0c727b 843fi
2b23dc1e 844
ef0c727b 845check_substr "$COMPONENTS" "ipso-agent"
1010cff7 846if test $? = 0; then
fd5a401b 847 if test "x$COMPONENTS" != "x ipso-agent"; then
971abf4f 848 AC_MSG_ERROR(IPSO agent and other components are mutually exclusive.)
ef0c727b
VK
849 fi
850 STATIC_BUILD="yes"
851 BUILD_STATIC_AGENT="yes"
3a6979cf 852 DISABLE_ICONV="yes"
ef0c727b 853 USE_PTH="yes"
d8637bab 854 MODULES="$MODULES appagent libnxlp db agent"
ef8a3c32 855 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT -D_IPSO -DSQLITE_THREADSAFE=0 -I/usr/local/include"
ef0c727b 856 LDFLAGS="$LDFLAGS -all-static"
971abf4f 857 STATIC_SUBAGENT_LIST="ecs ipso logwatch ping portcheck ups"
ef0c727b 858 SUBAGENT_DIRS="ipso"
c1165d33 859 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 860fi
c688d2a7 861
ef0c727b 862check_substr "$COMPONENTS" "agent"
1010cff7 863if test $? = 0; then
ef0c727b 864 BUILD_AGENT="yes"
ec1e303f 865 MODULES="$MODULES appagent libnxlp libnxmb db agent"
1010cff7
VK
866
867 case "$PLATFORM" in
868 Linux)
e58b0f75 869 SUBAGENT_DIRS="linux ds18x20"
1010cff7
VK
870 ;;
871 FreeBSD)
872 SUBAGENT_DIRS="freebsd"
873 ;;
874 OpenBSD)
875 SUBAGENT_DIRS="openbsd"
876 ;;
ad0f1ada
VK
877 NetBSD)
878 SUBAGENT_DIRS="netbsd"
879 ;;
1010cff7
VK
880 SunOS)
881 SUBAGENT_DIRS="sunos"
882 ;;
883 AIX)
884 SUBAGENT_DIRS="aix"
885 ;;
886 HP-UX)
887 SUBAGENT_DIRS="hpux"
cf52e714
AK
888 ;;
889 Darwin)
890 SUBAGENT_DIRS="darwin"
1010cff7 891 ;;
cfcfdd2b
VK
892 Minix)
893 SUBAGENT_DIRS="minix"
894 ;;
1010cff7
VK
895 *)
896 # unknown
897 ;;
898 esac
ef0c727b 899fi
b97191d2 900
94a7996a
VK
901check_substr "$COMPONENTS" "server"
902if test $? = 0; then
903 if test "x$DBDRIVER_SELECTED" != "xyes"; then
904 AC_MSG_ERROR(You must select at least one database driver when building server.)
905 fi
906 BUILD_SERVER="yes"
3cd8c93a 907 MODULES="$MODULES libnxsl libnxcc server smsdrv nxscript"
94a7996a 908 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES sql images"
03b96461 909 CONTRIB_MODULES="$CONTRIB_MODULES mibs backgrounds music templates"
623e2f0e 910 SMSDRV_DIRS="$SMSDRV_DIRS nxagent"
94a7996a
VK
911 if test "x$XMPP_SUPPORT" = "xyes"; then
912 MODULES="libstrophe $MODULES"
913 AC_DEFINE(XMPP_SUPPORTED, 1, Define to 1 if XMPP is supported)
914 fi
915fi
916
917check_substr "$COMPONENTS" "client"
918if test $? = 0; then
919 BUILD_CLIENT="yes"
94a7996a
VK
920 MODULES="$MODULES client"
921 CLIENT_COMPONENTS="$CLIENT_COMPONENTS nxalarm nxevent nxpush nxsms"
11f1babb
VK
922 check_substr "$COMPONENTS" "java"
923 if test $? = 0; then
924 CLIENT_COMPONENTS="$CLIENT_COMPONENTS nxshell"
925 fi
94a7996a
VK
926fi
927
928check_substr "$COMPONENTS" "client-proxy"
929if test $? = 0; then
930 MODULES="$MODULES nxcproxy"
931fi
932
ef0c727b 933check_substr "$COMPONENTS" "mysql"
1010cff7 934if test $? = 0; then
ef0c727b 935 DB_DRIVERS="$DB_DRIVERS mysql"
405fb3ad 936 SUBAGENT_DIRS="$SUBAGENT_DIRS mysql"
b67a9e12 937fi
6619a6b0 938
c6030457
VK
939check_substr "$COMPONENTS" "mariadb"
940if test $? = 0; then
941 DB_DRIVERS="$DB_DRIVERS mariadb"
942fi
943
ef0c727b 944check_substr "$COMPONENTS" "pgsql"
1010cff7 945if test $? = 0; then
ef0c727b
VK
946 DB_DRIVERS="$DB_DRIVERS pgsql"
947fi
e8636669 948
8817f620 949check_substr "$COMPONENTS" "sqlite_drv"
1010cff7 950if test $? = 0; then
ef0c727b 951 DB_DRIVERS="$DB_DRIVERS sqlite"
e8636669
VK
952fi
953
ef0c727b 954check_substr "$COMPONENTS" "odbc"
1010cff7 955if test $? = 0; then
ef0c727b
VK
956 DB_DRIVERS="$DB_DRIVERS odbc"
957fi
958
41b4790d
VK
959check_substr "$COMPONENTS" "oracle"
960if test $? = 0; then
961 DB_DRIVERS="$DB_DRIVERS oracle"
4d1753cd 962 SUBAGENT_DIRS="$SUBAGENT_DIRS oracle"
41b4790d
VK
963fi
964
84277a0f
AK
965check_substr "$COMPONENTS" "db2"
966if test $? = 0; then
967 DB_DRIVERS="$DB_DRIVERS db2"
6afe141e 968 SUBAGENT_DIRS="$SUBAGENT_DIRS db2"
84277a0f
AK
969fi
970
87f1fff0
VK
971check_substr "$COMPONENTS" "informix"
972if test $? = 0; then
973 DB_DRIVERS="$DB_DRIVERS informix"
80e96a82 974 SUBAGENT_DIRS="$SUBAGENT_DIRS informix"
87f1fff0
VK
975fi
976
247f8a6c
AK
977check_substr "$COMPONENTS" "raspberrypi"
978if test $? = 0; then
247f8a6c
AK
979 SUBAGENT_DIRS="$SUBAGENT_DIRS rpi"
980fi
ef0c727b 981
b14c3f22
VK
982check_substr "$COMPONENTS" "tuxedo"
983if test $? = 0; then
c7c6ce77 984 AGENT_DIRS="$AGENT_DIRS libnxtux"
b14c3f22
VK
985 SUBAGENT_DIRS="$SUBAGENT_DIRS tuxedo"
986fi
987
d6235717 988check_substr "$COMPONENTS" "mongodb"
989if test $? = 0; then
990 SUBAGENT_DIRS="$SUBAGENT_DIRS mongodb"
991fi
992
b7c8729b 993check_substr "$COMPONENTS" "vmgr"
994if test $? = 0; then
995 SUBAGENT_DIRS="$SUBAGENT_DIRS vmgr"
996fi
997
1647762a
VK
998check_substr "$COMPONENTS" "xen"
999if test $? = 0; then
1000 SUBAGENT_DIRS="$SUBAGENT_DIRS xen"
1001fi
1002
b550188f
VK
1003check_substr "$COMPONENTS" "sdk"
1004if test $? = 0; then
f6f9c0b6 1005 if test "x$STATIC_BUILD" = "xyes"; then
ec1e303f 1006 MODULES="$MODULES appagent client"
f6f9c0b6 1007 else
ec1e303f 1008 MODULES="$MODULES appagent client libnxsl libnxlp libnxcc db nxscript smsdrv snmp"
f6f9c0b6 1009 fi
b550188f
VK
1010fi
1011
1012
ef0c727b
VK
1013#--------------------------------------------------------------------
1014# Check for programs
1015#--------------------------------------------------------------------
1016
1017if test "x$PLATFORM" = "xHP-UX"; then
f172d7b7 1018 AC_CHECK_PROG([CC], [aCC], [aCC])
e7d9c4ae 1019 AC_CHECK_PROG([CCC], [aCC], [aCC])
ef0c727b 1020fi
df9812a9 1021if test "x$PLATFORM" = "xAIX"; then
f172d7b7 1022 AC_CHECK_PROG([CC], [xlc_r], [xlc_r])
df9812a9
VK
1023 AC_CHECK_PROG([CCC], [xlC_r], [xlC_r])
1024fi
9113e749 1025if test "x$PLATFORM" = "xSunOS"; then
f172d7b7 1026 AC_CHECK_PROG([CC], [cc], [cc])
9113e749
VK
1027 AC_CHECK_PROG([CCC], [CC], [CC])
1028fi
ef8a3c32
VK
1029if test "x$PLATFORM" = "xMinix"; then
1030 AC_CHECK_PROG([CC], [clang], [clang])
1031 AC_CHECK_PROG([CCC], [clang++], [clang++])
1032fi
f172d7b7 1033AC_PROG_CC
ef0c727b
VK
1034AC_PROG_CPP
1035AC_PROG_CXX
c3cfc039 1036if test "x$CXX" = "xg++"; then
753206b5
AK
1037 AC_CHECK_PROG([GPLUSPLUS], [g++], [yes], [no])
1038 if test "x$GPLUSPLUS" = "xno"; then
c3cfc039
VK
1039 AC_MSG_ERROR([*** FATAL: Cannot find any usable C++ compiler])
1040 fi
1041fi
ef8a3c32
VK
1042if test "x$CXX" = "xclang++"; then
1043 LIBS="$LIBS -lc++"
1044fi
fdf7ec40 1045AM_PROG_AS
ef0c727b
VK
1046AC_PROG_INSTALL
1047AC_PROG_LEX
76154a95 1048AC_CHECK_PROGS(YACC,bison byacc,yacc)
ef0c727b
VK
1049AC_PROG_LN_S
1050
1051AC_ARG_VAR(PERL,local path to the perl interpreter)
1052perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin"
1053AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path)
1054
1055
1056#--------------------------------------------------------------------
ef0c727b
VK
1057# C/C++ capabilities
1058#--------------------------------------------------------------------
1059
1060AC_C_CONST
1061AC_PROG_GCC_TRADITIONAL
1d9cc60e 1062AC_C_BIGENDIAN
ef0c727b
VK
1063
1064
1065#--------------------------------------------------------------------
1066# Platform-dependent settings
1067#--------------------------------------------------------------------
1068
1069case "$PLATFORM" in
1070 AIX)
545bda2d 1071 LDFLAGS_PREFIX="-no-undefined -Wl,-brtl $LDFLAGS"
ef0c727b
VK
1072 ;;
1073 HP-UX)
f0c1ad9c 1074 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 -D_LARGEFILE64_SOURCE"
ef0c727b 1075 if test "x$CXX" = "xaCC"; then
5a64ab96 1076 CPPFLAGS="$CPPFLAGS -D_HP_ATOMIC_INLINE"
53c96e2d 1077 CFLAGS="$CFLAGS -AC99"
6e872345 1078 CXXFLAGS="-mt $CXXFLAGS +W749 +W829 +W4232"
ef0c727b
VK
1079 LDFLAGS="$LDFLAGS -mt"
1080 fi
6dde8627
VK
1081 if test `uname -m` != 'ia64'; then
1082 HPUX_HPPA="yes"
1083 fi
ef0c727b 1084 ;;
75c30ed4 1085 SunOS)
b92efe0e 1086 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D__EXTENSIONS__"
e1e8cffb 1087
44ca59aa
VK
1088 AC_MSG_CHECKING(whether C compiler accepts -O2)
1089 OLD_CPPFLAGS="$CPPFLAGS"
1090 CPPFLAGS="$CPPFLAGS -O2"
12313882 1091 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
44ca59aa
VK
1092 [ AC_MSG_RESULT(yes) ],
1093 [
1094 CPPFLAGS="$OLD_CPPFLAGS"
1095 AC_MSG_RESULT(no)
e1e8cffb
VK
1096 ])
1097
1098 AC_MSG_CHECKING(whether C compiler accepts -features=extensions)
1099 OLD_CFLAGS="$CFLAGS"
1100 CFLAGS="$CFLAGS -features=extensions"
1101 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1102 [ AC_MSG_RESULT(yes) ],
1103 [
1104 CFLAGS="$OLD_CFLAGS"
1105 AC_MSG_RESULT(no)
44ca59aa 1106 ])
75c30ed4 1107 ;;
56b2f755 1108 Linux)
f47bd4ca 1109 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -O2"
56b2f755 1110 ;;
d1056954 1111 Darwin)
f47bd4ca 1112 CPPFLAGS="$CPPFLAGS -Wno-deprecated-declarations -O2"
d1056954 1113 ;;
ef8a3c32
VK
1114 Minix)
1115 CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
1116 LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
1117 USE_PTH="yes"
1118 ;;
ef0c727b
VK
1119 *)
1120 ;;
1121esac
1122
1123
1124#--------------------------------------------------------------------
c90d3610 1125# C++ compiler tuning:
cc297a70 1126# * Disable C++ exceptions and RTTI
779ce551 1127# * Turn on 64bit mode on HP-UX/Itanium
cc297a70 1128# * Turn on 64bit mode on AIX
d358c73f 1129# * Turn on 64bit mode on Solaris
3bc41d67 1130# * Disable inconsistent C/C++ linkage warnings for Solaris Studio
ef0c727b
VK
1131#--------------------------------------------------------------------
1132
5482ef16 1133if test "x$ac_compiler_gnu" = "xyes" ; then
9113e749 1134 SQLFLAGS="-x c -Wundef"
6e383343 1135 CPPFLAGS="$CPPFLAGS -Wformat"
ef0c727b 1136
94a82f76
VK
1137 AC_MSG_CHECKING(whether C compiler accepts -Wno-unused-result)
1138 OLD_CPPFLAGS="$CPPFLAGS"
1139 CPPFLAGS="$CPPFLAGS -Wno-unused-result"
1140 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1141 [ AC_MSG_RESULT(yes) ],
1142 [
1143 CPPFLAGS="$OLD_CPPFLAGS"
1144 AC_MSG_RESULT(no)
1145 ])
1146
5bcda3c0
VK
1147 AC_MSG_CHECKING(whether C compiler accepts -Werror=return-type)
1148 OLD_CPPFLAGS="$CPPFLAGS"
1149 CPPFLAGS="$CPPFLAGS -Werror=return-type"
1150 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1151 [ AC_MSG_RESULT(yes) ],
1152 [
1153 CPPFLAGS="$OLD_CPPFLAGS"
1154 AC_MSG_RESULT(no)
1155 ])
1156
ef0c727b
VK
1157 AC_LANG_PUSH([C++])
1158
1159 AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti)
e6b112bc 1160 OLD_CXXFLAGS="$CXXFLAGS"
ef0c727b
VK
1161 CXXFLAGS="$CXXFLAGS -fno-rtti"
1162 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1163 [ AC_MSG_RESULT(yes) ],
1164 [
1165 CXXFLAGS="$OLD_CXXFLAGS"
1166 AC_MSG_RESULT(no)
1167 ])
1168
3118008e
VK
1169 AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions)
1170 OLD_CXXFLAGS="$CXXFLAGS"
1171 CXXFLAGS="$CXXFLAGS -fno-exceptions"
1172 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1173 [ AC_MSG_RESULT(yes) ],
1174 [
1175 CXXFLAGS="$OLD_CXXFLAGS"
1176 AC_MSG_RESULT(no)
1177 ])
ef0c727b
VK
1178
1179 AC_LANG_POP([C++])
1180
9b318048
VK
1181 MACHINE=`uname -m`
1182 if test "x$MACHINE" = "xi686" -o "x$MACHINE" = "xi586"; then
1183 AC_MSG_CHECKING(whether C compiler accepts -march=$MACHINE)
1184 OLD_CPPFLAGS="$CPPFLAGS"
1185 CPPFLAGS="$CPPFLAGS -march=$MACHINE"
1186 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1187 [
1188 AC_MSG_RESULT(yes)
1189 ],
1190 [
1191 CPPFLAGS="$OLD_CPPFLAGS"
1192 AC_MSG_RESULT(no)
1193 ])
1194 fi
1195
779ce551 1196 if test "x$PLATFORM" = "xHP-UX"; then
cc297a70
VK
1197 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1198 AC_MSG_CHECKING(whether C compiler accepts -milp32)
1199 OLD_CPPFLAGS="$CPPFLAGS"
1200 CPPFLAGS="$CPPFLAGS -milp32"
1201 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1202 [
1203 LDFLAGS="-milp32 $LDFLAGS"
1204 AC_MSG_RESULT(yes)
1205 ],
1206 [
1207 CPPFLAGS="$OLD_CPPFLAGS"
1208 AC_MSG_RESULT(no)
1209 ])
1210 else
1211 AC_MSG_CHECKING(whether C compiler accepts -mlp64)
1212 OLD_CPPFLAGS="$CPPFLAGS"
1213 CPPFLAGS="$CPPFLAGS -mlp64"
1214 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1215 [
1216 LDFLAGS="-mlp64 -L/usr/lib/hpux64 -L/usr/local/lib/hpux64 $LDFLAGS"
1217 AC_MSG_RESULT(yes)
1218 ],
1219 [
1220 CPPFLAGS="$OLD_CPPFLAGS"
1221 AC_MSG_RESULT(no)
1222 ])
1223 fi
1224 fi
1225
1226 if test "x$PLATFORM" = "xAIX"; then
1227 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1228 AC_MSG_CHECKING(whether C compiler accepts -maix32)
1229 OLD_CPPFLAGS="$CPPFLAGS"
1230 CPPFLAGS="$CPPFLAGS -maix32"
fecf6a2b 1231 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
1232 [
1233 LDFLAGS="-maix32 $LDFLAGS"
5482ef16
VK
1234 LTINIT_CC="$CC -maix32"
1235 LTINIT_CXX="$CXX -maix32"
1c45282c 1236 OBJECT_MODE=32
cc297a70
VK
1237 AC_MSG_RESULT(yes)
1238 ],
1239 [
1240 CPPFLAGS="$OLD_CPPFLAGS"
1241 AC_MSG_RESULT(no)
1242 ])
1243 else
1244 AC_MSG_CHECKING(whether C compiler accepts -maix64)
1245 OLD_CPPFLAGS="$CPPFLAGS"
1246 CPPFLAGS="$CPPFLAGS -maix64"
fecf6a2b 1247 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
1248 [
1249 LDFLAGS="-maix64 $LDFLAGS"
5482ef16
VK
1250 LTINIT_CC="$CC -maix64"
1251 LTINIT_CXX="$CXX -maix64"
1c45282c 1252 OBJECT_MODE=64
cc297a70
VK
1253 AC_MSG_RESULT(yes)
1254 ],
1255 [
1256 CPPFLAGS="$OLD_CPPFLAGS"
1257 AC_MSG_RESULT(no)
1258 ])
1259 fi
779ce551 1260 fi
d358c73f
VK
1261
1262 if test "x$PLATFORM" = "xSunOS"; then
1263 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1264 AC_MSG_CHECKING(whether C compiler accepts -m32)
1265 OLD_CPPFLAGS="$CPPFLAGS"
1266 CPPFLAGS="$CPPFLAGS -m32"
1267 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1268 [
1269 LDFLAGS="-m32 $LDFLAGS"
e2e3ce85
VK
1270 LTINIT_CC="$CC -m32"
1271 LTINIT_CXX="$CXX -m32"
d358c73f
VK
1272 AC_MSG_RESULT(yes)
1273 ],
1274 [
1275 CPPFLAGS="$OLD_CPPFLAGS"
1276 AC_MSG_RESULT(no)
1277 ])
1278 else
1279 AC_MSG_CHECKING(whether C compiler accepts -m64)
1280 OLD_CPPFLAGS="$CPPFLAGS"
1281 CPPFLAGS="$CPPFLAGS -m64"
1282 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1283 [
1284 LDFLAGS="-m64 $LDFLAGS"
e2e3ce85
VK
1285 LTINIT_CC="$CC -m64"
1286 LTINIT_CXX="$CXX -m64"
d358c73f
VK
1287 AC_MSG_RESULT(yes)
1288 ],
1289 [
1290 CPPFLAGS="$OLD_CPPFLAGS"
1291 AC_MSG_RESULT(no)
1292 ])
1293 fi
1294 fi
779ce551 1295
3ac3594a
VK
1296
1297 if test "x$PLATFORM" = "xLinux"; then
1298 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1299 AC_MSG_CHECKING(whether C compiler accepts -m32)
1300 OLD_CPPFLAGS="$CPPFLAGS"
1301 CPPFLAGS="$CPPFLAGS -m32"
1302 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1303 [
1304 LDFLAGS="-m32 $LDFLAGS"
e2e3ce85
VK
1305 LTINIT_CC="$CC -m32"
1306 LTINIT_CXX="$CXX -m32"
3ac3594a
VK
1307 AC_MSG_RESULT(yes)
1308 ],
1309 [
1310 CPPFLAGS="$OLD_CPPFLAGS"
1311 AC_MSG_RESULT(no)
1312 ])
1313 fi
1314 fi
1315
ce5592b2
VK
1316 if test "x$ENABLE_DEBUG" = "xyes"; then
1317 CPPFLAGS="$CPPFLAGS -ggdb3"
1318 fi
ef0c727b
VK
1319fi
1320
cfd95c74
VK
1321if test "x$CXX" = "xaCC" ; then
1322 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
451b735a
VK
1323 if test "x$HPUX_HPPA" = "xyes"; then
1324 ARCHFLAG="+DA1.1"
1325 else
1326 ARCHFLAG="+DD32"
1327 fi
1328 AC_MSG_CHECKING(whether C compiler accepts $ARCHFLAG)
4d37b0c5 1329 OLD_CPPFLAGS="$CPPFLAGS"
451b735a 1330 CPPFLAGS="$ARCHFLAG $CPPFLAGS"
cfd95c74
VK
1331 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1332 [
451b735a
VK
1333 LDFLAGS="$ARCHFLAG $LDFLAGS"
1334 CCASFLAGS="$ARCHFLAG $CCASFLAGS"
cfd95c74
VK
1335 AC_MSG_RESULT(yes)
1336 ],
1337 [
4d37b0c5
VK
1338 CPPFLAGS="$OLD_CPPFLAGS"
1339 AC_MSG_RESULT(no)
cfd95c74 1340 ])
4d37b0c5 1341 else
451b735a
VK
1342 if test "x$HPUX_HPPA" = "xyes"; then
1343 ARCHFLAG="+DA2.0W"
1344 else
1345 ARCHFLAG="+DD64"
1346 fi
1347 AC_MSG_CHECKING(whether C compiler accepts $ARCHFLAG)
cfd95c74 1348 OLD_CPPFLAGS="$CPPFLAGS"
451b735a 1349 CPPFLAGS="$ARCHFLAG $CPPFLAGS"
cfd95c74
VK
1350 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1351 [
451b735a
VK
1352 LDFLAGS="$ARCHFLAG $LDFLAGS"
1353 CCASFLAGS="$ARCHFLAG $CCASFLAGS"
cfd95c74
VK
1354 AC_MSG_RESULT(yes)
1355 ],
1356 [
1357 CPPFLAGS="$OLD_CPPFLAGS"
1358 AC_MSG_RESULT(no)
1359 ])
4d37b0c5 1360 fi
ef0c727b
VK
1361fi
1362
df9812a9 1363if test "x$CXX" = "xxlC_r" ; then
d1cb61cf 1364 SQLFLAGS="-qnoppline"
9b99f1c0
VK
1365 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1366 AC_MSG_CHECKING(whether C compiler accepts -q32)
1367 OLD_CPPFLAGS="$CPPFLAGS"
1368 CPPFLAGS="-q32 $CPPFLAGS"
1369 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1370 [
1371 LDFLAGS="-q32 $LDFLAGS"
df9812a9 1372 OBJECT_MODE=32
9b99f1c0
VK
1373 AC_MSG_RESULT(yes)
1374 ],
1375 [
1376 CPPFLAGS="$OLD_CPPFLAGS"
1377 AC_MSG_RESULT(no)
1378 ])
1379 else
1380 AC_MSG_CHECKING(whether C compiler accepts -q64)
1381 OLD_CPPFLAGS="$CPPFLAGS"
1382 CPPFLAGS="-q64 $CPPFLAGS"
1383 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1384 [
1385 LDFLAGS="-q64 $LDFLAGS"
df9812a9 1386 OBJECT_MODE=64
9b99f1c0
VK
1387 AC_MSG_RESULT(yes)
1388 ],
1389 [
1390 CPPFLAGS="$OLD_CPPFLAGS"
1391 AC_MSG_RESULT(no)
1392 ])
1393 fi
1394fi
1395
9113e749
VK
1396if test "x$CXX" = "xCC" ; then
1397 SQLFLAGS="-Qn"
1398 CPPFLAGS="$CPPFLAGS -mt"
3bc41d67 1399 CXXFLAGS="$CXXFLAGS -erroff=badargtype2w,wbadinit"
9113e749
VK
1400
1401 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1402 AC_MSG_CHECKING(whether C compiler accepts -m32)
f5e5296e
VK
1403 count=`$CC -flags | grep '^\-m32 ' | wc -l`
1404 if test $count -eq 1; then
1405 AC_MSG_RESULT(yes)
1406 CPPFLAGS="$CPPFLAGS -m32"
1407 LDFLAGS="-m32 $LDFLAGS"
1408 else
1409 AC_MSG_RESULT(no)
1410 fi
9113e749 1411 else
c3900dbb 1412 TEST_XARCH="no"
9113e749 1413 AC_MSG_CHECKING(whether C compiler accepts -m64)
f5e5296e
VK
1414 count=`$CC -flags | grep '^\-m64 ' | wc -l`
1415 if test $count -eq 1; then
1416 AC_MSG_RESULT(yes)
1417 CPPFLAGS="$CPPFLAGS -m64"
1418 LDFLAGS="-m64 $LDFLAGS"
1419 else
1420 AC_MSG_RESULT(no)
1421 TEST_XARCH="yes"
1422 fi
c3900dbb
VK
1423 if test "x$TEST_XARCH" = "xyes"; then
1424 if test "x$CPUTYPE" = "xsparc"; then
1425 ARCH="-xarch=v9"
1426 else
1427 ARCH="-xarch=amd64"
1428 fi
1429 AC_MSG_CHECKING(whether C compiler accepts $ARCH)
1430 OLD_CPPFLAGS="$CPPFLAGS"
1431 CPPFLAGS="$CPPFLAGS $ARCH"
1432 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1433 [
1434 LDFLAGS="$ARCH $LDFLAGS"
1435 AC_MSG_RESULT(yes)
1436 ],
1437 [
1438 CPPFLAGS="$OLD_CPPFLAGS"
1439 AC_MSG_RESULT(no)
1440 ])
1441 fi
9113e749
VK
1442 fi
1443fi
1444
edb018d7
VK
1445
1446#--------------------------------------------------------------------
1447# Initialize libtool
1448#--------------------------------------------------------------------
1449
1450if test "x$STATIC_BUILD" = "xyes"; then
1451 enable_shared=no
1452 enable_static=yes
1453else
1454 enable_shared=yes
e99eba92
VK
1455 if test "x$BUILD_SDK" = "xyes"; then
1456 enable_static=yes
1457 else
1458 enable_static=no
1459 fi
edb018d7 1460fi
1ef5e57a
VK
1461
1462if test "x$LTINIT_CC" != "x"; then
1463 SAVED_CC="$CC"
1464 CC="$LTINIT_CC"
1465fi
1466if test "x$LTINIT_CXX" != "x"; then
1467 SAVED_CXX="$CXX"
1468 CXX="$LTINIT_CXX"
1469fi
1470
ff12e2f1 1471LT_PREREQ([2.2])
1ef5e57a
VK
1472LT_INIT([dlopen])
1473
1474if test "x$SAVED_CC" != "x"; then
1475 CC="$SAVED_CC"
1476fi
1477if test "x$SAVED_CXX" != "x"; then
1478 CXX="$SAVED_CXX"
1479fi
edb018d7
VK
1480
1481
cfd95c74
VK
1482#--------------------------------------------------------------------
1483# Additional include and library directories
1484#--------------------------------------------------------------------
ef0c727b 1485
cfd95c74
VK
1486if test "x$CXX" != "xaCC"; then
1487 if test -d /usr/local/include; then
5482ef16 1488 if test "x$ac_compiler_gnu" = "xyes"; then
cfd95c74
VK
1489 AC_MSG_CHECKING(whether -I/usr/local/include needed)
1490 OLD_CPPFLAGS="$CPPFLAGS"
1491 CPPFLAGS="$CPPFLAGS -Werror -I/usr/local/include"
2adc2d49 1492 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
cfd95c74
VK
1493 [
1494 CPPFLAGS="$OLD_CPPFLAGS -I/usr/local/include"
1495 AC_MSG_RESULT(yes)
1496 ],
1497 [
1498 CPPFLAGS="$OLD_CPPFLAGS"
1499 AC_MSG_RESULT(no)
1500 ]
1501 )
1502 else
1503 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
1504 fi
1505 fi
1506
1507 if test -d /usr/kerberos/include; then
1508 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1509 fi
ef0c727b 1510
cfd95c74
VK
1511 if test -d /usr/local/lib; then
1512 LDFLAGS="$LDFLAGS -L/usr/local/lib"
1513 fi
1514fi
ef0c727b 1515
de4c0511
VK
1516
1517#--------------------------------------------------------------------
1518# Check for additional system libraries
1519#--------------------------------------------------------------------
1520
1521AC_CHECK_LIB(xnet, accept)
1522AC_CHECK_LIB(socket, if_nameindex)
1523AC_CHECK_LIB(dl, dlopen)
1524AC_CHECK_LIB(kstat, kstat_open)
1525
1526# sockets/resolver
1527if test "$BUILD_SERVER-$XMPP_SUPPORT" = "yes-yes"; then
1528 AC_CHECK_HEADERS([arpa/nameser_compat.h])
1529 AC_CHECK_FUNC(res_query, , [AC_CHECK_LIB(resolv, res_query, [], [AC_CHECK_LIB(resolv, __res_query)])])
1530fi
1531AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
1532AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
1533AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
1534
1535if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
1536 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
1537fi
1538
1539if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
1540 AC_MSG_CHECKING([if we can include libnsl + libsocket])
1541 LIBS="-lnsl -lsocket $LIBS"
1542 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
1543 if test "$my_ac_link_result" = "no" ; then
1544 AC_MSG_RESULT([failure])
1545 AC_MSG_ERROR([unable to use gethostbyname()])
1546 else
1547 AC_MSG_RESULT([success])
1548 fi
1549fi
1550
1551
ef0c727b
VK
1552#--------------------------------------------------------------------
1553# Check for threads library - either POSIX or GNU
1554#--------------------------------------------------------------------
1555
1556if test "x$USE_PTH" = "xyes"; then
1557 AC_CHECK_HEADER(pth.h,,AC_MSG_ERROR([*** GNU Pth thread support not installed - please install first ***]))
ef8a3c32
VK
1558 CPPFLAGS="$CPPFLAGS -D_USE_GNU_PTH"
1559 LIBS="$LIBS -lpth"
ef0c727b
VK
1560else
1561 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
1562
1563 if test "x$CXX" = "xaCC"; then
1564 PTHREAD_LIBS=""
1565 else
1566 PTHREAD_LIBS="error"
1567 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
1568 AC_EGREP_CPP(yes,
1569 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
1570 yes
1571 #endif
c4952327
VK
1572 ], [
1573 AC_MSG_RESULT(yes)
1574 PTHREAD_LIBS="-pthread"
1575 if test "x$CXX" = "xc++"; then
1576 # Quash clang's "-pthread unused during compilation" warnings
1577 PTHREAD_LDFLAGS="-Wc,-Qunused-arguments"
1578 fi
1579 ],
ef0c727b
VK
1580 AC_MSG_RESULT(no))
1581 if test "x$PTHREAD_LIBS" = "xerror"; then
1582 AC_CHECK_LIB(pthread, pthread_attr_init,
1583 PTHREAD_LIBS="-lpthread")
1584 fi
f725c1b7 1585 # On HP-UX (at least 11.00) pthread library contains
b041c587 1586 # __pthread_attr_init_system instead of pthread_attr_init
f725c1b7 1587 if test "x$PTHREAD_LIBS" = "xerror"; then
b041c587 1588 AC_CHECK_LIB(pthread, __pthread_attr_init_system,
f725c1b7
VK
1589 PTHREAD_LIBS="-lpthread")
1590 fi
ef0c727b
VK
1591 if test "x$PTHREAD_LIBS" = "xerror"; then
1592 AC_CHECK_LIB(pthreads, pthread_attr_init,
1593 PTHREAD_LIBS="-lpthreads")
1594 fi
1595 if test "x$PTHREAD_LIBS" = "xerror"; then
1596 AC_CHECK_FUNC(pthread_attr_init,
1597 PTHREAD_LIBS="")
1598 fi
1599 fi
1600
1601 if test "x$PTHREAD_LIBS" = "xerror"; then
1602 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
1603 fi
8d131dda 1604 LIBS="$LIBS $PTHREAD_LIBS"
ef0c727b
VK
1605
1606 # Extensions to posix threads
1607 AC_CHECK_HEADERS([pthread_np.h],,,[
9c29f76e 1608#include <pthread.h>
ef0c727b
VK
1609 ])
1610 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
1611
1612 # Check for recursive mutexes
39086394
VK
1613 AC_CHECK_FUNCS([pthread_mutexattr_settype __pthread_mutexattr_settype pthread_mutexattr_setkind_np])
1614 AC_CHECK_DECLS([pthread_mutexattr_settype, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
9c29f76e
VK
1615#include <pthread.h>
1616#if HAVE_PTHREAD_NP_H
1617#include <pthread_np.h>
1618#endif
ef0c727b
VK
1619 ])
1620
1621 # Check for read/write locks
1622 # On Linux, rwlock functions declared always, but pthread_rwlock_t may need
1623 # additional defines
1624 AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
1625 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
1626 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
afd0c386
VK
1627 [AC_COMPILE_IFELSE([
1628 AC_LANG_PROGRAM([
9c29f76e
VK
1629#include <sys/types.h>
1630#include <pthread.h>
afd0c386
VK
1631 ],
1632 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b 1633 ac_cv_struct_pthread_rw=yes, [
afd0c386
VK
1634 AC_COMPILE_IFELSE([
1635 AC_LANG_PROGRAM([
9c29f76e
VK
1636#define _XOPEN_SOURCE 500
1637#include <sys/types.h>
1638#include <pthread.h>
afd0c386
VK
1639 ],
1640 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b
VK
1641 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
1642 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1643 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
1644 fi
1645 ])])
1646 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1647 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
1648 fi
1649 fi
1650
1651fi
1652
1653
1654#--------------------------------------------------------------------
9c3bf7f4 1655# Checks for OpenSSL/CommonCrypto
ef0c727b
VK
1656#--------------------------------------------------------------------
1657
1658if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
9c3bf7f4
VK
1659 USE_COMMONCRYPTO="no"
1660 if test "x$PLATFORM" = "xDarwin" -a "x$DISABLE_COMMONCRYPTO" != "xyes"; then
1661 AC_CHECK_FUNC(CC_MD5_Init, [
1662 AC_DEFINE(WITH_COMMONCRYPTO, 1, Define to 1 if you have CommonCrypto library and headers)
1663 USE_COMMONCRYPTO="yes"
1664 WITH_ENCRYPTION="yes"
ef0c727b 1665 ])
9c3bf7f4
VK
1666 fi
1667 if test "x$USE_COMMONCRYPTO" != "xyes"; then
1668 AC_CHECK_LIB($OPENSSL_LIBCRYPTO, RSA_new,
1669 [
1670 AC_DEFINE(WITH_OPENSSL, 1, Define to 1 if you have OpenSSL library and headers)
1671 AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_aes_256_cbc,
1672 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
1673 AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_bf_cbc,
1674 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
1675 AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_idea_cbc,
1676 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
1677 AC_CHECK_LIB($OPENSSL_LIBCRYPTO, EVP_des_ede3_cbc,
1678 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
1679 if test "x$HAVE_LIBCRYPTO" = "xyes"; then
1680 WITH_ENCRYPTION="yes"
1681 LIBS="$LIBS -l$OPENSSL_LIBSSL -l$OPENSSL_LIBCRYPTO"
1682 else
1683 AC_MSG_ERROR(lib$OPENSSL_LIBCRYPTO does not provide any suitable encryption algorithm)
1684 fi
1a448476
VK
1685
1686 AC_CHECK_FUNCS([X509_STORE_set_verify_cb])
9c3bf7f4
VK
1687 ],
1688 [
1689 AC_MSG_ERROR(lib$OPENSSL_LIBCRYPTO is required for encryption support)
1690 ])
1691 fi
ef0c727b
VK
1692fi
1693
1694
1695#--------------------------------------------------------------------
0322eed7
VK
1696# Checks for header files
1697#--------------------------------------------------------------------
1698
8d4bb054 1699AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h])
2e98cdb4 1700AC_CHECK_HEADERS([sys/int_types.h time.h sys/time.h sys/utsname.h sys/wait.h])
e9c8eb1d 1701AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h netinet/tcp.h net/nh.h sys/socket.h])
0322eed7
VK
1702AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
1703AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
c1099678 1704AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h locale.h])
df9812a9 1705AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h])
7b45b90d 1706AC_CHECK_HEADERS([grp.h pwd.h malloc.h stdbool.h utime.h])
f09c2d05 1707AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
0322eed7
VK
1708[[#ifdef HAVE_SYS_TYPES_H
1709# include <sys/types.h>
1710#endif
1711#ifdef HAVE_SYS_TIME_H
1712# include <sys/time.h>
1713#endif
1714#ifdef HAVE_SYS_SOCKET_H
1715# include <sys/socket.h>
1716#endif
1717]])
1718
1719
1720#--------------------------------------------------------------------
1217cb75
VK
1721# Checks for __get_cpuid
1722#--------------------------------------------------------------------
1723
1724AC_CHECK_HEADERS([cpuid.h])
1725AC_MSG_CHECKING(for __get_cpuid)
1726AC_LANG_PUSH([C++])
1727AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1728#if HAVE_CPUID_H
1729#include <cpuid.h>
1730#endif
1731]],[[
1732 unsigned int eax, ebx, ecx, edx;
1733 return __get_cpuid(0x01, &eax, &ebx, &ecx, &edx);
1734]])
1735],[
1736 AC_MSG_RESULT(yes)
1737 AC_DEFINE(HAVE_GET_CPUID,1,Define to 1 if __get_cpuid function is available)
1738],[
1739 AC_MSG_RESULT(no)
1740 AC_DEFINE(HAVE_GET_CPUID,0,Define to 1 if __get_cpuid function is available)
1741])
1742AC_LANG_POP([C++])
1743
1744
1745#--------------------------------------------------------------------
8d4bb054
VK
1746# Checks for alloca
1747#--------------------------------------------------------------------
1748
1749AC_CHECK_HEADERS([alloca.h])
1750AC_MSG_CHECKING(for alloca)
1751AC_LANG_PUSH([C++])
1752AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1753#if HAVE_STDLIB_H
1754#include <stdlib.h>
1755#endif
1756#if HAVE_MALLOC_H
1757#include <malloc.h>
1758#endif
1759#if HAVE_ALLOCA_H
1760#include <alloca.h>
1761#endif
1762]],[[
1763 char *p = (char *)alloca(256);
1764 return (p != NULL) ? 0 : 1;
1765]])
1766],[
1767 AC_MSG_RESULT(yes)
1768 AC_DEFINE(HAVE_ALLOCA,1,Define to 1 if alloca function is available)
1769],[
1770 AC_MSG_RESULT(no)
1771 AC_DEFINE(HAVE_ALLOCA,0,Define to 1 if alloca function is available)
1772])
1773AC_LANG_POP([C++])
1774
1775
1776#--------------------------------------------------------------------
5f77533a
VK
1777# Checks for d_type in struct dirent
1778#--------------------------------------------------------------------
1779
1780AC_MSG_CHECKING(for d_type in struct dirent)
1781AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1782#if HAVE_STDLIB_H
1783#include <stdlib.h>
1784#endif
1785#if HAVE_DIRENT_H
1786#include <dirent.h>
1787#endif
1788]],[[
1789 struct dirent d;
1790 return d.d_type;
1791]])
1792],[
1793 AC_MSG_RESULT(yes)
1794 AC_DEFINE(HAVE_DIRENT_D_TYPE,1,Define to 1 if struct dirent has member d_type)
1795],[
1796 AC_MSG_RESULT(no)
1797 AC_DEFINE(HAVE_DIRENT_D_TYPE,0,Define to 1 if struct dirent has member d_type)
1798])
1799AC_CHECK_DECLS([DT_DIR, DT_REG, DT_UNKNOWN],,,[
1800#if HAVE_DIRENT_H
1801#include <dirent.h>
1802#endif
1803])
1804
1805
1806#--------------------------------------------------------------------
b8adb0f2
VK
1807# Checks for IPv6 support
1808#--------------------------------------------------------------------
1809
1810if test "x$DISABLE_IPV6" != "xyes"; then
1811 AC_CHECK_DECL(AF_INET6,,,[
1812#if HAVE_NETINET_IN_H
1813#include <netinet/in.h>
1814#endif
1815 ])
1816 if test "x$ac_cv_have_decl_AF_INET6" = "xyes"; then
1817 AC_CHECK_TYPE(struct sockaddr_in6, [
1818 AC_DEFINE(WITH_IPV6, 1, Define to have IPv6 support)
1819 IPV6_SUPPORT="yes"
1820 ],,[
1821#if HAVE_NETINET_IN_H
1822#include <netinet/in.h>
1823#endif
1824 ])
1825 fi
1826fi
1827
257a4037
VK
1828
1829#--------------------------------------------------------------------
1830# Checks for RADIUS client library
1831#--------------------------------------------------------------------
1832
1833if test "x$BUILD_SERVER" = "xyes" ; then
1834 AC_CHECK_HEADERS([radcli/radcli.h])
1835 if test "x$ac_cv_header_radcli_radcli_h" = "xyes"; then
1836 AC_CHECK_LIB(radcli, rc_auth, [
1837 SERVER_LIBS="$SERVER_LIBS -lradcli"
1838 AC_DEFINE(USE_RADCLI, 1, Define to 1 if radcli is used as RADIUS client)
1839 ])
1840 fi
1841fi
1842
1843
b8adb0f2 1844#--------------------------------------------------------------------
ef0c727b
VK
1845# Checks for other libs.
1846#--------------------------------------------------------------------
d16cf8a5 1847
e0760102 1848if test "x$BUILD_SERVER" = "xyes" ; then
7c48e2aa 1849 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"]))])
65834be3
VK
1850 if test "x$DISABLE_READLINE" = "xno"; then
1851 AC_CHECK_LIB(readline, readline, [SERVER_LIBS="$SERVER_LIBS -lreadline"], [AC_CHECK_LIB(edit, readline, [SERVER_LIBS="$SERVER_LIBS -ledit"])])
7c48e2aa 1852
0a70c186
VK
1853 SAVED_LIBS="$LIBS"
1854 LIBS="$LIBS $SERVER_LIBS"
0322eed7 1855
0a70c186 1856 AC_CHECK_FUNCS([readline])
0322eed7 1857
0a70c186
VK
1858 # Check if passing rl_insert to rl_bind_key needs cast
1859 if test "$ac_cv_func_readline" = "yes"; then
1860 AC_LANG_PUSH([C++])
1861
1862 AC_MSG_CHECKING(for rl_insert cast)
0322eed7 1863
afd0c386 1864 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1865 [
1866#include <stdio.h>
1867#include <readline/readline.h>
0a70c186 1868 ],[ rl_bind_key('\t', (Function *)rl_insert); ])],
0322eed7 1869 [
0a70c186
VK
1870 AC_MSG_RESULT((Function *))
1871 AC_DEFINE(RL_INSERT_CAST,(Function *),Required cast for rl_insert)
1872 ],[
1873 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1874 [
1875#include <stdio.h>
1876#include <readline/readline.h>
1877 ],[ rl_bind_key('\t', (rl_command_func_t *)rl_insert); ])],
1878 [
1879 AC_MSG_RESULT((rl_command_func_t *))
1880 AC_DEFINE(RL_INSERT_CAST,(rl_command_func_t *),Required cast for rl_insert)
1881 ],[
1882 AC_MSG_RESULT(not needed)
1883 AC_DEFINE(RL_INSERT_CAST,,Required cast for rl_insert)
1884 ]
1885 )
0322eed7
VK
1886 ]
1887 )
0322eed7 1888
0a70c186
VK
1889 AC_LANG_POP([C++])
1890 fi
1891 LIBS="$SAVED_LIBS"
0322eed7 1892 fi
e0760102
VK
1893fi
1894
3d2bc3ae
VK
1895check_substr "$COMPONENTS" "sqlite"
1896if test $? = 0; then
1897 if test "x$FORCE_INTERNAL_SQLITE" = "xyes"; then
1898 HAVE_SQLITE=no
1899 else
1900 OLD_LIBS="$LIBS"
1901 HAVE_SQLITE=yes
1902 AC_CHECK_HEADER(sqlite3.h,,HAVE_SQLITE=no)
1903 if test "x$HAVE_SQLITE" = "xyes"; then
1904 AC_CHECK_LIB(sqlite3, sqlite3_initialize, [], [ HAVE_SQLITE=no ])
1905 fi
1906 if test "x$HAVE_SQLITE" = "xyes"; then
b536ca1b
VK
1907 if test "x$cross_compiling" = "xyes"; then
1908 AC_MSG_WARN([Cross-compiling mode is active, assuming libsqlite3 is thread-safe])
1909 else
1910 AC_MSG_CHECKING(if libsqlite3 is thread-safe)
1911 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
1912#include <sqlite3.h>
1913 ]],[[
1914 return sqlite3_threadsafe() ? 0 : 1;
1915 ]])
1916 ],[
1917 AC_MSG_RESULT(yes)
1918 ],[
1919 AC_MSG_RESULT(no)
1920 HAVE_SQLITE=no
1921 ])
1922 fi
3d2bc3ae
VK
1923 fi
1924 LIBS="$OLD_LIBS"
1925 fi
1926 if test "x$HAVE_SQLITE" = "xno"; then
1927 MODULES="sqlite $MODULES"
1928 fi
1929fi
1930
f1b8f11c
VK
1931if test "x$FORCE_INTERNAL_ZLIB" = "xyes"; then
1932 HAVE_ZLIB=no
1933else
1934 HAVE_ZLIB=yes
1935 AC_CHECK_HEADER(zlib.h,,HAVE_ZLIB=no)
1936 if test "x$HAVE_ZLIB" = "xyes"; then
1937 AC_CHECK_LIB(z, deflate, [], [ HAVE_ZLIB=no ])
1fd41bcd 1938 fi
ef0c727b 1939fi
f1b8f11c
VK
1940if test "x$HAVE_ZLIB" = "xno"; then
1941 MODULES="zlib $MODULES"
1942fi
ef0c727b 1943
467c489f
VK
1944if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
1945 HAVE_LIBEXPAT=no
1946else
1947 HAVE_LIBEXPAT=yes
1948 AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
1949 AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
1950fi
80ce37ac
VK
1951if test "x$HAVE_LIBEXPAT" = "xno"; then
1952 MODULES="libexpat $MODULES"
1bb6b449 1953fi
ef0c727b 1954
17b35ccc
VK
1955if test "x$FORCE_INTERNAL_LIBTRE" = "xyes"; then
1956 HAVE_LIBTRE=no
1957else
1958 HAVE_LIBTRE=yes
1959 AC_CHECK_HEADER(tre/regex.h,,HAVE_LIBTRE=no)
1960 AC_CHECK_LIB(tre, tre_compile, [], [ HAVE_LIBTRE=no ])
1961fi
1962if test "x$HAVE_LIBTRE" = "xno"; then
1963 MODULES="libtre $MODULES"
1964 AC_DEFINE(USE_BUNDLED_LIBTRE,1,Define to 1 if bundled libtre is used)
a67fa146 1965
720c23d0
VK
1966 tre_version_1='0'
1967 tre_version_2='8'
1968 tre_version_3='0'
a67fa146
VK
1969 tre_version=$tre_version_1.$tre_version_2.$tre_version_3
1970 AC_DEFINE_UNQUOTED(TRE_VERSION, "$tre_version", [ TRE version string. ])
1971 AC_DEFINE_UNQUOTED(TRE_VERSION_1, $tre_version_1, [ TRE version level 1. ])
1972 AC_DEFINE_UNQUOTED(TRE_VERSION_2, $tre_version_2, [ TRE version level 2. ])
1973 AC_DEFINE_UNQUOTED(TRE_VERSION_3, $tre_version_3, [ TRE version level 3. ])
1974 AC_SUBST(TRE_VERSION, $tre_version)
1975
1976 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])
1977 AC_DEFINE(TRE_APPROX, 1, [ Define if you want to enable approximate matching functionality. ])
17b35ccc 1978fi
ef0c727b 1979
f5393033
VK
1980if test "x$FORCE_INTERNAL_JANSSON" = "xyes"; then
1981 HAVE_JANSSON=no
1982else
1983 HAVE_JANSSON=yes
1984 AC_CHECK_HEADER(jansson.h,,HAVE_JANSSON=no)
1985 AC_CHECK_LIB(jansson, json_object, [ HAVE_JANSSON=yes ], [ HAVE_JANSSON=no ])
1986fi
1987if test "x$HAVE_JANSSON" = "xno"; then
1988 MODULES="jansson $MODULES"
1989fi
1990
4050bafb
VK
1991if test "x$DISABLE_LMSENSORS" = "xno"; then
1992 HAVE_LMSENSORS=yes
1993 AC_CHECK_HEADER(sensors/sensors.h,,HAVE_LMSENSORS=no)
1994 if test "x$HAVE_LMSENSORS" = "xyes"; then
1995 AC_CHECK_LIB(sensors, sensors_init, [ DUMMY="" ], [ HAVE_LMSENSORS=no ])
1996 fi
1997 if test "x$HAVE_LMSENSORS" = "xyes"; then
1998 SUBAGENT_DIRS="$SUBAGENT_DIRS lmsensors"
1999 fi
38bfa5da
AK
2000fi
2001
e6316fe0
VK
2002if test "x$DISABLE_CURL" = "xno"; then
2003 AC_CHECK_HEADER(curl/curl.h,HAVE_LIBCURL=yes,HAVE_LIBCURL=no)
2004 if test "x$HAVE_LIBCURL" = "xyes"; then
2005 AC_CHECK_LIB(curl, curl_global_init, [ HAVE_LIBCURL=yes ], [ HAVE_LIBCURL=no ])
2006 AC_CHECK_DECLS([CURLOPT_NOSIGNAL, curl_version_info],,,[
2368dc85
VK
2007#ifdef HAVE_CURL_CURL_H
2008#include <curl/curl.h>
2009#endif
e6316fe0
VK
2010 ])
2011 fi
d9177dd1 2012
e6316fe0 2013 if test "x$HAVE_LIBCURL" != "xyes"; then
67fc78d2 2014 AC_MSG_ERROR(libcurl is required. Check that it is installed or use --without-curl option)
e6316fe0
VK
2015 fi
2016
2017 SUBAGENT_DIRS="$SUBAGENT_DIRS netsvc"
2018 SMSDRV_DIRS="$SMSDRV_DIRS anysms kannel mymobile nexmo slack smseagle text2reach websms"
2019 HDLINK_DIRS="$HDLINK_DIRS jira redmine"
2020 AC_DEFINE(HAVE_LIBCURL, 1, Define to 1 if libcurl is available)
0a4194c2
AK
2021fi
2022
f32b0155
VK
2023if test "x$DISABLE_SSH" != "xyes"; then
2024 AC_CHECK_HEADER(libssh/libssh.h,HAVE_LIBSSH=yes,HAVE_LIBSSH=no)
2025 if test "x$HAVE_LIBSSH" = "xyes"; then
e9a40aa1 2026 AC_CHECK_LIB(ssh, ssh_version, [ HAVE_LIBSSH=yes ], [ HAVE_LIBSSH=no ])
f32b0155 2027 fi
12acf3d3 2028
f32b0155
VK
2029 if test "x$HAVE_LIBSSH" = "xyes"; then
2030 SUBAGENT_DIRS="$SUBAGENT_DIRS ssh"
2031 AC_DEFINE(HAVE_LIBSSH, 1, Define to 1 if libssh is available)
2032 else
2033 AC_MSG_ERROR(libssh is required for SSH support. Check that it is installed or use --disable-ssh option)
2034 fi
2035else
2036 HAVE_LIBSSH=no
12acf3d3
VK
2037fi
2038
2cfe4482
VK
2039if test "x$LDAP_SUPPORT" = "xyes"; then
2040 AC_CHECK_HEADER(ldap.h,HAVE_LDAP=yes,HAVE_LDAP=no)
2041 if test "x$HAVE_LDAP" = "xyes"; then
2042 AC_CHECK_LIB(ldap, ldap_init, [ HAVE_LDAP=yes ], [ HAVE_LDAP=no ])
e8ef7fe1 2043 if test "x$HAVE_LDAP" = "xyes"; then
a0008bce 2044 AC_CHECK_LIB(lber, ber_init, [ SERVER_LIBS="-llber $SERVER_LIBS" ])
e8ef7fe1 2045 fi
2cfe4482 2046 fi
d9177dd1 2047 if test "x$HAVE_LDAP" = "xyes"; then
2048 SERVER_LIBS="-lldap $SERVER_LIBS"
2cfe4482 2049 AC_DEFINE(WITH_LDAP, 1, Define to 1 if you have LDAP libraries and headers)
d95c3dad
A
2050 AC_CHECK_HEADERS([ldap_ssl.h],,,
2051 [
2052#include <ldap.h>
a164b767 2053 ])
d95c3dad
A
2054 AC_CHECK_TYPES([ber_int_t],,,
2055 [
2056#include <ldap.h>
2057#if HAVE_LDAP_SSL_H
2058#include <ldap_ssl.h>
2059#endif
daa828ee 2060 ])
d95c3dad
A
2061
2062 OLD_LIBS="$LIBS"
2063 LIBS="$LIBS -lldap"
2064 AC_CHECK_FUNCS([ldap_initialize ldapssl_init])
2065 AC_CHECK_FUNCS([ldap_control_create ldap_create_control nsldapi_build_control])
2066 AC_CHECK_FUNCS([ldap_create_page_control ldap_parse_page_control])
2067 LIBS="$OLD_LIBS"
2068
2069 AC_CHECK_DECLS([nsldapi_build_control],,,
2070 [
2071#include <ldap.h>
2072#if HAVE_LDAP_SSL_H
2073#include <ldap_ssl.h>
2074#endif
b00236dd 2075 ])
d9177dd1 2076 fi
2cfe4482 2077 LDAP_SUPPORT="$HAVE_LDAP"
d9177dd1 2078fi
2079
ef0c727b
VK
2080#--------------------------------------------------------------------
2081# Checks for data types
2082#--------------------------------------------------------------------
2083
d16cf8a5
AK
2084AC_CHECK_SIZEOF(short)
2085AC_CHECK_SIZEOF(int)
2086AC_CHECK_SIZEOF(long)
2087AC_CHECK_SIZEOF(long long)
2088
2089AC_TYPE_PID_T
d16cf8a5
AK
2090AC_TYPE_SIZE_T
2091AC_STRUCT_TIMEZONE
2092
5456cd6d
VK
2093AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t, bool],,,[
2094#ifdef HAVE_STDBOOL_H
2095#include <stdbool.h>
2096#endif
2097#ifdef HAVE_STDINT_H
2098#include <stdint.h>
2099#endif
2100])
51128b42 2101AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
4c779d83
VK
2102#if HAVE_SYS_TYPES_H
2103#include <sys/types.h>
2104#endif
2105#if HAVE_SYS_SOCKET_H
2106#include <sys/socket.h>
2107#endif
2108])
e0293f7f
VK
2109AC_CHECK_TYPES([struct stat64],,,[
2110#if HAVE_SYS_STAT_H
2111#include <sys/stat.h>
2112#endif
2113])
521d90e7 2114
e25cadc9 2115
ef0c727b
VK
2116#--------------------------------------------------------------------
2117# Checks for functions
2118#--------------------------------------------------------------------
d16cf8a5
AK
2119
2120AC_FUNC_ERROR_AT_LINE
d16cf8a5 2121AC_FUNC_MEMCMP
d16cf8a5
AK
2122AC_FUNC_SELECT_ARGTYPES
2123AC_FUNC_STRFTIME
2124AC_FUNC_STRTOD
2125AC_FUNC_VPRINTF
2126
80ce37ac 2127AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
fdb710a7 2128AC_CHECK_FUNCS([strrchr strlwr strtok_r strtol strtoul strtoll strtoull setlocale])
3b3ee220 2129AC_CHECK_FUNCS([tolower if_nametoindex daemon mmap strerror_r scandir uname poll])
c601fc15 2130AC_CHECK_FUNCS([usleep nanosleep gmtime_r localtime_r stat64 fstat64 lstat64])
840e065a 2131AC_CHECK_FUNCS([fopen64 strptime timegm gethostbyname2_r getaddrinfo rand_r])
7b45b90d 2132AC_CHECK_FUNCS([itoa _itoa isatty getgrnam getpwnam malloc_info malloc_trim utime])
aa24418a 2133
9757ca46 2134AC_CHECK_DECLS([nanosleep, daemon, strerror])
be6467e9 2135
6f95ef89
VK
2136# Do not use inet_pton on Solaris as it has binary compatibility problems
2137if test "$PLATFORM" != "SunOS"; then
2138 AC_CHECK_FUNCS([inet_pton])
2139fi
2140
b0823d06
VK
2141# Check if strerror_r is POSIX-compliant
2142if test "$ac_cv_func_strerror_r" = "yes"; then
2143 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
2144 AC_LANG_PUSH([C++])
2145 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7f9423af
VK
2146#if HAVE_STRING_H
2147#include <string.h>
2148#endif
2149#if HAVE_ERRNO_H
2150#include <errno.h>
2151#endif
b0823d06 2152 ]],[[
7f9423af
VK
2153 int e;
2154 char buffer[256];
2155 e = strerror_r(1, buffer, 256);
2156 return e;
b0823d06
VK
2157 ]])
2158 ],[
2159 AC_MSG_RESULT(yes)
2160 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
2161 ],[
2162 AC_MSG_RESULT(no)
2163 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
2164 ])
2165 AC_LANG_POP([C++])
2166fi
2167
be6467e9
VK
2168# Check if struct tm has tm_gmtoff member
2169AC_MSG_CHECKING(for struct tm.tm_gmtoff)
2170AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2171#if HAVE_TIME_H
2172#include <time.h>
2173#endif
2174#if HAVE_SYS_TIME_H
2175#include <sys/time.h>
2176#endif
2177]],[[
be6467e9
VK
2178 struct tm t;
2179 return t.tm_gmtoff;
be6467e9
VK
2180]])
2181],[
2182AC_MSG_RESULT(yes)
2183AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
2184],[
2185AC_MSG_RESULT(no)
2186])
d16cf8a5 2187
f91feddc 2188AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
70fed300
AK
2189AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
2190
c6491611
VK
2191# asprintf, scprintf, etc.
2192AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
2193AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
342a701d 2194AC_CHECK_FUNCS([snprintf vsnprintf])
c6491611
VK
2195
2196AC_MSG_CHECKING(whether snprintf returns required buffer size)
2197AC_RUN_IFELSE(
2198 [AC_LANG_PROGRAM([
2199#include <stdio.h>
2200#include <string.h>
2201 ], [
2202 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
2203 ])
2204 ],
2205 [ AC_MSG_RESULT(yes)
2206 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
2207 ],
2208 [ AC_MSG_RESULT(no) ],
2209 [ AC_MSG_RESULT(no) ]
2210)
2211
2f64a076
VK
2212AC_MSG_CHECKING(whether free correctly handles NULL pointer)
2213AC_RUN_IFELSE(
2214 [AC_LANG_PROGRAM([
2215#include <stdlib.h>
2216 ], [
2217 free(NULL);
2218 return 0;
2219 ])
2220 ],
2221 [ AC_MSG_RESULT(yes)
2222 AC_DEFINE(FREE_IS_NULL_SAFE, 1, Define to 1 if free corectly handles NULL pointer)
2223 ],
2224 [ AC_MSG_RESULT(no) ],
2225 [ AC_MSG_RESULT(no) ]
2226)
2227
c6491611 2228
ef0c727b
VK
2229#--------------------------------------------------------------------
2230# Checks for macros and definitions
2231#--------------------------------------------------------------------
dff54fed 2232
c62d158b 2233AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64, htonll, ntohll],,,[
ef0c727b 2234#ifdef HAVE_SYS_TYPES_H
99e50bb7 2235#include <sys/types.h>
ef0c727b
VK
2236#endif
2237#if HAVE_BYTESWAP_H
2238#include <byteswap.h>
2239#endif
2240#if HAVE_NETINET_IN_H
2241#include <netinet/in.h>
2242#endif
2243#if HAVE_NET_NH_H
2244#include <net/nh.h>
2245#endif
2246])
aa24418a
VK
2247AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
2248#ifdef HAVE_UNISTD_H
2249#include <unistd.h>
2250#endif
2251#ifdef HAVE_DLFCN_H
2252#include <dlfcn.h>
2253#endif
2254])
ce7565e7
VK
2255AC_CHECK_DECLS([va_copy, __va_copy],,,[
2256#ifdef HAVE_UNISTD_H
2257#include <unistd.h>
2258#endif
2259#ifdef HAVE_STDARG_H
2260#include <stdarg.h>
2261#endif
2262#ifdef HAVE_STDLIB_H
2263#include <stdlib.h>
2264#endif
2265])
dff54fed 2266
dff54fed 2267
ef0c727b 2268#--------------------------------------------------------------------
df9812a9
VK
2269# getopt
2270#--------------------------------------------------------------------
2271
2272if test "x$FORCE_INTERNAL_GETOPT" = "xyes"; then
2273 AC_DEFINE([USE_BUNDLED_GETOPT], [1], [Define to 1 if bundled getopt must be used])
2274else
2275 AC_CHECK_HEADERS([getopt.h])
2276 AC_CHECK_LIB(gnugetopt, getopt_long)
2277 AC_CHECK_DECLS([getopt_long],,,[
2278#if HAVE_GETOPT_H
2279#include <getopt.h>
2280#endif
2281 ])
2282fi
2283
2284
2285#--------------------------------------------------------------------
671651a1
VK
2286# Linux specific checks
2287#--------------------------------------------------------------------
2288
2289if test "x$PLATFORM" = "xLinux"; then
2290 AC_CHECK_HEADERS([sys/reboot.h],,,[[ ]])
2291 AC_CHECK_DECLS([reboot, RB_AUTOBOOT, RB_POWER_OFF, RB_HALT_SYSTEM],,,[
2292#if HAVE_SYS_REBOOT_H
2293#include <sys/reboot.h>
2294#endif
2295 ])
2296 AC_CHECK_FUNCS([reboot],,,[
2297#if HAVE_SYS_REBOOT_H
2298#include <sys/reboot.h>
2299#endif
2300 ])
f92a016a
VK
2301
2302 AC_CHECK_HEADERS([jemalloc/jemalloc.h],
2303 [
2304 AC_CHECK_LIB(jemalloc, malloc,
2305 [
2306 WITH_JEMALLOC="yes"
2307 AC_DEFINE(WITH_JEMALLOC,1,Define to 1 if libjemalloc is used)
2308 ])
2309 ])
671651a1
VK
2310fi
2311
2312
2313#--------------------------------------------------------------------
ef0c727b
VK
2314# AIX specific checks
2315#--------------------------------------------------------------------
d16cf8a5 2316
ef0c727b
VK
2317if test "x$PLATFORM" = "xAIX"; then
2318 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
efdaffe4 2319 AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64, __sync_add_and_fetch, __sync_sub_and_fetch],,,[
df9812a9
VK
2320#if HAVE_PROCINFO_H
2321#include <procinfo.h>
2322#endif
2323 ])
ef0c727b
VK
2324 AC_CHECK_FUNCS([getprocs64],,,[
2325#if HAVE_PROCINFO_H
2326#include <procinfo.h>
6cd41ceb 2327#endif
ef0c727b 2328 ])
7e56bf2e
VK
2329fi
2330
cd4c8ca3 2331
ef0c727b 2332#--------------------------------------------------------------------
f47bd4ca
VK
2333# Solaris specific checks
2334#--------------------------------------------------------------------
2335
2336if test "x$PLATFORM" = "xSunOS"; then
2337 AC_CHECK_FUNCS([atomic_inc_32_nv atomic_dec_32_nv],,,[
2338#include <sys/atomic.h>
2339 ])
2340fi
2341
2342
2343#--------------------------------------------------------------------
ba8db57b
VK
2344# HP-UX specific checks
2345#--------------------------------------------------------------------
2346
2347if test "x$PLATFORM" = "xHP-UX"; then
3268bb77 2348 AC_CHECK_HEADERS([atomic.h sys/mib.h],,,[[ ]])
f09c2d05
VK
2349 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
2350#if HAVE_NET_IF_H
2351#include <net/if.h>
2352#endif
2353 ])
2354 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
2355#if HAVE_SYS_MIB_H
2356#include <sys/mib.h>
2357#endif
2358 ])
cfd95c74
VK
2359
2360 AC_MSG_CHECKING(if pst_diskinfo has read/write stats fields)
2361 AC_LANG_PUSH([C++])
2362 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2363#include <sys/pstat.h>
2364 ]], [[
2365pst_diskinfo d;
2366int x;
2367x = (int)d.psd_dkread;
2368x = (int)d.psd_dkwrite;
2369 ]])],
2370 [
2371 AC_DEFINE([HAVE_DISKINFO_RWSTATS],[1],[Define to 1 if pst_diskinfo has read/write stats fields])
2372 AC_MSG_RESULT(yes)
2373 ],
2374 [
2375 AC_MSG_RESULT(no)
2376 ])
2377 AC_LANG_POP([C++])
ba8db57b
VK
2378fi
2379
2380
2381#--------------------------------------------------------------------
aa24418a
VK
2382# *BSD specific checks
2383#--------------------------------------------------------------------
2384
058fbb88 2385AC_CHECK_HEADERS([sys/event.h])
aa24418a 2386AC_CHECK_LIB(kvm, kvm_open)
058fbb88 2387AC_CHECK_FUNCS([kvm_openfiles kvm_getswapinfo kqueue])
aa24418a
VK
2388AC_CHECK_TYPES([struct kinfo_proc2],,,[
2389#if HAVE_SYS_SYSCTL_H
2390#include <sys/sysctl.h>
2391#endif
2392])
2393
2394
28ba6824
VK
2395#--------------------------------------------------------------------
2396# FreeBSD specific checks
2397#--------------------------------------------------------------------
2398
2399if test "x$PLATFORM" = "xFreeBSD"; then
61f58c11
VK
2400 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
2401#if HAVE_SYS_TYPES_H
2402#include <sys/types.h>
2403#endif
2404#if HAVE_SYS_SOCKET_H
2405#include <sys/socket.h>
2406#endif
2407#include <net/route.h>
2408 ])
28ba6824
VK
2409fi
2410
2411
aa24418a 2412#--------------------------------------------------------------------
ea6615cf
VK
2413# OpenBSD specific checks
2414#--------------------------------------------------------------------
2415
2416if test "x$PLATFORM" = "xOpenBSD"; then
abac7ffe 2417 AC_CHECK_DECLS([SIOCGIFDATA],,,[
2418#if HAVE_SYS_SOCKIO_H
2419#include <sys/sockio.h>
2420#endif
2421 ])
ea6615cf
VK
2422 AC_MSG_CHECKING(if kvm_getprocs requires sizeof kinfo_proc argument)
2423 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2424#include <sys/param.h>
2425#include <sys/proc.h>
abac7ffe 2426#include <sys/sysctl.h>
ea6615cf
VK
2427#include <kvm.h>
2428#include <sys/user.h>
2429 ]],[[
2430 int count;
2431 kvm_getprocs(NULL, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
2432 return 0;
2433 ]])
2434 ],[
2435 AC_MSG_RESULT(yes)
2436 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,1,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
2437 ],[
2438 AC_MSG_RESULT(no)
2439 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,0,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
2440 ])
2441
2442 AC_MSG_CHECKING(if struct kinfo_proc has member kp_proc)
2443 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2444#include <sys/param.h>
2445#include <sys/proc.h>
abac7ffe 2446#include <sys/sysctl.h>
ea6615cf
VK
2447#include <kvm.h>
2448#include <sys/user.h>
2449 ]],[[
2450 struct kinfo_proc p;
2451 return p.kp_proc.p_pid;
2452 ]])
2453 ],[
2454 AC_MSG_RESULT(yes)
2455 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,1,Define to 1 if struct kinfo_proc has member kp_proc)
2456 ],[
2457 AC_MSG_RESULT(no)
2458 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,0,Define to 1 if struct kinfo_proc has member kp_proc)
2459 ])
2460fi
2461
2462
2463#--------------------------------------------------------------------
ef8a3c32
VK
2464# Minix specific checks
2465#--------------------------------------------------------------------
2466
2467if test "x$PLATFORM" = "xMinix"; then
2468 AC_CHECK_HEADERS([minix/minlib.h])
2469fi
2470
2471
2472#--------------------------------------------------------------------
ef0c727b
VK
2473# Check for UNICODE stuff
2474#--------------------------------------------------------------------
3e39fcde 2475
25a19da6
VK
2476if test "x$BUILD_UNICODE" = "xyes"; then
2477 CPPFLAGS="$CPPFLAGS -DUNICODE"
2478fi
2479
5a82ecc7 2480AC_CHECK_HEADERS([wchar.h wctype.h iconv.h widec.h])
aa24418a 2481AC_CHECK_TYPES([wchar_t, wint_t],,,[
6b93c954
VK
2482#if HAVE_WCHAR_H
2483#include <wchar.h>
2484#endif
2485])
f172d7b7
VK
2486AC_CHECK_SIZEOF(wchar_t,,[
2487#if HAVE_WCHAR_H
2488#include <wchar.h>
2489#endif
2490])
fdf1ed50
VK
2491AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper towlower])
2492AC_CHECK_FUNCS([wcslwr wcserror wcserror_r wfopen wfopen64 fputws putws])
2493AC_CHECK_FUNCS([wopen wstat waccess wgetenv wrename wunlink wremove wchdir])
2494AC_CHECK_FUNCS([wmkdir wrmdir wsystem wmkstemp wpopen wctime wchmod vwscanf])
2495AC_CHECK_FUNCS([vswscanf vfwscanf wcscasecmp wcsncasecmp wcstombs wcsrtombs])
7b45b90d 2496AC_CHECK_FUNCS([mbstowcs mbsrtowcs itow _itow wcsftime wcstok wutime])
c6d5c1b0 2497AC_CHECK_FUNCS([wprintf vwprintf swprintf vswprintf fwprintf vfwprintf])
dff54fed 2498
465bd4ff
VK
2499AC_CHECK_DECLS([putws],,,[
2500#if HAVE_WCHAR_H
2501#include <wchar.h>
2502#endif
2503])
2504
75b4d48e
VK
2505if test "x$ac_cv_func_wcsftime" = "xyes"; then
2506 AC_MSG_CHECKING(whether wcsftime is working correctly)
2507 AC_RUN_IFELSE(
2508 [AC_LANG_PROGRAM([
2509#include <stdio.h>
2510#ifdef HAVE_UNISTD_H
2511#include <unistd.h>
2512#endif
2513#ifdef HAVE_TIME_H
2514#include <time.h>
2515#endif
2516#ifdef HAVE_SYS_TIME_H
2517#include <sys/time.h>
2518#endif
2519#if HAVE_WCHAR_H
2520#include <wchar.h>
2521#endif
2522 ], [[
2523 wchar_t buffer[64];
2524 struct tm *ltm;
2525 time_t t;
2526
2527 t = time(NULL);
2528 ltm = localtime(&t);
2529 wcsftime(buffer, 64, L"%Y", ltm);
2530 return wcstol(buffer, NULL, 10) == ltm->tm_year + 1900 ? 0 : 1;
2531 ]])
2532 ],
2533 [ AC_MSG_RESULT(yes)
2534 AC_DEFINE(WORKING_WCSFTIME, 1, Define to 1 if wcsftime is working correctly)
2535 ],
2536 [ AC_MSG_RESULT(no) ],
2537 [ AC_MSG_RESULT(no) ]
2538 )
2539fi
2540
3265ba38 2541if test "x$DISABLE_ICONV" != "xyes"; then
75c30ed4 2542 AC_CHECK_LIB(iconv, libiconv_open,
dff54fed 2543 [ ac_found_iconv=yes
8d131dda 2544 LIBS="$LIBS -liconv"
75c30ed4
VK
2545 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
2546 ],
2547 [
2548 AC_CHECK_LIB(iconv, iconv,
2549 [ ac_found_iconv=yes
8d131dda 2550 LIBS="$LIBS -liconv"
75c30ed4
VK
2551 ])
2552 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
2553 ])
dff54fed
VK
2554else
2555 ac_found_iconv=no
ef0c727b 2556 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
dff54fed 2557fi
93571e7f 2558
3bf0df9f
VK
2559AC_MSG_CHECKING(whether fgetws can be used with popen)
2560AC_RUN_IFELSE(
2561 [AC_LANG_PROGRAM([
2562#include <stdio.h>
2563#ifdef HAVE_UNISTD_H
2564#include <unistd.h>
2565#endif
2566#if HAVE_WCHAR_H
2567#include <wchar.h>
2568#endif
2569 ], [[
2570 int rc = 1;
2571 wchar_t line[4096];
2572 FILE *f = popen("echo test", "r");
2573 if(f!=NULL)
2574 {
2575 fgetws(line, 4096, f);
2576 pclose(f);
2577 rc = 0;
2578 }
2579 return rc;
2580 ]])
2581 ],
2582 [ AC_MSG_RESULT(yes)
2583 AC_DEFINE(SAFE_FGETWS_WITH_POPEN, 1, Define to 1 if fgetws can be used with popen)
2584 ],
2585 [ AC_MSG_RESULT(no) ],
2586 [ AC_MSG_RESULT(no) ]
2587)
2588
93571e7f
VK
2589AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
2590AC_RUN_IFELSE(
2591 [AC_LANG_PROGRAM([
2592#if HAVE_ICONV_H
2593#include <iconv.h>
2594#endif
2595 ], [
2596 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
2597 ])
2598 ],
2599 [ AC_MSG_RESULT(yes)
2600 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
2601 valid_ucs2_code="UCS-2-INTERNAL"
2602 ],
2603 [ AC_MSG_RESULT(no) ],
2604 [ AC_MSG_RESULT(no) ]
2605)
2606
2607AC_MSG_CHECKING(whether iconv supports UCS-2)
2608AC_RUN_IFELSE(
2609 [AC_LANG_PROGRAM([
2610#if HAVE_ICONV_H
2611#include <iconv.h>
2612#endif
2613 ], [
2614 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
2615 ])
2616 ],
2617 [ AC_MSG_RESULT(yes)
2618 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
2619 valid_ucs2_code="UCS-2"
2620 ],
2621 [ AC_MSG_RESULT(no) ],
8b86c5dc 2622 [ AC_MSG_RESULT(no) ]
93571e7f
VK
2623)
2624
2625AC_MSG_CHECKING(whether iconv supports UCS2)
2626AC_RUN_IFELSE(
2627 [AC_LANG_PROGRAM([
2628#if HAVE_ICONV_H
2629#include <iconv.h>
2630#endif
2631 ], [
2632 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
2633 ])
2634 ],
2635 [ AC_MSG_RESULT(yes)
2636 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
2637 valid_ucs2_code="UCS2"
2638 ],
2639 [ AC_MSG_RESULT(no) ],
2640 [ AC_MSG_RESULT(no) ]
2641)
2642
44bccbbc
VK
2643AC_MSG_CHECKING(whether iconv supports UCS-2BE)
2644AC_RUN_IFELSE(
2645 [AC_LANG_PROGRAM([
2646#if HAVE_ICONV_H
2647#include <iconv.h>
2648#endif
2649 ], [
2650 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
2651 ])
2652 ],
2653 [ AC_MSG_RESULT(yes)
2654 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
2655 valid_ucs2_code="UCS-2BE"
2656 ],
2657 [ AC_MSG_RESULT(no) ],
2658 [ AC_MSG_RESULT(no) ]
2659)
2660
6e17f325
VK
2661AC_MSG_CHECKING(whether iconv supports UCS-2LE)
2662AC_RUN_IFELSE(
2663 [AC_LANG_PROGRAM([
2664#if HAVE_ICONV_H
2665#include <iconv.h>
2666#endif
2667 ], [
2668 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
2669 ])
2670 ],
2671 [ AC_MSG_RESULT(yes)
2672 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
2673 valid_ucs2_code="UCS-2LE"
2674 ],
2675 [ AC_MSG_RESULT(no) ],
2676 [ AC_MSG_RESULT(no) ]
2677)
2678
4a4e1feb
VK
2679AC_MSG_CHECKING(whether iconv supports UTF-16)
2680AC_RUN_IFELSE(
2681 [AC_LANG_PROGRAM([
2682#if HAVE_ICONV_H
2683#include <iconv.h>
2684#endif
2685 ], [
2686 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
2687 ])
2688 ],
2689 [ AC_MSG_RESULT(yes)
2690 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
2691 valid_ucs2_code="UTF-16"
2692 ],
2693 [ AC_MSG_RESULT(no) ],
2694 [ AC_MSG_RESULT(no) ]
2695)
2696
8b86c5dc
VK
2697AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
2698AC_RUN_IFELSE(
2699 [AC_LANG_PROGRAM([
2700#if HAVE_ICONV_H
2701#include <iconv.h>
2702#endif
2703 ], [
2704 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
2705 ])
2706 ],
2707 [ AC_MSG_RESULT(yes)
2708 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
2709 valid_ucs4_code="UCS-4-INTERNAL"
2710 ],
2711 [ AC_MSG_RESULT(no) ],
2712 [ AC_MSG_RESULT(no) ]
2713)
2714
2715AC_MSG_CHECKING(whether iconv supports UCS-4)
2716AC_RUN_IFELSE(
2717 [AC_LANG_PROGRAM([
2718#if HAVE_ICONV_H
2719#include <iconv.h>
2720#endif
2721 ], [
2722 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
2723 ])
2724 ],
2725 [ AC_MSG_RESULT(yes)
2726 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
2727 valid_ucs4_code="UCS-4"
2728 ],
2729 [ AC_MSG_RESULT(no) ],
2730 [ AC_MSG_RESULT(no) ]
2731)
2732
2733AC_MSG_CHECKING(whether iconv supports UCS4)
2734AC_RUN_IFELSE(
2735 [AC_LANG_PROGRAM([
2736#if HAVE_ICONV_H
2737#include <iconv.h>
2738#endif
2739 ], [
2740 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
2741 ])
2742 ],
2743 [ AC_MSG_RESULT(yes)
2744 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
2745 valid_ucs4_code="UCS4"
2746 ],
2747 [ AC_MSG_RESULT(no) ],
2748 [ AC_MSG_RESULT(no) ]
2749)
2750
2751AC_MSG_CHECKING(whether iconv supports UCS-4BE)
2752AC_RUN_IFELSE(
2753 [AC_LANG_PROGRAM([
2754#if HAVE_ICONV_H
2755#include <iconv.h>
2756#endif
2757 ], [
2758 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
2759 ])
2760 ],
2761 [ AC_MSG_RESULT(yes)
2762 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
2763 valid_ucs4_code="UCS-4BE"
2764 ],
2765 [ AC_MSG_RESULT(no) ],
2766 [ AC_MSG_RESULT(no) ]
2767)
2768
6e17f325
VK
2769AC_MSG_CHECKING(whether iconv supports UCS-4LE)
2770AC_RUN_IFELSE(
2771 [AC_LANG_PROGRAM([
2772#if HAVE_ICONV_H
2773#include <iconv.h>
2774#endif
2775 ], [
2776 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
2777 ])
2778 ],
2779 [ AC_MSG_RESULT(yes)
2780 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
2781 valid_ucs4_code="UCS-4LE"
2782 ],
2783 [ AC_MSG_RESULT(no) ],
2784 [ AC_MSG_RESULT(no) ]
2785)
2786
4a4e1feb
VK
2787AC_MSG_CHECKING(whether iconv supports UTF-32)
2788AC_RUN_IFELSE(
2789 [AC_LANG_PROGRAM([
2790#if HAVE_ICONV_H
2791#include <iconv.h>
2792#endif
2793 ], [
2794 return iconv_open("UTF-8","UTF-32")==(iconv_t)(-1);
2795 ])
2796 ],
2797 [ AC_MSG_RESULT(yes)
2798 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
2799 valid_ucs4_code="UTF-32"
2800 ],
2801 [ AC_MSG_RESULT(no) ],
2802 [ AC_MSG_RESULT(no) ]
2803)
2804
93571e7f
VK
2805AC_MSG_CHECKING(whether iconv supports //IGNORE)
2806AC_RUN_IFELSE(
2807 [AC_LANG_PROGRAM([
2808#if HAVE_ICONV_H
2809#include <iconv.h>
2810#endif
2811 ], [
2812 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
2813 ])
2814 ],
2815 [ AC_MSG_RESULT(yes)
2816 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
2817 ],
2818 [ AC_MSG_RESULT(no) ],
2819 [ AC_MSG_RESULT(no) ]
2820)
3e39fcde 2821
bd96aa53
VK
2822AC_MSG_CHECKING(whether iconv supports state reset)
2823AC_RUN_IFELSE(
2824 [AC_LANG_PROGRAM([
2825#include <stdio.h>
2826#if HAVE_ICONV_H
2827#include <iconv.h>
2828#endif
2829 ], [
2830 iconv_t cd = iconv_open("UTF-8","$valid_ucs2_code");
2831 if (cd == (iconv_t)(-1)) return 1;
2832 return iconv(cd, NULL, NULL, NULL, NULL) != 0;
2833 ])
2834 ],
2835 [ AC_MSG_RESULT(yes)
2836 AC_DEFINE(HAVE_ICONV_STATE_RESET, 1, Define to 1 if iconv supports state reset)
2837 ],
2838 [ AC_MSG_RESULT(no) ],
2839 [ AC_MSG_RESULT(no) ]
2840)
2841
2842AC_MSG_CHECKING(whether iconv descriptor cache is needed)
2843case $enable_iconv_cache in
2844 auto)
2845 case $PLATFORM in
2846 SunOS|HP-UX|AIX)
2847 enable_iconv_cache=yes
2848 ;;
2849 *)
2850 enable_iconv_cache=no
2851 ;;
2852 esac
2853 ;;
2854 yes|no)
2855 ;;
2856 *)
2857 AC_MSG_ERROR([Value given to --enable-iconv-cache must be one of yes, no or auto])
2858 ;;
2859esac
2860if test "x$enable_iconv_cache" = "xyes"; then
2861 AC_DEFINE(WITH_ICONV_CACHE, 1, Define to 1 to enable iconv descriptor cache)
2862fi
2863AC_MSG_RESULT($enable_iconv_cache)
2864
19619a35
AK
2865# taken from ZSH's configure
2866# Check if iconv uses const in prototype declaration
24b1570c 2867if test "x$ac_found_iconv" = "xyes"; then
53c96e2d 2868 AC_LANG_PUSH([C++])
19619a35 2869 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
7f9423af
VK
2870 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2871#include <stdlib.h>
f6a2136d 2872#if HAVE_ICONV_H
7f9423af 2873#include <iconv.h>
f6a2136d 2874#endif
f6a2136d
VK
2875 ]],
2876 [[
3e51d371
VK
2877 char **p = NULL;
2878 iconv(0, (const char **)p, 0, 0, 0);
7f9423af 2879 ]])],
3e51d371
VK
2880 [ac_cv_iconv_const=const],
2881 [ac_cv_iconv_const=])])
53c96e2d 2882 AC_LANG_POP([C++])
19619a35
AK
2883 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
2884 [Define as const if the declaration of iconv() needs const.])
2885fi
2886
a67fa146
VK
2887if test "x$ac_cv_type_wchar_t" = "xyes"; then
2888 if test $ac_cv_sizeof_wchar_t -eq 2; then
2889 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
2890 fi
8b86c5dc 2891
a67fa146
VK
2892 if test $ac_cv_sizeof_wchar_t -eq 4; then
2893 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
2894 fi
2895
2896 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
2897 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
2898 fi
2899else
2900 if test "x$BUILD_UNICODE" = "xyes"; then
2901 AC_MSG_ERROR(wchar_t is required for UNICODE build)
2902 fi
8b86c5dc
VK
2903fi
2904
c29360a9 2905
ef0c727b 2906#--------------------------------------------------------------------
ca0f4ea3
VK
2907# MySQL
2908#--------------------------------------------------------------------
2909
2910check_substr "$COMPONENTS" "mysql"
2911if test $? = 0; then
9f1ea006
VK
2912 OLD_CPPFLAGS="$CPPFLAGS"
2913 OLD_LDFLAGS="$LDFLAGS"
2914 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2915
2916 CPPFLAGS="$CPPFLAGS $MYSQL_CPPFLAGS"
2917 LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
2918 if test "x$MYSQL_LD_RUN_PATH" != "x"; then
2919 LD_RUN_PATH="${MYSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2920 fi
2921
b93fd1c1 2922 AC_CHECK_HEADER(mysql.h,,AC_MSG_ERROR([Cannot find mysql.h - check your MySQL client installation]))
9f1ea006 2923
6fce76d8 2924 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
e99f8e86 2925 [
c6030457 2926 AC_MSG_ERROR(libmysqlclient is requred for MySQL support)
e99f8e86 2927 ])
aa7794f0 2928
8d131dda
VK
2929 OLD_LIBS="$LIBS"
2930 LIBS="$LIBS $MYSQL_LIBS"
aa7794f0 2931
ca0f4ea3 2932 AC_CHECK_FUNCS(mysql_real_escape_string)
9f1ea006
VK
2933
2934 CPPFLAGS="$OLD_CPPFLAGS"
2935 LDFLAGS="$OLD_LDFLAGS"
2936 LD_RUN_PATH="$OLD_LD_RUN_PATH"
8d131dda 2937 LIBS="$OLD_LIBS"
ca0f4ea3
VK
2938fi
2939
2940
2941#--------------------------------------------------------------------
c6030457
VK
2942# MariaDB
2943#--------------------------------------------------------------------
2944
2945check_substr "$COMPONENTS" "mariadb"
2946if test $? = 0; then
2947 OLD_CPPFLAGS="$CPPFLAGS"
2948 OLD_LDFLAGS="$LDFLAGS"
2949 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2950
2951 CPPFLAGS="$CPPFLAGS $MARIADB_CPPFLAGS"
2952 LDFLAGS="$LDFLAGS $MARIADB_LDFLAGS"
2953 if test "x$MARIADB_LD_RUN_PATH" != "x"; then
2954 LD_RUN_PATH="${MARIADB_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2955 fi
2956
2957 AC_CHECK_HEADER(mysql.h,,AC_MSG_ERROR([Cannot find mysql.h - check your MariaDB client installation]))
2958
2959 AC_CHECK_LIB(mariadb, mysql_init, [MARIADB_LIBS="-lmariadb"],
2960 [
2961 AC_MSG_ERROR(libmariadb is requred for MariaDB support)
2962 ])
2963
2964 CPPFLAGS="$OLD_CPPFLAGS"
2965 LDFLAGS="$OLD_LDFLAGS"
2966 LD_RUN_PATH="$OLD_LD_RUN_PATH"
2967fi
2968
2969
2970#--------------------------------------------------------------------
58ed4897
VK
2971# PostgreSQL
2972#--------------------------------------------------------------------
2973
203458b7 2974check_substr "$COMPONENTS" "pgsql"
58ed4897 2975if test $? = 0; then
b535eed6
VK
2976 OLD_CPPFLAGS="$CPPFLAGS"
2977 OLD_LDFLAGS="$LDFLAGS"
2978 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2979
2980 CPPFLAGS="$CPPFLAGS $PGSQL_CPPFLAGS"
2981 LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
2982 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
2983 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2984 fi
2985
9f1ea006
VK
2986 AC_CHECK_HEADER(libpq-fe.h,,AC_MSG_ERROR([Cannot find libpq-fe.h - check your PostgreSQL client installation]))
2987
7e19eef6
VK
2988 AC_CHECK_DECLS([PGRES_SINGLE_TUPLE],,,[
2989#include <libpq-fe.h>
2990 ])
2991
58ed4897 2992 AC_CHECK_LIB(m, floor)
b535eed6
VK
2993 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
2994 if test "x$PLATFORM" = "xSunOS"; then
9857563b
VK
2995 if test -d "$PGSQL_LD_RUN_PATH/sparcv9"; then
2996 PGSQL_LDFLAGS="$PGSQL_LDFLAGS/sparcv9"
2997 else
2998 PGSQL_LDFLAGS="$PGSQL_LDFLAGS/64"
2999 fi
b535eed6
VK
3000 LDFLAGS="$OLD_LDFLAGS $PGSQL_LDFLAGS"
3001 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
3002 PGSQL_LD_RUN_PATH="$PGSQL_LD_RUN_PATH/sparcv9"
3003 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${OLD_LD_RUN_PATH:+:}${OLD_LD_RUN_PATH}"
3004 fi
3005 unset ac_cv_lib_pq_PQconnectdb
3006 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
3007 AC_MSG_ERROR(libpq is required for PostgreSQL support)])
3008 else
3009 AC_MSG_ERROR(libpq is required for PostgreSQL support)
3010 fi
3011 ])
6fce76d8 3012
b535eed6
VK
3013 CPPFLAGS="$OLD_CPPFLAGS"
3014 LDFLAGS="$OLD_LDFLAGS"
3015 LD_RUN_PATH="$OLD_LD_RUN_PATH"
58ed4897
VK
3016fi
3017
3018
3019#--------------------------------------------------------------------
9c29f76e
VK
3020# ODBC
3021#--------------------------------------------------------------------
3022
3023check_substr "$COMPONENTS" "odbc"
3024if test $? = 0; then
2cfe4482
VK
3025 OLD_CPPFLAGS="$CPPFLAGS"
3026 OLD_LDFLAGS="$LDFLAGS"
3027 OLD_LD_RUN_PATH="$LD_RUN_PATH"
3028
3029 CPPFLAGS="$CPPFLAGS $ODBC_CPPFLAGS"
b535eed6 3030 LDFLAGS="$LDFLAGS $ODBC_LDFLAGS"
2cfe4482
VK
3031 if test "x$ODBC_LD_RUN_PATH" != "x"; then
3032 LD_RUN_PATH="${ODBC_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
3033 fi
3034
6fce76d8 3035 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
9c29f76e 3036 [AC_MSG_ERROR(libodbc is required for ODBC support)])
60a1159a
VK
3037 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
3038 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
3039 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
3040 fi
2cfe4482
VK
3041
3042 CPPFLAGS="$OLD_CPPFLAGS"
3043 LDFLAGS="$OLD_LDFLAGS"
3044 LD_RUN_PATH="$OLD_LD_RUN_PATH"
9c29f76e
VK
3045fi
3046
3047
3048#--------------------------------------------------------------------
41b4790d
VK
3049# Oracle
3050#--------------------------------------------------------------------
3051
3052check_substr "$COMPONENTS" "oracle"
3053if test $? = 0; then
2cfe4482
VK
3054 OLD_CPPFLAGS="$CPPFLAGS"
3055 OLD_LDFLAGS="$LDFLAGS"
3056 OLD_LD_RUN_PATH="$LD_RUN_PATH"
3057
3058 CPPFLAGS="$CPPFLAGS $ORACLE_CPPFLAGS"
b535eed6 3059 LDFLAGS="$LDFLAGS $ORACLE_LDFLAGS"
2cfe4482
VK
3060 if test "x$ORACLE_LD_RUN_PATH" != "x"; then
3061 LD_RUN_PATH="${ORACLE_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
3062 fi
3063
41b4790d 3064 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
e5cceced 3065 AC_CHECK_LIB(nnz12, nzstrcpy, [NNZ_LIB=-lnnz12],
7d8c91ef 3066 [
e5cceced
VK
3067 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
3068 [
3069 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
3070 ], [-lclntsh])
7d8c91ef
VK
3071 ], [-lclntsh])
3072 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
3073 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
045845e5 3074 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
60a1159a
VK
3075 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
3076 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
3077 fi
2cfe4482
VK
3078
3079 CPPFLAGS="$OLD_CPPFLAGS"
3080 LDFLAGS="$OLD_LDFLAGS"
3081 LD_RUN_PATH="$OLD_LD_RUN_PATH"
41b4790d
VK
3082fi
3083
84277a0f
AK
3084#--------------------------------------------------------------------
3085# DB2
3086#--------------------------------------------------------------------
3087
3088check_substr "$COMPONENTS" "db2"
3089if test $? = 0; then
3090 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
3091 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
3092 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
6afe141e 3093 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
3094 SUBAGENT_LIBS="$SUBAGENT_LIBS $DB2_LIBS"
3095 fi
84277a0f 3096fi
41b4790d
VK
3097
3098#--------------------------------------------------------------------
37861c72
VK
3099# Informix
3100#--------------------------------------------------------------------
3101
3102check_substr "$COMPONENTS" "informix"
3103if test $? = 0; then
3104 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
4f2e8e9b
VK
3105 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
3106 [AC_MSG_ERROR(libthcli is required for Informix support)])
60a1159a
VK
3107 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
3108 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
3109 fi
37861c72
VK
3110fi
3111
c3cfc039
VK
3112
3113#--------------------------------------------------------------------
50e4bc8c
VK
3114# Java
3115#--------------------------------------------------------------------
3116
3117check_substr "$COMPONENTS" "java"
3118if test $? = 0; then
3119 AC_CHECK_HEADER(jni.h,,AC_MSG_ERROR([*** Cannot find jni.h - check your JDK installation ***]))
50e4bc8c
VK
3120fi
3121
3122
3123#--------------------------------------------------------------------
b14c3f22
VK
3124# Tuxedo
3125#--------------------------------------------------------------------
3126
3127check_substr "$COMPONENTS" "tuxedo"
3128if test $? = 0; then
3129 OLD_CPPFLAGS="$CPPFLAGS"
3130 OLD_LDFLAGS="$LDFLAGS"
3131 OLD_LIBS="$LIBS"
3132
3133 if test "x$TUXEDO_BASE" != "x"; then
3134 TUXEDO_CPPFLAGS="-I$TUXEDO_BASE/include"
3135 TUXEDO_LDFLAGS="-L$TUXEDO_BASE/lib"
3136 CPPFLAGS="$CPPFLAGS $TUXEDO_CPPFLAGS"
3137 LDFLAGS="$LDFLAGS $TUXEDO_LDFLAGS"
3138 fi
3139
3140 AC_CHECK_HEADER(atmi.h,,AC_MSG_ERROR([*** Cannot find atmi.h - check your Tuxedo installation ***]))
3141
3142 # https://community.oracle.com/thread/2346582
3143 if test "x$PLATFORM" = "xLinux"; then
3144 TUXEDO_LDFLAGS="$TUXEDO_LDFLAGS -Xlinker --no-as-needed"
3145 LDFLAGS="$LDFLAGS -Xlinker --no-as-needed"
3146 fi
6d14d0b0
VK
3147
3148 if test "$PLATFORM" = "SunOS"; then
3149 AC_CHECK_LIB(rt, nanosleep, [ TUXEDO_LIBS="$TUXEDO_LIBS -lrt" ])
3150 fi
3151
73517e51
VK
3152 if test "$PLATFORM" = "AIX"; then
3153 AC_MSG_CHECKING(for xa_switchp in libengine)
3154 OLD_LIBS_LIBENGINE="$LIBS"
3155 LIBS="$LIBS -lengine"
3156 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ extern char *xa_switchp; ]], [[ *xa_switchp = 0; ]])],
3157 [
3158 AC_MSG_RESULT(yes)
3159 TUXEDO_LIBS="$TUXEDO_LIBS -lengine"
3160 ],
3161 [ AC_MSG_RESULT(no) ])
3162 LIBS="$OLD_LIBS_LIBENGINE"
3163 fi
3164
6d14d0b0 3165 LIBS="$LIBS $TUXEDO_LIBS"
73517e51 3166 AC_CHECK_LIB(tux, tpcall, [], [AC_MSG_ERROR(libtux is required for Tuxedo support)])
b14c3f22
VK
3167
3168 CPPFLAGS="$OLD_CPPFLAGS"
3169 LDFLAGS="$OLD_LDFLAGS"
3170 LIBS="$OLD_LIBS"
73517e51
VK
3171
3172 if test "x$PLATFORM" = "xAIX"; then
3173 if test -e $TUXEDO_BASE/lib/tpinit.o; then
c7c6ce77 3174 TUXEDO_TPINIT="$TUXEDO_BASE/lib/tpinit.o"
73517e51
VK
3175 fi
3176 fi
b14c3f22
VK
3177fi
3178
123800f4 3179
d6235717 3180#--------------------------------------------------------------------
cac05a70 3181# ZeroMQ
3182#--------------------------------------------------------------------
3183
3184check_substr "$COMPONENTS" "zeromq"
3185if test $? = 0; then
3186 OLD_CPPFLAGS="$CPPFLAGS"
3187 OLD_LDFLAGS="$LDFLAGS"
3188 OLD_LIBS="$LIBS"
3189
3190 if test "x$ZEROMQ_BASE" != "x"; then
3191 ZEROMQ_CPPFLAGS="-I$ZEROMQ_BASE/include"
3192 ZEROMQ_LDFLAGS="-L$ZEROMQ_BASE/lib"
3193 CPPFLAGS="$CPPFLAGS $ZEROMQ_CPPFLAGS"
3194 LDFLAGS="$LDFLAGS $ZEROMQ_LDFLAGS"
7fcdcb0c 3195 fi
cac05a70 3196
ca026ade
VK
3197 AC_CHECK_HEADER(zmq.h,,[
3198 if test "x$ZEROMQ_REQUIRED" = "xyes"; then
3199 AC_MSG_ERROR([*** Cannot find zmq.h - check your ZeroMQ installation ***])
3200 else
3201 ZEROMQ_SUPPORT="no"
3202 fi
3203 ])
3204 AC_CHECK_LIB(zmq, zmq_ctx_new, [ SERVER_LIBS="$SERVER_LIBS -lzmq" ], [
3205 if test "x$ZEROMQ_REQUIRED" = "xyes"; then
3206 AC_MSG_ERROR([*** libzmq is missing or too old - check your ZeroMQ installation ***])
3207 else
3208 ZEROMQ_SUPPORT="no"
3209 fi
3210 ])
cac05a70 3211
ca026ade
VK
3212 if test "x$ZEROMQ_SUPPORT" = "xyes"; then
3213 AC_DEFINE(WITH_ZMQ, 1, Define to 1 if ZeroMQ is supported)
3214 fi
cac05a70 3215
3216 CPPFLAGS="$OLD_CPPFLAGS"
3217 LDFLAGS="$OLD_LDFLAGS"
3218 LIBS="$OLD_LIBS"
3219fi
3220
123800f4
VK
3221
3222#--------------------------------------------------------------------
3223# MQTT
3224#--------------------------------------------------------------------
3225
e6316fe0 3226if test "x$DISABLE_MQTT" != "xyes"; then
123800f4
VK
3227 OLD_CPPFLAGS="$CPPFLAGS"
3228 OLD_LDFLAGS="$LDFLAGS"
3229 OLD_LIBS="$LIBS"
3230
e6316fe0
VK
3231 if test "x$MOSQUITTO_BASE" != "x"; then
3232 MQTT_CPPFLAGS="-I$MOSQUITTO_BASE/include"
3233 MQTT_LDFLAGS="-L$MOSQUITTO_BASE/lib"
123800f4
VK
3234 CPPFLAGS="$CPPFLAGS $MQTT_CPPFLAGS"
3235 LDFLAGS="$LDFLAGS $MQTT_LDFLAGS"
3236 fi
3237
3238 AC_CHECK_HEADER(mosquitto.h,,[
e6316fe0 3239 AC_MSG_ERROR([*** Cannot find mosquitto.h - check your libmosquitto installation or disable MQTT support with --disable-mqtt ***])
123800f4 3240 ])
fab0916b 3241 AC_CHECK_LIB(mosquitto, mosquitto_lib_init, [ MQTT_LIBS="-lmosquitto" ], [
e6316fe0 3242 AC_MSG_ERROR([*** libmosquitto is missing - check your libmosquitto installation or disable MQTT support with --disable-mqtt***])
123800f4
VK
3243 ])
3244
e6316fe0
VK
3245 MQTT_SUPPORT="yes"
3246 AC_DEFINE(WITH_MQTT, 1, Define to 1 if MQTT is supported)
3247 SUBAGENT_DIRS="$SUBAGENT_DIRS mqtt"
123800f4
VK
3248
3249 CPPFLAGS="$OLD_CPPFLAGS"
3250 LDFLAGS="$OLD_LDFLAGS"
3251 LIBS="$OLD_LIBS"
3252fi
3253
3254
cac05a70 3255#--------------------------------------------------------------------
d6235717 3256# MongoDB
3257#--------------------------------------------------------------------
3258
3259check_substr "$COMPONENTS" "mongodb"
3260if test $? = 0; then
3261 OLD_CPPFLAGS="$CPPFLAGS"
3262 OLD_LDFLAGS="$LDFLAGS"
3263 OLD_LIBS="$LIBS"
3264
3265 if test "x$MONGODB_BASE" != "x"; then
3266 MONGODB_CPPFLAGS="-I$MONGODB_BASE/include/libmongoc-1.0/ -I$MONGODB_BASE/include/libbson-1.0/"
3267 MONGODB_LDFLAGS="-L$MONGODB_BASE/lib"
3268 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
3269 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
3270 else
3271 MONGODB_CPPFLAGS="-I/usr/local/include/libmongoc-1.0/ -I/usr/local/include/libbson-1.0/"
3272 MONGODB_LDFLAGS="-L/usr/local/lib"
3273 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
3274 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
b7c8729b 3275 fi
d6235717 3276
3277 AC_CHECK_HEADER(mongoc.h,,AC_MSG_ERROR([*** Cannot find mongoc.h - check your MongoDB installation ***]))
4bed256b 3278 AC_CHECK_LIB(mongoc-1.0, mongoc_client_get_database, [ MONGODB_LIBS="$MONGODB_LIBS -lmongoc-1.0" ])
d6235717 3279 AC_CHECK_LIB(bson-1.0, nanosleep, [ MONGODB_LIBS="$MONGODB_LIBS -lbson-1.0" ])
3280
3281 LIBS="$LIBS $MONGODB_LIBS"
3282
3283 CPPFLAGS="$OLD_CPPFLAGS"
3284 LDFLAGS="$OLD_LDFLAGS"
3285 LIBS="$OLD_LIBS"
3286fi
b14c3f22 3287
e6316fe0 3288
b14c3f22 3289#--------------------------------------------------------------------
b7c8729b 3290# VMGR
3291#--------------------------------------------------------------------
3292
3293check_substr "$COMPONENTS" "vmgr"
3294if test $? = 0; then
3295 OLD_CPPFLAGS="$CPPFLAGS"
3296 OLD_LDFLAGS="$LDFLAGS"
3297 OLD_LIBS="$LIBS"
3298
442297fa
VK
3299 if test "x$LIBVIRT_BASE" != "x"; then
3300 VMGR_CPPFLAGS="-I$LIBVIRT_BASE/include"
3301 VMGR_LDFLAGS="-L$LIBVIRT_BASE/lib"
b7c8729b 3302 CPPFLAGS="$CPPFLAGS $VMGR_CPPFLAGS"
3303 LDFLAGS="$LDFLAGS $VMGR_LDFLAGS"
3304 else
442297fa
VK
3305 VMGR_CPPFLAGS=""
3306 VMGR_LDFLAGS=""
b7c8729b 3307 CPPFLAGS="$CPPFLAGS $VMGR_CPPFLAGS"
3308 LDFLAGS="$LDFLAGS $VMGR_LDFLAGS"
3309 fi
3310
442297fa 3311 AC_CHECK_HEADER(libvirt/libvirt.h,,AC_MSG_ERROR([*** Cannot find libvirt.h - check your libvirt installation ***]))
4bed256b 3312 AC_CHECK_LIB(virt, virConnectGetLibVersion, [ VMGR_LIBS="$VMGR_LIBS -lvirt" ])
b7c8729b 3313 LIBS="$LIBS $VMGR_LIBS"
3314
07abe797
VK
3315 AC_CHECK_FUNCS([virDomainGetTime])
3316
b7c8729b 3317 CPPFLAGS="$OLD_CPPFLAGS"
3318 LDFLAGS="$OLD_LDFLAGS"
3319 LIBS="$OLD_LIBS"
3320fi
3321
1647762a
VK
3322
3323#--------------------------------------------------------------------
3324# XEN
3325#--------------------------------------------------------------------
3326
3327check_substr "$COMPONENTS" "xen"
3328if test $? = 0; then
3329 OLD_CPPFLAGS="$CPPFLAGS"
3330 OLD_LDFLAGS="$LDFLAGS"
3331 OLD_LIBS="$LIBS"
3332
3333 AC_CHECK_HEADER(libxl.h,,AC_MSG_ERROR([*** Cannot find libxl.h - check your libxen installation ***]))
3334 AC_CHECK_LIB(xenlight, libxl_ctx_alloc, [ XEN_LIBS="$XEN_LIBS -lxenlight" ])
3335 AC_CHECK_LIB(xenctrl, xc_vcpu_getinfo, [ XEN_LIBS="$XEN_LIBS -lxenctrl" ])
3336
3337 CPPFLAGS="$OLD_CPPFLAGS"
3338 LDFLAGS="$OLD_LDFLAGS"
3339 LIBS="$OLD_LIBS"
3340fi
3341
24c44589
VK
3342
3343#--------------------------------------------------------------------
3344# LoraWAN
3345#--------------------------------------------------------------------
3346
3347check_substr "$COMPONENTS" "agent"
3348if test $? = 0; then
3349 if test "x$HAVE_LIBCURL" = "xyes" -a "x$MQTT_SUPPORT" = "xyes"; then
3350 SUBAGENT_DIRS="$SUBAGENT_DIRS lorawan"
3351 fi
3352fi
3353
b7c8729b 3354#--------------------------------------------------------------------
ca0f4ea3
VK
3355# Other settings
3356#--------------------------------------------------------------------
3357
a5a95ac8
VK
3358if test "x$RUNTIME_PREFIX" = "x"; then
3359 if test "x${BUILD_UNICODE}" = "xyes"; then
f434ab60 3360 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\" -DSTATEDIR=L\\\"\${localstatedir}/lib/netxms\\\""
a5a95ac8 3361 else
f434ab60 3362 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\" -DSTATEDIR=\\\"\${localstatedir}/lib/netxms\\\""
a5a95ac8 3363 fi
b07c50cc 3364else
a5a95ac8 3365 if test "x${BUILD_UNICODE}" = "xyes"; then
54df06e2 3366 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"$RUNTIME_PREFIX\\\" -DDATADIR=L\\\"$RUNTIME_PREFIX/share/netxms\\\" -DBINDIR=L\\\"$RUNTIME_PREFIX/bin\\\" -DLIBDIR=L\\\"$RUNTIME_PREFIX/lib\\\" -DPKGLIBDIR=L\\\"$RUNTIME_PREFIX/lib/netxms\\\" -DSTATEDIR=L\\\"$RUNTIME_STATE_DIR/lib/netxms\\\""
a5a95ac8 3367 else
54df06e2 3368 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"$RUNTIME_PREFIX\\\" -DDATADIR=\\\"$RUNTIME_PREFIX/share/netxms\\\" -DBINDIR=\\\"$RUNTIME_PREFIX/bin\\\" -DLIBDIR=\\\"$RUNTIME_PREFIX/lib\\\" -DPKGLIBDIR=\\\"$RUNTIME_PREFIX/lib/netxms\\\" -DSTATEDIR=\\\"$RUNTIME_STATE_DIR/lib/netxms\\\""
a5a95ac8 3369 fi
1fd3eaa2 3370 LDFLAGS_SUFFIX="$LDFLAGS_SUFFIX -R $RUNTIME_PREFIX/lib"
b07c50cc 3371fi
1de39d9e 3372
c4952327 3373LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $PTHREAD_LDFLAGS $LDFLAGS_SUFFIX"
ca0f4ea3 3374
25ae8377
VK
3375if test "x${ENABLE_WERROR}" = "xyes"; then
3376 CPPFLAGS="$CPPFLAGS -Werror"
3377fi
3378
cbc4d191
VK
3379if test "x$PLATFORM" = "xDarwin"; then
3380 SHLIB_SUFFIX=".so"
3381else
3382 if test "x$shrext_cmds" != "x"; then
3383 SHLIB_SUFFIX="$shrext_cmds"
3384 else
3385 SHLIB_SUFFIX=".so"
3386 fi
2b479c92 3387fi
cbc4d191 3388AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], _T("$SHLIB_SUFFIX"), [Define to platform's shared library suffix])
2b479c92 3389
8c9993b4
VK
3390if test "x$ENABLE_DEBUG" = "xno"; then
3391 CPPFLAGS="$CPPFLAGS -DNDEBUG"
3392fi
3393
f92a016a
VK
3394if test "x$WITH_JEMALLOC" = "xyes"; then
3395 LIBS="$LIBS -ljemalloc"
3396fi
3397
551ec9ca 3398AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
17b35ccc 3399AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
f5393033 3400AM_CONDITIONAL([USE_INTERNAL_JANSSON], [test "x$HAVE_JANSSON" = "xno"])
3d2bc3ae 3401AM_CONDITIONAL([USE_INTERNAL_SQLITE], [test "x$HAVE_SQLITE" = "xno"])
f1b8f11c 3402AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$HAVE_ZLIB" = "no"])
c1165d33
VK
3403AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
3404AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
9c3bf7f4 3405AM_CONDITIONAL([USE_ENCRYPTION], [test "x${WITH_ENCRYPTION}" = "xyes"])
6dde8627 3406AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
123800f4 3407AM_CONDITIONAL([MQTT_SUPPORT], [test "x$MQTT_SUPPORT" = "xyes"])
058bf6fc 3408AM_CONDITIONAL([XMPP_SUPPORT], [test "x$XMPP_SUPPORT" = "xyes"])
7fcdcb0c 3409AM_CONDITIONAL([ZEROMQ_SUPPORT], [test "x$ZEROMQ_SUPPORT" = "xyes"])
8b86c5dc 3410
ca0f4ea3
VK
3411
3412#--------------------------------------------------------------------
ef6a61aa
VK
3413# Get compiler version
3414#--------------------------------------------------------------------
3415
3416COMPILER_VERSION=""
a5b98ccc
VK
3417if test "$CXX" = "CC"; then
3418 v=`$CXX -V 2>&1 | head -1`
ef6a61aa 3419 if test $? = 0; then
a5b98ccc 3420 COMPILER_VERSION="$v"
ef6a61aa 3421 fi
a5b98ccc
VK
3422else
3423 for opt in -qversion --version -v -V; do
3424 v=`$CXX $opt 2>/dev/null | head -1`
3425 if test $? = 0; then
3426 if test "x$v" != "x" -a "x$COMPILER_VERSION" = "x"; then
3427 COMPILER_VERSION="$v"
3428 fi
3429 fi
3430 done
3431fi
3432AC_DEFINE_UNQUOTED([CPP_COMPILER_VERSION], "$COMPILER_VERSION", [C++ compiler version information])
ef6a61aa
VK
3433
3434
3435#--------------------------------------------------------------------
8a96930f
AK
3436# Cleanup variables
3437#--------------------------------------------------------------------
3438
3439AS_IF([test "x$with_dist" = "xyes"],
3440[
c7c6ce77 3441 AGENT_DIRS=`echo $AGENT_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
8a96930f
AK
3442 SUBAGENT_DIRS=`echo $SUBAGENT_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3443 MODULES=`echo $MODULES|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3444 SMSDRV_DIRS=`echo $SMSDRV_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3445 HDLINK_DIRS=`echo $HDLINK_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
3446])
3447
0cdd78ad 3448
8a96930f 3449#--------------------------------------------------------------------
ef0c727b
VK
3450# Substitute variables
3451#--------------------------------------------------------------------
82fa7c5d 3452
ef0c727b
VK
3453AC_SUBST(DB_DRIVERS)
3454AC_SUBST(MODULES)
c7c6ce77 3455AC_SUBST(AGENT_DIRS)
ef0c727b 3456AC_SUBST(SUBAGENT_DIRS)
7dda4453 3457AC_SUBST(SERVER_INCLUDE)
7c48e2aa 3458AC_SUBST(SERVER_LIBS)
ef0c727b 3459AC_SUBST(SERVER_TOOLS)
c20f8eb7 3460AC_SUBST(SMSDRV_DIRS)
6fad8870 3461AC_SUBST(HDLINK_DIRS)
52a2232c 3462AC_SUBST(PDSDRV_DIRS)
ef0c727b
VK
3463AC_SUBST(TOP_LEVEL_MODULES)
3464AC_SUBST(CONTRIB_MODULES)
c2612d83 3465AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
3466AC_SUBST(STATIC_SUBAGENT_LIST)
3467AC_SUBST(SUBAGENT_LIBS)
3468AC_SUBST(BUILD_SERVER)
447350a9 3469AC_SUBST(BUILD_SDK)
2cfe4482
VK
3470AC_SUBST(MYSQL_CPPFLAGS)
3471AC_SUBST(MYSQL_LDFLAGS)
6fce76d8 3472AC_SUBST(MYSQL_LIBS)
c6030457
VK
3473AC_SUBST(MARIADB_CPPFLAGS)
3474AC_SUBST(MARIADB_LDFLAGS)
3475AC_SUBST(MARIADB_LIBS)
2cfe4482
VK
3476AC_SUBST(PGSQL_CPPFLAGS)
3477AC_SUBST(PGSQL_LDFLAGS)
6fce76d8 3478AC_SUBST(PGSQL_LIBS)
2cfe4482
VK
3479AC_SUBST(ORACLE_CPPFLAGS)
3480AC_SUBST(ORACLE_LDFLAGS)
7d8c91ef 3481AC_SUBST(ORACLE_LIBS)
2cfe4482
VK
3482AC_SUBST(ODBC_CPPFLAGS)
3483AC_SUBST(ODBC_LDFLAGS)
6fce76d8 3484AC_SUBST(ODBC_LIBS)
2cfe4482
VK
3485AC_SUBST(DB2_CPPFLAGS)
3486AC_SUBST(DB2_LDFLAGS)
84277a0f 3487AC_SUBST(DB2_LIBS)
2cfe4482
VK
3488AC_SUBST(INFORMIX_CPPFLAGS)
3489AC_SUBST(INFORMIX_LDFLAGS)
87f1fff0 3490AC_SUBST(INFORMIX_LIBS)
1647762a 3491AC_SUBST(INSTALL_LIBPATH)
11ce9a66 3492AC_SUBST(OBJECT_MODE)
9113e749 3493AC_SUBST(SQLFLAGS)
cbc4d191 3494AC_SUBST(SHLIB_SUFFIX)
b14c3f22
VK
3495AC_SUBST(TUXEDO_CPPFLAGS)
3496AC_SUBST(TUXEDO_LDFLAGS)
6d14d0b0 3497AC_SUBST(TUXEDO_LIBS)
c7c6ce77 3498AC_SUBST(TUXEDO_TPINIT)
d6235717 3499AC_SUBST(MONGODB_CPPFLAGS)
3500AC_SUBST(MONGODB_LDFLAGS)
3501AC_SUBST(MONGODB_LIBS)
123800f4
VK
3502AC_SUBST(MQTT_CPPFLAGS)
3503AC_SUBST(MQTT_LDFLAGS)
fab0916b 3504AC_SUBST(MQTT_LIBS)
b7c8729b 3505AC_SUBST(VMGR_CPPFLAGS)
3506AC_SUBST(VMGR_LDFLAGS)
3507AC_SUBST(VMGR_LIBS)
1647762a
VK
3508AC_SUBST(XEN_CPPFLAGS)
3509AC_SUBST(XEN_LDFLAGS)
3510AC_SUBST(XEN_LIBS)
7fcdcb0c
VK
3511AC_SUBST(ZEROMQ_CPPFLAGS)
3512AC_SUBST(ZEROMQ_LDFLAGS)
d16cf8a5 3513
ef0c727b
VK
3514#--------------------------------------------------------------------
3515# Shared libs versions
d16cf8a5
AK
3516#
3517# versioning scheme: current:revision:age
3518#
3519# current
3520# The number of the current interface exported by the library. A current
3521# value of `0', means that you are calling the interface exported by this
3522# library interface 0.
3523#
3524# revision
3525# The implementation number of the most recent interface exported by this
3526# library. In this case, a revision value of `0' means that this is the
3527# first implementation of the interface.
3528# If the next release of this library exports the same interface, but has a
3529# different implementation (perhaps some bugs have been fixed), the revision
3530# number will be higher, but current number will be the same. In that case,
3531# when given a choice, the library with the highest revision will always
3532# be used by the runtime loader.
3533#
3534# age
3535# The number of previous additional interfaces supported by this library.
3536# If age were `2', then this library can be linked into executables which
3537# were built with a release of this library that exported the current
3538# interface number, current, or any of the previous two interfaces.
3539# By definition age must be less than or equal to current. At the outset,
3540# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 3541#--------------------------------------------------------------------
d16cf8a5 3542
359784de 3543NETXMS_LIBRARY_VERSION=2:0:0
c7d14846 3544AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 3545
ef0c727b
VK
3546#--------------------------------------------------------------------
3547# Generate output files
3548#--------------------------------------------------------------------
d16cf8a5
AK
3549
3550AC_CONFIG_FILES([
0c3c0c39
AK
3551 Makefile
3552 contrib/Makefile
36874eca
VK
3553 contrib/backgrounds/Makefile
3554 contrib/integration/Makefile
3555 contrib/integration/HP_EVA/Makefile
bad6cc0c 3556 contrib/integration/HP_P2000/Makefile
36874eca 3557 contrib/mibs/Makefile
19e3290a 3558 contrib/music/Makefile
0c3c0c39 3559 contrib/startup/Makefile
b3d9f3b8 3560 contrib/startup/systemd/Makefile
fa66d60c 3561 contrib/startup/debian/Makefile
daaefaaf 3562 contrib/startup/gentoo/Makefile
7483d0bf 3563 contrib/startup/hp-ux/Makefile
0c3c0c39 3564 contrib/startup/redhat/Makefile
5de3893d 3565 contrib/startup/suse/Makefile
9993edf4 3566 contrib/startup/ubuntu/Makefile
6adf3219 3567 contrib/startup/solaris/Makefile
03b96461 3568 contrib/templates/Makefile
0c3c0c39 3569 doc/Makefile
a48203d2
VK
3570 doc/internal/Makefile
3571 doc/manuals/Makefile
3572 doc/misc/Makefile
0c3c0c39
AK
3573 images/Makefile
3574 include/Makefile
8e9db1a9 3575 include/msvc/Makefile
0c3c0c39 3576 m4/Makefile
0c3c0c39 3577 src/Makefile
9191f6ad
VK
3578 src/agent/Makefile
3579 src/agent/core/Makefile
3580 src/agent/install/Makefile
359784de 3581 src/agent/libnxagent/Makefile
52275230 3582 src/agent/libnxappc/Makefile
a2a24e9d 3583 src/agent/libnxsd/Makefile
c7c6ce77 3584 src/agent/libnxtux/Makefile
9191f6ad 3585 src/agent/subagents/Makefile
9191f6ad 3586 src/agent/subagents/aix/Makefile
297be545 3587 src/agent/subagents/bind9/Makefile
df8b3df7 3588 src/agent/subagents/darwin/Makefile
52f5ee00
VK
3589 src/agent/subagents/db2/Makefile
3590 src/agent/subagents/dbquery/Makefile
ab1e80fd 3591 src/agent/subagents/devemu/Makefile
e58b0f75 3592 src/agent/subagents/ds18x20/Makefile
80e96a82 3593 src/agent/subagents/ecs/Makefile
ab1e80fd 3594 src/agent/subagents/filemgr/Makefile
9191f6ad 3595 src/agent/subagents/freebsd/Makefile
478ee38b 3596 src/agent/subagents/gps/Makefile
80e96a82
VK
3597 src/agent/subagents/hpux/Makefile
3598 src/agent/subagents/informix/Makefile
9191f6ad 3599 src/agent/subagents/ipso/Makefile
50e4bc8c
VK
3600 src/agent/subagents/java/Makefile
3601 src/agent/subagents/java/java/Makefile
9ea35a1c 3602 src/agent/subagents/jmx/Makefile
80e96a82 3603 src/agent/subagents/linux/Makefile
df8b3df7 3604 src/agent/subagents/lmsensors/Makefile
80e96a82 3605 src/agent/subagents/logwatch/Makefile
ce9e00cc 3606 src/agent/subagents/lorawan/Makefile
cfcfdd2b 3607 src/agent/subagents/minix/Makefile
fab0916b 3608 src/agent/subagents/mqtt/Makefile
405fb3ad 3609 src/agent/subagents/mysql/Makefile
80e96a82 3610 src/agent/subagents/netbsd/Makefile
df8b3df7 3611 src/agent/subagents/netsvc/Makefile
80e96a82
VK
36