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