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