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