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