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