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