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