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