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