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