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