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