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