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