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