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