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