fixed issue 469; fixed build error on Linux
[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
3bf0df9f 7AC_INIT([NetXMS], [1.2.11], [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 1764
3bf0df9f
VK
1765AC_MSG_CHECKING(whether fgetws can be used with popen)
1766AC_RUN_IFELSE(
1767 [AC_LANG_PROGRAM([
1768#include <stdio.h>
1769#ifdef HAVE_UNISTD_H
1770#include <unistd.h>
1771#endif
1772#if HAVE_WCHAR_H
1773#include <wchar.h>
1774#endif
1775 ], [[
1776 int rc = 1;
1777 wchar_t line[4096];
1778 FILE *f = popen("echo test", "r");
1779 if(f!=NULL)
1780 {
1781 fgetws(line, 4096, f);
1782 pclose(f);
1783 rc = 0;
1784 }
1785 return rc;
1786 ]])
1787 ],
1788 [ AC_MSG_RESULT(yes)
1789 AC_DEFINE(SAFE_FGETWS_WITH_POPEN, 1, Define to 1 if fgetws can be used with popen)
1790 ],
1791 [ AC_MSG_RESULT(no) ],
1792 [ AC_MSG_RESULT(no) ]
1793)
1794
93571e7f
VK
1795AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
1796AC_RUN_IFELSE(
1797 [AC_LANG_PROGRAM([
1798#if HAVE_ICONV_H
1799#include <iconv.h>
1800#endif
1801 ], [
1802 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
1803 ])
1804 ],
1805 [ AC_MSG_RESULT(yes)
1806 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
1807 valid_ucs2_code="UCS-2-INTERNAL"
1808 ],
1809 [ AC_MSG_RESULT(no) ],
1810 [ AC_MSG_RESULT(no) ]
1811)
1812
1813AC_MSG_CHECKING(whether iconv supports UCS-2)
1814AC_RUN_IFELSE(
1815 [AC_LANG_PROGRAM([
1816#if HAVE_ICONV_H
1817#include <iconv.h>
1818#endif
1819 ], [
1820 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
1821 ])
1822 ],
1823 [ AC_MSG_RESULT(yes)
1824 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
1825 valid_ucs2_code="UCS-2"
1826 ],
1827 [ AC_MSG_RESULT(no) ],
8b86c5dc 1828 [ AC_MSG_RESULT(no) ]
93571e7f
VK
1829)
1830
1831AC_MSG_CHECKING(whether iconv supports UCS2)
1832AC_RUN_IFELSE(
1833 [AC_LANG_PROGRAM([
1834#if HAVE_ICONV_H
1835#include <iconv.h>
1836#endif
1837 ], [
1838 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
1839 ])
1840 ],
1841 [ AC_MSG_RESULT(yes)
1842 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
1843 valid_ucs2_code="UCS2"
1844 ],
1845 [ AC_MSG_RESULT(no) ],
1846 [ AC_MSG_RESULT(no) ]
1847)
1848
44bccbbc
VK
1849AC_MSG_CHECKING(whether iconv supports UCS-2BE)
1850AC_RUN_IFELSE(
1851 [AC_LANG_PROGRAM([
1852#if HAVE_ICONV_H
1853#include <iconv.h>
1854#endif
1855 ], [
1856 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
1857 ])
1858 ],
1859 [ AC_MSG_RESULT(yes)
1860 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
1861 valid_ucs2_code="UCS-2BE"
1862 ],
1863 [ AC_MSG_RESULT(no) ],
1864 [ AC_MSG_RESULT(no) ]
1865)
1866
6e17f325
VK
1867AC_MSG_CHECKING(whether iconv supports UCS-2LE)
1868AC_RUN_IFELSE(
1869 [AC_LANG_PROGRAM([
1870#if HAVE_ICONV_H
1871#include <iconv.h>
1872#endif
1873 ], [
1874 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
1875 ])
1876 ],
1877 [ AC_MSG_RESULT(yes)
1878 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
1879 valid_ucs2_code="UCS-2LE"
1880 ],
1881 [ AC_MSG_RESULT(no) ],
1882 [ AC_MSG_RESULT(no) ]
1883)
1884
4a4e1feb
VK
1885AC_MSG_CHECKING(whether iconv supports UTF-16)
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","UTF-16")==(iconv_t)(-1);
1893 ])
1894 ],
1895 [ AC_MSG_RESULT(yes)
1896 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
1897 valid_ucs2_code="UTF-16"
1898 ],
1899 [ AC_MSG_RESULT(no) ],
1900 [ AC_MSG_RESULT(no) ]
1901)
1902
8b86c5dc
VK
1903AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
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-4-INTERNAL")==(iconv_t)(-1);
1911 ])
1912 ],
1913 [ AC_MSG_RESULT(yes)
1914 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
1915 valid_ucs4_code="UCS-4-INTERNAL"
1916 ],
1917 [ AC_MSG_RESULT(no) ],
1918 [ AC_MSG_RESULT(no) ]
1919)
1920
1921AC_MSG_CHECKING(whether iconv supports UCS-4)
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","UCS-4")==(iconv_t)(-1);
1929 ])
1930 ],
1931 [ AC_MSG_RESULT(yes)
1932 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
1933 valid_ucs4_code="UCS-4"
1934 ],
1935 [ AC_MSG_RESULT(no) ],
1936 [ AC_MSG_RESULT(no) ]
1937)
1938
1939AC_MSG_CHECKING(whether iconv supports UCS4)
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","UCS4")==(iconv_t)(-1);
1947 ])
1948 ],
1949 [ AC_MSG_RESULT(yes)
1950 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
1951 valid_ucs4_code="UCS4"
1952 ],
1953 [ AC_MSG_RESULT(no) ],
1954 [ AC_MSG_RESULT(no) ]
1955)
1956
1957AC_MSG_CHECKING(whether iconv supports UCS-4BE)
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-4BE")==(iconv_t)(-1);
1965 ])
1966 ],
1967 [ AC_MSG_RESULT(yes)
1968 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
1969 valid_ucs4_code="UCS-4BE"
1970 ],
1971 [ AC_MSG_RESULT(no) ],
1972 [ AC_MSG_RESULT(no) ]
1973)
1974
6e17f325
VK
1975AC_MSG_CHECKING(whether iconv supports UCS-4LE)
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","UCS-4LE")==(iconv_t)(-1);
1983 ])
1984 ],
1985 [ AC_MSG_RESULT(yes)
1986 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
1987 valid_ucs4_code="UCS-4LE"
1988 ],
1989 [ AC_MSG_RESULT(no) ],
1990 [ AC_MSG_RESULT(no) ]
1991)
1992
4a4e1feb
VK
1993AC_MSG_CHECKING(whether iconv supports UTF-32)
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","UTF-32")==(iconv_t)(-1);
2001 ])
2002 ],
2003 [ AC_MSG_RESULT(yes)
2004 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
2005 valid_ucs4_code="UTF-32"
2006 ],
2007 [ AC_MSG_RESULT(no) ],
2008 [ AC_MSG_RESULT(no) ]
2009)
2010
93571e7f
VK
2011AC_MSG_CHECKING(whether iconv supports //IGNORE)
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//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
2019 ])
2020 ],
2021 [ AC_MSG_RESULT(yes)
2022 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
2023 ],
2024 [ AC_MSG_RESULT(no) ],
2025 [ AC_MSG_RESULT(no) ]
2026)
3e39fcde 2027
19619a35
AK
2028# taken from ZSH's configure
2029# Check if iconv uses const in prototype declaration
24b1570c 2030if test "x$ac_found_iconv" = "xyes"; then
53c96e2d 2031 AC_LANG_PUSH([C++])
19619a35 2032 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
7f9423af
VK
2033 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2034#include <stdlib.h>
f6a2136d 2035#if HAVE_ICONV_H
7f9423af 2036#include <iconv.h>
f6a2136d 2037#endif
f6a2136d
VK
2038 ]],
2039 [[
3e51d371
VK
2040 char **p = NULL;
2041 iconv(0, (const char **)p, 0, 0, 0);
7f9423af 2042 ]])],
3e51d371
VK
2043 [ac_cv_iconv_const=const],
2044 [ac_cv_iconv_const=])])
53c96e2d 2045 AC_LANG_POP([C++])
19619a35
AK
2046 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
2047 [Define as const if the declaration of iconv() needs const.])
2048fi
2049
a67fa146
VK
2050if test "x$ac_cv_type_wchar_t" = "xyes"; then
2051 if test $ac_cv_sizeof_wchar_t -eq 2; then
2052 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
2053 fi
8b86c5dc 2054
a67fa146
VK
2055 if test $ac_cv_sizeof_wchar_t -eq 4; then
2056 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
2057 fi
2058
2059 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
2060 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
2061 fi
2062else
2063 if test "x$BUILD_UNICODE" = "xyes"; then
2064 AC_MSG_ERROR(wchar_t is required for UNICODE build)
2065 fi
8b86c5dc
VK
2066fi
2067
c29360a9 2068
ef0c727b 2069#--------------------------------------------------------------------
ca0f4ea3
VK
2070# MySQL
2071#--------------------------------------------------------------------
2072
2073check_substr "$COMPONENTS" "mysql"
2074if test $? = 0; then
6fce76d8 2075 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
ca0f4ea3 2076 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
aa7794f0 2077
8d131dda
VK
2078 OLD_LIBS="$LIBS"
2079 LIBS="$LIBS $MYSQL_LIBS"
aa7794f0 2080
9c29f76e
VK
2081 AC_MSG_CHECKING(whether mysql clients can run)
2082 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2083#include <stdio.h>
2084#include <mysql.h>
2085int main(void)
2086{
2087 MYSQL *a = mysql_init(NULL);
2088 return 0;
2089}
2090 ]])],[],[
2091 AC_MSG_RESULT(no)
2092 AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)
2093 ],[])
ca0f4ea3 2094 AC_MSG_RESULT(yes)
6fce76d8 2095
ca0f4ea3 2096 AC_CHECK_FUNCS(mysql_real_escape_string)
8d131dda 2097 LIBS="$OLD_LIBS"
ca0f4ea3
VK
2098fi
2099
2100
2101#--------------------------------------------------------------------
58ed4897
VK
2102# PostgreSQL
2103#--------------------------------------------------------------------
2104
203458b7 2105check_substr "$COMPONENTS" "pgsql"
58ed4897
VK
2106if test $? = 0; then
2107 AC_CHECK_LIB(m, floor)
6fce76d8 2108 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"],
58ed4897 2109 [AC_MSG_ERROR(libpq is required for PostgreSQL support)])
6fce76d8
VK
2110
2111 AC_MSG_CHECKING(whether postgresql clients can run)
8d131dda
VK
2112 OLD_LIBS="$LIBS"
2113 LIBS="$LIBS $PGSQL_LIBS"
6fce76d8
VK
2114 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2115 #include <stdio.h>
2116 #include <libpq-fe.h>
2117 int main(void)
2118 {
2119 PGconn *a = PQconnectdb("");
2120 return 0;
2121 }
2122 ]])],[AC_MSG_RESULT(yes)],[
58ed4897
VK
2123 AC_MSG_RESULT(no)
2124 AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
2125 ],[])
8d131dda 2126 LIBS="$OLD_LIBS"
7070538d 2127 AC_CHECK_LIB(pq, PQfformat, [ AC_DEFINE(HAVE_PQFFORMAT, 1, PQfformat not exist in 7.3) ])
58ed4897
VK
2128fi
2129
2130
2131#--------------------------------------------------------------------
9c29f76e
VK
2132# ODBC
2133#--------------------------------------------------------------------
2134
2135check_substr "$COMPONENTS" "odbc"
2136if test $? = 0; then
6fce76d8 2137 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
9c29f76e 2138 [AC_MSG_ERROR(libodbc is required for ODBC support)])
60a1159a
VK
2139 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2140 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
2141 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
2142 fi
9c29f76e
VK
2143fi
2144
2145
2146#--------------------------------------------------------------------
41b4790d
VK
2147# Oracle
2148#--------------------------------------------------------------------
2149
2150check_substr "$COMPONENTS" "oracle"
2151if test $? = 0; then
2152 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
7d8c91ef
VK
2153 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
2154 [
2155 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
2156 ], [-lclntsh])
2157 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
2158 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
045845e5 2159 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
60a1159a
VK
2160 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2161 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
2162 fi
41b4790d
VK
2163fi
2164
84277a0f
AK
2165#--------------------------------------------------------------------
2166# DB2
2167#--------------------------------------------------------------------
2168
2169check_substr "$COMPONENTS" "db2"
2170if test $? = 0; then
2171 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
2172 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
2173 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
6afe141e 2174 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2175 SUBAGENT_LIBS="$SUBAGENT_LIBS $DB2_LIBS"
2176 fi
84277a0f 2177fi
41b4790d
VK
2178
2179#--------------------------------------------------------------------
37861c72
VK
2180# Informix
2181#--------------------------------------------------------------------
2182
2183check_substr "$COMPONENTS" "informix"
2184if test $? = 0; then
2185 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
4f2e8e9b
VK
2186 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
2187 [AC_MSG_ERROR(libthcli is required for Informix support)])
60a1159a
VK
2188 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2189 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
2190 fi
37861c72
VK
2191fi
2192
c3cfc039
VK
2193
2194#--------------------------------------------------------------------
50e4bc8c
VK
2195# Java
2196#--------------------------------------------------------------------
2197
2198check_substr "$COMPONENTS" "java"
2199if test $? = 0; then
2200 AC_CHECK_HEADER(jni.h,,AC_MSG_ERROR([*** Cannot find jni.h - check your JDK installation ***]))
2201# AC_CHECK_LIB(jvm, SQLAllocHandle, [JAVA_LIBS="-ljvm"],
2202# [AC_MSG_ERROR(libjvm is required for Java support)])
2203fi
2204
2205
2206#--------------------------------------------------------------------
ca0f4ea3
VK
2207# Other settings
2208#--------------------------------------------------------------------
2209
a5a95ac8
VK
2210if test "x$RUNTIME_PREFIX" = "x"; then
2211 if test "x${BUILD_UNICODE}" = "xyes"; then
2212 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\""
2213 else
2214 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\""
2215 fi
b07c50cc 2216else
a5a95ac8
VK
2217 if test "x${BUILD_UNICODE}" = "xyes"; then
2218 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\\\""
2219 else
2220 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"$RUNTIME_PREFIX\\\" -DDATADIR=\\\"$RUNTIME_PREFIX/share/netxms\\\" -DBINDIR=\\\"$RUNTIME_PREFIX/bin\\\" -DLIBDIR=\\\"$RUNTIME_PREFIX/lib\\\" -DPKGLIBDIR=\\\"$RUNTIME_PREFIX/lib/netxms\\\""
2221 fi
b07c50cc 2222fi
545bda2d 2223LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $LDFLAGS_SUFFIX"
ca0f4ea3 2224
25ae8377
VK
2225if test "x${ENABLE_WERROR}" = "xyes"; then
2226 CPPFLAGS="$CPPFLAGS -Werror"
2227fi
2228
2b479c92
VK
2229if test "x$shrext_cmds" != "x"; then
2230 AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], _T("$shrext_cmds"), [Define to platform's shared library suffix])
2231fi
2232
551ec9ca 2233AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
17b35ccc 2234AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
1fd41bcd 2235AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$NEED_ZLIB/$HAVE_ZLIB" = "yes/no"])
c1165d33
VK
2236AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
2237AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
eca43970 2238AM_CONDITIONAL([USE_ENCRYPTION], [test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"])
6dde8627 2239AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
058bf6fc 2240AM_CONDITIONAL([XMPP_SUPPORT], [test "x$XMPP_SUPPORT" = "xyes"])
8b86c5dc 2241
ca0f4ea3
VK
2242
2243#--------------------------------------------------------------------
ef0c727b
VK
2244# Substitute variables
2245#--------------------------------------------------------------------
82fa7c5d 2246
ef0c727b
VK
2247AC_SUBST(DB_DRIVERS)
2248AC_SUBST(MODULES)
2249AC_SUBST(SUBAGENT_DIRS)
7dda4453 2250AC_SUBST(SERVER_INCLUDE)
7c48e2aa 2251AC_SUBST(SERVER_LIBS)
ef0c727b
VK
2252AC_SUBST(SERVER_TOOLS)
2253AC_SUBST(TOP_LEVEL_MODULES)
2254AC_SUBST(CONTRIB_MODULES)
c2612d83 2255AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
2256AC_SUBST(STATIC_SUBAGENT_LIST)
2257AC_SUBST(SUBAGENT_LIBS)
2258AC_SUBST(BUILD_SERVER)
447350a9 2259AC_SUBST(BUILD_SDK)
6fce76d8
VK
2260AC_SUBST(MYSQL_LIBS)
2261AC_SUBST(PGSQL_LIBS)
7d8c91ef 2262AC_SUBST(ORACLE_LIBS)
6fce76d8 2263AC_SUBST(ODBC_LIBS)
84277a0f 2264AC_SUBST(DB2_LIBS)
87f1fff0 2265AC_SUBST(INFORMIX_LIBS)
11ce9a66 2266AC_SUBST(OBJECT_MODE)
9113e749 2267AC_SUBST(SQLFLAGS)
2b479c92 2268AC_SUBST(SHLIB_SUFFIX, $shrext_cmds)
d16cf8a5 2269
ef0c727b
VK
2270#--------------------------------------------------------------------
2271# Shared libs versions
d16cf8a5
AK
2272#
2273# versioning scheme: current:revision:age
2274#
2275# current
2276# The number of the current interface exported by the library. A current
2277# value of `0', means that you are calling the interface exported by this
2278# library interface 0.
2279#
2280# revision
2281# The implementation number of the most recent interface exported by this
2282# library. In this case, a revision value of `0' means that this is the
2283# first implementation of the interface.
2284# If the next release of this library exports the same interface, but has a
2285# different implementation (perhaps some bugs have been fixed), the revision
2286# number will be higher, but current number will be the same. In that case,
2287# when given a choice, the library with the highest revision will always
2288# be used by the runtime loader.
2289#
2290# age
2291# The number of previous additional interfaces supported by this library.
2292# If age were `2', then this library can be linked into executables which
2293# were built with a release of this library that exported the current
2294# interface number, current, or any of the previous two interfaces.
2295# By definition age must be less than or equal to current. At the outset,
2296# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 2297#--------------------------------------------------------------------
d16cf8a5 2298
17b35ccc 2299NETXMS_LIBRARY_VERSION=1:0:0
c7d14846 2300AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 2301
ef0c727b
VK
2302#--------------------------------------------------------------------
2303# Generate output files
2304#--------------------------------------------------------------------
d16cf8a5
AK
2305
2306AC_CONFIG_FILES([
0c3c0c39
AK
2307 Makefile
2308 contrib/Makefile
36874eca
VK
2309 contrib/backgrounds/Makefile
2310 contrib/integration/Makefile
2311 contrib/integration/HP_EVA/Makefile
bad6cc0c 2312 contrib/integration/HP_P2000/Makefile
36874eca 2313 contrib/mibs/Makefile
0c3c0c39 2314 contrib/startup/Makefile
fa66d60c 2315 contrib/startup/debian/Makefile
daaefaaf 2316 contrib/startup/gentoo/Makefile
7483d0bf 2317 contrib/startup/hp-ux/Makefile
0c3c0c39 2318 contrib/startup/redhat/Makefile
5de3893d 2319 contrib/startup/suse/Makefile
9993edf4 2320 contrib/startup/ubuntu/Makefile
6adf3219 2321 contrib/startup/solaris/Makefile
0c3c0c39 2322 doc/Makefile
a48203d2
VK
2323 doc/internal/Makefile
2324 doc/manuals/Makefile
2325 doc/misc/Makefile
0c3c0c39
AK
2326 images/Makefile
2327 include/Makefile
2328 m4/Makefile
0c3c0c39 2329 src/Makefile
9191f6ad 2330 src/agent/Makefile
6ac698ed 2331 src/agent/appagent/Makefile
9191f6ad
VK
2332 src/agent/core/Makefile
2333 src/agent/install/Makefile
a2a24e9d 2334 src/agent/libnxsd/Makefile
9191f6ad 2335 src/agent/subagents/Makefile
9191f6ad 2336 src/agent/subagents/aix/Makefile
df8b3df7 2337 src/agent/subagents/darwin/Makefile
80e96a82 2338 src/agent/subagents/ecs/Makefile
9191f6ad 2339 src/agent/subagents/freebsd/Makefile
80e96a82
VK
2340 src/agent/subagents/hpux/Makefile
2341 src/agent/subagents/informix/Makefile
9191f6ad 2342 src/agent/subagents/ipso/Makefile
50e4bc8c
VK
2343 src/agent/subagents/java/Makefile
2344 src/agent/subagents/java/java/Makefile
2345 src/agent/subagents/java/java/src/Makefile
2346 src/agent/subagents/java/java/src/main/Makefile
2347 src/agent/subagents/java/java/src/main/java/Makefile
2348 src/agent/subagents/java/java/src/main/java/org/Makefile
2349 src/agent/subagents/java/java/src/main/java/org/netxms/Makefile
2350 src/agent/subagents/java/java/src/main/java/org/netxms/agent/Makefile
80e96a82 2351 src/agent/subagents/linux/Makefile
df8b3df7 2352 src/agent/subagents/lmsensors/Makefile
80e96a82
VK
2353 src/agent/subagents/logwatch/Makefile
2354 src/agent/subagents/netbsd/Makefile
df8b3df7 2355 src/agent/subagents/netsvc/Makefile
80e96a82
VK
2356 src/agent/subagents/odbcquery/Makefile
2357 src/agent/subagents/openbsd/Makefile
4d1753cd 2358 src/agent/subagents/oracle/Makefile
9191f6ad 2359 src/agent/subagents/ping/Makefile
80e96a82 2360 src/agent/subagents/portCheck/Makefile
df8b3df7 2361 src/agent/subagents/rpi/Makefile
9191f6ad 2362 src/agent/subagents/sms/Makefile
80e96a82 2363 src/agent/subagents/sunos/Makefile
9191f6ad 2364 src/agent/subagents/ups/Makefile
80e96a82
VK
2365 src/agent/subagents/winnt/Makefile
2366 src/agent/subagents/winperf/Makefile
a7a03ffd
VK
2367 src/agent/subagents/wmi/Makefile
2368 src/agent/subagents/db2/Makefile
0bd64860 2369 src/agent/tools/Makefile
6ac698ed 2370 src/agent/tools/nxappget/Makefile
0bd64860 2371 src/agent/tools/nxapush/Makefile
c2612d83 2372 src/client/Makefile
551592f4 2373 src/client/install/Makefile
c94fa5c2 2374 src/client/nxalarm/Makefile
e84701c5 2375 src/client/nxevent/Makefile
9cb6c12f 2376 src/client/nxlexer/Makefile
e84701c5 2377 src/client/nxpush/Makefile
59ffa5b7 2378 src/client/nxsms/Makefile
9cb6c12f
VK
2379 src/client/scilexer/Makefile
2380 src/client/windows/Makefile
2381 src/client/windows/nxav/Makefile
2382 src/client/windows/nxav/res/Makefile
23c8c53e
AK
2383 src/client/windows/nxcon/Makefile
2384 src/client/windows/nxcon/icons/Makefile
2385 src/client/windows/nxcon/res/Makefile
23c8c53e
AK
2386 src/client/windows/nxnotify/Makefile
2387 src/client/windows/nxnotify/res/Makefile
9cb6c12f
VK
2388 src/client/windows/nxuilib/Makefile
2389 src/client/windows/nxuilib/res/Makefile
2390 src/client/windows/nxuilib/sounds/Makefile
d1834406
VK
2391 src/db/Makefile
2392 src/db/dbdrv/Makefile
87f1fff0
VK
2393 src/db/dbdrv/db2/Makefile
2394 src/db/dbdrv/informix/Makefile
d1834406
VK
2395 src/db/dbdrv/odbc/Makefile
2396 src/db/dbdrv/mssql/Makefile
2397 src/db/dbdrv/mysql/Makefile
87f1fff0 2398 src/db/dbdrv/oracle/Makefile
d1834406
VK
2399 src/db/dbdrv/pgsql/Makefile
2400 src/db/dbdrv/sqlite/Makefile
d1834406 2401 src/db/libnxdb/Makefile
9191f6ad
VK
2402 src/install/Makefile
2403 src/install/windows/Makefile
2404 src/libexpat/Makefile
2405 src/libexpat/libexpat/Makefile
2406 src/libnetxms/Makefile
2407 src/libnxcl/Makefile
2408 src/libnxlp/Makefile
2409 src/libnxmap/Makefile
2410 src/libnxsl/Makefile
058bf6fc 2411 src/libstrophe/Makefile
a67fa146
VK
2412 src/libtre/Makefile
2413 src/libtre/win32/Makefile
a7a03ffd 2414 src/nxcproxy/Makefile
9191f6ad 2415 src/nxscript/Makefile
0c3c0c39
AK
2416 src/server/Makefile
2417 src/server/core/Makefile
644f97f5 2418 src/server/drivers/Makefile
0239cfea 2419 src/server/drivers/at/Makefile
644f97f5 2420 src/server/drivers/baystack/Makefile
b1bd1fb2 2421 src/server/drivers/cat2900xl/Makefile
910846cc 2422 src/server/drivers/catalyst/Makefile
fce03ab9 2423 src/server/drivers/cisco-esw/Makefile
8bdfaed8 2424 src/server/drivers/dell-pwc/Makefile
a548def4 2425 src/server/drivers/dlink/Makefile
644f97f5 2426 src/server/drivers/ers8000/Makefile
4e592faf
VK
2427 src/server/drivers/lib/Makefile
2428 src/server/drivers/lib/avaya-ers/Makefile
b1bd1fb2 2429 src/server/drivers/lib/cisco/Makefile
81ecaf38 2430 src/server/drivers/netscreen/Makefile
e10e890e 2431 src/server/drivers/ntws/Makefile
c183a9f9 2432 src/server/drivers/ping3/Makefile
9b13553b 2433 src/server/drivers/procurve/Makefile
217e4d6a 2434 src/server/drivers/symbol-ws/Makefile
d770a97c
VK
2435 src/server/include/Makefile
2436 src/server/libnxsrv/Makefile
2437 src/server/netxmsd/Makefile
d8f2e39b
VK
2438 src/server/smsdrv/Makefile
2439 src/server/smsdrv/generic/Makefile
91369aca 2440 src/server/smsdrv/nxagent/Makefile
aab8a8b6 2441 src/server/smsdrv/portech/Makefile
80a30c53 2442 src/server/smsdrv/dummy/Makefile
0c3c0c39 2443 src/server/tools/Makefile
0c3c0c39
AK
2444 src/server/tools/nxaction/Makefile
2445 src/server/tools/nxadm/Makefile
9191f6ad 2446 src/server/tools/nxap/Makefile
5b0c7d0d
VK
2447 src/server/tools/nxconfig/Makefile
2448 src/server/tools/nxconfig/res/Makefile
f90d7fc5 2449 src/server/tools/nxdbmgr/Makefile
9191f6ad 2450 src/server/tools/nxget/Makefile
d24fdaf4 2451 src/server/tools/nxupload/Makefile
c5c0f362
VK
2452 src/snmp/Makefile
2453 src/snmp/libnxsnmp/Makefile
2454 src/snmp/nxmibc/Makefile
2455 src/snmp/nxsnmpget/Makefile
2456 src/snmp/nxsnmpset/Makefile
2457 src/snmp/nxsnmpwalk/Makefile
9191f6ad 2458 src/sqlite/Makefile
f65df2b1 2459 src/tools/Makefile
f65df2b1 2460 src/tools/nxdevcfg/Makefile
56e13b13 2461 src/tools/nxencpasswd/Makefile
1fd41bcd 2462 src/zlib/Makefile
9191f6ad 2463 sql/Makefile
0c3c0c39 2464 tools/Makefile
d16cf8a5
AK
2465])
2466
12249937
VK
2467AC_OUTPUT
2468
ef0c727b 2469echo "Updating libtool"
5cecf50e
AK
2470sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2471
779ce551 2472# On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
5482ef16 2473if test "x$ac_compiler_gnu" = "xyes" && test "x$PLATFORM" = "xHP-UX"; then
779ce551
VK
2474 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2475fi
2476
b677ef59
VK
2477# On AIX, correct OBJECT_MODE must be set before linking
2478# To avoid manual setting by user, we add this to libtool script
2479if test "x$PLATFORM" = "xAIX"; then
2480 head -n 1 ./libtool > ./libtool.new
2481 echo "export OBJECT_MODE=$OBJECT_MODE" >> ./libtool.new
2482 tail -n +2 ./libtool >> ./libtool.new
2483 mv libtool.new libtool
2484 chmod +x ./libtool
2485fi
2486
ef0c727b
VK
2487#--------------------------------------------------------------------
2488# Print summary
2489#--------------------------------------------------------------------
a7442678 2490
a7442678
AK
2491echo
2492echo
2493echo
2494echo '---------------------------------------------------------------------'
2495echo ' Configure results'
2496echo '---------------------------------------------------------------------'
2497echo
8b86c5dc 2498 echo "Prefix : ${prefix}"
a7442678 2499if test "x${BUILD_SERVER}" = "xyes"; then
8b86c5dc 2500 echo "Build Server : YES"
7c48e2aa 2501 echo "Server libs : ${SERVER_LIBS}"
058bf6fc
VK
2502 if test "x${XMPP_SUPPORT}" = "xyes"; then
2503 echo "XMPP support : YES"
2504 else
2505 echo "XMPP support : NO"
2506 fi
a7442678 2507else
8b86c5dc 2508 echo "Build Server : NO"
a7442678
AK
2509fi
2510if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
8b86c5dc 2511 echo "Encryption enabled : YES"
a7442678 2512else
8b86c5dc 2513 echo "Encryption enabled : NO"
a7442678
AK
2514fi
2515if test "x${DB_DRIVERS}" != "x"; then
8b86c5dc 2516 echo "Build DB-Drivers :${DB_DRIVERS}"
a7442678 2517else
8b86c5dc 2518 echo "Build DB-Drivers : NO"
a7442678
AK
2519fi
2520if test "x${BUILD_CLIENT}" = "xyes"; then
8b86c5dc 2521 echo "Build Clients : YES"
a7442678 2522else
8b86c5dc 2523 echo "Build Clients : NO"
a7442678
AK
2524fi
2525if test "x${BUILD_AGENT}" = "xyes"; then
8b86c5dc
VK
2526 echo "Build Agent : YES"
2527 echo "Subagents list : ${SUBAGENT_DIRS}"
a7442678 2528else
8b86c5dc 2529 echo "Build Agent : NO"
a7442678 2530fi
e8636669 2531if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
8b86c5dc
VK
2532 echo "Build Static Agent : YES"
2533 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
e8636669 2534else
8b86c5dc 2535 echo "Build Static Agent : NO"
e8636669 2536fi
8b86c5dc 2537if test "x${BUILD_UNICODE}" = "xyes"; then
a67fa146 2538 echo "UNICODE build : YES"
8b86c5dc 2539else
a67fa146 2540 echo "UNICODE build : NO"
8b86c5dc 2541fi
551ec9ca
VK
2542if test "x${HAVE_LIBEXPAT}" = "xno"; then
2543 echo "Use internal libexpat : YES"
1bb6b449 2544else
551ec9ca 2545 echo "Use internal libexpat : NO"
1bb6b449 2546fi
17b35ccc
VK
2547if test "x${HAVE_LIBTRE}" = "xno"; then
2548 echo "Use internal libtre : YES"
2549else
2550 echo "Use internal libtre : NO"
2551fi
1fd41bcd
VK
2552if test "x${NEED_ZLIB}" = "xyes"; then
2553 if test "x${HAVE_ZLIB}" = "xno"; then
2554 echo "Use internal zlib : YES"
2555 else
2556 echo "Use internal zlib : NO"
2557 fi
2558fi
cc297a70
VK
2559if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
2560 echo "Force 32bit build : YES"
2561else
2562 echo "Force 32bit build : NO"
2563fi
7d8c91ef 2564
9113e749
VK
2565echo "C compiler : ${CC}"
2566echo "C++ compiler : ${CXX}"
7d8c91ef
VK
2567echo "CPPFLAGS : ${CPPFLAGS}"
2568echo "CXXFLAGS : ${CXXFLAGS}"
2569echo "CFLAGS : ${CFLAGS}"
2570echo "LDFLAGS : ${LDFLAGS}"
8d131dda 2571echo "LIBS : ${LIBS}"
7d8c91ef 2572
6fce76d8
VK
2573if test "x${MYSQL_LIBS}" != "x"; then
2574 echo "MySQL libs : ${MYSQL_LIBS}"
2575fi
2576if test "x${PGSQL_LIBS}" != "x"; then
2577 echo "PostgreSQL libs : ${PGSQL_LIBS}"
2578fi
7d8c91ef
VK
2579if test "x${ORACLE_LIBS}" != "x"; then
2580 echo "Oracle libs : ${ORACLE_LIBS}"
2581fi
6fce76d8
VK
2582if test "x${ODBC_LIBS}" != "x"; then
2583 echo "ODBC libs : ${ODBC_LIBS}"
2584fi
84277a0f
AK
2585if test "x${DB2_LIBS}" != "x"; then
2586 echo "DB2 libs : ${DB2_LIBS}"
2587fi
37861c72
VK
2588if test "x${INFORMIX_LIBS}" != "x"; then
2589 echo "Informix libs : ${INFORMIX_LIBS}"
2590fi
ecbed20c
VK
2591
2592FLAGS_CPP="src/tools/nxdevcfg/flags.cpp"
2593echo "/* Automatically generated by configure */" > $FLAGS_CPP
d541b129
VK
2594echo "#include <nms_common.h>" >> $FLAGS_CPP
2595echo "const TCHAR *g_cppFlags = _T(\"${CPPFLAGS}\");" >> $FLAGS_CPP
2596echo "const TCHAR *g_cFlags = _T(\"${CFLAGS}\");" >> $FLAGS_CPP
2597echo "const TCHAR *g_cxxFlags = _T(\"${CXXFLAGS}\");" >> $FLAGS_CPP
2598echo "const TCHAR *g_ldFlags = _T(\"${LDFLAGS}\");" >> $FLAGS_CPP
2599echo "const TCHAR *g_libs = _T(\"${LIBS}\");" >> $FLAGS_CPP
7dda4453
VK
2600echo "const TCHAR *g_cc = _T(\"${CC}\");" >> $FLAGS_CPP
2601echo "const TCHAR *g_cxx = _T(\"${CXX}\");" >> $FLAGS_CPP
2602echo "const TCHAR *g_ld = _T(\"${LD}\");" >> $FLAGS_CPP
2603echo "const TCHAR *g_perl = _T(\"${PERL}\");" >> $FLAGS_CPP