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