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