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