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