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