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