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