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