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