unfinished SNMP trap configuration API
[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
467c489f 7AC_INIT([NetXMS], [1.1.0], [NetXMS Team <bugs@netxms.org>])
ba1d810c
AK
8AC_CONFIG_AUX_DIR(config)
9AM_CONFIG_HEADER(config.h)
d16cf8a5
AK
10AM_INIT_AUTOMAKE
11
aa24418a 12AC_CONFIG_MACRO_DIR([m4])
5387ff75 13
ef0c727b
VK
14#--------------------------------------------------------------------
15# Functions
16#--------------------------------------------------------------------
5387ff75 17
ef0c727b
VK
18check_substr()
19{
1010cff7 20 for w in $1; do
ef0c727b
VK
21 if test "x$w" = "x$2"; then
22 return 0;
23 fi
24 done
25 return 1
26}
16dff090 27
d3c8926d 28
ef0c727b
VK
29#--------------------------------------------------------------------
30# Initialize variables
31#--------------------------------------------------------------------
d3c8926d 32
ef0c727b
VK
33PLATFORM=`uname -s`
34COMPONENTS=""
35DISABLE_ICONV="no"
36DISABLE_ENCRYPTION="no"
37ENABLE_UNSTABLE="no"
f974a50a 38ENABLE_DEBUG="no"
ef0c727b
VK
39STATIC_BUILD="no"
40DBDRIVER_SELECTED="no"
41USE_PTH="no"
42BUILD_SERVER="no"
43BUILD_AGENT="no"
44BUILD_CLIENT="no"
45BUILD_NXHTTPD="no"
46BUILD_STATIC_AGENT="no"
47NEED_ZLIB="no"
d99ee887 48NEED_WXWIDGETS="no"
f65df2b1 49MODULES="libnetxms tools install"
ef0c727b
VK
50STATIC_SUBAGENT_LIST=""
51SUBAGENT_DIRS=""
52SUBAGENT_LIBS=""
53UNSTABLE_SUBAGENT_DIRS=""
54SERVER_TOOLS=""
55TOP_LEVEL_MODULES=""
56CONTRIB_MODULES=""
c2612d83 57CLIENT_COMPONENTS=""
8b86c5dc 58BUILD_UNICODE="no"
273da39a 59WX_UNICODE="no"
7d8c91ef 60ORACLE_LIBS=""
6fce76d8
VK
61PGSQL_LIBS=""
62MYSQL_LIBS=""
63ODBC_LIBS=""
467c489f 64FORCE_INTERNAL_EXPAT="no"
d3c8926d 65
16dff090 66
ef0c727b
VK
67#--------------------------------------------------------------------
68# Parse command line parameters
69#--------------------------------------------------------------------
7c9c94a7 70
ef0c727b
VK
71AC_ARG_WITH(server,
72[AS_HELP_STRING(--with-server,build server)],
73[
8817f620 74 COMPONENTS="$COMPONENTS sqlite snmp server agent"
c5c0f362
VK
75])
76
77AC_ARG_WITH(snmp,
78[AS_HELP_STRING(--with-snmp,build SNMP library and tools)],
79[
80 COMPONENTS="$COMPONENTS snmp"
ef0c727b 81])
7c9c94a7 82
ef0c727b
VK
83AC_ARG_WITH(client,
84[AS_HELP_STRING(--with-client,build client library and tools)],
85[
86 COMPONENTS="$COMPONENTS client"
87])
d16cf8a5 88
c2612d83 89AC_ARG_WITH(agent,
ef0c727b
VK
90[AS_HELP_STRING(--with-agent,build agent)],
91[
8817f620 92 COMPONENTS="$COMPONENTS sqlite agent"
ef0c727b 93])
d16cf8a5 94
ef0c727b
VK
95AC_ARG_WITH(static-agent,
96[AS_HELP_STRING(--with-static-agent,build statically linked agent)],
97[
8817f620 98 COMPONENTS="$COMPONENTS sqlite static-agent"
ef0c727b 99])
d16cf8a5 100
ef0c727b
VK
101AC_ARG_WITH(ipso-agent,
102[AS_HELP_STRING(--with-ipso-agent,build statically linked IPSO agent)],
103[
8817f620 104 COMPONENTS="$COMPONENTS sqlite ipso-agent"
ef0c727b 105])
521d90e7 106
e02b69b9
VK
107AC_ARG_WITH(webui,
108[AS_HELP_STRING(--with-webui,build web interface)],
ef0c727b 109[
e02b69b9 110 COMPONENTS="$COMPONENTS webui"
ef0c727b 111])
d16cf8a5 112
ef0c727b
VK
113AC_ARG_WITH(mdebug,
114[AS_HELP_STRING(--with-mdebug,use debug version of memory allocation functions)],
115[
116 CPPFLAGS="$CPPFLAGS -DNETXMS_MEMORY_DEBUG"
117])
d16cf8a5 118
467c489f
VK
119AC_ARG_WITH(internal-libexpat,
120[AS_HELP_STRING(--with-internal-libexpat,force use of bundled libexpat)],
121[
122 FORCE_INTERNAL_EXPAT="yes"
123])
124
9486b324
VK
125AC_ARG_WITH(sqlite,
126[AS_HELP_STRING(--with-sqlite,build SQLite database driver)],
127[ if test "x$withval" != "xno" ; then
8817f620 128 COMPONENTS="$COMPONENTS sqlite_drv"
ef0c727b 129 DBDRIVER_SELECTED="yes"
9486b324
VK
130fi ])
131
c4b88c3d
VK
132AC_ARG_WITH(odbc,
133[AS_HELP_STRING(--with-odbc,build ODBC database driver)],
134[ if test "x$withval" != "xno" ; then
135 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
136 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
137 LDFLAGS="$LDFLAGS -L${withval}/lib"
138 CPPFLAGS="$CPPFLAGS -I${withval}/include"
ef0c727b
VK
139 fi
140 COMPONENTS="$COMPONENTS odbc"
141 DBDRIVER_SELECTED="yes"
c4b88c3d
VK
142fi ])
143
41b4790d
VK
144AC_ARG_WITH(oracle,
145[AS_HELP_STRING(--with-oracle,build Oracle database driver)],
146[ if test "x$withval" != "xno" ; then
147 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
7d8c91ef
VK
148 if test -x "$withval/lib" ; then
149 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
150 LDFLAGS="$LDFLAGS -L${withval}/lib"
151 else
152 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
153 LDFLAGS="$LDFLAGS -L${withval}"
154 fi
155 if test -x "$withval/include" ; then
156 CPPFLAGS="$CPPFLAGS -I${withval}/include"
157 fi
158 if test -x "$withval/sdk/include" ; then
159 CPPFLAGS="$CPPFLAGS -I${withval}/sdk/include"
160 fi
41b4790d
VK
161 fi
162 COMPONENTS="$COMPONENTS oracle"
163 DBDRIVER_SELECTED="yes"
164fi ])
165
d16cf8a5 166AC_ARG_WITH(mysql,
c4b88c3d 167[AS_HELP_STRING(--with-mysql,build MySQL database driver)],
d16cf8a5
AK
168[ if test "x$withval" != "xno" ; then
169 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
170 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
171 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/mysql -L${withval}/mysql/lib"
6693a1d0 172 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include"
d16cf8a5 173 else
007ae516
VK
174 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}"
175 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 176 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 177 fi
ef0c727b
VK
178 COMPONENTS="$COMPONENTS mysql"
179 DBDRIVER_SELECTED="yes"
6693a1d0 180fi ])
d16cf8a5
AK
181
182AC_ARG_WITH(pgsql,
c4b88c3d 183[AS_HELP_STRING(--with-pgsql,build PostgreSQL database driver)],
d16cf8a5 184[ if test "x$withval" != "xno" ; then
6693a1d0
AK
185 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
186 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
187 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/pgsql -L${withval}/lib/postgresql -L${withval}/pgsql/lib -L${withval}/postgresql/lib"
188 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/pgsql -I${withval}/include/postgresql -I${withval}/pgsql/include -I${withval}/postgresql/include"
189 else
007ae516
VK
190 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}"
191 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
192 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"
193 fi
ef0c727b
VK
194 COMPONENTS="$COMPONENTS pgsql"
195 DBDRIVER_SELECTED="yes"
6693a1d0 196fi ])
d16cf8a5 197
ef0c727b 198AC_ARG_WITH(openssl,
1010cff7
VK
199[AS_HELP_STRING(--with-openssl,specify OpenSSL location)],
200[
201 if test "x$withval" != "xno" ; then
202 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
203 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
204 LDFLAGS="$LDFLAGS -L${withval}/lib"
205 CPPFLAGS="$CPPFLAGS -I${withval}/include"
206 else
207 LD_RUN_PATH="/usr/local/lib:/opt/openssl/lib:/usr/local/ssl/lib:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
208 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/opt/openssl/lib"
4d37b0c5 209 CPPFLAGS="$CPPFLAGS -I/opt/openssl/include"
ef0c727b 210 fi
1010cff7
VK
211 fi
212 REQUIRE_ENCRYPTION="yes"
213])
ef0c727b 214
c3cfc039
VK
215AC_ARG_WITH(gd,
216[AS_HELP_STRING(--with-gd,specify GD location)],
217[
218 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
219 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
220 LDFLAGS="$LDFLAGS -L${withval}/lib"
221 CPPFLAGS="$CPPFLAGS -I${withval}/include"
222 fi
223])
224
ef0c727b
VK
225AC_ARG_ENABLE(iconv,
226[AS_HELP_STRING(--disable-iconv,do not use iconv() for text conversions)],
3a7ce527 227[
ef0c727b 228 DISABLE_ICONV="yes"
3a7ce527 229])
3a7ce527 230
ef0c727b
VK
231AC_ARG_ENABLE(encryption,
232[AS_HELP_STRING(--disable-encryption,disable encryption support)],
e0760102 233[
ef0c727b 234 DISABLE_ENCRYPTION="yes"
e0760102
VK
235])
236
ef0c727b
VK
237AC_ARG_ENABLE(unstable,
238[AS_HELP_STRING(--enable-unstable,build experimental/unstable components)],
d8ca9c03 239[
ef0c727b 240 ENABLE_UNSTABLE="yes"
d8ca9c03
VK
241])
242
f974a50a
VK
243AC_ARG_ENABLE(debug,
244[AS_HELP_STRING(--enable-debug,enable additional debugging functionality)],
245[
246 ENABLE_DEBUG="yes"
247])
248
ef0c727b
VK
249AC_ARG_WITH(dist,
250[AS_HELP_STRING(--with-dist,for maintainers only)],
68e4e62d 251 DB_DRIVERS=" mysql pgsql odbc mssql sqlite oracle"
f65df2b1 252 MODULES="libexpat libnetxms install sqlite snmp libnxsl libnxlp db server agent libnxmap libnxcl client nxscript tools webui"
ad0f1ada 253 SUBAGENT_DIRS="linux freebsd openbsd netbsd sunos aix ipso hpux"
ef0c727b
VK
254 NXCONFIG="nxconfig"
255 TOP_LEVEL_MODULES="sql images"
256 CONTRIB_MODULES="mibs backgrounds"
aa24418a 257 CLIENT_COMPONENTS="nxalarm nxevent nxpush nxsms"
24f89c3a 258 UNSTABLE_SUBAGENT_DIRS="odbcquery"
ef0c727b
VK
259 SERVER_TOOLS="nxconfig"
260)
261
d8ca9c03 262
ef0c727b
VK
263#--------------------------------------------------------------------
264# Validate command line parameters and set various checking options
265#--------------------------------------------------------------------
266
8817f620
VK
267check_substr "$COMPONENTS" "sqlite"
268if test $? = 0; then
269 MODULES="$MODULES sqlite"
270fi
271
ef0c727b 272check_substr "$COMPONENTS" "static-agent"
1010cff7 273if test $? = 0; then
ef0c727b
VK
274 if test "x$COMPONENTS" != "x static-agent"; then
275 AC_MSG_ERROR(Static agent and other components are mutally exclusive.)
276 fi
277 STATIC_BUILD="yes"
278 BUILD_STATIC_AGENT="yes"
aa8d6795 279 MODULES="$MODULES libnxlp agent"
3a6979cf 280 DISABLE_ICONV="yes"
ef0c727b 281 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT"
e8636669 282
ef0c727b 283 case "$PLATFORM" in
e8636669
VK
284 Linux)
285 SUBAGENT_DIRS="linux"
d0b5a098
VK
286 SUBAGENT_LIBS="../subagents/linux/libnsm_linux.la"
287 STATIC_SUBAGENT_LIST="linux $STATIC_SUBAGENT_LIST"
e8636669
VK
288 ;;
289 FreeBSD)
290 SUBAGENT_DIRS="freebsd"
d0b5a098
VK
291 SUBAGENT_LIBS="../subagents/freebsd/libnsm_freebsd.la"
292 STATIC_SUBAGENT_LIST="freebsd $STATIC_SUBAGENT_LIST"
e8636669 293 ;;
992ba479
AK
294 OpenBSD)
295 SUBAGENT_DIRS="openbsd"
296 SUBAGENT_LIBS="../subagents/openbsd/libnsm_openbsd.la"
297 STATIC_SUBAGENT_LIST="openbsd $STATIC_SUBAGENT_LIST"
298 ;;
ad0f1ada
VK
299 NetBSD)
300 SUBAGENT_DIRS="netbsd"
301 SUBAGENT_LIBS="../subagents/netbsd/libnsm_netbsd.la"
302 STATIC_SUBAGENT_LIST="netbsd $STATIC_SUBAGENT_LIST"
303 ;;
e8636669
VK
304 SunOS)
305 SUBAGENT_DIRS="sunos"
d0b5a098
VK
306 SUBAGENT_LIBS="../subagents/sunos/libnsm_sunos.la"
307 STATIC_SUBAGENT_LIST="sunos $STATIC_SUBAGENT_LIST"
308 ;;
309 AIX)
310 SUBAGENT_DIRS="aix"
311 SUBAGENT_LIBS="../subagents/aix/libnsm_aix.la"
312 STATIC_SUBAGENT_LIST="aix $STATIC_SUBAGENT_LIST"
e8636669 313 ;;
c29360a9
VK
314 HP-UX)
315 SUBAGENT_DIRS="hpux"
316 SUBAGENT_LIBS="../subagents/hpux/libnsm_hpux.la"
317 STATIC_SUBAGENT_LIST="hpux $STATIC_SUBAGENT_LIST"
318 ;;
e8636669
VK
319 *)
320 # unknown
321 ;;
322 esac
ef0c727b 323fi
2b23dc1e 324
ef0c727b 325check_substr "$COMPONENTS" "ipso-agent"
1010cff7 326if test $? = 0; then
fd5a401b 327 if test "x$COMPONENTS" != "x ipso-agent"; then
ef0c727b
VK
328 AC_MSG_ERROR(IPSO agent and other components are mutally exclusive.)
329 fi
330 STATIC_BUILD="yes"
331 BUILD_STATIC_AGENT="yes"
3a6979cf 332 DISABLE_ICONV="yes"
ef0c727b 333 USE_PTH="yes"
aa8d6795 334 MODULES="$MODULES libnxlp agent"
aa24418a 335 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT -D_IPSO -D_USE_GNU_PTH -DSQLITE_THREADSAFE=0 -I/usr/local/include"
ef0c727b
VK
336 LDFLAGS="$LDFLAGS -all-static"
337 STATIC_SUBAGENT_LIST="ipso ping portcheck ups"
338 SUBAGENT_DIRS="ipso"
339 SUBAGENT_LIBS="../subagents/ipso/libnsm_ipso.la ../subagents/ping/libnsm_ping.la ../subagents/portCheck/libnsm_portCheck.la ../subagents/ups/libnsm_ups.la"
340fi
c688d2a7 341
c5c0f362
VK
342check_substr "$COMPONENTS" "snmp"
343if test $? = 0; then
344 NEED_ZLIB="yes"
345 MODULES="$MODULES snmp"
346fi
347
ef0c727b 348check_substr "$COMPONENTS" "server"
1010cff7 349if test $? = 0; then
ef0c727b
VK
350 if test "x$DBDRIVER_SELECTED" != "xyes"; then
351 AC_MSG_ERROR(You must select at least one database driver when building server.)
352 fi
353 BUILD_SERVER="yes"
d1834406 354 MODULES="$MODULES libnxmap libnxsl libnxlp db server nxscript"
ef0c727b
VK
355 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES sql images"
356 CONTRIB_MODULES="$CONTRIB_MODULES mibs backgrounds"
357fi
dff54fed 358
e44986e5
VK
359check_substr "$COMPONENTS" "client"
360if test $? = 0; then
361 BUILD_CLIENT="yes"
362 NEED_ZLIB="yes"
aa24418a 363 MODULES="$MODULES libnxmap libnxcl client"
36ad9f45 364 CLIENT_COMPONENTS="$CLIENT_COMPONENTS nxalarm nxevent nxpush nxsms"
e44986e5
VK
365fi
366
ef0c727b 367check_substr "$COMPONENTS" "agent"
1010cff7 368if test $? = 0; then
ef0c727b 369 BUILD_AGENT="yes"
28ba6824 370 MODULES="$MODULES libnxlp db agent"
ef0c727b 371 if test "x$ENABLE_UNSTABLE" = "xyes"; then
24f89c3a 372 UNSTABLE_SUBAGENT_DIRS="odbcquery"
987b646a 373 fi
1010cff7
VK
374
375 case "$PLATFORM" in
376 Linux)
377 SUBAGENT_DIRS="linux"
378 ;;
379 FreeBSD)
380 SUBAGENT_DIRS="freebsd"
381 ;;
382 OpenBSD)
383 SUBAGENT_DIRS="openbsd"
384 ;;
ad0f1ada
VK
385 NetBSD)
386 SUBAGENT_DIRS="netbsd"
387 ;;
1010cff7
VK
388 SunOS)
389 SUBAGENT_DIRS="sunos"
390 ;;
391 AIX)
392 SUBAGENT_DIRS="aix"
393 ;;
394 HP-UX)
395 SUBAGENT_DIRS="hpux"
396 ;;
397 *)
398 # unknown
399 ;;
400 esac
ef0c727b 401fi
b97191d2 402
e02b69b9 403check_substr "$COMPONENTS" "webui"
1010cff7 404if test $? = 0; then
ef0c727b 405 BUILD_NXHTTPD="yes"
e02b69b9 406 MODULES="$MODULES libnxmap libnxcl webui"
ef0c727b 407fi
b67a9e12 408
ef0c727b 409check_substr "$COMPONENTS" "mysql"
1010cff7 410if test $? = 0; then
ef0c727b 411 DB_DRIVERS="$DB_DRIVERS mysql"
b67a9e12 412fi
6619a6b0 413
ef0c727b 414check_substr "$COMPONENTS" "pgsql"
1010cff7 415if test $? = 0; then
ef0c727b
VK
416 DB_DRIVERS="$DB_DRIVERS pgsql"
417fi
e8636669 418
8817f620 419check_substr "$COMPONENTS" "sqlite_drv"
1010cff7 420if test $? = 0; then
ef0c727b 421 DB_DRIVERS="$DB_DRIVERS sqlite"
e8636669
VK
422fi
423
ef0c727b 424check_substr "$COMPONENTS" "odbc"
1010cff7 425if test $? = 0; then
ef0c727b
VK
426 DB_DRIVERS="$DB_DRIVERS odbc"
427fi
428
41b4790d
VK
429check_substr "$COMPONENTS" "oracle"
430if test $? = 0; then
431 DB_DRIVERS="$DB_DRIVERS oracle"
432fi
433
ef0c727b
VK
434
435#--------------------------------------------------------------------
436# Check for programs
437#--------------------------------------------------------------------
438
439if test "x$PLATFORM" = "xHP-UX"; then
e7d9c4ae 440 AC_CHECK_PROG([CCC], [aCC], [aCC])
ef0c727b
VK
441fi
442AC_PROG_CC(aCC gcc cc cl)
443AC_PROG_CPP
444AC_PROG_CXX
c3cfc039 445if test "x$CXX" = "xg++"; then
753206b5
AK
446 AC_CHECK_PROG([GPLUSPLUS], [g++], [yes], [no])
447 if test "x$GPLUSPLUS" = "xno"; then
c3cfc039
VK
448 AC_MSG_ERROR([*** FATAL: Cannot find any usable C++ compiler])
449 fi
450fi
ef0c727b
VK
451AC_PROG_INSTALL
452AC_PROG_LEX
76154a95 453AC_CHECK_PROGS(YACC,bison byacc,yacc)
ef0c727b
VK
454AC_PROG_LN_S
455
456AC_ARG_VAR(PERL,local path to the perl interpreter)
457perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin"
458AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path)
459
460
461#--------------------------------------------------------------------
462# Initialize libtool
463#--------------------------------------------------------------------
464
465if test "x$STATIC_BUILD" = "xyes"; then
466 enable_shared=no
467 enable_static=yes
468else
469 enable_shared=yes
470 enable_static=no
471fi
e8636669
VK
472AC_LIBTOOL_DLOPEN
473AC_PROG_LIBTOOL
3a7ce527 474
d16cf8a5 475
ef0c727b
VK
476#--------------------------------------------------------------------
477# C/C++ capabilities
478#--------------------------------------------------------------------
479
480AC_C_CONST
481AC_PROG_GCC_TRADITIONAL
1d9cc60e 482AC_C_BIGENDIAN
ef0c727b
VK
483
484
485#--------------------------------------------------------------------
486# Platform-dependent settings
487#--------------------------------------------------------------------
488
489case "$PLATFORM" in
490 AIX)
9fedef8b 491 LDFLAGS="-no-undefined -Wl,-brtl $LDFLAGS"
ef0c727b
VK
492 ;;
493 HP-UX)
5a5957b2 494 CPPFLAGS="$CPPFLAGS -D_HPUX -D_HPUX_SOURCE -D_POSIX_PTHREAD_SEMANTICS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 -D_REENTRANT"
ef0c727b
VK
495 if test "x$CXX" = "xaCC"; then
496 CXXFLAGS="-mt $CXXFLAGS +W749 +W829"
497 LDFLAGS="$LDFLAGS -mt"
498 fi
499 ;;
75c30ed4 500 SunOS)
27ed5b1d 501 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
75c30ed4
VK
502 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
503 export LD_LIBRARY_PATH
504 ;;
56b2f755
VK
505 Linux)
506 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
507 ;;
ef0c727b
VK
508 *)
509 ;;
510esac
511
512
513#--------------------------------------------------------------------
c90d3610
VK
514# C++ compiler tuning:
515# * Disable C++ exceptions
516# * Disable compiling string constants as "const char *"
517# * Disable some GCC warnings
779ce551 518# * Turn on 64bit mode on HP-UX/Itanium
ef0c727b
VK
519#--------------------------------------------------------------------
520
521if test "x$CC" = "xgcc" ; then
522
523 AC_LANG_PUSH([C++])
524
525 AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti)
526 OLD_CXXFLGAS="$CXXFLAGS"
527 CXXFLAGS="$CXXFLAGS -fno-rtti"
528 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
529 [ AC_MSG_RESULT(yes) ],
530 [
531 CXXFLAGS="$OLD_CXXFLAGS"
532 AC_MSG_RESULT(no)
533 ])
534
535 AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions)
536 OLD_CXXFLGAS="$CXXFLAGS"
537 CXXFLAGS="$CXXFLAGS -fno-exceptions"
538 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
539 [ AC_MSG_RESULT(yes) ],
540 [
541 CXXFLAGS="$OLD_CXXFLAGS"
542 AC_MSG_RESULT(no)
543 ])
544
c90d3610
VK
545 AC_MSG_CHECKING(whether C++ compiler accepts -Wno-deprecated)
546 OLD_CXXFLGAS="$CXXFLAGS"
547 CXXFLAGS="$CXXFLAGS -Wno-deprecated"
548 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
549 [ AC_MSG_RESULT(yes) ],
550 [
551 CXXFLAGS="$OLD_CXXFLAGS"
552 AC_MSG_RESULT(no)
553 ])
554
ef0c727b
VK
555 AC_LANG_POP([C++])
556
779ce551
VK
557 if test "x$PLATFORM" = "xHP-UX"; then
558 AC_MSG_CHECKING(whether C compiler accepts -mlp64)
1a66a110 559 OLD_CPPFLAGS="$CPPFLAGS"
779ce551
VK
560 CPPFLAGS="$CPPFLAGS -mlp64"
561 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
562 [
563 LDFLAGS="-mlp64 -L/usr/lib/hpux64 -L/usr/local/lib/hpux64 $LDFLAGS"
564 AC_MSG_RESULT(yes)
565 ],
566 [
567 CPPFLAGS="$OLD_CPPFLAGS"
568 AC_MSG_RESULT(no)
569 ])
570 fi
571
ce5592b2
VK
572 if test "x$ENABLE_DEBUG" = "xyes"; then
573 CPPFLAGS="$CPPFLAGS -ggdb3"
574 fi
ef0c727b
VK
575fi
576
577
578#--------------------------------------------------------------------
579# Additional include and library directories
580#--------------------------------------------------------------------
581
582if test -d /usr/local/include; then
4d37b0c5
VK
583 if test "x$CC" = "xgcc"; then
584 AC_MSG_CHECKING(whether -I/usr/local/include needed)
585 OLD_CPPFLAGS="$CPPFLAGS"
586 CPPFLAGS="$CPPFLAGS -Werror -I/usr/local/include"
587 AC_TRY_COMPILE([],[],
588 [
589 CPPFLAGS="$OLD_CPPFLAGS -I/usr/local/include"
590 AC_MSG_RESULT(yes)
591 ],
592 [
593 CPPFLAGS="$OLD_CPPFLAGS"
594 AC_MSG_RESULT(no)
595 ]
596 )
597 else
598 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
599 fi
ef0c727b
VK
600fi
601
602if test -d /usr/kerberos/include; then
603 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
604fi
605
606if test -d /usr/local/lib; then
607 LDFLAGS="$LDFLAGS -L/usr/local/lib"
608fi
609
610
611#--------------------------------------------------------------------
612# Check for threads library - either POSIX or GNU
613#--------------------------------------------------------------------
614
615if test "x$USE_PTH" = "xyes"; then
616 AC_CHECK_HEADER(pth.h,,AC_MSG_ERROR([*** GNU Pth thread support not installed - please install first ***]))
617else
618 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
619
620 if test "x$CXX" = "xaCC"; then
621 PTHREAD_LIBS=""
622 else
623 PTHREAD_LIBS="error"
624 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
625 AC_EGREP_CPP(yes,
626 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
627 yes
628 #endif
629 ], AC_MSG_RESULT(yes)
630 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" PTHREAD_LIBS="-pthread",
631 AC_MSG_RESULT(no))
632 if test "x$PTHREAD_LIBS" = "xerror"; then
633 AC_CHECK_LIB(pthread, pthread_attr_init,
634 PTHREAD_LIBS="-lpthread")
635 fi
f725c1b7 636 # On HP-UX (at least 11.00) pthread library contains
b041c587 637 # __pthread_attr_init_system instead of pthread_attr_init
f725c1b7 638 if test "x$PTHREAD_LIBS" = "xerror"; then
b041c587 639 AC_CHECK_LIB(pthread, __pthread_attr_init_system,
f725c1b7
VK
640 PTHREAD_LIBS="-lpthread")
641 fi
ef0c727b
VK
642 if test "x$PTHREAD_LIBS" = "xerror"; then
643 AC_CHECK_LIB(pthreads, pthread_attr_init,
644 PTHREAD_LIBS="-lpthreads")
645 fi
646 if test "x$PTHREAD_LIBS" = "xerror"; then
647 AC_CHECK_FUNC(pthread_attr_init,
648 PTHREAD_LIBS="")
649 fi
650 fi
651
652 if test "x$PTHREAD_LIBS" = "xerror"; then
653 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
654 fi
655 LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
656
657 # Extensions to posix threads
658 AC_CHECK_HEADERS([pthread_np.h],,,[
9c29f76e 659#include <pthread.h>
ef0c727b
VK
660 ])
661 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
662
663 # Check for recursive mutexes
39086394
VK
664 AC_CHECK_FUNCS([pthread_mutexattr_settype __pthread_mutexattr_settype pthread_mutexattr_setkind_np])
665 AC_CHECK_DECLS([pthread_mutexattr_settype, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
9c29f76e
VK
666#include <pthread.h>
667#if HAVE_PTHREAD_NP_H
668#include <pthread_np.h>
669#endif
ef0c727b
VK
670 ])
671
672 # Check for read/write locks
673 # On Linux, rwlock functions declared always, but pthread_rwlock_t may need
674 # additional defines
675 AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
676 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
677 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
9c29f76e
VK
678 [AC_TRY_COMPILE([
679#include <sys/types.h>
680#include <pthread.h>
681 ],
ef0c727b
VK
682 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
683 ac_cv_struct_pthread_rw=yes, [
9c29f76e
VK
684 AC_TRY_COMPILE([
685#define _XOPEN_SOURCE 500
686#include <sys/types.h>
687#include <pthread.h>
688 ],
ef0c727b
VK
689 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
690 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
691 if test "$ac_cv_struct_pthread_rw" = "yes"; then
692 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
693 fi
694 ])])
695 if test "$ac_cv_struct_pthread_rw" = "yes"; then
696 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
697 fi
698 fi
699
700fi
701
702
703#--------------------------------------------------------------------
704# Checks for OpenSSL
705#--------------------------------------------------------------------
706
707if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
708 AC_CHECK_LIB(crypto, RSA_new,
709 [
710 AC_DEFINE(WITH_OPENSSL,,[with openssl])
711 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
712 [], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
713 AC_CHECK_LIB(crypto, EVP_bf_cbc,
714 [], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
715 AC_CHECK_LIB(crypto, EVP_idea_cbc,
716 [], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
717 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
718 [], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
719 ],
720 [
721 if test "x$REQUIRE_ENCRYPTION" = "xyes"; then
722 AC_MSG_ERROR(libcrypto is required for encryption support)
723 else
724 AC_MSG_RESULT(libcrypto is required for encryption support)
725 fi
726 ])
727fi
728
729
730#--------------------------------------------------------------------
0322eed7
VK
731# Checks for header files
732#--------------------------------------------------------------------
733
734AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h alloca.h])
735AC_CHECK_HEADERS([sys/int_types.h time.h sys/time.h sys/utsname.h])
736AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h net/nh.h sys/socket.h])
737AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
738AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
739AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h])
740AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h getopt.h])
f09c2d05 741AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
0322eed7
VK
742[[#ifdef HAVE_SYS_TYPES_H
743# include <sys/types.h>
744#endif
745#ifdef HAVE_SYS_TIME_H
746# include <sys/time.h>
747#endif
748#ifdef HAVE_SYS_SOCKET_H
749# include <sys/socket.h>
750#endif
751]])
752
753
754#--------------------------------------------------------------------
ef0c727b
VK
755# Checks for other libs.
756#--------------------------------------------------------------------
d16cf8a5 757
779ce551 758AC_CHECK_LIB(xnet, accept)
521d90e7 759AC_CHECK_LIB(socket, if_nameindex)
87bb64a7 760AC_CHECK_LIB(dl, dlopen)
1b3c0ef0 761AC_CHECK_LIB(kstat, kstat_open)
b821526a 762AC_CHECK_LIB(gnugetopt, getopt_long)
d16cf8a5 763
e0760102
VK
764if test "x$BUILD_SERVER" = "xyes" ; then
765 AC_CHECK_LIB(termcap, tgetstr, [], [AC_CHECK_LIB(ncurses, tgetstr, [], AC_CHECK_LIB(curses, tgetstr))])
0322eed7
VK
766 AC_CHECK_LIB(readline, readline, [], [AC_CHECK_LIB(edit, readline)])
767 AC_CHECK_FUNCS([readline])
768
769 # Check if passing rl_insert to rl_bind_key needs cast
770 if test "$ac_cv_func_readline" = "yes"; then
771 AC_LANG_PUSH([C++])
772
773 AC_MSG_CHECKING(for rl_insert cast)
774
775 AC_TRY_COMPILE(
776 [
777#include <stdio.h>
778#include <readline/readline.h>
779 ],[ rl_bind_key('\t', (Function *)rl_insert); ],
780 [
781 AC_MSG_RESULT((Function *))
782 AC_DEFINE(RL_INSERT_CAST,(Function *),Required cast for rl_insert)
783 ],[
784 AC_TRY_COMPILE(
785 [
786#include <stdio.h>
787#include <readline/readline.h>
788 ],[ rl_bind_key('\t', (rl_command_func_t *)rl_insert); ],
789 [
790 AC_MSG_RESULT((rl_command_func_t *))
791 AC_DEFINE(RL_INSERT_CAST,(rl_command_func_t *),Required cast for rl_insert)
792 ],[
793 AC_MSG_RESULT(not needed)
794 AC_DEFINE(RL_INSERT_CAST,,Required cast for rl_insert)
795 ]
796 )
797 ]
798 )
799
800 AC_LANG_POP([C++])
801 fi
e0760102
VK
802fi
803
ef0c727b
VK
804if test "x$NEED_ZLIB" = "xyes"; then
805 AC_CHECK_HEADER(zlib.h,,AC_MSG_ERROR([*** ZLib development package not installed - please install first ***]))
806 AC_CHECK_LIB(z, deflate)
807fi
808
467c489f
VK
809if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
810 HAVE_LIBEXPAT=no
811else
812 HAVE_LIBEXPAT=yes
813 AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
814 AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
815fi
80ce37ac
VK
816if test "x$HAVE_LIBEXPAT" = "xno"; then
817 MODULES="libexpat $MODULES"
818 CPPFLAGS="$CPPFLAGS "
1bb6b449 819fi
ef0c727b 820
ef0c727b
VK
821
822#--------------------------------------------------------------------
823# Checks for data types
824#--------------------------------------------------------------------
825
d16cf8a5
AK
826AC_CHECK_SIZEOF(short)
827AC_CHECK_SIZEOF(int)
828AC_CHECK_SIZEOF(long)
829AC_CHECK_SIZEOF(long long)
830
831AC_TYPE_PID_T
832AC_TYPE_SIGNAL
833AC_TYPE_SIZE_T
834AC_STRUCT_TIMEZONE
835
51128b42
VK
836AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t])
837AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
4c779d83
VK
838#if HAVE_SYS_TYPES_H
839#include <sys/types.h>
840#endif
841#if HAVE_SYS_SOCKET_H
842#include <sys/socket.h>
843#endif
844])
e0293f7f
VK
845AC_CHECK_TYPES([struct stat64],,,[
846#if HAVE_SYS_STAT_H
847#include <sys/stat.h>
848#endif
849])
521d90e7 850
e25cadc9 851
ef0c727b
VK
852#--------------------------------------------------------------------
853# Checks for functions
854#--------------------------------------------------------------------
d16cf8a5
AK
855
856AC_FUNC_ERROR_AT_LINE
d16cf8a5 857AC_FUNC_MEMCMP
d16cf8a5
AK
858AC_FUNC_SELECT_ARGTYPES
859AC_FUNC_STRFTIME
860AC_FUNC_STRTOD
861AC_FUNC_VPRINTF
862
80ce37ac 863AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
b50f1100 864AC_CHECK_FUNCS([strrchr strtol strtoul strtoll strtoull])
467e30e1 865AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
aa24418a
VK
866AC_CHECK_FUNCS([usleep nanosleep getopt_long gmtime_r localtime_r lstat64])
867
868AC_CHECK_DECLS([nanosleep])
be6467e9 869
b0823d06
VK
870# Check if strerror_r is POSIX-compliant
871if test "$ac_cv_func_strerror_r" = "yes"; then
872 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
873 AC_LANG_PUSH([C++])
874 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7f9423af
VK
875#if HAVE_STRING_H
876#include <string.h>
877#endif
878#if HAVE_ERRNO_H
879#include <errno.h>
880#endif
b0823d06 881 ]],[[
7f9423af
VK
882 int e;
883 char buffer[256];
884 e = strerror_r(1, buffer, 256);
885 return e;
b0823d06
VK
886 ]])
887 ],[
888 AC_MSG_RESULT(yes)
889 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
890 ],[
891 AC_MSG_RESULT(no)
892 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
893 ])
894 AC_LANG_POP([C++])
895fi
896
be6467e9
VK
897# Check if timezone is a function
898AC_MSG_CHECKING(for timezone function)
899AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
900#if HAVE_TIME_H
901#include <time.h>
902#endif
903#if HAVE_SYS_TIME_H
904#include <sys/time.h>
905#endif
906]],[[
be6467e9 907 timezone(0, 0);
be6467e9
VK
908]])
909],[
910AC_MSG_RESULT(yes)
911AC_DEFINE(HAVE_TIMEZONE,1,Define to 1 if timezone function is available)
912],[
913AC_MSG_RESULT(no)
445cba33
VK
914AC_CHECK_DECLS([timezone],,,[
915#if HAVE_TIME_H
916#include <time.h>
917#endif
918#if HAVE_SYS_TIME_H
919#include <sys/time.h>
920#endif
921])
be6467e9
VK
922])
923
924# Check if struct tm has tm_gmtoff member
925AC_MSG_CHECKING(for struct tm.tm_gmtoff)
926AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
927#if HAVE_TIME_H
928#include <time.h>
929#endif
930#if HAVE_SYS_TIME_H
931#include <sys/time.h>
932#endif
933]],[[
be6467e9
VK
934 struct tm t;
935 return t.tm_gmtoff;
be6467e9
VK
936]])
937],[
938AC_MSG_RESULT(yes)
939AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
940],[
941AC_MSG_RESULT(no)
942])
d16cf8a5 943
99e50bb7
VK
944AC_CHECK_DECLS([getopt_long],,,[
945#if HAVE_GETOPT_H
946#include <getopt.h>
947#endif
948])
73d7fbdb 949
f91feddc 950AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
70fed300
AK
951AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
952
d16cf8a5
AK
953# sockets/resolver (probably for solaris)
954AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
955AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
956AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
957
958if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
959 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
960fi
961
962if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
963 AC_MSG_CHECKING([if we can include libnsl + libsocket])
964 LIBS="-lnsl -lsocket $LIBS"
965 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
966 if test "$my_ac_link_result" = "no" ; then
967 AC_MSG_RESULT([failure])
968 AC_MSG_ERROR([unable to use gethostbyname()])
969 else
970 AC_MSG_RESULT([success])
971 fi
972fi
973
c6491611
VK
974# asprintf, scprintf, etc.
975AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
976AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
977
978AC_MSG_CHECKING(whether snprintf returns required buffer size)
979AC_RUN_IFELSE(
980 [AC_LANG_PROGRAM([
981#include <stdio.h>
982#include <string.h>
983 ], [
984 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
985 ])
986 ],
987 [ AC_MSG_RESULT(yes)
988 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
989 ],
990 [ AC_MSG_RESULT(no) ],
991 [ AC_MSG_RESULT(no) ]
992)
993
994
dff54fed 995
ef0c727b
VK
996#--------------------------------------------------------------------
997# Checks for macros and definitions
998#--------------------------------------------------------------------
dff54fed 999
ef0c727b
VK
1000AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
1001#ifdef HAVE_SYS_TYPES_H
99e50bb7 1002#include <sys/types.h>
ef0c727b
VK
1003#endif
1004#if HAVE_BYTESWAP_H
1005#include <byteswap.h>
1006#endif
1007#if HAVE_NETINET_IN_H
1008#include <netinet/in.h>
1009#endif
1010#if HAVE_NET_NH_H
1011#include <net/nh.h>
1012#endif
1013])
aa24418a
VK
1014AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
1015#ifdef HAVE_UNISTD_H
1016#include <unistd.h>
1017#endif
1018#ifdef HAVE_DLFCN_H
1019#include <dlfcn.h>
1020#endif
1021])
ce7565e7
VK
1022AC_CHECK_DECLS([va_copy, __va_copy],,,[
1023#ifdef HAVE_UNISTD_H
1024#include <unistd.h>
1025#endif
1026#ifdef HAVE_STDARG_H
1027#include <stdarg.h>
1028#endif
1029#ifdef HAVE_STDLIB_H
1030#include <stdlib.h>
1031#endif
1032])
dff54fed 1033
dff54fed 1034
ef0c727b
VK
1035#--------------------------------------------------------------------
1036# AIX specific checks
1037#--------------------------------------------------------------------
d16cf8a5 1038
ef0c727b
VK
1039if test "x$PLATFORM" = "xAIX"; then
1040 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
1041 AC_CHECK_DECLS([getkerninfo])
1042 AC_CHECK_FUNCS([getprocs64],,,[
1043#if HAVE_PROCINFO_H
1044#include <procinfo.h>
6cd41ceb 1045#endif
ef0c727b 1046 ])
7e56bf2e
VK
1047fi
1048
cd4c8ca3 1049
ef0c727b 1050#--------------------------------------------------------------------
ba8db57b
VK
1051# HP-UX specific checks
1052#--------------------------------------------------------------------
1053
1054if test "x$PLATFORM" = "xHP-UX"; then
f09c2d05
VK
1055 AC_CHECK_HEADERS([sys/mib.h],,,[[ ]])
1056 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
1057#if HAVE_NET_IF_H
1058#include <net/if.h>
1059#endif
1060 ])
1061 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
1062#if HAVE_SYS_MIB_H
1063#include <sys/mib.h>
1064#endif
1065 ])
ba8db57b
VK
1066fi
1067
1068
1069#--------------------------------------------------------------------
aa24418a
VK
1070# *BSD specific checks
1071#--------------------------------------------------------------------
1072
1073AC_CHECK_LIB(kvm, kvm_open)
1074AC_CHECK_FUNCS([kvm_getswapinfo])
1075AC_CHECK_TYPES([struct kinfo_proc2],,,[
1076#if HAVE_SYS_SYSCTL_H
1077#include <sys/sysctl.h>
1078#endif
1079])
1080
1081
28ba6824
VK
1082
1083#--------------------------------------------------------------------
1084# FreeBSD specific checks
1085#--------------------------------------------------------------------
1086
1087if test "x$PLATFORM" = "xFreeBSD"; then
61f58c11
VK
1088 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
1089#if HAVE_SYS_TYPES_H
1090#include <sys/types.h>
1091#endif
1092#if HAVE_SYS_SOCKET_H
1093#include <sys/socket.h>
1094#endif
1095#include <net/route.h>
1096 ])
28ba6824
VK
1097fi
1098
1099
aa24418a 1100#--------------------------------------------------------------------
8b86c5dc
VK
1101# Check for wxWidgets
1102#--------------------------------------------------------------------
1103
1104if test "x$NEED_WXWIDGETS" = "xyes"; then
1105 AC_PATH_PROGS([WXCONF], [wx-config wxgtk2-2.8-config], [no], [$PATH:/usr/local/bin])
1106 if test "x$WXCONF" = "xno"; then
1107 AC_MSG_ERROR([*** wxWidgets not installed - unable to build GUI components ***])
1108 else
1109 AC_PATH_PROGS([WXRC], [wxrc wxrc-gtk2-2.8], [no], [$PATH:/usr/local/bin])
1110 if test "x$WXRC" = "xno"; then
1111 AC_MSG_ERROR([*** wxWidgets resource compiler not found - unable to build GUI components ***])
1112 else
1113 NEED_UNICODE=`$WXCONF --selected-config | grep unicode | wc -l`
1114 if test $NEED_UNICODE -eq 1; then
1115 BUILD_UNICODE="yes"
273da39a 1116 WX_UNICODE="yes"
8b86c5dc
VK
1117 fi
1118 CXXFLAGS="$CXXFLAGS `$WXCONF --cxxflags --debug=$ENABLE_DEBUG`"
1119 LDFLAGS="$LDFLAGS `$WXCONF --libs --debug=$ENABLE_DEBUG`"
1120 fi
1121 fi
bfc410a1
VK
1122 $WXCONF --cxxflags | grep error >/dev/null
1123 if test $? = 0; then
1124 echo "wx-config output:"
1125 echo "*** BEGIN ***"
1126 $WXCONF --cxxflags
1127 echo "*** END ***"
1128 AC_MSG_ERROR([*** wxWidgets is not configured properly - see wx-config output above ***])
1129 fi
8b86c5dc
VK
1130fi
1131
1132
1133#--------------------------------------------------------------------
ef0c727b
VK
1134# Check for UNICODE stuff
1135#--------------------------------------------------------------------
3e39fcde 1136
8b86c5dc 1137AC_CHECK_HEADERS([wchar.h wctype.h iconv.h])
aa24418a 1138AC_CHECK_TYPES([wchar_t, wint_t],,,[
6b93c954
VK
1139#if HAVE_WCHAR_H
1140#include <wchar.h>
1141#endif
1142])
3e39fcde 1143AC_CHECK_SIZEOF(wchar_t)
aa24418a
VK
1144AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper wcserror wcserror_r])
1145AC_CHECK_FUNCS([wfopen wopen wstat wgetenv wrename wunlink])
ba8db57b 1146AC_CHECK_FUNCS([wfopen wopen wstat wgetenv wrename wunlink])
dff54fed 1147
3265ba38 1148if test "x$DISABLE_ICONV" != "xyes"; then
75c30ed4 1149 AC_CHECK_LIB(iconv, libiconv_open,
dff54fed 1150 [ ac_found_iconv=yes
75c30ed4
VK
1151 LDFLAGS="$LDFLAGS -liconv"
1152 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
1153 ],
1154 [
1155 AC_CHECK_LIB(iconv, iconv,
1156 [ ac_found_iconv=yes
1157 LDFLAGS="$LDFLAGS -liconv"
1158 ])
1159 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
1160 ])
dff54fed
VK
1161else
1162 ac_found_iconv=no
ef0c727b 1163 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
dff54fed 1164fi
93571e7f
VK
1165
1166AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
1167AC_RUN_IFELSE(
1168 [AC_LANG_PROGRAM([
1169#if HAVE_ICONV_H
1170#include <iconv.h>
1171#endif
1172 ], [
1173 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
1174 ])
1175 ],
1176 [ AC_MSG_RESULT(yes)
1177 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
1178 valid_ucs2_code="UCS-2-INTERNAL"
1179 ],
1180 [ AC_MSG_RESULT(no) ],
1181 [ AC_MSG_RESULT(no) ]
1182)
1183
1184AC_MSG_CHECKING(whether iconv supports UCS-2)
1185AC_RUN_IFELSE(
1186 [AC_LANG_PROGRAM([
1187#if HAVE_ICONV_H
1188#include <iconv.h>
1189#endif
1190 ], [
1191 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
1192 ])
1193 ],
1194 [ AC_MSG_RESULT(yes)
1195 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
1196 valid_ucs2_code="UCS-2"
1197 ],
1198 [ AC_MSG_RESULT(no) ],
8b86c5dc 1199 [ AC_MSG_RESULT(no) ]
93571e7f
VK
1200)
1201
1202AC_MSG_CHECKING(whether iconv supports UCS2)
1203AC_RUN_IFELSE(
1204 [AC_LANG_PROGRAM([
1205#if HAVE_ICONV_H
1206#include <iconv.h>
1207#endif
1208 ], [
1209 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
1210 ])
1211 ],
1212 [ AC_MSG_RESULT(yes)
1213 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
1214 valid_ucs2_code="UCS2"
1215 ],
1216 [ AC_MSG_RESULT(no) ],
1217 [ AC_MSG_RESULT(no) ]
1218)
1219
44bccbbc
VK
1220AC_MSG_CHECKING(whether iconv supports UCS-2BE)
1221AC_RUN_IFELSE(
1222 [AC_LANG_PROGRAM([
1223#if HAVE_ICONV_H
1224#include <iconv.h>
1225#endif
1226 ], [
1227 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
1228 ])
1229 ],
1230 [ AC_MSG_RESULT(yes)
1231 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
1232 valid_ucs2_code="UCS-2BE"
1233 ],
1234 [ AC_MSG_RESULT(no) ],
1235 [ AC_MSG_RESULT(no) ]
1236)
1237
6e17f325
VK
1238AC_MSG_CHECKING(whether iconv supports UCS-2LE)
1239AC_RUN_IFELSE(
1240 [AC_LANG_PROGRAM([
1241#if HAVE_ICONV_H
1242#include <iconv.h>
1243#endif
1244 ], [
1245 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
1246 ])
1247 ],
1248 [ AC_MSG_RESULT(yes)
1249 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
1250 valid_ucs2_code="UCS-2LE"
1251 ],
1252 [ AC_MSG_RESULT(no) ],
1253 [ AC_MSG_RESULT(no) ]
1254)
1255
8b86c5dc
VK
1256AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
1257AC_RUN_IFELSE(
1258 [AC_LANG_PROGRAM([
1259#if HAVE_ICONV_H
1260#include <iconv.h>
1261#endif
1262 ], [
1263 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
1264 ])
1265 ],
1266 [ AC_MSG_RESULT(yes)
1267 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
1268 valid_ucs4_code="UCS-4-INTERNAL"
1269 ],
1270 [ AC_MSG_RESULT(no) ],
1271 [ AC_MSG_RESULT(no) ]
1272)
1273
1274AC_MSG_CHECKING(whether iconv supports UCS-4)
1275AC_RUN_IFELSE(
1276 [AC_LANG_PROGRAM([
1277#if HAVE_ICONV_H
1278#include <iconv.h>
1279#endif
1280 ], [
1281 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
1282 ])
1283 ],
1284 [ AC_MSG_RESULT(yes)
1285 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
1286 valid_ucs4_code="UCS-4"
1287 ],
1288 [ AC_MSG_RESULT(no) ],
1289 [ AC_MSG_RESULT(no) ]
1290)
1291
1292AC_MSG_CHECKING(whether iconv supports UCS4)
1293AC_RUN_IFELSE(
1294 [AC_LANG_PROGRAM([
1295#if HAVE_ICONV_H
1296#include <iconv.h>
1297#endif
1298 ], [
1299 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
1300 ])
1301 ],
1302 [ AC_MSG_RESULT(yes)
1303 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
1304 valid_ucs4_code="UCS4"
1305 ],
1306 [ AC_MSG_RESULT(no) ],
1307 [ AC_MSG_RESULT(no) ]
1308)
1309
1310AC_MSG_CHECKING(whether iconv supports UCS-4BE)
1311AC_RUN_IFELSE(
1312 [AC_LANG_PROGRAM([
1313#if HAVE_ICONV_H
1314#include <iconv.h>
1315#endif
1316 ], [
1317 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
1318 ])
1319 ],
1320 [ AC_MSG_RESULT(yes)
1321 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
1322 valid_ucs4_code="UCS-4BE"
1323 ],
1324 [ AC_MSG_RESULT(no) ],
1325 [ AC_MSG_RESULT(no) ]
1326)
1327
6e17f325
VK
1328AC_MSG_CHECKING(whether iconv supports UCS-4LE)
1329AC_RUN_IFELSE(
1330 [AC_LANG_PROGRAM([
1331#if HAVE_ICONV_H
1332#include <iconv.h>
1333#endif
1334 ], [
1335 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
1336 ])
1337 ],
1338 [ AC_MSG_RESULT(yes)
1339 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
1340 valid_ucs4_code="UCS-4LE"
1341 ],
1342 [ AC_MSG_RESULT(no) ],
1343 [ AC_MSG_RESULT(no) ]
1344)
1345
5e40a69e
VK
1346AC_MSG_CHECKING(whether iconv supports ISO8859-1)
1347AC_RUN_IFELSE(
1348 [AC_LANG_PROGRAM([
1349#if HAVE_ICONV_H
1350#include <iconv.h>
1351#endif
1352 ], [
1353 return iconv_open("UTF-8","ISO8859-1")==(iconv_t)(-1);
1354 ])
1355 ],
1356 [ AC_MSG_RESULT(yes)
1357 AC_DEFINE(HAVE_ICONV_ISO8859_1, 1, Define to 1 if iconv supports ISO8859-1)
1358 ],
1359 [ AC_MSG_RESULT(no) ],
1360 [ AC_MSG_RESULT(no) ]
1361)
1362
1363AC_MSG_CHECKING(whether iconv supports ISO-8859-1)
1364AC_RUN_IFELSE(
1365 [AC_LANG_PROGRAM([
1366#if HAVE_ICONV_H
1367#include <iconv.h>
1368#endif
1369 ], [
1370 return iconv_open("UTF-8","ISO-8859-1")==(iconv_t)(-1);
1371 ])
1372 ],
1373 [ AC_MSG_RESULT(yes)
1374 AC_DEFINE(HAVE_ICONV_ISO_8859_1, 1, Define to 1 if iconv supports ISO-8859-1)
1375 ],
1376 [ AC_MSG_RESULT(no) ],
1377 [ AC_MSG_RESULT(no) ]
1378)
1379
1380AC_MSG_CHECKING(whether iconv supports ASCII)
1381AC_RUN_IFELSE(
1382 [AC_LANG_PROGRAM([
1383#if HAVE_ICONV_H
1384#include <iconv.h>
1385#endif
1386 ], [
1387 return iconv_open("UTF-8","ASCII")==(iconv_t)(-1);
1388 ])
1389 ],
1390 [ AC_MSG_RESULT(yes)
1391 AC_DEFINE(HAVE_ICONV_ASCII, 1, Define to 1 if iconv supports ASCII)
1392 ],
1393 [ AC_MSG_RESULT(no) ],
1394 [ AC_MSG_RESULT(no) ]
1395)
1396
93571e7f
VK
1397AC_MSG_CHECKING(whether iconv supports //IGNORE)
1398AC_RUN_IFELSE(
1399 [AC_LANG_PROGRAM([
1400#if HAVE_ICONV_H
1401#include <iconv.h>
1402#endif
1403 ], [
1404 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
1405 ])
1406 ],
1407 [ AC_MSG_RESULT(yes)
1408 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
1409 ],
1410 [ AC_MSG_RESULT(no) ],
1411 [ AC_MSG_RESULT(no) ]
1412)
3e39fcde 1413
19619a35
AK
1414# taken from ZSH's configure
1415# Check if iconv uses const in prototype declaration
24b1570c 1416if test "x$ac_found_iconv" = "xyes"; then
19619a35 1417 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
7f9423af
VK
1418 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1419#include <stdlib.h>
1420#include <iconv.h>
1421 ]],
1422 [[
1423#ifdef __cplusplus
1424"C"
1425#endif
1426#if defined(__STDC__) || defined(__cplusplus)
1427 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1428#else
1429 size_t iconv();
1430#endif
1431 ]])],
19619a35
AK
1432 [ac_cv_iconv_const=],
1433 [ac_cv_iconv_const=const])])
1434 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
1435 [Define as const if the declaration of iconv() needs const.])
1436fi
1437
93571e7f 1438if test $ac_cv_sizeof_wchar_t -eq 2; then
8b86c5dc
VK
1439 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
1440fi
1441
1442if test $ac_cv_sizeof_wchar_t -eq 4; then
1443 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
1444fi
1445
c29360a9 1446
ef0c727b 1447#--------------------------------------------------------------------
ca0f4ea3
VK
1448# MySQL
1449#--------------------------------------------------------------------
1450
1451check_substr "$COMPONENTS" "mysql"
1452if test $? = 0; then
6fce76d8 1453 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
ca0f4ea3 1454 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
aa7794f0
VK
1455
1456 OLD_LDFLAGS="$LDFLAGS"
1457 LDFLAGS="$LDFLAGS $MYSQL_LIBS"
1458
9c29f76e
VK
1459 AC_MSG_CHECKING(whether mysql clients can run)
1460 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1461#include <stdio.h>
1462#include <mysql.h>
1463int main(void)
1464{
1465 MYSQL *a = mysql_init(NULL);
1466 return 0;
1467}
1468 ]])],[],[
1469 AC_MSG_RESULT(no)
1470 AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)
1471 ],[])
ca0f4ea3 1472 AC_MSG_RESULT(yes)
6fce76d8 1473
ca0f4ea3 1474 AC_CHECK_FUNCS(mysql_real_escape_string)
6fce76d8 1475 LDFLAGS="$OLD_LDFLAGS"
ca0f4ea3
VK
1476fi
1477
1478
1479#--------------------------------------------------------------------
58ed4897
VK
1480# PostgreSQL
1481#--------------------------------------------------------------------
1482
203458b7 1483check_substr "$COMPONENTS" "pgsql"
58ed4897
VK
1484if test $? = 0; then
1485 AC_CHECK_LIB(m, floor)
6fce76d8 1486 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"],
58ed4897 1487 [AC_MSG_ERROR(libpq is required for PostgreSQL support)])
6fce76d8
VK
1488
1489 AC_MSG_CHECKING(whether postgresql clients can run)
1490 OLD_LDFLAGS="$LDFLAGS"
1491 LDFLAGS="$LDFLAGS $PGSQL_LIBS"
1492 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1493 #include <stdio.h>
1494 #include <libpq-fe.h>
1495 int main(void)
1496 {
1497 PGconn *a = PQconnectdb("");
1498 return 0;
1499 }
1500 ]])],[AC_MSG_RESULT(yes)],[
58ed4897
VK
1501 AC_MSG_RESULT(no)
1502 AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
1503 ],[])
6fce76d8 1504 LDFLAGS="$OLD_LDFLAGS"
7070538d 1505 AC_CHECK_LIB(pq, PQfformat, [ AC_DEFINE(HAVE_PQFFORMAT, 1, PQfformat not exist in 7.3) ])
58ed4897
VK
1506fi
1507
1508
1509#--------------------------------------------------------------------
9c29f76e
VK
1510# ODBC
1511#--------------------------------------------------------------------
1512
1513check_substr "$COMPONENTS" "odbc"
1514if test $? = 0; then
6fce76d8 1515 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
9c29f76e
VK
1516 [AC_MSG_ERROR(libodbc is required for ODBC support)])
1517fi
1518
1519
1520#--------------------------------------------------------------------
41b4790d
VK
1521# Oracle
1522#--------------------------------------------------------------------
1523
1524check_substr "$COMPONENTS" "oracle"
1525if test $? = 0; then
1526 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
7d8c91ef
VK
1527 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
1528 [
1529 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
1530 ], [-lclntsh])
1531 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
1532 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
41b4790d
VK
1533fi
1534
1535
1536#--------------------------------------------------------------------
c3cfc039
VK
1537# nxhttpd
1538#--------------------------------------------------------------------
1539
e02b69b9 1540check_substr "$COMPONENTS" "webui"
c3cfc039
VK
1541if test $? = 0; then
1542 AC_CHECK_HEADER(gd.h,,AC_MSG_ERROR([*** GD support not installed - please install first ***]))
1543 AC_CHECK_LIB(gd, gdImageCreate, [], [
1544 AC_MSG_ERROR(libgd is required for web interface)
1545 ])
1546
1547fi
1548
1549
1550#--------------------------------------------------------------------
ca0f4ea3
VK
1551# Other settings
1552#--------------------------------------------------------------------
1553
f65df2b1 1554CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DPREFIX=\\\"\${prefix}\\\" -DPREFIXW=L\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\""
ca0f4ea3 1555
8b86c5dc 1556AM_CONDITIONAL([BUILD_UNICODE_LIBS], [test "x$BUILD_UNICODE" = "xyes"])
551ec9ca 1557AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
8b86c5dc 1558
ca0f4ea3
VK
1559
1560#--------------------------------------------------------------------
ef0c727b
VK
1561# Substitute variables
1562#--------------------------------------------------------------------
82fa7c5d 1563
ef0c727b
VK
1564AC_SUBST(DB_DRIVERS)
1565AC_SUBST(MODULES)
1566AC_SUBST(SUBAGENT_DIRS)
1567AC_SUBST(SERVER_TOOLS)
1568AC_SUBST(TOP_LEVEL_MODULES)
1569AC_SUBST(CONTRIB_MODULES)
c2612d83 1570AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
1571AC_SUBST(STATIC_SUBAGENT_LIST)
1572AC_SUBST(SUBAGENT_LIBS)
1573AC_SUBST(BUILD_SERVER)
1574AC_SUBST(UNSTABLE_SUBAGENT_DIRS)
db91456f 1575AC_SUBST(WXRC)
6fce76d8
VK
1576AC_SUBST(MYSQL_LIBS)
1577AC_SUBST(PGSQL_LIBS)
7d8c91ef 1578AC_SUBST(ORACLE_LIBS)
6fce76d8 1579AC_SUBST(ODBC_LIBS)
d16cf8a5 1580
ef0c727b
VK
1581#--------------------------------------------------------------------
1582# Shared libs versions
d16cf8a5
AK
1583#
1584# versioning scheme: current:revision:age
1585#
1586# current
1587# The number of the current interface exported by the library. A current
1588# value of `0', means that you are calling the interface exported by this
1589# library interface 0.
1590#
1591# revision
1592# The implementation number of the most recent interface exported by this
1593# library. In this case, a revision value of `0' means that this is the
1594# first implementation of the interface.
1595# If the next release of this library exports the same interface, but has a
1596# different implementation (perhaps some bugs have been fixed), the revision
1597# number will be higher, but current number will be the same. In that case,
1598# when given a choice, the library with the highest revision will always
1599# be used by the runtime loader.
1600#
1601# age
1602# The number of previous additional interfaces supported by this library.
1603# If age were `2', then this library can be linked into executables which
1604# were built with a release of this library that exported the current
1605# interface number, current, or any of the previous two interfaces.
1606# By definition age must be less than or equal to current. At the outset,
1607# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 1608#--------------------------------------------------------------------
d16cf8a5 1609
8c5adf3a 1610NETXMS_LIBRARY_VERSION=0:2:0
c7d14846 1611AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 1612
ef0c727b
VK
1613
1614#--------------------------------------------------------------------
1615# Generate output files
1616#--------------------------------------------------------------------
d16cf8a5
AK
1617
1618AC_CONFIG_FILES([
ef0c727b 1619 README
0c3c0c39
AK
1620 Makefile
1621 contrib/Makefile
0c3c0c39 1622 contrib/startup/Makefile
daaefaaf 1623 contrib/startup/gentoo/Makefile
0c3c0c39 1624 contrib/startup/redhat/Makefile
5de3893d 1625 contrib/startup/suse/Makefile
9993edf4 1626 contrib/startup/ubuntu/Makefile
82fa7c5d 1627 contrib/mibs/Makefile
3f2f9f2b 1628 contrib/backgrounds/Makefile
0c3c0c39 1629 doc/Makefile
a48203d2
VK
1630 doc/internal/Makefile
1631 doc/manuals/Makefile
1632 doc/misc/Makefile
0c3c0c39
AK
1633 images/Makefile
1634 include/Makefile
1635 m4/Makefile
1636 netware/Makefile
1637 sql/Makefile
0c3c0c39 1638 src/Makefile
8817f620 1639 src/sqlite/Makefile
80ce37ac
VK
1640 src/libexpat/Makefile
1641 src/libexpat/libexpat/Makefile
0c3c0c39 1642 src/libnetxms/Makefile
0c3c0c39 1643 src/libnxcl/Makefile
aa8d6795 1644 src/libnxlp/Makefile
c002b04a 1645 src/libnxsl/Makefile
1d410d50 1646 src/libnxmap/Makefile
1b1edd49
VK
1647 src/install/Makefile
1648 src/install/windows/Makefile
c2612d83 1649 src/client/Makefile
551592f4 1650 src/client/install/Makefile
c94fa5c2 1651 src/client/nxalarm/Makefile
e84701c5
VK
1652 src/client/nxevent/Makefile
1653 src/client/nxpush/Makefile
59ffa5b7 1654 src/client/nxsms/Makefile
23c8c53e
AK
1655 src/client/windows/nxuilib/Makefile
1656 src/client/windows/nxuilib/res/Makefile
1657 src/client/windows/nxuilib/sounds/Makefile
d9db1c72 1658 src/client/nxlexer/Makefile
23c8c53e
AK
1659 src/client/windows/nxcon/Makefile
1660 src/client/windows/nxcon/icons/Makefile
1661 src/client/windows/nxcon/res/Makefile
23c8c53e
AK
1662 src/client/windows/nxav/Makefile
1663 src/client/windows/nxav/res/Makefile
1664 src/client/windows/nxnotify/Makefile
1665 src/client/windows/nxnotify/res/Makefile
f519aa3e 1666 src/nxscript/Makefile
d1834406
VK
1667 src/db/Makefile
1668 src/db/dbdrv/Makefile
1669 src/db/dbdrv/odbc/Makefile
1670 src/db/dbdrv/mssql/Makefile
1671 src/db/dbdrv/mysql/Makefile
1672 src/db/dbdrv/pgsql/Makefile
1673 src/db/dbdrv/sqlite/Makefile
1674 src/db/dbdrv/oracle/Makefile
1675 src/db/libnxdb/Makefile
0c3c0c39
AK
1676 src/server/Makefile
1677 src/server/core/Makefile
d770a97c
VK
1678 src/server/include/Makefile
1679 src/server/libnxsrv/Makefile
1680 src/server/netxmsd/Makefile
d8f2e39b
VK
1681 src/server/smsdrv/Makefile
1682 src/server/smsdrv/generic/Makefile
91369aca 1683 src/server/smsdrv/nxagent/Makefile
0c3c0c39
AK
1684 src/server/tools/Makefile
1685 src/server/tools/nxget/Makefile
1686 src/server/tools/nxaction/Makefile
1687 src/server/tools/nxadm/Makefile
5b0c7d0d
VK
1688 src/server/tools/nxconfig/Makefile
1689 src/server/tools/nxconfig/res/Makefile
f90d7fc5 1690 src/server/tools/nxdbmgr/Makefile
4e2debcc 1691 src/server/tools/nxencpasswd/Makefile
d24fdaf4 1692 src/server/tools/nxupload/Makefile
c5c0f362
VK
1693 src/snmp/Makefile
1694 src/snmp/libnxsnmp/Makefile
1695 src/snmp/nxmibc/Makefile
1696 src/snmp/nxsnmpget/Makefile
1697 src/snmp/nxsnmpset/Makefile
1698 src/snmp/nxsnmpwalk/Makefile
f65df2b1
VK
1699 src/tools/Makefile
1700 src/tools/nxcptest/Makefile
1701 src/tools/nxdevcfg/Makefile
0c3c0c39
AK
1702 src/agent/Makefile
1703 src/agent/core/Makefile
5795bf90 1704 src/agent/install/Makefile
0c3c0c39
AK
1705 src/agent/subagents/Makefile
1706 src/agent/subagents/linux/Makefile
1707 src/agent/subagents/sunos/Makefile
d0b5a098 1708 src/agent/subagents/aix/Makefile
9bdf494f 1709 src/agent/subagents/hpux/Makefile
0c3c0c39
AK
1710 src/agent/subagents/skeleton/Makefile
1711 src/agent/subagents/freebsd/Makefile
992ba479 1712 src/agent/subagents/openbsd/Makefile
ad0f1ada 1713 src/agent/subagents/netbsd/Makefile
2b23dc1e 1714 src/agent/subagents/ipso/Makefile
0c3c0c39 1715 src/agent/subagents/netware/Makefile
1bc607cc
VK
1716 src/agent/subagents/winnt/Makefile
1717 src/agent/subagents/win9x/Makefile
0c3c0c39 1718 src/agent/subagents/winperf/Makefile
3737b4b9 1719 src/agent/subagents/wmi/Makefile
93f15c2a 1720 src/agent/subagents/portCheck/Makefile
abc48356 1721 src/agent/subagents/ping/Makefile
dbca7ed1 1722 src/agent/subagents/sms/Makefile
2f06a66e 1723 src/agent/subagents/ups/Makefile
539ab0c3
AK
1724 src/agent/subagents/ecs/Makefile
1725 src/agent/subagents/odbcquery/Makefile
0d362f93 1726 src/agent/subagents/logwatch/Makefile
e02b69b9 1727 src/webui/Makefile
420d9ecf
AK
1728 src/webui/nxhttpd/Makefile
1729 src/webui/nxhttpd/static/Makefile
1730 src/webui/nxhttpd/static/images/Makefile
1731 src/webui/nxhttpd/static/images/buttons/Makefile
1732 src/webui/nxhttpd/static/images/buttons/normal/Makefile
1733 src/webui/nxhttpd/static/images/buttons/pressed/Makefile
1734 src/webui/nxhttpd/static/images/ctrlpanel/Makefile
1735 src/webui/nxhttpd/static/images/objects/Makefile
1736 src/webui/nxhttpd/static/images/status/Makefile
0c3c0c39 1737 tools/Makefile
d16cf8a5
AK
1738])
1739
12249937
VK
1740AC_OUTPUT
1741
ef0c727b 1742echo "Updating libtool"
5cecf50e
AK
1743sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
1744
779ce551
VK
1745# On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
1746if test "x$CC" = "xgcc" && test "x$PLATFORM" = "xHP-UX"; then
1747 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
1748fi
1749
ef0c727b
VK
1750#--------------------------------------------------------------------
1751# Print summary
1752#--------------------------------------------------------------------
a7442678 1753
a7442678
AK
1754echo
1755echo
1756echo
1757echo '---------------------------------------------------------------------'
1758echo ' Configure results'
1759echo '---------------------------------------------------------------------'
1760echo
8b86c5dc 1761 echo "Prefix : ${prefix}"
a7442678 1762if test "x${BUILD_SERVER}" = "xyes"; then
8b86c5dc 1763 echo "Build Server : YES"
a7442678 1764else
8b86c5dc 1765 echo "Build Server : NO"
a7442678
AK
1766fi
1767if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
8b86c5dc 1768 echo "Encryption enabled : YES"
a7442678 1769else
8b86c5dc 1770 echo "Encryption enabled : NO"
a7442678
AK
1771fi
1772if test "x${DB_DRIVERS}" != "x"; then
8b86c5dc 1773 echo "Build DB-Drivers :${DB_DRIVERS}"
a7442678 1774else
8b86c5dc 1775 echo "Build DB-Drivers : NO"
a7442678
AK
1776fi
1777if test "x${BUILD_CLIENT}" = "xyes"; then
8b86c5dc 1778 echo "Build Clients : YES"
a7442678 1779else
8b86c5dc 1780 echo "Build Clients : NO"
a7442678 1781fi
ef0c727b 1782if test "x${BUILD_NXHTTPD}" = "xyes"; then
8b86c5dc 1783 echo "Build Web Interface : YES"
2654e540 1784else
8b86c5dc 1785 echo "Build Web Interface : NO"
2654e540 1786fi
a7442678 1787if test "x${BUILD_AGENT}" = "xyes"; then
8b86c5dc
VK
1788 echo "Build Agent : YES"
1789 echo "Subagents list : ${SUBAGENT_DIRS}"
a7442678 1790else
8b86c5dc 1791 echo "Build Agent : NO"
a7442678 1792fi
e8636669 1793if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
8b86c5dc
VK
1794 echo "Build Static Agent : YES"
1795 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
e8636669 1796else
8b86c5dc 1797 echo "Build Static Agent : NO"
e8636669 1798fi
8b86c5dc
VK
1799if test "x${BUILD_UNICODE}" = "xyes"; then
1800 echo "Build UNICODE libraries : YES"
1801else
1802 echo "Build UNICODE libraries : NO"
1803fi
551ec9ca
VK
1804if test "x${HAVE_LIBEXPAT}" = "xno"; then
1805 echo "Use internal libexpat : YES"
1bb6b449 1806else
551ec9ca 1807 echo "Use internal libexpat : NO"
1bb6b449 1808fi
7d8c91ef
VK
1809
1810echo "CPPFLAGS : ${CPPFLAGS}"
1811echo "CXXFLAGS : ${CXXFLAGS}"
1812echo "CFLAGS : ${CFLAGS}"
1813echo "LDFLAGS : ${LDFLAGS}"
1814
6fce76d8
VK
1815if test "x${MYSQL_LIBS}" != "x"; then
1816 echo "MySQL libs : ${MYSQL_LIBS}"
1817fi
1818if test "x${PGSQL_LIBS}" != "x"; then
1819 echo "PostgreSQL libs : ${PGSQL_LIBS}"
1820fi
7d8c91ef
VK
1821if test "x${ORACLE_LIBS}" != "x"; then
1822 echo "Oracle libs : ${ORACLE_LIBS}"
1823fi
6fce76d8
VK
1824if test "x${ODBC_LIBS}" != "x"; then
1825 echo "ODBC libs : ${ODBC_LIBS}"
1826fi
1827