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