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