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