Fixed typo mistake
[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
3118008e 7AC_INIT([NetXMS], [2.0-RC1], [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
fecf6a2b
VK
102#--------------------------------------------------------------------
103# Common compilation flags
104#--------------------------------------------------------------------
105
842c22f4 106CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DTRE_WCHAR=1"
fecf6a2b
VK
107
108
ef0c727b
VK
109#--------------------------------------------------------------------
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
ef0c727b
VK
143AC_ARG_WITH(agent,
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"
ab2c09bb 519 SUBAGENT_DIRS="linux ds18x20 freebsd openbsd netbsd sunos aix ipso hpux odbcquery informix oracle lmsensors darwin rpi java ubntlw 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
12313882
VK
544#--------------------------------------------------------------------
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
ef0c727b
VK
556#--------------------------------------------------------------------
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
ab2c09bb 787 SUBAGENT_DIRS="$SUBAGENT_DIRS java ubntlw"
50e4bc8c
VK
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
ef0c727b
VK
842#--------------------------------------------------------------------
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
3118008e
VK
919 AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions)
920 OLD_CXXFLAGS="$CXXFLAGS"
921 CXXFLAGS="$CXXFLAGS -fno-exceptions"
922 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
923 [ AC_MSG_RESULT(yes) ],
924 [
925 CXXFLAGS="$OLD_CXXFLAGS"
926 AC_MSG_RESULT(no)
927 ])
ef0c727b
VK
928
929 AC_LANG_POP([C++])
930
9b318048
VK
931 MACHINE=`uname -m`
932 if test "x$MACHINE" = "xi686" -o "x$MACHINE" = "xi586"; then
933 AC_MSG_CHECKING(whether C compiler accepts -march=$MACHINE)
934 OLD_CPPFLAGS="$CPPFLAGS"
935 CPPFLAGS="$CPPFLAGS -march=$MACHINE"
936 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
937 [
938 AC_MSG_RESULT(yes)
939 ],
940 [
941 CPPFLAGS="$OLD_CPPFLAGS"
942 AC_MSG_RESULT(no)
943 ])
944 fi
945
779ce551 946 if test "x$PLATFORM" = "xHP-UX"; then
cc297a70
VK
947 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
948 AC_MSG_CHECKING(whether C compiler accepts -milp32)
949 OLD_CPPFLAGS="$CPPFLAGS"
950 CPPFLAGS="$CPPFLAGS -milp32"
951 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
952 [
953 LDFLAGS="-milp32 $LDFLAGS"
954 AC_MSG_RESULT(yes)
955 ],
956 [
957 CPPFLAGS="$OLD_CPPFLAGS"
958 AC_MSG_RESULT(no)
959 ])
960 else
961 AC_MSG_CHECKING(whether C compiler accepts -mlp64)
962 OLD_CPPFLAGS="$CPPFLAGS"
963 CPPFLAGS="$CPPFLAGS -mlp64"
964 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
965 [
966 LDFLAGS="-mlp64 -L/usr/lib/hpux64 -L/usr/local/lib/hpux64 $LDFLAGS"
967 AC_MSG_RESULT(yes)
968 ],
969 [
970 CPPFLAGS="$OLD_CPPFLAGS"
971 AC_MSG_RESULT(no)
972 ])
973 fi
974 fi
975
976 if test "x$PLATFORM" = "xAIX"; then
977 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
978 AC_MSG_CHECKING(whether C compiler accepts -maix32)
979 OLD_CPPFLAGS="$CPPFLAGS"
980 CPPFLAGS="$CPPFLAGS -maix32"
fecf6a2b 981 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
982 [
983 LDFLAGS="-maix32 $LDFLAGS"
5482ef16
VK
984 LTINIT_CC="$CC -maix32"
985 LTINIT_CXX="$CXX -maix32"
1c45282c 986 OBJECT_MODE=32
cc297a70
VK
987 AC_MSG_RESULT(yes)
988 ],
989 [
990 CPPFLAGS="$OLD_CPPFLAGS"
991 AC_MSG_RESULT(no)
992 ])
993 else
994 AC_MSG_CHECKING(whether C compiler accepts -maix64)
995 OLD_CPPFLAGS="$CPPFLAGS"
996 CPPFLAGS="$CPPFLAGS -maix64"
fecf6a2b 997 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
998 [
999 LDFLAGS="-maix64 $LDFLAGS"
5482ef16
VK
1000 LTINIT_CC="$CC -maix64"
1001 LTINIT_CXX="$CXX -maix64"
1c45282c 1002 OBJECT_MODE=64
cc297a70
VK
1003 AC_MSG_RESULT(yes)
1004 ],
1005 [
1006 CPPFLAGS="$OLD_CPPFLAGS"
1007 AC_MSG_RESULT(no)
1008 ])
1009 fi
779ce551 1010 fi
d358c73f
VK
1011
1012 if test "x$PLATFORM" = "xSunOS"; then
1013 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1014 AC_MSG_CHECKING(whether C compiler accepts -m32)
1015 OLD_CPPFLAGS="$CPPFLAGS"
1016 CPPFLAGS="$CPPFLAGS -m32"
1017 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1018 [
1019 LDFLAGS="-m32 $LDFLAGS"
1020 AC_MSG_RESULT(yes)
1021 ],
1022 [
1023 CPPFLAGS="$OLD_CPPFLAGS"
1024 AC_MSG_RESULT(no)
1025 ])
1026 else
1027 AC_MSG_CHECKING(whether C compiler accepts -m64)
1028 OLD_CPPFLAGS="$CPPFLAGS"
1029 CPPFLAGS="$CPPFLAGS -m64"
1030 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1031 [
1032 LDFLAGS="-m64 $LDFLAGS"
1033 AC_MSG_RESULT(yes)
1034 ],
1035 [
1036 CPPFLAGS="$OLD_CPPFLAGS"
1037 AC_MSG_RESULT(no)
1038 ])
1039 fi
1040 fi
779ce551 1041
3ac3594a
VK
1042
1043 if test "x$PLATFORM" = "xLinux"; then
1044 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1045 AC_MSG_CHECKING(whether C compiler accepts -m32)
1046 OLD_CPPFLAGS="$CPPFLAGS"
1047 CPPFLAGS="$CPPFLAGS -m32"
1048 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1049 [
1050 LDFLAGS="-m32 $LDFLAGS"
1051 AC_MSG_RESULT(yes)
1052 ],
1053 [
1054 CPPFLAGS="$OLD_CPPFLAGS"
1055 AC_MSG_RESULT(no)
1056 ])
1057 fi
1058 fi
1059
ce5592b2
VK
1060 if test "x$ENABLE_DEBUG" = "xyes"; then
1061 CPPFLAGS="$CPPFLAGS -ggdb3"
1062 fi
ef0c727b
VK
1063fi
1064
cfd95c74
VK
1065if test "x$CXX" = "xaCC" ; then
1066 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
451b735a
VK
1067 if test "x$HPUX_HPPA" = "xyes"; then
1068 ARCHFLAG="+DA1.1"
1069 else
1070 ARCHFLAG="+DD32"
1071 fi
1072 AC_MSG_CHECKING(whether C compiler accepts $ARCHFLAG)
4d37b0c5 1073 OLD_CPPFLAGS="$CPPFLAGS"
451b735a 1074 CPPFLAGS="$ARCHFLAG $CPPFLAGS"
cfd95c74
VK
1075 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1076 [
451b735a
VK
1077 LDFLAGS="$ARCHFLAG $LDFLAGS"
1078 CCASFLAGS="$ARCHFLAG $CCASFLAGS"
cfd95c74
VK
1079 AC_MSG_RESULT(yes)
1080 ],
1081 [
4d37b0c5
VK
1082 CPPFLAGS="$OLD_CPPFLAGS"
1083 AC_MSG_RESULT(no)
cfd95c74 1084 ])
4d37b0c5 1085 else
451b735a
VK
1086 if test "x$HPUX_HPPA" = "xyes"; then
1087 ARCHFLAG="+DA2.0W"
1088 else
1089 ARCHFLAG="+DD64"
1090 fi
1091 AC_MSG_CHECKING(whether C compiler accepts $ARCHFLAG)
cfd95c74 1092 OLD_CPPFLAGS="$CPPFLAGS"
451b735a 1093 CPPFLAGS="$ARCHFLAG $CPPFLAGS"
cfd95c74
VK
1094 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1095 [
451b735a
VK
1096 LDFLAGS="$ARCHFLAG $LDFLAGS"
1097 CCASFLAGS="$ARCHFLAG $CCASFLAGS"
cfd95c74
VK
1098 AC_MSG_RESULT(yes)
1099 ],
1100 [
1101 CPPFLAGS="$OLD_CPPFLAGS"
1102 AC_MSG_RESULT(no)
1103 ])
4d37b0c5 1104 fi
ef0c727b
VK
1105fi
1106
df9812a9 1107if test "x$CXX" = "xxlC_r" ; then
d1cb61cf 1108 SQLFLAGS="-qnoppline"
9b99f1c0
VK
1109 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1110 AC_MSG_CHECKING(whether C compiler accepts -q32)
1111 OLD_CPPFLAGS="$CPPFLAGS"
1112 CPPFLAGS="-q32 $CPPFLAGS"
1113 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1114 [
1115 LDFLAGS="-q32 $LDFLAGS"
df9812a9 1116 OBJECT_MODE=32
9b99f1c0
VK
1117 AC_MSG_RESULT(yes)
1118 ],
1119 [
1120 CPPFLAGS="$OLD_CPPFLAGS"
1121 AC_MSG_RESULT(no)
1122 ])
1123 else
1124 AC_MSG_CHECKING(whether C compiler accepts -q64)
1125 OLD_CPPFLAGS="$CPPFLAGS"
1126 CPPFLAGS="-q64 $CPPFLAGS"
1127 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1128 [
1129 LDFLAGS="-q64 $LDFLAGS"
df9812a9 1130 OBJECT_MODE=64
9b99f1c0
VK
1131 AC_MSG_RESULT(yes)
1132 ],
1133 [
1134 CPPFLAGS="$OLD_CPPFLAGS"
1135 AC_MSG_RESULT(no)
1136 ])
1137 fi
1138fi
1139
9113e749
VK
1140if test "x$CXX" = "xCC" ; then
1141 SQLFLAGS="-Qn"
1142 CPPFLAGS="$CPPFLAGS -mt"
3bc41d67 1143 CXXFLAGS="$CXXFLAGS -erroff=badargtype2w,wbadinit"
9113e749
VK
1144
1145 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
1146 AC_MSG_CHECKING(whether C compiler accepts -m32)
f5e5296e
VK
1147 count=`$CC -flags | grep '^\-m32 ' | wc -l`
1148 if test $count -eq 1; then
1149 AC_MSG_RESULT(yes)
1150 CPPFLAGS="$CPPFLAGS -m32"
1151 LDFLAGS="-m32 $LDFLAGS"
1152 else
1153 AC_MSG_RESULT(no)
1154 fi
9113e749 1155 else
c3900dbb 1156 TEST_XARCH="no"
9113e749 1157 AC_MSG_CHECKING(whether C compiler accepts -m64)
f5e5296e
VK
1158 count=`$CC -flags | grep '^\-m64 ' | wc -l`
1159 if test $count -eq 1; then
1160 AC_MSG_RESULT(yes)
1161 CPPFLAGS="$CPPFLAGS -m64"
1162 LDFLAGS="-m64 $LDFLAGS"
1163 else
1164 AC_MSG_RESULT(no)
1165 TEST_XARCH="yes"
1166 fi
c3900dbb
VK
1167 if test "x$TEST_XARCH" = "xyes"; then
1168 if test "x$CPUTYPE" = "xsparc"; then
1169 ARCH="-xarch=v9"
1170 else
1171 ARCH="-xarch=amd64"
1172 fi
1173 AC_MSG_CHECKING(whether C compiler accepts $ARCH)
1174 OLD_CPPFLAGS="$CPPFLAGS"
1175 CPPFLAGS="$CPPFLAGS $ARCH"
1176 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
1177 [
1178 LDFLAGS="$ARCH $LDFLAGS"
1179 AC_MSG_RESULT(yes)
1180 ],
1181 [
1182 CPPFLAGS="$OLD_CPPFLAGS"
1183 AC_MSG_RESULT(no)
1184 ])
1185 fi
9113e749
VK
1186 fi
1187fi
1188
edb018d7
VK
1189
1190#--------------------------------------------------------------------
1191# Initialize libtool
1192#--------------------------------------------------------------------
1193
1194if test "x$STATIC_BUILD" = "xyes"; then
1195 enable_shared=no
1196 enable_static=yes
1197else
1198 enable_shared=yes
e99eba92
VK
1199 if test "x$BUILD_SDK" = "xyes"; then
1200 enable_static=yes
1201 else
1202 enable_static=no
1203 fi
edb018d7 1204fi
1ef5e57a
VK
1205
1206if test "x$LTINIT_CC" != "x"; then
1207 SAVED_CC="$CC"
1208 CC="$LTINIT_CC"
1209fi
1210if test "x$LTINIT_CXX" != "x"; then
1211 SAVED_CXX="$CXX"
1212 CXX="$LTINIT_CXX"
1213fi
1214
ff12e2f1 1215LT_PREREQ([2.2])
1ef5e57a
VK
1216LT_INIT([dlopen])
1217
1218if test "x$SAVED_CC" != "x"; then
1219 CC="$SAVED_CC"
1220fi
1221if test "x$SAVED_CXX" != "x"; then
1222 CXX="$SAVED_CXX"
1223fi
edb018d7
VK
1224
1225
cfd95c74
VK
1226#--------------------------------------------------------------------
1227# Additional include and library directories
1228#--------------------------------------------------------------------
ef0c727b 1229
cfd95c74
VK
1230if test "x$CXX" != "xaCC"; then
1231 if test -d /usr/local/include; then
5482ef16 1232 if test "x$ac_compiler_gnu" = "xyes"; then
cfd95c74
VK
1233 AC_MSG_CHECKING(whether -I/usr/local/include needed)
1234 OLD_CPPFLAGS="$CPPFLAGS"
1235 CPPFLAGS="$CPPFLAGS -Werror -I/usr/local/include"
2adc2d49 1236 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
cfd95c74
VK
1237 [
1238 CPPFLAGS="$OLD_CPPFLAGS -I/usr/local/include"
1239 AC_MSG_RESULT(yes)
1240 ],
1241 [
1242 CPPFLAGS="$OLD_CPPFLAGS"
1243 AC_MSG_RESULT(no)
1244 ]
1245 )
1246 else
1247 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
1248 fi
1249 fi
1250
1251 if test -d /usr/kerberos/include; then
1252 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1253 fi
ef0c727b 1254
cfd95c74
VK
1255 if test -d /usr/local/lib; then
1256 LDFLAGS="$LDFLAGS -L/usr/local/lib"
1257 fi
1258fi
ef0c727b 1259
de4c0511
VK
1260
1261#--------------------------------------------------------------------
1262# Check for additional system libraries
1263#--------------------------------------------------------------------
1264
1265AC_CHECK_LIB(xnet, accept)
1266AC_CHECK_LIB(socket, if_nameindex)
1267AC_CHECK_LIB(dl, dlopen)
1268AC_CHECK_LIB(kstat, kstat_open)
1269
1270# sockets/resolver
1271if test "$BUILD_SERVER-$XMPP_SUPPORT" = "yes-yes"; then
1272 AC_CHECK_HEADERS([arpa/nameser_compat.h])
1273 AC_CHECK_FUNC(res_query, , [AC_CHECK_LIB(resolv, res_query, [], [AC_CHECK_LIB(resolv, __res_query)])])
1274fi
1275AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
1276AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
1277AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
1278
1279if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
1280 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
1281fi
1282
1283if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
1284 AC_MSG_CHECKING([if we can include libnsl + libsocket])
1285 LIBS="-lnsl -lsocket $LIBS"
1286 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
1287 if test "$my_ac_link_result" = "no" ; then
1288 AC_MSG_RESULT([failure])
1289 AC_MSG_ERROR([unable to use gethostbyname()])
1290 else
1291 AC_MSG_RESULT([success])
1292 fi
1293fi
1294
1295
ef0c727b
VK
1296#--------------------------------------------------------------------
1297# Check for threads library - either POSIX or GNU
1298#--------------------------------------------------------------------
1299
1300if test "x$USE_PTH" = "xyes"; then
1301 AC_CHECK_HEADER(pth.h,,AC_MSG_ERROR([*** GNU Pth thread support not installed - please install first ***]))
1302else
1303 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
1304
1305 if test "x$CXX" = "xaCC"; then
1306 PTHREAD_LIBS=""
1307 else
1308 PTHREAD_LIBS="error"
1309 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
1310 AC_EGREP_CPP(yes,
1311 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
1312 yes
1313 #endif
1314 ], AC_MSG_RESULT(yes)
fecf6a2b 1315 PTHREAD_LIBS="-pthread",
ef0c727b
VK
1316 AC_MSG_RESULT(no))
1317 if test "x$PTHREAD_LIBS" = "xerror"; then
1318 AC_CHECK_LIB(pthread, pthread_attr_init,
1319 PTHREAD_LIBS="-lpthread")
1320 fi
f725c1b7 1321 # On HP-UX (at least 11.00) pthread library contains
b041c587 1322 # __pthread_attr_init_system instead of pthread_attr_init
f725c1b7 1323 if test "x$PTHREAD_LIBS" = "xerror"; then
b041c587 1324 AC_CHECK_LIB(pthread, __pthread_attr_init_system,
f725c1b7
VK
1325 PTHREAD_LIBS="-lpthread")
1326 fi
ef0c727b
VK
1327 if test "x$PTHREAD_LIBS" = "xerror"; then
1328 AC_CHECK_LIB(pthreads, pthread_attr_init,
1329 PTHREAD_LIBS="-lpthreads")
1330 fi
1331 if test "x$PTHREAD_LIBS" = "xerror"; then
1332 AC_CHECK_FUNC(pthread_attr_init,
1333 PTHREAD_LIBS="")
1334 fi
1335 fi
1336
1337 if test "x$PTHREAD_LIBS" = "xerror"; then
1338 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
1339 fi
8d131dda 1340 LIBS="$LIBS $PTHREAD_LIBS"
ef0c727b
VK
1341
1342 # Extensions to posix threads
1343 AC_CHECK_HEADERS([pthread_np.h],,,[
9c29f76e 1344#include <pthread.h>
ef0c727b
VK
1345 ])
1346 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
1347
1348 # Check for recursive mutexes
39086394
VK
1349 AC_CHECK_FUNCS([pthread_mutexattr_settype __pthread_mutexattr_settype pthread_mutexattr_setkind_np])
1350 AC_CHECK_DECLS([pthread_mutexattr_settype, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
9c29f76e
VK
1351#include <pthread.h>
1352#if HAVE_PTHREAD_NP_H
1353#include <pthread_np.h>
1354#endif
ef0c727b
VK
1355 ])
1356
1357 # Check for read/write locks
1358 # On Linux, rwlock functions declared always, but pthread_rwlock_t may need
1359 # additional defines
1360 AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
1361 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
1362 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
afd0c386
VK
1363 [AC_COMPILE_IFELSE([
1364 AC_LANG_PROGRAM([
9c29f76e
VK
1365#include <sys/types.h>
1366#include <pthread.h>
afd0c386
VK
1367 ],
1368 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b 1369 ac_cv_struct_pthread_rw=yes, [
afd0c386
VK
1370 AC_COMPILE_IFELSE([
1371 AC_LANG_PROGRAM([
9c29f76e
VK
1372#define _XOPEN_SOURCE 500
1373#include <sys/types.h>
1374#include <pthread.h>
afd0c386
VK
1375 ],
1376 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b
VK
1377 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
1378 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1379 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
1380 fi
1381 ])])
1382 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1383 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
1384 fi
1385 fi
1386
1387fi
1388
1389
1390#--------------------------------------------------------------------
1391# Checks for OpenSSL
1392#--------------------------------------------------------------------
1393
1394if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
1395 AC_CHECK_LIB(crypto, RSA_new,
1396 [
2cfe4482 1397 AC_DEFINE(WITH_OPENSSL, 1, Define to 1 if you have OpenSSL library and headers)
ef0c727b 1398 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
e0a77f08 1399 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
ef0c727b 1400 AC_CHECK_LIB(crypto, EVP_bf_cbc,
e0a77f08 1401 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
ef0c727b 1402 AC_CHECK_LIB(crypto, EVP_idea_cbc,
e0a77f08 1403 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
ef0c727b 1404 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
e0a77f08 1405 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
d27e7413 1406 SERVER_LIBS="$SERVER_LIBS -lssl"
e0a77f08
VK
1407 if test "x$HAVE_LIBCRYPTO" = "xyes"; then
1408 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
1409# LIBS="$LIBS -Wl,-Bstatic -lcrypto -Wl,-Bdynamic"
1410 LIBS="$LIBS -lcrypto"
1411 else
1412 LIBS="$LIBS -lcrypto"
1413 fi
1414 else
058bf6fc 1415 AC_MSG_ERROR(libcrypto does not provide any suitable encryption algorithm)
e0a77f08 1416 fi
ef0c727b
VK
1417 ],
1418 [
058bf6fc 1419 AC_MSG_ERROR(libcrypto is required for encryption support)
ef0c727b
VK
1420 ])
1421fi
1422
1423
0322eed7
VK
1424#--------------------------------------------------------------------
1425# Checks for header files
1426#--------------------------------------------------------------------
1427
1428AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h alloca.h])
2e98cdb4 1429AC_CHECK_HEADERS([sys/int_types.h time.h sys/time.h sys/utsname.h sys/wait.h])
e9c8eb1d 1430AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h netinet/tcp.h net/nh.h sys/socket.h])
0322eed7
VK
1431AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
1432AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
c1099678 1433AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h locale.h])
df9812a9 1434AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h])
5962498b 1435AC_CHECK_HEADERS([grp.h pwd.h malloc.h])
f09c2d05 1436AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
0322eed7
VK
1437[[#ifdef HAVE_SYS_TYPES_H
1438# include <sys/types.h>
1439#endif
1440#ifdef HAVE_SYS_TIME_H
1441# include <sys/time.h>
1442#endif
1443#ifdef HAVE_SYS_SOCKET_H
1444# include <sys/socket.h>
1445#endif
1446]])
1447
1448
b8adb0f2
VK
1449#--------------------------------------------------------------------
1450# Checks for IPv6 support
1451#--------------------------------------------------------------------
1452
1453if test "x$DISABLE_IPV6" != "xyes"; then
1454 AC_CHECK_DECL(AF_INET6,,,[
1455#if HAVE_NETINET_IN_H
1456#include <netinet/in.h>
1457#endif
1458 ])
1459 if test "x$ac_cv_have_decl_AF_INET6" = "xyes"; then
1460 AC_CHECK_TYPE(struct sockaddr_in6, [
1461 AC_DEFINE(WITH_IPV6, 1, Define to have IPv6 support)
1462 IPV6_SUPPORT="yes"
1463 ],,[
1464#if HAVE_NETINET_IN_H
1465#include <netinet/in.h>
1466#endif
1467 ])
1468 fi
1469fi
1470
ef0c727b
VK
1471#--------------------------------------------------------------------
1472# Checks for other libs.
1473#--------------------------------------------------------------------
d16cf8a5 1474
e0760102 1475if test "x$BUILD_SERVER" = "xyes" ; then
7c48e2aa 1476 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
1477 if test "x$DISABLE_READLINE" = "xno"; then
1478 AC_CHECK_LIB(readline, readline, [SERVER_LIBS="$SERVER_LIBS -lreadline"], [AC_CHECK_LIB(edit, readline, [SERVER_LIBS="$SERVER_LIBS -ledit"])])
1479 fi
1fd17e2d 1480 AC_CHECK_LIB(rt, timer_create, [SERVER_LIBS="$SERVER_LIBS -lrt"])
7c48e2aa
VK
1481 SAVED_LDFLAGS="$LDFLAGS"
1482 LDFLAGS="$LDFLAGS $SERVER_LIBS"
1483
1fd17e2d
VK
1484 AC_CHECK_FUNCS([readline timer_create])
1485 AC_CHECK_TYPES([timer_t])
0322eed7
VK
1486
1487 # Check if passing rl_insert to rl_bind_key needs cast
1488 if test "$ac_cv_func_readline" = "yes"; then
1489 AC_LANG_PUSH([C++])
1490
1491 AC_MSG_CHECKING(for rl_insert cast)
1492
afd0c386 1493 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1494 [
1495#include <stdio.h>
1496#include <readline/readline.h>
afd0c386 1497 ],[ rl_bind_key('\t', (Function *)rl_insert); ])],
0322eed7
VK
1498 [
1499 AC_MSG_RESULT((Function *))
1500 AC_DEFINE(RL_INSERT_CAST,(Function *),Required cast for rl_insert)
1501 ],[
afd0c386 1502 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1503 [
1504#include <stdio.h>
1505#include <readline/readline.h>
afd0c386 1506 ],[ rl_bind_key('\t', (rl_command_func_t *)rl_insert); ])],
0322eed7
VK
1507 [
1508 AC_MSG_RESULT((rl_command_func_t *))
1509 AC_DEFINE(RL_INSERT_CAST,(rl_command_func_t *),Required cast for rl_insert)
1510 ],[
1511 AC_MSG_RESULT(not needed)
1512 AC_DEFINE(RL_INSERT_CAST,,Required cast for rl_insert)
1513 ]
1514 )
1515 ]
1516 )
1517
1518 AC_LANG_POP([C++])
1519 fi
7c48e2aa 1520 LDFLAGS="$SAVED_LDFLAGS"
e0760102
VK
1521fi
1522
ef0c727b 1523if test "x$NEED_ZLIB" = "xyes"; then
1fd41bcd
VK
1524 if test "x$FORCE_INTERNAL_ZLIB" = "xyes"; then
1525 HAVE_ZLIB=no
1526 else
1527 HAVE_ZLIB=yes
1528 AC_CHECK_HEADER(zlib.h,,HAVE_ZLIB=no)
1529 if test "x$HAVE_ZLIB" = "xyes"; then
1530 AC_CHECK_LIB(z, deflate, [], [ HAVE_ZLIB=no ])
1531 fi
1532 fi
1533 if test "x$HAVE_ZLIB" = "xno"; then
1534 MODULES="zlib $MODULES"
1535 fi
ef0c727b
VK
1536fi
1537
467c489f
VK
1538if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
1539 HAVE_LIBEXPAT=no
1540else
1541 HAVE_LIBEXPAT=yes
1542 AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
1543 AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
1544fi
80ce37ac
VK
1545if test "x$HAVE_LIBEXPAT" = "xno"; then
1546 MODULES="libexpat $MODULES"
1bb6b449 1547fi
ef0c727b 1548
17b35ccc
VK
1549if test "x$FORCE_INTERNAL_LIBTRE" = "xyes"; then
1550 HAVE_LIBTRE=no
1551else
1552 HAVE_LIBTRE=yes
1553 AC_CHECK_HEADER(tre/regex.h,,HAVE_LIBTRE=no)
1554 AC_CHECK_LIB(tre, tre_compile, [], [ HAVE_LIBTRE=no ])
1555fi
1556if test "x$HAVE_LIBTRE" = "xno"; then
1557 MODULES="libtre $MODULES"
1558 AC_DEFINE(USE_BUNDLED_LIBTRE,1,Define to 1 if bundled libtre is used)
a67fa146 1559
720c23d0
VK
1560 tre_version_1='0'
1561 tre_version_2='8'
1562 tre_version_3='0'
a67fa146
VK
1563 tre_version=$tre_version_1.$tre_version_2.$tre_version_3
1564 AC_DEFINE_UNQUOTED(TRE_VERSION, "$tre_version", [ TRE version string. ])
1565 AC_DEFINE_UNQUOTED(TRE_VERSION_1, $tre_version_1, [ TRE version level 1. ])
1566 AC_DEFINE_UNQUOTED(TRE_VERSION_2, $tre_version_2, [ TRE version level 2. ])
1567 AC_DEFINE_UNQUOTED(TRE_VERSION_3, $tre_version_3, [ TRE version level 3. ])
1568 AC_SUBST(TRE_VERSION, $tre_version)
1569
1570 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])
1571 AC_DEFINE(TRE_APPROX, 1, [ Define if you want to enable approximate matching functionality. ])
17b35ccc 1572fi
ef0c727b 1573
f5393033
VK
1574if test "x$FORCE_INTERNAL_JANSSON" = "xyes"; then
1575 HAVE_JANSSON=no
1576else
1577 HAVE_JANSSON=yes
1578 AC_CHECK_HEADER(jansson.h,,HAVE_JANSSON=no)
1579 AC_CHECK_LIB(jansson, json_object, [ HAVE_JANSSON=yes ], [ HAVE_JANSSON=no ])
1580fi
1581if test "x$HAVE_JANSSON" = "xno"; then
1582 MODULES="jansson $MODULES"
1583fi
1584
4050bafb
VK
1585if test "x$DISABLE_LMSENSORS" = "xno"; then
1586 HAVE_LMSENSORS=yes
1587 AC_CHECK_HEADER(sensors/sensors.h,,HAVE_LMSENSORS=no)
1588 if test "x$HAVE_LMSENSORS" = "xyes"; then
1589 AC_CHECK_LIB(sensors, sensors_init, [ DUMMY="" ], [ HAVE_LMSENSORS=no ])
1590 fi
1591 if test "x$HAVE_LMSENSORS" = "xyes"; then
1592 SUBAGENT_DIRS="$SUBAGENT_DIRS lmsensors"
1593 fi
38bfa5da
AK
1594fi
1595
0a4194c2
AK
1596AC_CHECK_HEADER(curl/curl.h,HAVE_LIBCURL=yes,HAVE_LIBCURL=no)
1597if test "x$HAVE_LIBCURL" = "xyes"; then
2368dc85
VK
1598 AC_CHECK_LIB(curl, curl_global_init, [ HAVE_LIBCURL=yes ], [ HAVE_LIBCURL=no ])
1599 AC_CHECK_DECLS([CURLOPT_NOSIGNAL, curl_version_info],,,[
1600#ifdef HAVE_CURL_CURL_H
1601#include <curl/curl.h>
1602#endif
1603])
0a4194c2 1604fi
d9177dd1 1605
0a4194c2 1606if test "x$HAVE_LIBCURL" = "xyes"; then
c80c69bd 1607 SUBAGENT_DIRS="$SUBAGENT_DIRS netsvc"
e47404b3 1608 SMSDRV_DIRS="$SMSDRV_DIRS kannel websms"
6fad8870 1609 HDLINK_DIRS="$HDLINK_DIRS jira"
3bc41d67 1610 AC_DEFINE(HAVE_LIBCURL, 1, Define to 1 if libcurl is available)
0a4194c2
AK
1611fi
1612
2cfe4482
VK
1613if test "x$LDAP_SUPPORT" = "xyes"; then
1614 AC_CHECK_HEADER(ldap.h,HAVE_LDAP=yes,HAVE_LDAP=no)
1615 if test "x$HAVE_LDAP" = "xyes"; then
1616 AC_CHECK_LIB(ldap, ldap_init, [ HAVE_LDAP=yes ], [ HAVE_LDAP=no ])
1617 fi
d9177dd1 1618 if test "x$HAVE_LDAP" = "xyes"; then
1619 SERVER_LIBS="-lldap $SERVER_LIBS"
2cfe4482 1620 AC_DEFINE(WITH_LDAP, 1, Define to 1 if you have LDAP libraries and headers)
d95c3dad
A
1621 AC_CHECK_HEADERS([ldap_ssl.h],,,
1622 [
1623#include <ldap.h>
a164b767 1624 ])
d95c3dad
A
1625 AC_CHECK_TYPES([ber_int_t],,,
1626 [
1627#include <ldap.h>
1628#if HAVE_LDAP_SSL_H
1629#include <ldap_ssl.h>
1630#endif
daa828ee 1631 ])
d95c3dad
A
1632
1633 OLD_LIBS="$LIBS"
1634 LIBS="$LIBS -lldap"
1635 AC_CHECK_FUNCS([ldap_initialize ldapssl_init])
1636 AC_CHECK_FUNCS([ldap_control_create ldap_create_control nsldapi_build_control])
1637 AC_CHECK_FUNCS([ldap_create_page_control ldap_parse_page_control])
1638 LIBS="$OLD_LIBS"
1639
1640 AC_CHECK_DECLS([nsldapi_build_control],,,
1641 [
1642#include <ldap.h>
1643#if HAVE_LDAP_SSL_H
1644#include <ldap_ssl.h>
1645#endif
b00236dd 1646 ])
d9177dd1 1647 fi
2cfe4482 1648 LDAP_SUPPORT="$HAVE_LDAP"
d9177dd1 1649fi
1650
ef0c727b
VK
1651#--------------------------------------------------------------------
1652# Checks for data types
1653#--------------------------------------------------------------------
1654
d16cf8a5
AK
1655AC_CHECK_SIZEOF(short)
1656AC_CHECK_SIZEOF(int)
1657AC_CHECK_SIZEOF(long)
1658AC_CHECK_SIZEOF(long long)
1659
1660AC_TYPE_PID_T
d16cf8a5
AK
1661AC_TYPE_SIZE_T
1662AC_STRUCT_TIMEZONE
1663
3071f10a 1664AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t])
51128b42 1665AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
4c779d83
VK
1666#if HAVE_SYS_TYPES_H
1667#include <sys/types.h>
1668#endif
1669#if HAVE_SYS_SOCKET_H
1670#include <sys/socket.h>
1671#endif
1672])
e0293f7f
VK
1673AC_CHECK_TYPES([struct stat64],,,[
1674#if HAVE_SYS_STAT_H
1675#include <sys/stat.h>
1676#endif
1677])
521d90e7 1678
e25cadc9 1679
ef0c727b
VK
1680#--------------------------------------------------------------------
1681# Checks for functions
1682#--------------------------------------------------------------------
d16cf8a5
AK
1683
1684AC_FUNC_ERROR_AT_LINE
d16cf8a5 1685AC_FUNC_MEMCMP
d16cf8a5
AK
1686AC_FUNC_SELECT_ARGTYPES
1687AC_FUNC_STRFTIME
1688AC_FUNC_STRTOD
1689AC_FUNC_VPRINTF
1690
80ce37ac 1691AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
c1099678 1692AC_CHECK_FUNCS([strrchr strlwr strtol strtoul strtoll strtoull setlocale])
467e30e1 1693AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
c601fc15 1694AC_CHECK_FUNCS([usleep nanosleep gmtime_r localtime_r stat64 fstat64 lstat64])
ecdf8898 1695AC_CHECK_FUNCS([fopen64 strptime timegm gethostbyname2_r getaddrinfo])
5962498b 1696AC_CHECK_FUNCS([itoa _itoa isatty getgrnam getpwnam malloc_info malloc_trim])
aa24418a 1697
9757ca46 1698AC_CHECK_DECLS([nanosleep, daemon, strerror])
be6467e9 1699
6f95ef89
VK
1700# Do not use inet_pton on Solaris as it has binary compatibility problems
1701if test "$PLATFORM" != "SunOS"; then
1702 AC_CHECK_FUNCS([inet_pton])
1703fi
1704
b0823d06
VK
1705# Check if strerror_r is POSIX-compliant
1706if test "$ac_cv_func_strerror_r" = "yes"; then
1707 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
1708 AC_LANG_PUSH([C++])
1709 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7f9423af
VK
1710#if HAVE_STRING_H
1711#include <string.h>
1712#endif
1713#if HAVE_ERRNO_H
1714#include <errno.h>
1715#endif
b0823d06 1716 ]],[[
7f9423af
VK
1717 int e;
1718 char buffer[256];
1719 e = strerror_r(1, buffer, 256);
1720 return e;
b0823d06
VK
1721 ]])
1722 ],[
1723 AC_MSG_RESULT(yes)
1724 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
1725 ],[
1726 AC_MSG_RESULT(no)
1727 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
1728 ])
1729 AC_LANG_POP([C++])
1730fi
1731
be6467e9
VK
1732# Check if struct tm has tm_gmtoff member
1733AC_MSG_CHECKING(for struct tm.tm_gmtoff)
1734AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1735#if HAVE_TIME_H
1736#include <time.h>
1737#endif
1738#if HAVE_SYS_TIME_H
1739#include <sys/time.h>
1740#endif
1741]],[[
be6467e9
VK
1742 struct tm t;
1743 return t.tm_gmtoff;
be6467e9
VK
1744]])
1745],[
1746AC_MSG_RESULT(yes)
1747AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
1748],[
1749AC_MSG_RESULT(no)
1750])
d16cf8a5 1751
f91feddc 1752AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
70fed300
AK
1753AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
1754
c6491611
VK
1755# asprintf, scprintf, etc.
1756AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
1757AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
342a701d 1758AC_CHECK_FUNCS([snprintf vsnprintf])
c6491611
VK
1759
1760AC_MSG_CHECKING(whether snprintf returns required buffer size)
1761AC_RUN_IFELSE(
1762 [AC_LANG_PROGRAM([
1763#include <stdio.h>
1764#include <string.h>
1765 ], [
1766 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
1767 ])
1768 ],
1769 [ AC_MSG_RESULT(yes)
1770 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
1771 ],
1772 [ AC_MSG_RESULT(no) ],
1773 [ AC_MSG_RESULT(no) ]
1774)
1775
1776
ef0c727b
VK
1777#--------------------------------------------------------------------
1778# Checks for macros and definitions
1779#--------------------------------------------------------------------
dff54fed 1780
ef0c727b
VK
1781AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
1782#ifdef HAVE_SYS_TYPES_H
99e50bb7 1783#include <sys/types.h>
ef0c727b
VK
1784#endif
1785#if HAVE_BYTESWAP_H
1786#include <byteswap.h>
1787#endif
1788#if HAVE_NETINET_IN_H
1789#include <netinet/in.h>
1790#endif
1791#if HAVE_NET_NH_H
1792#include <net/nh.h>
1793#endif
1794])
aa24418a
VK
1795AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
1796#ifdef HAVE_UNISTD_H
1797#include <unistd.h>
1798#endif
1799#ifdef HAVE_DLFCN_H
1800#include <dlfcn.h>
1801#endif
1802])
ce7565e7
VK
1803AC_CHECK_DECLS([va_copy, __va_copy],,,[
1804#ifdef HAVE_UNISTD_H
1805#include <unistd.h>
1806#endif
1807#ifdef HAVE_STDARG_H
1808#include <stdarg.h>
1809#endif
1810#ifdef HAVE_STDLIB_H
1811#include <stdlib.h>
1812#endif
1813])
dff54fed 1814
dff54fed 1815
df9812a9
VK
1816#--------------------------------------------------------------------
1817# getopt
1818#--------------------------------------------------------------------
1819
1820if test "x$FORCE_INTERNAL_GETOPT" = "xyes"; then
1821 AC_DEFINE([USE_BUNDLED_GETOPT], [1], [Define to 1 if bundled getopt must be used])
1822else
1823 AC_CHECK_HEADERS([getopt.h])
1824 AC_CHECK_LIB(gnugetopt, getopt_long)
1825 AC_CHECK_DECLS([getopt_long],,,[
1826#if HAVE_GETOPT_H
1827#include <getopt.h>
1828#endif
1829 ])
1830fi
1831
1832
671651a1
VK
1833#--------------------------------------------------------------------
1834# Linux specific checks
1835#--------------------------------------------------------------------
1836
1837if test "x$PLATFORM" = "xLinux"; then
1838 AC_CHECK_HEADERS([sys/reboot.h],,,[[ ]])
1839 AC_CHECK_DECLS([reboot, RB_AUTOBOOT, RB_POWER_OFF, RB_HALT_SYSTEM],,,[
1840#if HAVE_SYS_REBOOT_H
1841#include <sys/reboot.h>
1842#endif
1843 ])
1844 AC_CHECK_FUNCS([reboot],,,[
1845#if HAVE_SYS_REBOOT_H
1846#include <sys/reboot.h>
1847#endif
1848 ])
f92a016a
VK
1849
1850 AC_CHECK_HEADERS([jemalloc/jemalloc.h],
1851 [
1852 AC_CHECK_LIB(jemalloc, malloc,
1853 [
1854 WITH_JEMALLOC="yes"
1855 AC_DEFINE(WITH_JEMALLOC,1,Define to 1 if libjemalloc is used)
1856 ])
1857 ])
671651a1
VK
1858fi
1859
1860
ef0c727b
VK
1861#--------------------------------------------------------------------
1862# AIX specific checks
1863#--------------------------------------------------------------------
d16cf8a5 1864
ef0c727b
VK
1865if test "x$PLATFORM" = "xAIX"; then
1866 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
efdaffe4 1867 AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64, __sync_add_and_fetch, __sync_sub_and_fetch],,,[
df9812a9
VK
1868#if HAVE_PROCINFO_H
1869#include <procinfo.h>
1870#endif
1871 ])
ef0c727b
VK
1872 AC_CHECK_FUNCS([getprocs64],,,[
1873#if HAVE_PROCINFO_H
1874#include <procinfo.h>
6cd41ceb 1875#endif
ef0c727b 1876 ])
7e56bf2e
VK
1877fi
1878
cd4c8ca3 1879
f47bd4ca
VK
1880#--------------------------------------------------------------------
1881# Solaris specific checks
1882#--------------------------------------------------------------------
1883
1884if test "x$PLATFORM" = "xSunOS"; then
1885 AC_CHECK_FUNCS([atomic_inc_32_nv atomic_dec_32_nv],,,[
1886#include <sys/atomic.h>
1887 ])
1888fi
1889
1890
ba8db57b
VK
1891#--------------------------------------------------------------------
1892# HP-UX specific checks
1893#--------------------------------------------------------------------
1894
1895if test "x$PLATFORM" = "xHP-UX"; then
3268bb77 1896 AC_CHECK_HEADERS([atomic.h sys/mib.h],,,[[ ]])
f09c2d05
VK
1897 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
1898#if HAVE_NET_IF_H
1899#include <net/if.h>
1900#endif
1901 ])
1902 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
1903#if HAVE_SYS_MIB_H
1904#include <sys/mib.h>
1905#endif
1906 ])
cfd95c74
VK
1907
1908 AC_MSG_CHECKING(if pst_diskinfo has read/write stats fields)
1909 AC_LANG_PUSH([C++])
1910 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1911#include <sys/pstat.h>
1912 ]], [[
1913pst_diskinfo d;
1914int x;
1915x = (int)d.psd_dkread;
1916x = (int)d.psd_dkwrite;
1917 ]])],
1918 [
1919 AC_DEFINE([HAVE_DISKINFO_RWSTATS],[1],[Define to 1 if pst_diskinfo has read/write stats fields])
1920 AC_MSG_RESULT(yes)
1921 ],
1922 [
1923 AC_MSG_RESULT(no)
1924 ])
1925 AC_LANG_POP([C++])
ba8db57b
VK
1926fi
1927
1928
aa24418a
VK
1929#--------------------------------------------------------------------
1930# *BSD specific checks
1931#--------------------------------------------------------------------
1932
1933AC_CHECK_LIB(kvm, kvm_open)
1934AC_CHECK_FUNCS([kvm_getswapinfo])
1935AC_CHECK_TYPES([struct kinfo_proc2],,,[
1936#if HAVE_SYS_SYSCTL_H
1937#include <sys/sysctl.h>
1938#endif
1939])
1940
1941
28ba6824
VK
1942#--------------------------------------------------------------------
1943# FreeBSD specific checks
1944#--------------------------------------------------------------------
1945
1946if test "x$PLATFORM" = "xFreeBSD"; then
61f58c11
VK
1947 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
1948#if HAVE_SYS_TYPES_H
1949#include <sys/types.h>
1950#endif
1951#if HAVE_SYS_SOCKET_H
1952#include <sys/socket.h>
1953#endif
1954#include <net/route.h>
1955 ])
28ba6824
VK
1956fi
1957
1958
ea6615cf
VK
1959#--------------------------------------------------------------------
1960# OpenBSD specific checks
1961#--------------------------------------------------------------------
1962
1963if test "x$PLATFORM" = "xOpenBSD"; then
1964 AC_MSG_CHECKING(if kvm_getprocs requires sizeof kinfo_proc argument)
1965 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1966#include <sys/param.h>
1967#include <sys/proc.h>
1968#include <kvm.h>
1969#include <sys/user.h>
1970 ]],[[
1971 int count;
1972 kvm_getprocs(NULL, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
1973 return 0;
1974 ]])
1975 ],[
1976 AC_MSG_RESULT(yes)
1977 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,1,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1978 ],[
1979 AC_MSG_RESULT(no)
1980 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,0,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1981 ])
1982
1983 AC_MSG_CHECKING(if struct kinfo_proc has member kp_proc)
1984 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1985#include <sys/param.h>
1986#include <sys/proc.h>
1987#include <kvm.h>
1988#include <sys/user.h>
1989 ]],[[
1990 struct kinfo_proc p;
1991 return p.kp_proc.p_pid;
1992 ]])
1993 ],[
1994 AC_MSG_RESULT(yes)
1995 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,1,Define to 1 if struct kinfo_proc has member kp_proc)
1996 ],[
1997 AC_MSG_RESULT(no)
1998 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,0,Define to 1 if struct kinfo_proc has member kp_proc)
1999 ])
2000fi
2001
2002
ef0c727b
VK
2003#--------------------------------------------------------------------
2004# Check for UNICODE stuff
2005#--------------------------------------------------------------------
3e39fcde 2006
5a82ecc7 2007AC_CHECK_HEADERS([wchar.h wctype.h iconv.h widec.h])
aa24418a 2008AC_CHECK_TYPES([wchar_t, wint_t],,,[
6b93c954
VK
2009#if HAVE_WCHAR_H
2010#include <wchar.h>
2011#endif
2012])
f172d7b7
VK
2013AC_CHECK_SIZEOF(wchar_t,,[
2014#if HAVE_WCHAR_H
2015#include <wchar.h>
2016#endif
2017])
fdf1ed50
VK
2018AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper towlower])
2019AC_CHECK_FUNCS([wcslwr wcserror wcserror_r wfopen wfopen64 fputws putws])
2020AC_CHECK_FUNCS([wopen wstat waccess wgetenv wrename wunlink wremove wchdir])
2021AC_CHECK_FUNCS([wmkdir wrmdir wsystem wmkstemp wpopen wctime wchmod vwscanf])
2022AC_CHECK_FUNCS([vswscanf vfwscanf wcscasecmp wcsncasecmp wcstombs wcsrtombs])
9138dfe2 2023AC_CHECK_FUNCS([itow _itow])
dff54fed 2024
3265ba38 2025if test "x$DISABLE_ICONV" != "xyes"; then
75c30ed4 2026 AC_CHECK_LIB(iconv, libiconv_open,
dff54fed 2027 [ ac_found_iconv=yes
8d131dda 2028 LIBS="$LIBS -liconv"
75c30ed4
VK
2029 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
2030 ],
2031 [
2032 AC_CHECK_LIB(iconv, iconv,
2033 [ ac_found_iconv=yes
8d131dda 2034 LIBS="$LIBS -liconv"
75c30ed4
VK
2035 ])
2036 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
2037 ])
dff54fed
VK
2038else
2039 ac_found_iconv=no
ef0c727b 2040 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
dff54fed 2041fi
93571e7f 2042
3bf0df9f
VK
2043AC_MSG_CHECKING(whether fgetws can be used with popen)
2044AC_RUN_IFELSE(
2045 [AC_LANG_PROGRAM([
2046#include <stdio.h>
2047#ifdef HAVE_UNISTD_H
2048#include <unistd.h>
2049#endif
2050#if HAVE_WCHAR_H
2051#include <wchar.h>
2052#endif
2053 ], [[
2054 int rc = 1;
2055 wchar_t line[4096];
2056 FILE *f = popen("echo test", "r");
2057 if(f!=NULL)
2058 {
2059 fgetws(line, 4096, f);
2060 pclose(f);
2061 rc = 0;
2062 }
2063 return rc;
2064 ]])
2065 ],
2066 [ AC_MSG_RESULT(yes)
2067 AC_DEFINE(SAFE_FGETWS_WITH_POPEN, 1, Define to 1 if fgetws can be used with popen)
2068 ],
2069 [ AC_MSG_RESULT(no) ],
2070 [ AC_MSG_RESULT(no) ]
2071)
2072
93571e7f
VK
2073AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
2074AC_RUN_IFELSE(
2075 [AC_LANG_PROGRAM([
2076#if HAVE_ICONV_H
2077#include <iconv.h>
2078#endif
2079 ], [
2080 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
2081 ])
2082 ],
2083 [ AC_MSG_RESULT(yes)
2084 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
2085 valid_ucs2_code="UCS-2-INTERNAL"
2086 ],
2087 [ AC_MSG_RESULT(no) ],
2088 [ AC_MSG_RESULT(no) ]
2089)
2090
2091AC_MSG_CHECKING(whether iconv supports UCS-2)
2092AC_RUN_IFELSE(
2093 [AC_LANG_PROGRAM([
2094#if HAVE_ICONV_H
2095#include <iconv.h>
2096#endif
2097 ], [
2098 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
2099 ])
2100 ],
2101 [ AC_MSG_RESULT(yes)
2102 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
2103 valid_ucs2_code="UCS-2"
2104 ],
2105 [ AC_MSG_RESULT(no) ],
8b86c5dc 2106 [ AC_MSG_RESULT(no) ]
93571e7f
VK
2107)
2108
2109AC_MSG_CHECKING(whether iconv supports UCS2)
2110AC_RUN_IFELSE(
2111 [AC_LANG_PROGRAM([
2112#if HAVE_ICONV_H
2113#include <iconv.h>
2114#endif
2115 ], [
2116 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
2117 ])
2118 ],
2119 [ AC_MSG_RESULT(yes)
2120 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
2121 valid_ucs2_code="UCS2"
2122 ],
2123 [ AC_MSG_RESULT(no) ],
2124 [ AC_MSG_RESULT(no) ]
2125)
2126
44bccbbc
VK
2127AC_MSG_CHECKING(whether iconv supports UCS-2BE)
2128AC_RUN_IFELSE(
2129 [AC_LANG_PROGRAM([
2130#if HAVE_ICONV_H
2131#include <iconv.h>
2132#endif
2133 ], [
2134 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
2135 ])
2136 ],
2137 [ AC_MSG_RESULT(yes)
2138 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
2139 valid_ucs2_code="UCS-2BE"
2140 ],
2141 [ AC_MSG_RESULT(no) ],
2142 [ AC_MSG_RESULT(no) ]
2143)
2144
6e17f325
VK
2145AC_MSG_CHECKING(whether iconv supports UCS-2LE)
2146AC_RUN_IFELSE(
2147 [AC_LANG_PROGRAM([
2148#if HAVE_ICONV_H
2149#include <iconv.h>
2150#endif
2151 ], [
2152 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
2153 ])
2154 ],
2155 [ AC_MSG_RESULT(yes)
2156 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
2157 valid_ucs2_code="UCS-2LE"
2158 ],
2159 [ AC_MSG_RESULT(no) ],
2160 [ AC_MSG_RESULT(no) ]
2161)
2162
4a4e1feb
VK
2163AC_MSG_CHECKING(whether iconv supports UTF-16)
2164AC_RUN_IFELSE(
2165 [AC_LANG_PROGRAM([
2166#if HAVE_ICONV_H
2167#include <iconv.h>
2168#endif
2169 ], [
2170 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
2171 ])
2172 ],
2173 [ AC_MSG_RESULT(yes)
2174 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
2175 valid_ucs2_code="UTF-16"
2176 ],
2177 [ AC_MSG_RESULT(no) ],
2178 [ AC_MSG_RESULT(no) ]
2179)
2180
8b86c5dc
VK
2181AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
2182AC_RUN_IFELSE(
2183 [AC_LANG_PROGRAM([
2184#if HAVE_ICONV_H
2185#include <iconv.h>
2186#endif
2187 ], [
2188 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
2189 ])
2190 ],
2191 [ AC_MSG_RESULT(yes)
2192 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
2193 valid_ucs4_code="UCS-4-INTERNAL"
2194 ],
2195 [ AC_MSG_RESULT(no) ],
2196 [ AC_MSG_RESULT(no) ]
2197)
2198
2199AC_MSG_CHECKING(whether iconv supports UCS-4)
2200AC_RUN_IFELSE(
2201 [AC_LANG_PROGRAM([
2202#if HAVE_ICONV_H
2203#include <iconv.h>
2204#endif
2205 ], [
2206 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
2207 ])
2208 ],
2209 [ AC_MSG_RESULT(yes)
2210 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
2211 valid_ucs4_code="UCS-4"
2212 ],
2213 [ AC_MSG_RESULT(no) ],
2214 [ AC_MSG_RESULT(no) ]
2215)
2216
2217AC_MSG_CHECKING(whether iconv supports UCS4)
2218AC_RUN_IFELSE(
2219 [AC_LANG_PROGRAM([
2220#if HAVE_ICONV_H
2221#include <iconv.h>
2222#endif
2223 ], [
2224 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
2225 ])
2226 ],
2227 [ AC_MSG_RESULT(yes)
2228 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
2229 valid_ucs4_code="UCS4"
2230 ],
2231 [ AC_MSG_RESULT(no) ],
2232 [ AC_MSG_RESULT(no) ]
2233)
2234
2235AC_MSG_CHECKING(whether iconv supports UCS-4BE)
2236AC_RUN_IFELSE(
2237 [AC_LANG_PROGRAM([
2238#if HAVE_ICONV_H
2239#include <iconv.h>
2240#endif
2241 ], [
2242 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
2243 ])
2244 ],
2245 [ AC_MSG_RESULT(yes)
2246 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
2247 valid_ucs4_code="UCS-4BE"
2248 ],
2249 [ AC_MSG_RESULT(no) ],
2250 [ AC_MSG_RESULT(no) ]
2251)
2252
6e17f325
VK
2253AC_MSG_CHECKING(whether iconv supports UCS-4LE)
2254AC_RUN_IFELSE(
2255 [AC_LANG_PROGRAM([
2256#if HAVE_ICONV_H
2257#include <iconv.h>
2258#endif
2259 ], [
2260 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
2261 ])
2262 ],
2263 [ AC_MSG_RESULT(yes)
2264 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
2265 valid_ucs4_code="UCS-4LE"
2266 ],
2267 [ AC_MSG_RESULT(no) ],
2268 [ AC_MSG_RESULT(no) ]
2269)
2270
4a4e1feb
VK
2271AC_MSG_CHECKING(whether iconv supports UTF-32)
2272AC_RUN_IFELSE(
2273 [AC_LANG_PROGRAM([
2274#if HAVE_ICONV_H
2275#include <iconv.h>
2276#endif
2277 ], [
2278 return iconv_open("UTF-8","UTF-32")==(iconv_t)(-1);
2279 ])
2280 ],
2281 [ AC_MSG_RESULT(yes)
2282 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
2283 valid_ucs4_code="UTF-32"
2284 ],
2285 [ AC_MSG_RESULT(no) ],
2286 [ AC_MSG_RESULT(no) ]
2287)
2288
93571e7f
VK
2289AC_MSG_CHECKING(whether iconv supports //IGNORE)
2290AC_RUN_IFELSE(
2291 [AC_LANG_PROGRAM([
2292#if HAVE_ICONV_H
2293#include <iconv.h>
2294#endif
2295 ], [
2296 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
2297 ])
2298 ],
2299 [ AC_MSG_RESULT(yes)
2300 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
2301 ],
2302 [ AC_MSG_RESULT(no) ],
2303 [ AC_MSG_RESULT(no) ]
2304)
3e39fcde 2305
bd96aa53
VK
2306AC_MSG_CHECKING(whether iconv supports state reset)
2307AC_RUN_IFELSE(
2308 [AC_LANG_PROGRAM([
2309#include <stdio.h>
2310#if HAVE_ICONV_H
2311#include <iconv.h>
2312#endif
2313 ], [
2314 iconv_t cd = iconv_open("UTF-8","$valid_ucs2_code");
2315 if (cd == (iconv_t)(-1)) return 1;
2316 return iconv(cd, NULL, NULL, NULL, NULL) != 0;
2317 ])
2318 ],
2319 [ AC_MSG_RESULT(yes)
2320 AC_DEFINE(HAVE_ICONV_STATE_RESET, 1, Define to 1 if iconv supports state reset)
2321 ],
2322 [ AC_MSG_RESULT(no) ],
2323 [ AC_MSG_RESULT(no) ]
2324)
2325
2326AC_MSG_CHECKING(whether iconv descriptor cache is needed)
2327case $enable_iconv_cache in
2328 auto)
2329 case $PLATFORM in
2330 SunOS|HP-UX|AIX)
2331 enable_iconv_cache=yes
2332 ;;
2333 *)
2334 enable_iconv_cache=no
2335 ;;
2336 esac
2337 ;;
2338 yes|no)
2339 ;;
2340 *)
2341 AC_MSG_ERROR([Value given to --enable-iconv-cache must be one of yes, no or auto])
2342 ;;
2343esac
2344if test "x$enable_iconv_cache" = "xyes"; then
2345 AC_DEFINE(WITH_ICONV_CACHE, 1, Define to 1 to enable iconv descriptor cache)
2346fi
2347AC_MSG_RESULT($enable_iconv_cache)
2348
19619a35
AK
2349# taken from ZSH's configure
2350# Check if iconv uses const in prototype declaration
24b1570c 2351if test "x$ac_found_iconv" = "xyes"; then
53c96e2d 2352 AC_LANG_PUSH([C++])
19619a35 2353 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
7f9423af
VK
2354 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2355#include <stdlib.h>
f6a2136d 2356#if HAVE_ICONV_H
7f9423af 2357#include <iconv.h>
7f9423af 2358#endif
f6a2136d
VK
2359 ]],
2360 [[
3e51d371
VK
2361 char **p = NULL;
2362 iconv(0, (const char **)p, 0, 0, 0);
7f9423af 2363 ]])],
3e51d371
VK
2364 [ac_cv_iconv_const=const],
2365 [ac_cv_iconv_const=])])
53c96e2d 2366 AC_LANG_POP([C++])
19619a35
AK
2367 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
2368 [Define as const if the declaration of iconv() needs const.])
2369fi
2370
a67fa146
VK
2371if test "x$ac_cv_type_wchar_t" = "xyes"; then
2372 if test $ac_cv_sizeof_wchar_t -eq 2; then
2373 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
2374 fi
8b86c5dc 2375
a67fa146
VK
2376 if test $ac_cv_sizeof_wchar_t -eq 4; then
2377 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
2378 fi
2379
2380 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
2381 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
2382 fi
2383else
2384 if test "x$BUILD_UNICODE" = "xyes"; then
2385 AC_MSG_ERROR(wchar_t is required for UNICODE build)
2386 fi
8b86c5dc
VK
2387fi
2388
c29360a9 2389
ca0f4ea3
VK
2390#--------------------------------------------------------------------
2391# MySQL
2392#--------------------------------------------------------------------
2393
2394check_substr "$COMPONENTS" "mysql"
2395if test $? = 0; then
9f1ea006
VK
2396 OLD_CPPFLAGS="$CPPFLAGS"
2397 OLD_LDFLAGS="$LDFLAGS"
2398 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2399
2400 CPPFLAGS="$CPPFLAGS $MYSQL_CPPFLAGS"
2401 LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
2402 if test "x$MYSQL_LD_RUN_PATH" != "x"; then
2403 LD_RUN_PATH="${MYSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2404 fi
2405
b93fd1c1 2406 AC_CHECK_HEADER(mysql.h,,AC_MSG_ERROR([Cannot find mysql.h - check your MySQL client installation]))
9f1ea006 2407
6fce76d8 2408 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
ca0f4ea3 2409 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
aa7794f0 2410
8d131dda
VK
2411 OLD_LIBS="$LIBS"
2412 LIBS="$LIBS $MYSQL_LIBS"
aa7794f0 2413
ca0f4ea3 2414 AC_CHECK_FUNCS(mysql_real_escape_string)
9f1ea006
VK
2415
2416 CPPFLAGS="$OLD_CPPFLAGS"
2417 LDFLAGS="$OLD_LDFLAGS"
2418 LD_RUN_PATH="$OLD_LD_RUN_PATH"
8d131dda 2419 LIBS="$OLD_LIBS"
ca0f4ea3
VK
2420fi
2421
2422
58ed4897
VK
2423#--------------------------------------------------------------------
2424# PostgreSQL
2425#--------------------------------------------------------------------
2426
203458b7 2427check_substr "$COMPONENTS" "pgsql"
58ed4897 2428if test $? = 0; then
b535eed6
VK
2429 OLD_CPPFLAGS="$CPPFLAGS"
2430 OLD_LDFLAGS="$LDFLAGS"
2431 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2432
2433 CPPFLAGS="$CPPFLAGS $PGSQL_CPPFLAGS"
2434 LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
2435 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
2436 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2437 fi
2438
9f1ea006
VK
2439 AC_CHECK_HEADER(libpq-fe.h,,AC_MSG_ERROR([Cannot find libpq-fe.h - check your PostgreSQL client installation]))
2440
58ed4897 2441 AC_CHECK_LIB(m, floor)
b535eed6
VK
2442 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
2443 if test "x$PLATFORM" = "xSunOS"; then
2444 PGSQL_LDFLAGS="$PGSQL_LDFLAGS/sparcv9"
2445 LDFLAGS="$OLD_LDFLAGS $PGSQL_LDFLAGS"
2446 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
2447 PGSQL_LD_RUN_PATH="$PGSQL_LD_RUN_PATH/sparcv9"
2448 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${OLD_LD_RUN_PATH:+:}${OLD_LD_RUN_PATH}"
2449 fi
2450 unset ac_cv_lib_pq_PQconnectdb
2451 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
2452 AC_MSG_ERROR(libpq is required for PostgreSQL support)])
2453 else
2454 AC_MSG_ERROR(libpq is required for PostgreSQL support)
2455 fi
2456 ])
6fce76d8 2457
b535eed6
VK
2458 CPPFLAGS="$OLD_CPPFLAGS"
2459 LDFLAGS="$OLD_LDFLAGS"
2460 LD_RUN_PATH="$OLD_LD_RUN_PATH"
58ed4897
VK
2461fi
2462
2463
9c29f76e
VK
2464#--------------------------------------------------------------------
2465# ODBC
2466#--------------------------------------------------------------------
2467
2468check_substr "$COMPONENTS" "odbc"
2469if test $? = 0; then
2cfe4482
VK
2470 OLD_CPPFLAGS="$CPPFLAGS"
2471 OLD_LDFLAGS="$LDFLAGS"
2472 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2473
2474 CPPFLAGS="$CPPFLAGS $ODBC_CPPFLAGS"
b535eed6 2475 LDFLAGS="$LDFLAGS $ODBC_LDFLAGS"
2cfe4482
VK
2476 if test "x$ODBC_LD_RUN_PATH" != "x"; then
2477 LD_RUN_PATH="${ODBC_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2478 fi
2479
6fce76d8 2480 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
9c29f76e 2481 [AC_MSG_ERROR(libodbc is required for ODBC support)])
60a1159a
VK
2482 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2483 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
2484 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
2485 fi
2cfe4482
VK
2486
2487 CPPFLAGS="$OLD_CPPFLAGS"
2488 LDFLAGS="$OLD_LDFLAGS"
2489 LD_RUN_PATH="$OLD_LD_RUN_PATH"
9c29f76e
VK
2490fi
2491
2492
41b4790d
VK
2493#--------------------------------------------------------------------
2494# Oracle
2495#--------------------------------------------------------------------
2496
2497check_substr "$COMPONENTS" "oracle"
2498if test $? = 0; then
2cfe4482
VK
2499 OLD_CPPFLAGS="$CPPFLAGS"
2500 OLD_LDFLAGS="$LDFLAGS"
2501 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2502
2503 CPPFLAGS="$CPPFLAGS $ORACLE_CPPFLAGS"
b535eed6 2504 LDFLAGS="$LDFLAGS $ORACLE_LDFLAGS"
2cfe4482
VK
2505 if test "x$ORACLE_LD_RUN_PATH" != "x"; then
2506 LD_RUN_PATH="${ORACLE_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2507 fi
2508
41b4790d 2509 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
e5cceced 2510 AC_CHECK_LIB(nnz12, nzstrcpy, [NNZ_LIB=-lnnz12],
7d8c91ef 2511 [
e5cceced
VK
2512 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
2513 [
2514 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
2515 ], [-lclntsh])
7d8c91ef
VK
2516 ], [-lclntsh])
2517 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
2518 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
045845e5 2519 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
60a1159a
VK
2520 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2521 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
2522 fi
2cfe4482
VK
2523
2524 CPPFLAGS="$OLD_CPPFLAGS"
2525 LDFLAGS="$OLD_LDFLAGS"
2526 LD_RUN_PATH="$OLD_LD_RUN_PATH"
41b4790d
VK
2527fi
2528
84277a0f
AK
2529#--------------------------------------------------------------------
2530# DB2
2531#--------------------------------------------------------------------
2532
2533check_substr "$COMPONENTS" "db2"
2534if test $? = 0; then
2535 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
2536 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
2537 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
6afe141e 2538 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2539 SUBAGENT_LIBS="$SUBAGENT_LIBS $DB2_LIBS"
2540 fi
84277a0f 2541fi
41b4790d 2542
37861c72
VK
2543#--------------------------------------------------------------------
2544# Informix
2545#--------------------------------------------------------------------
2546
2547check_substr "$COMPONENTS" "informix"
2548if test $? = 0; then
2549 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
4f2e8e9b
VK
2550 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
2551 [AC_MSG_ERROR(libthcli is required for Informix support)])
60a1159a
VK
2552 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2553 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
2554 fi
37861c72
VK
2555fi
2556
c3cfc039 2557
50e4bc8c
VK
2558#--------------------------------------------------------------------
2559# Java
2560#--------------------------------------------------------------------
2561
2562check_substr "$COMPONENTS" "java"
2563if test $? = 0; then
2564 AC_CHECK_HEADER(jni.h,,AC_MSG_ERROR([*** Cannot find jni.h - check your JDK installation ***]))
50e4bc8c
VK
2565fi
2566
2567
b14c3f22
VK
2568#--------------------------------------------------------------------
2569# Tuxedo
2570#--------------------------------------------------------------------
2571
2572check_substr "$COMPONENTS" "tuxedo"
2573if test $? = 0; then
2574 OLD_CPPFLAGS="$CPPFLAGS"
2575 OLD_LDFLAGS="$LDFLAGS"
2576 OLD_LIBS="$LIBS"
2577
2578 if test "x$TUXEDO_BASE" != "x"; then
2579 TUXEDO_CPPFLAGS="-I$TUXEDO_BASE/include"
2580 TUXEDO_LDFLAGS="-L$TUXEDO_BASE/lib"
2581 CPPFLAGS="$CPPFLAGS $TUXEDO_CPPFLAGS"
2582 LDFLAGS="$LDFLAGS $TUXEDO_LDFLAGS"
2583 fi
2584
2585 AC_CHECK_HEADER(atmi.h,,AC_MSG_ERROR([*** Cannot find atmi.h - check your Tuxedo installation ***]))
2586
2587 # https://community.oracle.com/thread/2346582
2588 if test "x$PLATFORM" = "xLinux"; then
2589 TUXEDO_LDFLAGS="$TUXEDO_LDFLAGS -Xlinker --no-as-needed"
2590 LDFLAGS="$LDFLAGS -Xlinker --no-as-needed"
2591 fi
6d14d0b0
VK
2592
2593 if test "$PLATFORM" = "SunOS"; then
2594 AC_CHECK_LIB(rt, nanosleep, [ TUXEDO_LIBS="$TUXEDO_LIBS -lrt" ])
2595 fi
2596
73517e51
VK
2597 if test "$PLATFORM" = "AIX"; then
2598 AC_MSG_CHECKING(for xa_switchp in libengine)
2599 OLD_LIBS_LIBENGINE="$LIBS"
2600 LIBS="$LIBS -lengine"
2601 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ extern char *xa_switchp; ]], [[ *xa_switchp = 0; ]])],
2602 [
2603 AC_MSG_RESULT(yes)
2604 TUXEDO_LIBS="$TUXEDO_LIBS -lengine"
2605 ],
2606 [ AC_MSG_RESULT(no) ])
2607 LIBS="$OLD_LIBS_LIBENGINE"
2608 fi
2609
6d14d0b0 2610 LIBS="$LIBS $TUXEDO_LIBS"
73517e51 2611 AC_CHECK_LIB(tux, tpcall, [], [AC_MSG_ERROR(libtux is required for Tuxedo support)])
b14c3f22
VK
2612
2613 CPPFLAGS="$OLD_CPPFLAGS"
2614 LDFLAGS="$OLD_LDFLAGS"
2615 LIBS="$OLD_LIBS"
73517e51
VK
2616
2617 if test "x$PLATFORM" = "xAIX"; then
2618 if test -e $TUXEDO_BASE/lib/tpinit.o; then
2619 TUXEDO_LIBS="$TUXEDO_BASE/lib/tpinit.o $TUXEDO_LIBS"
2620 fi
2621 fi
b14c3f22
VK
2622fi
2623
d6235717 2624#--------------------------------------------------------------------
2625# MongoDB
2626#--------------------------------------------------------------------
2627
2628check_substr "$COMPONENTS" "mongodb"
2629if test $? = 0; then
2630 OLD_CPPFLAGS="$CPPFLAGS"
2631 OLD_LDFLAGS="$LDFLAGS"
2632 OLD_LIBS="$LIBS"
2633
2634 if test "x$MONGODB_BASE" != "x"; then
2635 MONGODB_CPPFLAGS="-I$MONGODB_BASE/include/libmongoc-1.0/ -I$MONGODB_BASE/include/libbson-1.0/"
2636 MONGODB_LDFLAGS="-L$MONGODB_BASE/lib"
2637 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
2638 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
2639 else
2640 MONGODB_CPPFLAGS="-I/usr/local/include/libmongoc-1.0/ -I/usr/local/include/libbson-1.0/"
2641 MONGODB_LDFLAGS="-L/usr/local/lib"
2642 CPPFLAGS="$CPPFLAGS $MONGODB_CPPFLAGS"
2643 LDFLAGS="$LDFLAGS $MONGODB_LDFLAGS"
2644 fi
2645
2646 AC_CHECK_HEADER(mongoc.h,,AC_MSG_ERROR([*** Cannot find mongoc.h - check your MongoDB installation ***]))
2647 AC_CHECK_LIB(mongoc-1.0, nanosleep, [ MONGODB_LIBS="$MONGODB_LIBS -lmongoc-1.0" ])
2648 AC_CHECK_LIB(bson-1.0, nanosleep, [ MONGODB_LIBS="$MONGODB_LIBS -lbson-1.0" ])
2649
2650 LIBS="$LIBS $MONGODB_LIBS"
2651
2652 CPPFLAGS="$OLD_CPPFLAGS"
2653 LDFLAGS="$OLD_LDFLAGS"
2654 LIBS="$OLD_LIBS"
2655fi
b14c3f22 2656
ca0f4ea3
VK
2657#--------------------------------------------------------------------
2658# Other settings
2659#--------------------------------------------------------------------
2660
a5a95ac8
VK
2661if test "x$RUNTIME_PREFIX" = "x"; then
2662 if test "x${BUILD_UNICODE}" = "xyes"; then
f434ab60 2663 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\" -DSTATEDIR=L\\\"\${localstatedir}/lib/netxms\\\""
a5a95ac8 2664 else
f434ab60 2665 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\" -DSTATEDIR=\\\"\${localstatedir}/lib/netxms\\\""
a5a95ac8 2666 fi
b07c50cc 2667else
a5a95ac8 2668 if test "x${BUILD_UNICODE}" = "xyes"; then
f434ab60 2669 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"$RUNTIME_PREFIX\\\" -DDATADIR=L\\\"$RUNTIME_PREFIX/share/netxms\\\" -DBINDIR=L\\\"$RUNTIME_PREFIX/bin\\\" -DLIBDIR=L\\\"$RUNTIME_PREFIX/lib\\\" -DPKGLIBDIR=L\\\"$RUNTIME_PREFIX/lib/netxms\\\" -DSTATEDIR=L\\\"$RUNTIME_PREFIX/var/lib/netxms\\\""
a5a95ac8 2670 else
f434ab60 2671 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"$RUNTIME_PREFIX\\\" -DDATADIR=\\\"$RUNTIME_PREFIX/share/netxms\\\" -DBINDIR=\\\"$RUNTIME_PREFIX/bin\\\" -DLIBDIR=\\\"$RUNTIME_PREFIX/lib\\\" -DPKGLIBDIR=\\\"$RUNTIME_PREFIX/lib/netxms\\\" -DSTATEDIR=\\\"$RUNTIME_PREFIX/var/lib/netxms\\\""
a5a95ac8 2672 fi
b07c50cc 2673fi
545bda2d 2674LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $LDFLAGS_SUFFIX"
ca0f4ea3 2675
25ae8377
VK
2676if test "x${ENABLE_WERROR}" = "xyes"; then
2677 CPPFLAGS="$CPPFLAGS -Werror"
2678fi
2679
cbc4d191
VK
2680if test "x$PLATFORM" = "xDarwin"; then
2681 SHLIB_SUFFIX=".so"
2682else
2683 if test "x$shrext_cmds" != "x"; then
2684 SHLIB_SUFFIX="$shrext_cmds"
2685 else
2686 SHLIB_SUFFIX=".so"
2687 fi
2b479c92 2688fi
cbc4d191 2689AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], _T("$SHLIB_SUFFIX"), [Define to platform's shared library suffix])
2b479c92 2690
8c9993b4
VK
2691if test "x$ENABLE_DEBUG" = "xno"; then
2692 CPPFLAGS="$CPPFLAGS -DNDEBUG"
2693fi
2694
f92a016a
VK
2695if test "x$WITH_JEMALLOC" = "xyes"; then
2696 LIBS="$LIBS -ljemalloc"
2697fi
2698
551ec9ca 2699AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
17b35ccc 2700AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
f5393033 2701AM_CONDITIONAL([USE_INTERNAL_JANSSON], [test "x$HAVE_JANSSON" = "xno"])
1fd41bcd 2702AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$NEED_ZLIB/$HAVE_ZLIB" = "yes/no"])
c1165d33
VK
2703AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
2704AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
eca43970 2705AM_CONDITIONAL([USE_ENCRYPTION], [test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"])
6dde8627 2706AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
058bf6fc 2707AM_CONDITIONAL([XMPP_SUPPORT], [test "x$XMPP_SUPPORT" = "xyes"])
8b86c5dc 2708
ca0f4ea3 2709
8a96930f
AK
2710#--------------------------------------------------------------------
2711# Cleanup variables
2712#--------------------------------------------------------------------
2713
2714AS_IF([test "x$with_dist" = "xyes"],
2715[
2716 SUBAGENT_DIRS=`echo $SUBAGENT_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2717 MODULES=`echo $MODULES|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2718 SMSDRV_DIRS=`echo $SMSDRV_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2719 HDLINK_DIRS=`echo $HDLINK_DIRS|perl -nae 'my %seen; my @out; for (@F) {push(@out, $_) unless $seen{$_}++; }; print join(" ", @out)'`
2720])
2721
ef0c727b
VK
2722#--------------------------------------------------------------------
2723# Substitute variables
2724#--------------------------------------------------------------------
82fa7c5d 2725
ef0c727b
VK
2726AC_SUBST(DB_DRIVERS)
2727AC_SUBST(MODULES)
2728AC_SUBST(SUBAGENT_DIRS)
7dda4453 2729AC_SUBST(SERVER_INCLUDE)
7c48e2aa 2730AC_SUBST(SERVER_LIBS)
ef0c727b 2731AC_SUBST(SERVER_TOOLS)
c20f8eb7 2732AC_SUBST(SMSDRV_DIRS)
6fad8870 2733AC_SUBST(HDLINK_DIRS)
52a2232c 2734AC_SUBST(PDSDRV_DIRS)
ef0c727b
VK
2735AC_SUBST(TOP_LEVEL_MODULES)
2736AC_SUBST(CONTRIB_MODULES)
c2612d83 2737AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
2738AC_SUBST(STATIC_SUBAGENT_LIST)
2739AC_SUBST(SUBAGENT_LIBS)
2740AC_SUBST(BUILD_SERVER)
447350a9 2741AC_SUBST(BUILD_SDK)
2cfe4482
VK
2742AC_SUBST(MYSQL_CPPFLAGS)
2743AC_SUBST(MYSQL_LDFLAGS)
6fce76d8 2744AC_SUBST(MYSQL_LIBS)
2cfe4482
VK
2745AC_SUBST(PGSQL_CPPFLAGS)
2746AC_SUBST(PGSQL_LDFLAGS)
6fce76d8 2747AC_SUBST(PGSQL_LIBS)
2cfe4482
VK
2748AC_SUBST(ORACLE_CPPFLAGS)
2749AC_SUBST(ORACLE_LDFLAGS)
7d8c91ef 2750AC_SUBST(ORACLE_LIBS)
2cfe4482
VK
2751AC_SUBST(ODBC_CPPFLAGS)
2752AC_SUBST(ODBC_LDFLAGS)
6fce76d8 2753AC_SUBST(ODBC_LIBS)
2cfe4482
VK
2754AC_SUBST(DB2_CPPFLAGS)
2755AC_SUBST(DB2_LDFLAGS)
84277a0f 2756AC_SUBST(DB2_LIBS)
2cfe4482
VK
2757AC_SUBST(INFORMIX_CPPFLAGS)
2758AC_SUBST(INFORMIX_LDFLAGS)
87f1fff0 2759AC_SUBST(INFORMIX_LIBS)
11ce9a66 2760AC_SUBST(OBJECT_MODE)
9113e749 2761AC_SUBST(SQLFLAGS)
cbc4d191 2762AC_SUBST(SHLIB_SUFFIX)
b14c3f22
VK
2763AC_SUBST(TUXEDO_CPPFLAGS)
2764AC_SUBST(TUXEDO_LDFLAGS)
6d14d0b0 2765AC_SUBST(TUXEDO_LIBS)
d6235717 2766AC_SUBST(MONGODB_CPPFLAGS)
2767AC_SUBST(MONGODB_LDFLAGS)
2768AC_SUBST(MONGODB_LIBS)
b5e5849b 2769AC_SUBST(INSTALL_LIBPATH)
d16cf8a5 2770
ef0c727b
VK
2771#--------------------------------------------------------------------
2772# Shared libs versions
d16cf8a5
AK
2773#
2774# versioning scheme: current:revision:age
2775#
2776# current
2777# The number of the current interface exported by the library. A current
2778# value of `0', means that you are calling the interface exported by this
2779# library interface 0.
2780#
2781# revision
2782# The implementation number of the most recent interface exported by this
2783# library. In this case, a revision value of `0' means that this is the
2784# first implementation of the interface.
2785# If the next release of this library exports the same interface, but has a
2786# different implementation (perhaps some bugs have been fixed), the revision
2787# number will be higher, but current number will be the same. In that case,
2788# when given a choice, the library with the highest revision will always
2789# be used by the runtime loader.
2790#
2791# age
2792# The number of previous additional interfaces supported by this library.
2793# If age were `2', then this library can be linked into executables which
2794# were built with a release of this library that exported the current
2795# interface number, current, or any of the previous two interfaces.
2796# By definition age must be less than or equal to current. At the outset,
2797# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 2798#--------------------------------------------------------------------
d16cf8a5 2799
359784de 2800NETXMS_LIBRARY_VERSION=2:0:0
c7d14846 2801AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 2802
ef0c727b
VK
2803#--------------------------------------------------------------------
2804# Generate output files
2805#--------------------------------------------------------------------
d16cf8a5
AK
2806
2807AC_CONFIG_FILES([
0c3c0c39
AK
2808 Makefile
2809 contrib/Makefile
36874eca
VK
2810 contrib/backgrounds/Makefile
2811 contrib/integration/Makefile
2812 contrib/integration/HP_EVA/Makefile
bad6cc0c 2813 contrib/integration/HP_P2000/Makefile
36874eca 2814 contrib/mibs/Makefile
19e3290a 2815 contrib/music/Makefile
0c3c0c39 2816 contrib/startup/Makefile
fa66d60c 2817 contrib/startup/debian/Makefile
daaefaaf 2818 contrib/startup/gentoo/Makefile
7483d0bf 2819 contrib/startup/hp-ux/Makefile
0c3c0c39 2820 contrib/startup/redhat/Makefile
5de3893d 2821 contrib/startup/suse/Makefile
9993edf4 2822 contrib/startup/ubuntu/Makefile
6adf3219 2823 contrib/startup/solaris/Makefile
27fc5ee9
AK
2824 debian/Makefile
2825 debian/patches/Makefile
2826 debian/source/Makefile
0c3c0c39 2827 doc/Makefile
a48203d2
VK
2828 doc/internal/Makefile
2829 doc/manuals/Makefile
2830 doc/misc/Makefile
0c3c0c39
AK
2831 images/Makefile
2832 include/Makefile
2833 m4/Makefile
0c3c0c39 2834 src/Makefile
9191f6ad 2835 src/agent/Makefile
6ac698ed 2836 src/agent/appagent/Makefile
9191f6ad
VK
2837 src/agent/core/Makefile
2838 src/agent/install/Makefile
359784de 2839 src/agent/libnxagent/Makefile
52275230 2840 src/agent/libnxappc/Makefile
a2a24e9d 2841 src/agent/libnxsd/Makefile
9191f6ad 2842 src/agent/subagents/Makefile
9191f6ad 2843 src/agent/subagents/aix/Makefile
df8b3df7 2844 src/agent/subagents/darwin/Makefile
52f5ee00
VK
2845 src/agent/subagents/db2/Makefile
2846 src/agent/subagents/dbquery/Makefile
ab1e80fd 2847 src/agent/subagents/devemu/Makefile
e58b0f75 2848 src/agent/subagents/ds18x20/Makefile
80e96a82 2849 src/agent/subagents/ecs/Makefile
ab1e80fd 2850 src/agent/subagents/filemgr/Makefile
9191f6ad 2851 src/agent/subagents/freebsd/Makefile
80e96a82
VK
2852 src/agent/subagents/hpux/Makefile
2853 src/agent/subagents/informix/Makefile
9191f6ad 2854 src/agent/subagents/ipso/Makefile
50e4bc8c
VK
2855 src/agent/subagents/java/Makefile
2856 src/agent/subagents/java/java/Makefile
2857 src/agent/subagents/java/java/src/Makefile
2858 src/agent/subagents/java/java/src/main/Makefile
2859 src/agent/subagents/java/java/src/main/java/Makefile
2860 src/agent/subagents/java/java/src/main/java/org/Makefile
2861 src/agent/subagents/java/java/src/main/java/org/netxms/Makefile
2862 src/agent/subagents/java/java/src/main/java/org/netxms/agent/Makefile
3118008e 2863 src/agent/subagents/java/java/src/main/java/org/netxms/agent/adapters/Makefile
d2f78ba0 2864 src/agent/subagents/java/sample/Makefile
688dad5a
VK
2865 src/agent/subagents/java/sample/src/Makefile
2866 src/agent/subagents/java/sample/src/main/Makefile
2867 src/agent/subagents/java/sample/src/main/java/Makefile
2868 src/agent/subagents/java/sample/src/main/java/org/Makefile
2869 src/agent/subagents/java/sample/src/main/java/org/netxms/Makefile
2870 src/agent/subagents/java/sample/src/main/java/org/netxms/agent/Makefile
2871 src/agent/subagents/java/sample/src/main/java/org/netxms/agent/demo/Makefile
80e96a82 2872 src/agent/subagents/linux/Makefile
df8b3df7 2873 src/agent/subagents/lmsensors/Makefile
80e96a82
VK
2874 src/agent/subagents/logwatch/Makefile
2875 src/agent/subagents/netbsd/Makefile
df8b3df7 2876 src/agent/subagents/netsvc/Makefile
80e96a82
VK
2877 src/agent/subagents/odbcquery/Makefile
2878 src/agent/subagents/openbsd/Makefile
4d1753cd 2879 src/agent/subagents/oracle/Makefile
9191f6ad 2880 src/agent/subagents/ping/Makefile
80e96a82 2881 src/agent/subagents/portCheck/Makefile
df8b3df7 2882 src/agent/subagents/rpi/Makefile
9191f6ad 2883 src/agent/subagents/sms/Makefile
80e96a82 2884 src/agent/subagents/sunos/Makefile
b14c3f22 2885 src/agent/subagents/tuxedo/Makefile
d6235717 2886 src/agent/subagents/mongodb/Makefile
de1205d5 2887 src/agent/subagents/ubntlw/Makefile
9191f6ad 2888 src/agent/subagents/ups/Makefile
80e96a82
VK
2889 src/agent/subagents/winnt/Makefile
2890 src/agent/subagents/winperf/Makefile
52f5ee00 2891 src/agent/subagents/wmi/Makefile
0bd64860 2892 src/agent/tools/Makefile
6ac698ed 2893 src/agent/tools/nxappget/Makefile
0bd64860 2894 src/agent/tools/nxapush/Makefile
c2612d83 2895 src/client/Makefile
551592f4 2896 src/client/install/Makefile
be03fec6 2897 src/client/libnxclient/Makefile
c94fa5c2 2898 src/client/nxalarm/Makefile
e84701c5
VK
2899 src/client/nxevent/Makefile
2900 src/client/nxpush/Makefile
59ffa5b7 2901 src/client/nxsms/Makefile
d1834406
VK
2902 src/db/Makefile
2903 src/db/dbdrv/Makefile
87f1fff0
VK
2904 src/db/dbdrv/db2/Makefile
2905 src/db/dbdrv/informix/Makefile
d1834406
VK
2906 src/db/dbdrv/odbc/Makefile
2907 src/db/dbdrv/mssql/Makefile
2908 src/db/dbdrv/mysql/Makefile
87f1fff0 2909 src/db/dbdrv/oracle/Makefile
d1834406
VK
2910 src/db/dbdrv/pgsql/Makefile
2911 src/db/dbdrv/sqlite/Makefile
d1834406 2912 src/db/libnxdb/Makefile
9191f6ad
VK
2913 src/install/Makefile
2914 src/install/windows/Makefile
f5393033 2915 src/jansson/Makefile
9191f6ad
VK
2916 src/libexpat/Makefile
2917 src/libexpat/libexpat/Makefile
2918 src/libnetxms/Makefile
9191f6ad
VK
2919 src/libnxlp/Makefile
2920 src/libnxmap/Makefile
0d956dd9 2921 src/libnxmb/Makefile
10d5b2b2 2922 src/libnxsl/Makefile
058bf6fc 2923 src/libstrophe/Makefile
a67fa146
VK
2924 src/libtre/Makefile
2925 src/libtre/win32/Makefile
a7a03ffd 2926 src/nxcproxy/Makefile
8dca469f 2927 src/nxlptest/Makefile
9191f6ad 2928 src/nxscript/Makefile
0c3c0c39
AK
2929 src/server/Makefile
2930 src/server/core/Makefile
644f97f5 2931 src/server/drivers/Makefile
386f88e3 2932 src/server/drivers/airespace/Makefile
0239cfea 2933 src/server/drivers/at/Makefile
644f97f5 2934 src/server/drivers/baystack/Makefile
b1bd1fb2 2935 src/server/drivers/cat2900xl/Makefile
910846cc 2936 src/server/drivers/catalyst/Makefile
fce03ab9 2937 src/server/drivers/cisco-esw/Makefile
ae8ea5a6 2938 src/server/drivers/cisco-sb/Makefile
8bdfaed8 2939 src/server/drivers/dell-pwc/Makefile
a548def4 2940 src/server/drivers/dlink/Makefile
644f97f5 2941 src/server/drivers/ers8000/Makefile
d7e23292 2942 src/server/drivers/h3c/Makefile
d594d378 2943 src/server/drivers/hpsw/Makefile
4e592faf
VK
2944 src/server/drivers/lib/Makefile
2945 src/server/drivers/lib/avaya-ers/Makefile
b1bd1fb2 2946 src/server/drivers/lib/cisco/Makefile
a73592db 2947 src/server/drivers/mikrotik/Makefile
81ecaf38 2948 src/server/drivers/netscreen/Makefile
e10e890e 2949 src/server/drivers/ntws/Makefile
c183a9f9 2950 src/server/drivers/ping3/Makefile
9b13553b 2951 src/server/drivers/procurve/Makefile
ac7e4032 2952 src/server/drivers/qtech-olt/Makefile
217e4d6a 2953 src/server/drivers/symbol-ws/Makefile
e5f4e3ac 2954 src/server/drivers/tb/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