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