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