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