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