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