update
[public/netxms.git] / configure.ac
CommitLineData
f974a50a 1# $Id: configure.ac,v 1.260 2007-07-15 14:18:38 victor Exp $
d16cf8a5 2#
ef0c727b
VK
3# NetXMS - Network Management System
4# Configure script
d16cf8a5
AK
5#
6
d99ee887 7AC_INIT([NetXMS], [0.2.19-rc1], [NetXMS Team <bugs@netxms.org>])
ba1d810c
AK
8AC_CONFIG_AUX_DIR(config)
9AM_CONFIG_HEADER(config.h)
d16cf8a5
AK
10AM_INIT_AUTOMAKE
11
5387ff75 12
ef0c727b
VK
13#--------------------------------------------------------------------
14# Functions
15#--------------------------------------------------------------------
5387ff75 16
ef0c727b
VK
17check_substr()
18{
1010cff7 19 for w in $1; do
ef0c727b
VK
20 if test "x$w" = "x$2"; then
21 return 0;
22 fi
23 done
24 return 1
25}
16dff090 26
d3c8926d 27
ef0c727b
VK
28#--------------------------------------------------------------------
29# Initialize variables
30#--------------------------------------------------------------------
d3c8926d 31
ef0c727b
VK
32PLATFORM=`uname -s`
33COMPONENTS=""
34DISABLE_ICONV="no"
35DISABLE_ENCRYPTION="no"
36ENABLE_UNSTABLE="no"
f974a50a 37ENABLE_DEBUG="no"
ef0c727b
VK
38STATIC_BUILD="no"
39DBDRIVER_SELECTED="no"
40USE_PTH="no"
41BUILD_SERVER="no"
42BUILD_AGENT="no"
43BUILD_CLIENT="no"
c2612d83 44BUILD_CONSOLE="no"
ef0c727b
VK
45BUILD_NXHTTPD="no"
46BUILD_STATIC_AGENT="no"
47NEED_ZLIB="no"
d99ee887 48NEED_WXWIDGETS="no"
ef0c727b 49MODULES=""
ef0c727b
VK
50STATIC_SUBAGENT_LIST=""
51SUBAGENT_DIRS=""
52SUBAGENT_LIBS=""
53UNSTABLE_SUBAGENT_DIRS=""
54SERVER_TOOLS=""
55TOP_LEVEL_MODULES=""
56CONTRIB_MODULES=""
c2612d83 57CLIENT_COMPONENTS=""
d3c8926d 58
16dff090 59
ef0c727b
VK
60#--------------------------------------------------------------------
61# Parse command line parameters
62#--------------------------------------------------------------------
7c9c94a7 63
ef0c727b
VK
64AC_ARG_WITH(server,
65[AS_HELP_STRING(--with-server,build server)],
66[
67 COMPONENTS="$COMPONENTS server agent"
68])
7c9c94a7 69
ef0c727b
VK
70AC_ARG_WITH(client,
71[AS_HELP_STRING(--with-client,build client library and tools)],
72[
73 COMPONENTS="$COMPONENTS client"
74])
d16cf8a5 75
c2612d83
VK
76AC_ARG_WITH(console,
77[AS_HELP_STRING(--with-console,build management console)],
78[
79 COMPONENTS="$COMPONENTS console client"
80])
81
ef0c727b
VK
82AC_ARG_WITH(agent,
83[AS_HELP_STRING(--with-agent,build agent)],
84[
85 COMPONENTS="$COMPONENTS agent"
86])
d16cf8a5 87
ef0c727b
VK
88AC_ARG_WITH(static-agent,
89[AS_HELP_STRING(--with-static-agent,build statically linked agent)],
90[
91 COMPONENTS="$COMPONENTS static-agent"
92])
d16cf8a5 93
ef0c727b
VK
94AC_ARG_WITH(ipso-agent,
95[AS_HELP_STRING(--with-ipso-agent,build statically linked IPSO agent)],
96[
97 COMPONENTS="$COMPONENTS ipso-agent"
98])
521d90e7 99
ef0c727b
VK
100AC_ARG_WITH(nxhttpd,
101[AS_HELP_STRING(--with-nxhttpd,build web interface)],
102[
103 COMPONENTS="$COMPONENTS nxhttpd"
104])
d16cf8a5 105
ef0c727b
VK
106AC_ARG_WITH(mdebug,
107[AS_HELP_STRING(--with-mdebug,use debug version of memory allocation functions)],
108[
109 CPPFLAGS="$CPPFLAGS -DNETXMS_MEMORY_DEBUG"
110])
d16cf8a5 111
9486b324
VK
112AC_ARG_WITH(sqlite,
113[AS_HELP_STRING(--with-sqlite,build SQLite database driver)],
114[ if test "x$withval" != "xno" ; then
115 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
116 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
117 LDFLAGS="$LDFLAGS -L${withval}/lib"
118 CPPFLAGS="$CPPFLAGS -I${withval}/include"
ef0c727b
VK
119 fi
120 COMPONENTS="$COMPONENTS sqlite"
121 DBDRIVER_SELECTED="yes"
9486b324
VK
122fi ])
123
c4b88c3d
VK
124AC_ARG_WITH(odbc,
125[AS_HELP_STRING(--with-odbc,build ODBC database driver)],
126[ if test "x$withval" != "xno" ; then
127 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
128 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
129 LDFLAGS="$LDFLAGS -L${withval}/lib"
130 CPPFLAGS="$CPPFLAGS -I${withval}/include"
ef0c727b
VK
131 fi
132 COMPONENTS="$COMPONENTS odbc"
133 DBDRIVER_SELECTED="yes"
c4b88c3d
VK
134fi ])
135
d16cf8a5 136AC_ARG_WITH(mysql,
c4b88c3d 137[AS_HELP_STRING(--with-mysql,build MySQL database driver)],
d16cf8a5
AK
138[ if test "x$withval" != "xno" ; then
139 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
140 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
141 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/mysql -L${withval}/mysql/lib"
6693a1d0 142 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include"
d16cf8a5 143 else
007ae516
VK
144 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}"
145 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 146 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 147 fi
ef0c727b
VK
148 COMPONENTS="$COMPONENTS mysql"
149 DBDRIVER_SELECTED="yes"
6693a1d0 150fi ])
d16cf8a5
AK
151
152AC_ARG_WITH(pgsql,
c4b88c3d 153[AS_HELP_STRING(--with-pgsql,build PostgreSQL database driver)],
d16cf8a5 154[ if test "x$withval" != "xno" ; then
6693a1d0
AK
155 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
156 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
157 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/pgsql -L${withval}/lib/postgresql -L${withval}/pgsql/lib -L${withval}/postgresql/lib"
158 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/pgsql -I${withval}/include/postgresql -I${withval}/pgsql/include -I${withval}/postgresql/include"
159 else
007ae516
VK
160 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}"
161 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
162 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"
163 fi
ef0c727b
VK
164 COMPONENTS="$COMPONENTS pgsql"
165 DBDRIVER_SELECTED="yes"
6693a1d0 166fi ])
d16cf8a5 167
ef0c727b 168AC_ARG_WITH(openssl,
1010cff7
VK
169[AS_HELP_STRING(--with-openssl,specify OpenSSL location)],
170[
171 if test "x$withval" != "xno" ; then
172 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
173 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
174 LDFLAGS="$LDFLAGS -L${withval}/lib"
175 CPPFLAGS="$CPPFLAGS -I${withval}/include"
176 else
177 LD_RUN_PATH="/usr/local/lib:/opt/openssl/lib:/usr/local/ssl/lib:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
178 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/opt/openssl/lib"
179 CPPFLAGS="$CPPFLAGS -I/usr/local/include -I/opt/openssl/include"
ef0c727b 180 fi
1010cff7
VK
181 fi
182 REQUIRE_ENCRYPTION="yes"
183])
ef0c727b 184
c3cfc039
VK
185AC_ARG_WITH(gd,
186[AS_HELP_STRING(--with-gd,specify GD location)],
187[
188 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
189 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
190 LDFLAGS="$LDFLAGS -L${withval}/lib"
191 CPPFLAGS="$CPPFLAGS -I${withval}/include"
192 fi
193])
194
ef0c727b
VK
195AC_ARG_ENABLE(iconv,
196[AS_HELP_STRING(--disable-iconv,do not use iconv() for text conversions)],
3a7ce527 197[
ef0c727b 198 DISABLE_ICONV="yes"
3a7ce527 199])
3a7ce527 200
ef0c727b
VK
201AC_ARG_ENABLE(encryption,
202[AS_HELP_STRING(--disable-encryption,disable encryption support)],
e0760102 203[
ef0c727b 204 DISABLE_ENCRYPTION="yes"
e0760102
VK
205])
206
ef0c727b
VK
207AC_ARG_ENABLE(unstable,
208[AS_HELP_STRING(--enable-unstable,build experimental/unstable components)],
d8ca9c03 209[
ef0c727b 210 ENABLE_UNSTABLE="yes"
d8ca9c03
VK
211])
212
f974a50a
VK
213AC_ARG_ENABLE(debug,
214[AS_HELP_STRING(--enable-debug,enable additional debugging functionality)],
215[
216 ENABLE_DEBUG="yes"
217])
218
ef0c727b
VK
219AC_ARG_WITH(dist,
220[AS_HELP_STRING(--with-dist,for maintainers only)],
68e4e62d 221 DB_DRIVERS=" mysql pgsql odbc mssql sqlite oracle"
d99ee887 222 MODULES="libnxsnmp libnxsl server agent libnxmap libnxcl nxevent nxpush nxreport nxmibc client console nxhttpd nxscript"
ef0c727b
VK
223 SUBAGENT_DIRS="linux freebsd openbsd sunos aix ipso hpux"
224 NXCONFIG="nxconfig"
225 TOP_LEVEL_MODULES="sql images"
226 CONTRIB_MODULES="mibs backgrounds"
d99ee887 227 CLIENT_COMPONENTS="console"
539ab0c3 228 UNSTABLE_SUBAGENT_DIRS="logscan odbcquery"
ef0c727b
VK
229 SERVER_TOOLS="nxconfig"
230)
231
d8ca9c03 232
ef0c727b
VK
233#--------------------------------------------------------------------
234# Validate command line parameters and set various checking options
235#--------------------------------------------------------------------
236
237check_substr "$COMPONENTS" "static-agent"
1010cff7 238if test $? = 0; then
ef0c727b
VK
239 if test "x$COMPONENTS" != "x static-agent"; then
240 AC_MSG_ERROR(Static agent and other components are mutally exclusive.)
241 fi
242 STATIC_BUILD="yes"
243 BUILD_STATIC_AGENT="yes"
0c3c0c39 244 MODULES="$MODULES agent"
3a6979cf 245 DISABLE_ICONV="yes"
ef0c727b 246 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT"
e8636669 247
ef0c727b 248 case "$PLATFORM" in
e8636669
VK
249 Linux)
250 SUBAGENT_DIRS="linux"
d0b5a098
VK
251 SUBAGENT_LIBS="../subagents/linux/libnsm_linux.la"
252 STATIC_SUBAGENT_LIST="linux $STATIC_SUBAGENT_LIST"
e8636669
VK
253 ;;
254 FreeBSD)
255 SUBAGENT_DIRS="freebsd"
d0b5a098
VK
256 SUBAGENT_LIBS="../subagents/freebsd/libnsm_freebsd.la"
257 STATIC_SUBAGENT_LIST="freebsd $STATIC_SUBAGENT_LIST"
e8636669 258 ;;
992ba479
AK
259 OpenBSD)
260 SUBAGENT_DIRS="openbsd"
261 SUBAGENT_LIBS="../subagents/openbsd/libnsm_openbsd.la"
262 STATIC_SUBAGENT_LIST="openbsd $STATIC_SUBAGENT_LIST"
263 ;;
e8636669
VK
264 SunOS)
265 SUBAGENT_DIRS="sunos"
d0b5a098
VK
266 SUBAGENT_LIBS="../subagents/sunos/libnsm_sunos.la"
267 STATIC_SUBAGENT_LIST="sunos $STATIC_SUBAGENT_LIST"
268 ;;
269 AIX)
270 SUBAGENT_DIRS="aix"
271 SUBAGENT_LIBS="../subagents/aix/libnsm_aix.la"
272 STATIC_SUBAGENT_LIST="aix $STATIC_SUBAGENT_LIST"
e8636669 273 ;;
c29360a9
VK
274 HP-UX)
275 SUBAGENT_DIRS="hpux"
276 SUBAGENT_LIBS="../subagents/hpux/libnsm_hpux.la"
277 STATIC_SUBAGENT_LIST="hpux $STATIC_SUBAGENT_LIST"
278 ;;
e8636669
VK
279 *)
280 # unknown
281 ;;
282 esac
ef0c727b 283fi
2b23dc1e 284
ef0c727b 285check_substr "$COMPONENTS" "ipso-agent"
1010cff7 286if test $? = 0; then
ef0c727b
VK
287 if test "x$COMPONENTS" != "x static-agent"; then
288 AC_MSG_ERROR(IPSO agent and other components are mutally exclusive.)
289 fi
290 STATIC_BUILD="yes"
291 BUILD_STATIC_AGENT="yes"
3a6979cf 292 DISABLE_ICONV="yes"
ef0c727b
VK
293 USE_PTH="yes"
294 MODULES="$MODULES agent"
295 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT -D_IPSO -D_USE_GNU_PTH -I/usr/local/include"
296 LDFLAGS="$LDFLAGS -all-static"
297 STATIC_SUBAGENT_LIST="ipso ping portcheck ups"
298 SUBAGENT_DIRS="ipso"
299 SUBAGENT_LIBS="../subagents/ipso/libnsm_ipso.la ../subagents/ping/libnsm_ping.la ../subagents/portCheck/libnsm_portCheck.la ../subagents/ups/libnsm_ups.la"
300fi
c688d2a7 301
ef0c727b 302check_substr "$COMPONENTS" "server"
1010cff7 303if test $? = 0; then
ef0c727b
VK
304 if test "x$DBDRIVER_SELECTED" != "xyes"; then
305 AC_MSG_ERROR(You must select at least one database driver when building server.)
306 fi
307 BUILD_SERVER="yes"
308 NEED_ZLIB="yes"
309 MODULES="$MODULES libnxmap libnxsnmp libnxsl server nxmibc nxscript"
310 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES sql images"
311 CONTRIB_MODULES="$CONTRIB_MODULES mibs backgrounds"
312fi
dff54fed 313
ef0c727b 314check_substr "$COMPONENTS" "client"
1010cff7 315if test $? = 0; then
ef0c727b
VK
316 BUILD_CLIENT="yes"
317 NEED_ZLIB="yes"
c2612d83
VK
318 MODULES="$MODULES libnxmap libnxcl nxevent nxpush nxreport console client"
319fi
320
321check_substr "$COMPONENTS" "console"
322if test $? = 0; then
323 BUILD_CONSOLE="yes"
d99ee887 324 NEED_WXWIDGETS="yes"
c2612d83 325 CLIENT_COMPONENTS="$CLIENT_COMPONENTS console"
ef0c727b 326fi
0c3c0c39 327
ef0c727b 328check_substr "$COMPONENTS" "agent"
1010cff7 329if test $? = 0; then
ef0c727b
VK
330 BUILD_AGENT="yes"
331 MODULES="$MODULES agent"
332 if test "x$ENABLE_UNSTABLE" = "xyes"; then
539ab0c3 333 UNSTABLE_SUBAGENT_DIRS="logscan odbcquery"
987b646a 334 fi
1010cff7
VK
335
336 case "$PLATFORM" in
337 Linux)
338 SUBAGENT_DIRS="linux"
339 ;;
340 FreeBSD)
341 SUBAGENT_DIRS="freebsd"
342 ;;
343 OpenBSD)
344 SUBAGENT_DIRS="openbsd"
345 ;;
346 SunOS)
347 SUBAGENT_DIRS="sunos"
348 ;;
349 AIX)
350 SUBAGENT_DIRS="aix"
351 ;;
352 HP-UX)
353 SUBAGENT_DIRS="hpux"
354 ;;
355 *)
356 # unknown
357 ;;
358 esac
ef0c727b 359fi
b97191d2 360
ef0c727b 361check_substr "$COMPONENTS" "nxhttpd"
1010cff7 362if test $? = 0; then
ef0c727b
VK
363 BUILD_NXHTTPD="yes"
364 MODULES="$MODULES libnxmap libnxcl nxhttpd"
365fi
b67a9e12 366
ef0c727b 367check_substr "$COMPONENTS" "mysql"
1010cff7 368if test $? = 0; then
ef0c727b 369 DB_DRIVERS="$DB_DRIVERS mysql"
b67a9e12 370fi
6619a6b0 371
ef0c727b 372check_substr "$COMPONENTS" "pgsql"
1010cff7 373if test $? = 0; then
ef0c727b
VK
374 DB_DRIVERS="$DB_DRIVERS pgsql"
375fi
e8636669 376
ef0c727b 377check_substr "$COMPONENTS" "sqlite"
1010cff7 378if test $? = 0; then
ef0c727b 379 DB_DRIVERS="$DB_DRIVERS sqlite"
e8636669
VK
380fi
381
ef0c727b 382check_substr "$COMPONENTS" "odbc"
1010cff7 383if test $? = 0; then
ef0c727b
VK
384 DB_DRIVERS="$DB_DRIVERS odbc"
385fi
386
387
388#--------------------------------------------------------------------
389# Check for programs
390#--------------------------------------------------------------------
391
392if test "x$PLATFORM" = "xHP-UX"; then
e7d9c4ae 393 AC_CHECK_PROG([CCC], [aCC], [aCC])
ef0c727b
VK
394fi
395AC_PROG_CC(aCC gcc cc cl)
396AC_PROG_CPP
397AC_PROG_CXX
c3cfc039
VK
398if test "x$CXX" = "xg++"; then
399 AC_CHECK_PROG([RC], [g++], [yes], [no])
400 if test "x$RC" = "xno"; then
401 AC_MSG_ERROR([*** FATAL: Cannot find any usable C++ compiler])
402 fi
403fi
ef0c727b
VK
404AC_PROG_INSTALL
405AC_PROG_LEX
406AC_PROG_YACC
407AC_PROG_LN_S
408
409AC_ARG_VAR(PERL,local path to the perl interpreter)
410perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin"
411AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path)
412
413
414#--------------------------------------------------------------------
415# Initialize libtool
416#--------------------------------------------------------------------
417
418if test "x$STATIC_BUILD" = "xyes"; then
419 enable_shared=no
420 enable_static=yes
421else
422 enable_shared=yes
423 enable_static=no
424fi
e8636669
VK
425AC_LIBTOOL_DLOPEN
426AC_PROG_LIBTOOL
3a7ce527 427
d16cf8a5 428
ef0c727b
VK
429#--------------------------------------------------------------------
430# C/C++ capabilities
431#--------------------------------------------------------------------
432
433AC_C_CONST
434AC_PROG_GCC_TRADITIONAL
1d9cc60e 435AC_C_BIGENDIAN
ef0c727b
VK
436
437
438#--------------------------------------------------------------------
439# Platform-dependent settings
440#--------------------------------------------------------------------
441
442case "$PLATFORM" in
443 AIX)
444 LDFLAGS="-no-undefined $LDFLAGS"
445 ;;
446 HP-UX)
5a5957b2 447 CPPFLAGS="$CPPFLAGS -D_HPUX -D_HPUX_SOURCE -D_POSIX_PTHREAD_SEMANTICS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 -D_REENTRANT"
ef0c727b
VK
448 if test "x$CXX" = "xaCC"; then
449 CXXFLAGS="-mt $CXXFLAGS +W749 +W829"
450 LDFLAGS="$LDFLAGS -mt"
451 fi
452 ;;
75c30ed4
VK
453 SunOS)
454 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
455 export LD_LIBRARY_PATH
456 ;;
ef0c727b
VK
457 *)
458 ;;
459esac
460
461
462#--------------------------------------------------------------------
c90d3610
VK
463# C++ compiler tuning:
464# * Disable C++ exceptions
465# * Disable compiling string constants as "const char *"
466# * Disable some GCC warnings
779ce551 467# * Turn on 64bit mode on HP-UX/Itanium
ef0c727b
VK
468#--------------------------------------------------------------------
469
470if test "x$CC" = "xgcc" ; then
471
472 AC_LANG_PUSH([C++])
473
474 AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti)
475 OLD_CXXFLGAS="$CXXFLAGS"
476 CXXFLAGS="$CXXFLAGS -fno-rtti"
477 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
478 [ AC_MSG_RESULT(yes) ],
479 [
480 CXXFLAGS="$OLD_CXXFLAGS"
481 AC_MSG_RESULT(no)
482 ])
483
484 AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions)
485 OLD_CXXFLGAS="$CXXFLAGS"
486 CXXFLAGS="$CXXFLAGS -fno-exceptions"
487 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
488 [ AC_MSG_RESULT(yes) ],
489 [
490 CXXFLAGS="$OLD_CXXFLAGS"
491 AC_MSG_RESULT(no)
492 ])
493
c90d3610
VK
494 AC_MSG_CHECKING(whether C++ compiler accepts -fno-const-strings)
495 OLD_CXXFLGAS="$CXXFLAGS"
496 CXXFLAGS="$CXXFLAGS -fno-const-strings"
497 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
498 [ AC_MSG_RESULT(yes) ],
499 [
500 CXXFLAGS="$OLD_CXXFLAGS"
501 AC_MSG_RESULT(no)
502 ])
503
504 AC_MSG_CHECKING(whether C++ compiler accepts -Wno-deprecated)
505 OLD_CXXFLGAS="$CXXFLAGS"
506 CXXFLAGS="$CXXFLAGS -Wno-deprecated"
507 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
508 [ AC_MSG_RESULT(yes) ],
509 [
510 CXXFLAGS="$OLD_CXXFLAGS"
511 AC_MSG_RESULT(no)
512 ])
513
ef0c727b
VK
514 AC_LANG_POP([C++])
515
779ce551
VK
516 if test "x$PLATFORM" = "xHP-UX"; then
517 AC_MSG_CHECKING(whether C compiler accepts -mlp64)
518 OLD_CPPFLGAS="$CPPFLAGS"
519 CPPFLAGS="$CPPFLAGS -mlp64"
520 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
521 [
522 LDFLAGS="-mlp64 -L/usr/lib/hpux64 -L/usr/local/lib/hpux64 $LDFLAGS"
523 AC_MSG_RESULT(yes)
524 ],
525 [
526 CPPFLAGS="$OLD_CPPFLAGS"
527 AC_MSG_RESULT(no)
528 ])
529 fi
530
ef0c727b
VK
531fi
532
533
534#--------------------------------------------------------------------
535# Additional include and library directories
536#--------------------------------------------------------------------
537
538if test -d /usr/local/include; then
539 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
540fi
541
542if test -d /usr/kerberos/include; then
543 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
544fi
545
546if test -d /usr/local/lib; then
547 LDFLAGS="$LDFLAGS -L/usr/local/lib"
548fi
549
550
551#--------------------------------------------------------------------
552# Check for threads library - either POSIX or GNU
553#--------------------------------------------------------------------
554
555if test "x$USE_PTH" = "xyes"; then
556 AC_CHECK_HEADER(pth.h,,AC_MSG_ERROR([*** GNU Pth thread support not installed - please install first ***]))
557else
558 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
559
560 if test "x$CXX" = "xaCC"; then
561 PTHREAD_LIBS=""
562 else
563 PTHREAD_LIBS="error"
564 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
565 AC_EGREP_CPP(yes,
566 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
567 yes
568 #endif
569 ], AC_MSG_RESULT(yes)
570 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" PTHREAD_LIBS="-pthread",
571 AC_MSG_RESULT(no))
572 if test "x$PTHREAD_LIBS" = "xerror"; then
573 AC_CHECK_LIB(pthread, pthread_attr_init,
574 PTHREAD_LIBS="-lpthread")
575 fi
576 if test "x$PTHREAD_LIBS" = "xerror"; then
577 AC_CHECK_LIB(pthreads, pthread_attr_init,
578 PTHREAD_LIBS="-lpthreads")
579 fi
580 if test "x$PTHREAD_LIBS" = "xerror"; then
581 AC_CHECK_FUNC(pthread_attr_init,
582 PTHREAD_LIBS="")
583 fi
584 fi
585
586 if test "x$PTHREAD_LIBS" = "xerror"; then
587 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
588 fi
589 LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
590
591 # Extensions to posix threads
592 AC_CHECK_HEADERS([pthread_np.h],,,[
9c29f76e 593#include <pthread.h>
ef0c727b
VK
594 ])
595 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
596
597 # Check for recursive mutexes
598 AC_CHECK_FUNCS([pthread_mutexattr_settype pthread_mutexattr_setkind_np])
599 AC_CHECK_DECLS([PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
9c29f76e
VK
600#include <pthread.h>
601#if HAVE_PTHREAD_NP_H
602#include <pthread_np.h>
603#endif
ef0c727b
VK
604 ])
605
606 # Check for read/write locks
607 # On Linux, rwlock functions declared always, but pthread_rwlock_t may need
608 # additional defines
609 AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
610 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
611 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
9c29f76e
VK
612 [AC_TRY_COMPILE([
613#include <sys/types.h>
614#include <pthread.h>
615 ],
ef0c727b
VK
616 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
617 ac_cv_struct_pthread_rw=yes, [
9c29f76e
VK
618 AC_TRY_COMPILE([
619#define _XOPEN_SOURCE 500
620#include <sys/types.h>
621#include <pthread.h>
622 ],
ef0c727b
VK
623 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
624 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
625 if test "$ac_cv_struct_pthread_rw" = "yes"; then
626 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
627 fi
628 ])])
629 if test "$ac_cv_struct_pthread_rw" = "yes"; then
630 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
631 fi
632 fi
633
634fi
635
636
637#--------------------------------------------------------------------
638# Checks for OpenSSL
639#--------------------------------------------------------------------
640
641if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
642 AC_CHECK_LIB(crypto, RSA_new,
643 [
644 AC_DEFINE(WITH_OPENSSL,,[with openssl])
645 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
646 [], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
647 AC_CHECK_LIB(crypto, EVP_bf_cbc,
648 [], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
649 AC_CHECK_LIB(crypto, EVP_idea_cbc,
650 [], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
651 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
652 [], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
653 ],
654 [
655 if test "x$REQUIRE_ENCRYPTION" = "xyes"; then
656 AC_MSG_ERROR(libcrypto is required for encryption support)
657 else
658 AC_MSG_RESULT(libcrypto is required for encryption support)
659 fi
660 ])
661fi
662
663
664#--------------------------------------------------------------------
665# Checks for other libs.
666#--------------------------------------------------------------------
d16cf8a5 667
779ce551 668AC_CHECK_LIB(xnet, accept)
521d90e7 669AC_CHECK_LIB(socket, if_nameindex)
87bb64a7 670AC_CHECK_LIB(dl, dlopen)
1b3c0ef0 671AC_CHECK_LIB(kstat, kstat_open)
d16cf8a5 672
e0760102
VK
673if test "x$BUILD_SERVER" = "xyes" ; then
674 AC_CHECK_LIB(termcap, tgetstr, [], [AC_CHECK_LIB(ncurses, tgetstr, [], AC_CHECK_LIB(curses, tgetstr))])
675 AC_CHECK_LIB(readline, readline)
676fi
677
ef0c727b
VK
678if test "x$NEED_ZLIB" = "xyes"; then
679 AC_CHECK_HEADER(zlib.h,,AC_MSG_ERROR([*** ZLib development package not installed - please install first ***]))
680 AC_CHECK_LIB(z, deflate)
681fi
682
683
684#--------------------------------------------------------------------
685# Checks for header files
686#--------------------------------------------------------------------
d16cf8a5 687
ef0c727b
VK
688AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h])
689AC_CHECK_HEADERS([sys/int_types.h sys/time.h sys/utsname.h])
ca6ad6bb 690AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h net/nh.h sys/socket.h])
70fed300 691AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
ef0c727b
VK
692AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h])
693AC_CHECK_HEADERS([sys/sysctl.h vm/vm_param.h])
ade50e8b
AK
694AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h],,,
695[[#ifdef HAVE_SYS_TYPES_H
696# include <sys/types.h>
697#endif
698#ifdef HAVE_SYS_TIME_H
699# include <sys/time.h>
700#endif
701#ifdef HAVE_SYS_SOCKET_H
702# include <sys/socket.h>
703#endif
704]])
d16cf8a5 705
ef0c727b
VK
706
707#--------------------------------------------------------------------
708# Checks for data types
709#--------------------------------------------------------------------
710
d16cf8a5
AK
711AC_CHECK_SIZEOF(short)
712AC_CHECK_SIZEOF(int)
713AC_CHECK_SIZEOF(long)
714AC_CHECK_SIZEOF(long long)
715
716AC_TYPE_PID_T
717AC_TYPE_SIGNAL
718AC_TYPE_SIZE_T
719AC_STRUCT_TIMEZONE
720
521d90e7 721AC_CHECK_TYPES([int64_t, uint64_t, u_int64_t])
4c779d83
VK
722AC_CHECK_TYPES([off_t, socklen_t],,,[
723#if HAVE_SYS_TYPES_H
724#include <sys/types.h>
725#endif
726#if HAVE_SYS_SOCKET_H
727#include <sys/socket.h>
728#endif
729])
521d90e7 730
e25cadc9 731
ef0c727b
VK
732#--------------------------------------------------------------------
733# Checks for functions
734#--------------------------------------------------------------------
d16cf8a5
AK
735
736AC_FUNC_ERROR_AT_LINE
d16cf8a5 737AC_FUNC_MEMCMP
d16cf8a5
AK
738AC_FUNC_SELECT_ARGTYPES
739AC_FUNC_STRFTIME
740AC_FUNC_STRTOD
741AC_FUNC_VPRINTF
742
b50f1100
VK
743AC_CHECK_FUNCS([gettimeofday memmove memset strchr strcspn strdup strerror])
744AC_CHECK_FUNCS([strrchr strtol strtoul strtoll strtoull])
467e30e1 745AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
8aa1f557 746AC_CHECK_FUNCS([nanosleep getopt_long gmtime_r])
d16cf8a5 747
73d7fbdb
VK
748AC_CHECK_DECLS([getopt_long])
749
f91feddc 750AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
70fed300
AK
751AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
752
d16cf8a5
AK
753# sockets/resolver (probably for solaris)
754AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
755AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
756AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
757
758if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
759 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
760fi
761
762if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
763 AC_MSG_CHECKING([if we can include libnsl + libsocket])
764 LIBS="-lnsl -lsocket $LIBS"
765 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
766 if test "$my_ac_link_result" = "no" ; then
767 AC_MSG_RESULT([failure])
768 AC_MSG_ERROR([unable to use gethostbyname()])
769 else
770 AC_MSG_RESULT([success])
771 fi
772fi
773
dff54fed 774
ef0c727b
VK
775#--------------------------------------------------------------------
776# Checks for macros and definitions
777#--------------------------------------------------------------------
dff54fed 778
ef0c727b
VK
779AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
780#ifdef HAVE_SYS_TYPES_H
781# include <sys/types.h>
782#endif
783#if HAVE_BYTESWAP_H
784#include <byteswap.h>
785#endif
786#if HAVE_NETINET_IN_H
787#include <netinet/in.h>
788#endif
789#if HAVE_NET_NH_H
790#include <net/nh.h>
791#endif
792])
dff54fed 793
dff54fed 794
ef0c727b
VK
795#--------------------------------------------------------------------
796# AIX specific checks
797#--------------------------------------------------------------------
d16cf8a5 798
ef0c727b
VK
799if test "x$PLATFORM" = "xAIX"; then
800 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
801 AC_CHECK_DECLS([getkerninfo])
802 AC_CHECK_FUNCS([getprocs64],,,[
803#if HAVE_PROCINFO_H
804#include <procinfo.h>
6cd41ceb 805#endif
ef0c727b 806 ])
7e56bf2e
VK
807fi
808
cd4c8ca3 809
ef0c727b
VK
810#--------------------------------------------------------------------
811# Check for UNICODE stuff
812#--------------------------------------------------------------------
3e39fcde 813
93571e7f 814AC_CHECK_HEADERS([wchar.h iconv.h])
3e39fcde 815AC_CHECK_SIZEOF(wchar_t)
dff54fed 816
3265ba38 817if test "x$DISABLE_ICONV" != "xyes"; then
75c30ed4 818 AC_CHECK_LIB(iconv, libiconv_open,
dff54fed 819 [ ac_found_iconv=yes
75c30ed4
VK
820 LDFLAGS="$LDFLAGS -liconv"
821 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
822 ],
823 [
824 AC_CHECK_LIB(iconv, iconv,
825 [ ac_found_iconv=yes
826 LDFLAGS="$LDFLAGS -liconv"
827 ])
828 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
829 ])
dff54fed
VK
830else
831 ac_found_iconv=no
ef0c727b 832 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
dff54fed 833fi
93571e7f
VK
834
835AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
836AC_RUN_IFELSE(
837 [AC_LANG_PROGRAM([
838#if HAVE_ICONV_H
839#include <iconv.h>
840#endif
841 ], [
842 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
843 ])
844 ],
845 [ AC_MSG_RESULT(yes)
846 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
847 valid_ucs2_code="UCS-2-INTERNAL"
848 ],
849 [ AC_MSG_RESULT(no) ],
850 [ AC_MSG_RESULT(no) ]
851)
852
853AC_MSG_CHECKING(whether iconv supports UCS-2)
854AC_RUN_IFELSE(
855 [AC_LANG_PROGRAM([
856#if HAVE_ICONV_H
857#include <iconv.h>
858#endif
859 ], [
860 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
861 ])
862 ],
863 [ AC_MSG_RESULT(yes)
864 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
865 valid_ucs2_code="UCS-2"
866 ],
867 [ AC_MSG_RESULT(no) ],
868 [ AC_MSG_RESULT(yes)
869 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
870 ]
871)
872
873AC_MSG_CHECKING(whether iconv supports UCS2)
874AC_RUN_IFELSE(
875 [AC_LANG_PROGRAM([
876#if HAVE_ICONV_H
877#include <iconv.h>
878#endif
879 ], [
880 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
881 ])
882 ],
883 [ AC_MSG_RESULT(yes)
884 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
885 valid_ucs2_code="UCS2"
886 ],
887 [ AC_MSG_RESULT(no) ],
888 [ AC_MSG_RESULT(no) ]
889)
890
44bccbbc
VK
891AC_MSG_CHECKING(whether iconv supports UCS-2BE)
892AC_RUN_IFELSE(
893 [AC_LANG_PROGRAM([
894#if HAVE_ICONV_H
895#include <iconv.h>
896#endif
897 ], [
898 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
899 ])
900 ],
901 [ AC_MSG_RESULT(yes)
902 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
903 valid_ucs2_code="UCS-2BE"
904 ],
905 [ AC_MSG_RESULT(no) ],
906 [ AC_MSG_RESULT(no) ]
907)
908
5e40a69e
VK
909AC_MSG_CHECKING(whether iconv supports ISO8859-1)
910AC_RUN_IFELSE(
911 [AC_LANG_PROGRAM([
912#if HAVE_ICONV_H
913#include <iconv.h>
914#endif
915 ], [
916 return iconv_open("UTF-8","ISO8859-1")==(iconv_t)(-1);
917 ])
918 ],
919 [ AC_MSG_RESULT(yes)
920 AC_DEFINE(HAVE_ICONV_ISO8859_1, 1, Define to 1 if iconv supports ISO8859-1)
921 ],
922 [ AC_MSG_RESULT(no) ],
923 [ AC_MSG_RESULT(no) ]
924)
925
926AC_MSG_CHECKING(whether iconv supports ISO-8859-1)
927AC_RUN_IFELSE(
928 [AC_LANG_PROGRAM([
929#if HAVE_ICONV_H
930#include <iconv.h>
931#endif
932 ], [
933 return iconv_open("UTF-8","ISO-8859-1")==(iconv_t)(-1);
934 ])
935 ],
936 [ AC_MSG_RESULT(yes)
937 AC_DEFINE(HAVE_ICONV_ISO_8859_1, 1, Define to 1 if iconv supports ISO-8859-1)
938 ],
939 [ AC_MSG_RESULT(no) ],
940 [ AC_MSG_RESULT(no) ]
941)
942
943AC_MSG_CHECKING(whether iconv supports ASCII)
944AC_RUN_IFELSE(
945 [AC_LANG_PROGRAM([
946#if HAVE_ICONV_H
947#include <iconv.h>
948#endif
949 ], [
950 return iconv_open("UTF-8","ASCII")==(iconv_t)(-1);
951 ])
952 ],
953 [ AC_MSG_RESULT(yes)
954 AC_DEFINE(HAVE_ICONV_ASCII, 1, Define to 1 if iconv supports ASCII)
955 ],
956 [ AC_MSG_RESULT(no) ],
957 [ AC_MSG_RESULT(no) ]
958)
959
93571e7f
VK
960AC_MSG_CHECKING(whether iconv supports //IGNORE)
961AC_RUN_IFELSE(
962 [AC_LANG_PROGRAM([
963#if HAVE_ICONV_H
964#include <iconv.h>
965#endif
966 ], [
967 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
968 ])
969 ],
970 [ AC_MSG_RESULT(yes)
971 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
972 ],
973 [ AC_MSG_RESULT(no) ],
974 [ AC_MSG_RESULT(no) ]
975)
3e39fcde 976
19619a35
AK
977# taken from ZSH's configure
978# Check if iconv uses const in prototype declaration
24b1570c 979if test "x$ac_found_iconv" = "xyes"; then
19619a35
AK
980 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
981 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
982 #include <iconv.h>]],
983 [[#ifdef __cplusplus
984 "C"
985 #endif
986 #if defined(__STDC__) || defined(__cplusplus)
987 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
988 #else
989 size_t iconv();
990 #endif]])],
991 [ac_cv_iconv_const=],
992 [ac_cv_iconv_const=const])])
993 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
994 [Define as const if the declaration of iconv() needs const.])
995fi
996
93571e7f 997if test $ac_cv_sizeof_wchar_t -eq 2; then
3e39fcde
VK
998 AC_DEFINE(HAVE_USEABLE_WCHAR_T, 1, Define to 1 if you have useable wchar_t)
999fi
1000
c29360a9 1001
ca0f4ea3
VK
1002#--------------------------------------------------------------------
1003# MySQL
1004#--------------------------------------------------------------------
1005
1006check_substr "$COMPONENTS" "mysql"
1007if test $? = 0; then
9c29f76e 1008 AC_CHECK_LIB(mysqlclient, mysql_init, [],
ca0f4ea3 1009 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
9c29f76e
VK
1010 AC_MSG_CHECKING(whether mysql clients can run)
1011 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1012#include <stdio.h>
1013#include <mysql.h>
1014int main(void)
1015{
1016 MYSQL *a = mysql_init(NULL);
1017 return 0;
1018}
1019 ]])],[],[
1020 AC_MSG_RESULT(no)
1021 AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)
1022 ],[])
ca0f4ea3
VK
1023 AC_MSG_RESULT(yes)
1024 AC_CHECK_FUNCS(mysql_real_escape_string)
1025fi
1026
1027
58ed4897
VK
1028#--------------------------------------------------------------------
1029# PostgreSQL
1030#--------------------------------------------------------------------
1031
203458b7 1032check_substr "$COMPONENTS" "pgsql"
58ed4897
VK
1033if test $? = 0; then
1034 AC_CHECK_LIB(m, floor)
1035 AC_CHECK_LIB(pq, PQconnectdb, ,
1036 [AC_MSG_ERROR(libpq is required for PostgreSQL support)])
1037 AC_MSG_CHECKING(whether postgresql clients can run)
1038 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1039 #include <stdio.h>
1040 #include <libpq-fe.h>
1041 int main(void)
1042 {
1043 PGconn *a = PQconnectdb("");
1044 return 0;
1045 }
1046 ]])],[],[
1047 AC_MSG_RESULT(no)
1048 AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
1049 ],[])
1050 AC_MSG_RESULT(yes)
1051fi
1052
1053
9c29f76e
VK
1054#--------------------------------------------------------------------
1055# ODBC
1056#--------------------------------------------------------------------
1057
1058check_substr "$COMPONENTS" "odbc"
1059if test $? = 0; then
1060 AC_CHECK_LIB(odbc, SQLAllocHandle, [],
1061 [AC_MSG_ERROR(libodbc is required for ODBC support)])
1062fi
1063
1064
1065#--------------------------------------------------------------------
1066# SQLite
1067#--------------------------------------------------------------------
1068
1069check_substr "$COMPONENTS" "sqlite"
1070if test $? = 0; then
75c30ed4 1071 AC_CHECK_LIB(rt, fdatasync)
9c29f76e
VK
1072 AC_CHECK_LIB(sqlite3, sqlite3_open, [],
1073 [AC_MSG_ERROR(libsqlite3 is required for SQLite support)])
1074fi
1075
1076
c3cfc039
VK
1077#--------------------------------------------------------------------
1078# nxhttpd
1079#--------------------------------------------------------------------
1080
1081check_substr "$COMPONENTS" "nxhttpd"
1082if test $? = 0; then
1083 AC_CHECK_HEADER(gd.h,,AC_MSG_ERROR([*** GD support not installed - please install first ***]))
1084 AC_CHECK_LIB(gd, gdImageCreate, [], [
1085 AC_MSG_ERROR(libgd is required for web interface)
1086 ])
1087
1088fi
1089
1090
d99ee887
VK
1091#--------------------------------------------------------------------
1092# Check for wxWidgets
1093#--------------------------------------------------------------------
1094
1095if test "x$NEED_WXWIDGETS" = "xyes"; then
1096 AC_CHECK_PROG([RC], [wx-config], [yes], [no])
1097 if test "x$RC" = "xyes"; then
f974a50a
VK
1098 CXXFLAGS="$CXXFLAGS `wx-config --cxxflags --debug=$ENABLE_DEBUG`"
1099 LDFLAGS="$CXXFLAGS `wx-config --libs --debug=$ENABLE_DEBUG`"
d99ee887
VK
1100 else
1101 AC_MSG_ERROR([*** wxWidgets not installed - unable to build GUI components ***])
1102 fi
1103fi
1104
1105
ca0f4ea3
VK
1106#--------------------------------------------------------------------
1107# Other settings
1108#--------------------------------------------------------------------
1109
28c329e2 1110CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DLIBDIR=\\\"\${libdir}\\\""
ca0f4ea3
VK
1111
1112
ef0c727b
VK
1113#--------------------------------------------------------------------
1114# Substitute variables
1115#--------------------------------------------------------------------
82fa7c5d 1116
ef0c727b
VK
1117AC_SUBST(DB_DRIVERS)
1118AC_SUBST(MODULES)
1119AC_SUBST(SUBAGENT_DIRS)
1120AC_SUBST(SERVER_TOOLS)
1121AC_SUBST(TOP_LEVEL_MODULES)
1122AC_SUBST(CONTRIB_MODULES)
c2612d83 1123AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
1124AC_SUBST(STATIC_SUBAGENT_LIST)
1125AC_SUBST(SUBAGENT_LIBS)
1126AC_SUBST(BUILD_SERVER)
1127AC_SUBST(UNSTABLE_SUBAGENT_DIRS)
d16cf8a5 1128
ef0c727b
VK
1129#--------------------------------------------------------------------
1130# Shared libs versions
d16cf8a5
AK
1131#
1132# versioning scheme: current:revision:age
1133#
1134# current
1135# The number of the current interface exported by the library. A current
1136# value of `0', means that you are calling the interface exported by this
1137# library interface 0.
1138#
1139# revision
1140# The implementation number of the most recent interface exported by this
1141# library. In this case, a revision value of `0' means that this is the
1142# first implementation of the interface.
1143# If the next release of this library exports the same interface, but has a
1144# different implementation (perhaps some bugs have been fixed), the revision
1145# number will be higher, but current number will be the same. In that case,
1146# when given a choice, the library with the highest revision will always
1147# be used by the runtime loader.
1148#
1149# age
1150# The number of previous additional interfaces supported by this library.
1151# If age were `2', then this library can be linked into executables which
1152# were built with a release of this library that exported the current
1153# interface number, current, or any of the previous two interfaces.
1154# By definition age must be less than or equal to current. At the outset,
1155# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 1156#--------------------------------------------------------------------
d16cf8a5 1157
c7d14846
VK
1158NETXMS_LIBRARY_VERSION=0:2:0
1159AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 1160
ef0c727b
VK
1161
1162#--------------------------------------------------------------------
1163# Generate output files
1164#--------------------------------------------------------------------
d16cf8a5
AK
1165
1166AC_CONFIG_FILES([
ef0c727b 1167 README
0c3c0c39
AK
1168 Makefile
1169 contrib/Makefile
0c3c0c39 1170 contrib/startup/Makefile
daaefaaf 1171 contrib/startup/gentoo/Makefile
0c3c0c39 1172 contrib/startup/redhat/Makefile
5de3893d 1173 contrib/startup/suse/Makefile
82fa7c5d 1174 contrib/mibs/Makefile
3f2f9f2b 1175 contrib/backgrounds/Makefile
0c3c0c39 1176 doc/Makefile
a48203d2
VK
1177 doc/internal/Makefile
1178 doc/manuals/Makefile
1179 doc/misc/Makefile
0c3c0c39
AK
1180 images/Makefile
1181 include/Makefile
1182 m4/Makefile
1183 netware/Makefile
1184 sql/Makefile
0c3c0c39
AK
1185 src/Makefile
1186 src/libnetxms/Makefile
d853cd74 1187 src/libnxsnmp/Makefile
0c3c0c39 1188 src/libnxcl/Makefile
c002b04a 1189 src/libnxsl/Makefile
1d410d50 1190 src/libnxmap/Makefile
1b1edd49
VK
1191 src/install/Makefile
1192 src/install/windows/Makefile
c2612d83
VK
1193 src/client/Makefile
1194 src/client/console/Makefile
1195 src/client/console/include/Makefile
1196 src/client/console/libnxmc/Makefile
1197 src/client/console/nxmc/Makefile
1198 src/client/console/nxmc/rc/Makefile
1199 src/client/console/plugins/Makefile
1200 src/client/console/plugins/ObjectBrowser/Makefile
0c3c0c39 1201 src/console/Makefile
8c7d057b
VK
1202 src/console/nxuilib/Makefile
1203 src/console/nxuilib/res/Makefile
f7d8c3b2 1204 src/console/nxuilib/sounds/Makefile
e4d08190 1205 src/console/nxlexer/Makefile
0c3c0c39
AK
1206 src/console/win32/Makefile
1207 src/console/win32/icons/Makefile
1208 src/console/win32/res/Makefile
1209 src/console/win32starter/Makefile
672441ac 1210 src/console/nxav/Makefile
2b463d08 1211 src/console/nxav/res/Makefile
52996299
VK
1212 src/console/nxnotify/Makefile
1213 src/console/nxnotify/res/Makefile
672441ac 1214 src/console/cmdline/Makefile
2b463d08
VK
1215 src/console/PocketPC/Makefile
1216 src/console/PocketPC/res/Makefile
0c3c0c39 1217 src/nxevent/Makefile
09c70d92 1218 src/nxpush/Makefile
1e8eed7a 1219 src/nxreport/Makefile
148f47cf 1220 src/nxmibc/Makefile
f519aa3e 1221 src/nxscript/Makefile
0c3c0c39
AK
1222 src/server/Makefile
1223 src/server/core/Makefile
a551fe4d 1224 src/server/netxmsd/Makefile
0c3c0c39
AK
1225 src/server/dbdrv/Makefile
1226 src/server/dbdrv/odbc/Makefile
1227 src/server/dbdrv/mssql/Makefile
1228 src/server/dbdrv/mysql/Makefile
1229 src/server/dbdrv/pgsql/Makefile
9486b324 1230 src/server/dbdrv/sqlite/Makefile
5de3893d 1231 src/server/dbdrv/oracle/Makefile
d8f2e39b
VK
1232 src/server/smsdrv/Makefile
1233 src/server/smsdrv/generic/Makefile
0c3c0c39
AK
1234 src/server/tools/Makefile
1235 src/server/tools/nxget/Makefile
1236 src/server/tools/nxaction/Makefile
1237 src/server/tools/nxadm/Makefile
5b0c7d0d
VK
1238 src/server/tools/nxconfig/Makefile
1239 src/server/tools/nxconfig/res/Makefile
f90d7fc5 1240 src/server/tools/nxdbmgr/Makefile
d853cd74 1241 src/server/tools/nxsnmpget/Makefile
734c670f 1242 src/server/tools/nxsnmpwalk/Makefile
665b4ccf 1243 src/server/tools/nxsnmpset/Makefile
d24fdaf4 1244 src/server/tools/nxupload/Makefile
0c3c0c39
AK
1245 src/server/libnxsrv/Makefile
1246 src/agent/Makefile
1247 src/agent/core/Makefile
5795bf90 1248 src/agent/install/Makefile
0c3c0c39
AK
1249 src/agent/subagents/Makefile
1250 src/agent/subagents/linux/Makefile
1251 src/agent/subagents/sunos/Makefile
d0b5a098 1252 src/agent/subagents/aix/Makefile
9bdf494f 1253 src/agent/subagents/hpux/Makefile
0c3c0c39
AK
1254 src/agent/subagents/skeleton/Makefile
1255 src/agent/subagents/freebsd/Makefile
992ba479 1256 src/agent/subagents/openbsd/Makefile
2b23dc1e 1257 src/agent/subagents/ipso/Makefile
0c3c0c39 1258 src/agent/subagents/netware/Makefile
1bc607cc
VK
1259 src/agent/subagents/winnt/Makefile
1260 src/agent/subagents/win9x/Makefile
0c3c0c39 1261 src/agent/subagents/winperf/Makefile
93f15c2a 1262 src/agent/subagents/portCheck/Makefile
b36a6eb9 1263 src/agent/subagents/logscan/Makefile
abc48356 1264 src/agent/subagents/ping/Makefile
2f06a66e 1265 src/agent/subagents/ups/Makefile
539ab0c3
AK
1266 src/agent/subagents/ecs/Makefile
1267 src/agent/subagents/odbcquery/Makefile
5de3893d 1268 src/nxhttpd/Makefile
066afcd4
VK
1269 src/nxhttpd/static/Makefile
1270 src/nxhttpd/static/images/Makefile
4351a82a
VK
1271 src/nxhttpd/static/images/buttons/Makefile
1272 src/nxhttpd/static/images/buttons/normal/Makefile
1273 src/nxhttpd/static/images/buttons/pressed/Makefile
6db3b20b 1274 src/nxhttpd/static/images/ctrlpanel/Makefile
18928f80 1275 src/nxhttpd/static/images/objects/Makefile
fb7ce4b9 1276 src/nxhttpd/static/images/status/Makefile
0c3c0c39 1277 tools/Makefile
d16cf8a5
AK
1278])
1279
12249937
VK
1280AC_OUTPUT
1281
ef0c727b 1282echo "Updating libtool"
5cecf50e
AK
1283sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
1284
779ce551
VK
1285# On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
1286if test "x$CC" = "xgcc" && test "x$PLATFORM" = "xHP-UX"; then
1287 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
1288fi
1289
a7442678 1290
ef0c727b
VK
1291#--------------------------------------------------------------------
1292# Print summary
1293#--------------------------------------------------------------------
a7442678 1294
a7442678
AK
1295echo
1296echo
1297echo
1298echo '---------------------------------------------------------------------'
1299echo ' Configure results'
1300echo '---------------------------------------------------------------------'
1301echo
1302 echo "Prefix : ${prefix}"
1303if test "x${BUILD_SERVER}" = "xyes"; then
1304 echo "Build Server : YES"
1305else
1306 echo "Build Server : NO"
1307fi
1308if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
1309 echo "Encryption enabled : YES"
1310else
1311 echo "Encryption enabled : NO"
1312fi
1313if test "x${DB_DRIVERS}" != "x"; then
1010cff7 1314 echo "Build DB-Drivers :${DB_DRIVERS}"
a7442678
AK
1315else
1316 echo "Build DB-Drivers : NO"
1317fi
1318if test "x${BUILD_CLIENT}" = "xyes"; then
1319 echo "Build Clients : YES"
1320else
1321 echo "Build Clients : NO"
1322fi
c2612d83
VK
1323if test "x${BUILD_CONSOLE}" = "xyes"; then
1324 echo "Build Console : YES"
1325else
1326 echo "Build Console : NO"
1327fi
ef0c727b 1328if test "x${BUILD_NXHTTPD}" = "xyes"; then
2654e540
AK
1329 echo "Build Web Interface : YES"
1330else
c2503081 1331 echo "Build Web Interface : NO"
2654e540 1332fi
a7442678
AK
1333if test "x${BUILD_AGENT}" = "xyes"; then
1334 echo "Build Agent : YES"
1335 echo "Subagents list : ${SUBAGENT_DIRS}"
1336else
1337 echo "Build Agent : NO"
1338fi
e8636669
VK
1339if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
1340 echo "Build Static Agent : YES"
1341 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
1342else
1343 echo "Build Static Agent : NO"
1344fi