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