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