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