added missing file
[public/netxms.git] / configure.ac
1 # $Id$
2 #
3 # NetXMS - Network Management System
4 # Configure script
5 #
6
7 AC_INIT([NetXMS], [1.1.1], [NetXMS Team <bugs@netxms.org>])
8 AC_CONFIG_AUX_DIR(config)
9 AM_CONFIG_HEADER(config.h)
10 AM_INIT_AUTOMAKE
11
12 AC_CONFIG_MACRO_DIR([m4])
13
14 #--------------------------------------------------------------------
15 # Functions
16 #--------------------------------------------------------------------
17
18 check_substr()
19 {
20 for w in $1; do
21 if test "x$w" = "x$2"; then
22 return 0;
23 fi
24 done
25 return 1
26 }
27
28
29 #--------------------------------------------------------------------
30 # Initialize variables
31 #--------------------------------------------------------------------
32
33 PLATFORM=`uname -s`
34 COMPONENTS=""
35 DISABLE_ICONV="no"
36 DISABLE_ENCRYPTION="no"
37 ENABLE_UNSTABLE="no"
38 ENABLE_DEBUG="no"
39 STATIC_BUILD="no"
40 DBDRIVER_SELECTED="no"
41 USE_PTH="no"
42 BUILD_SERVER="no"
43 BUILD_AGENT="no"
44 BUILD_CLIENT="no"
45 BUILD_NXHTTPD="no"
46 BUILD_STATIC_AGENT="no"
47 NEED_ZLIB="no"
48 MODULES="libnetxms tools install"
49 STATIC_SUBAGENT_LIST=""
50 SUBAGENT_DIRS=""
51 SUBAGENT_LIBS=""
52 UNSTABLE_SUBAGENT_DIRS=""
53 SERVER_TOOLS=""
54 TOP_LEVEL_MODULES=""
55 CONTRIB_MODULES=""
56 CLIENT_COMPONENTS=""
57 BUILD_UNICODE="no"
58 ORACLE_LIBS=""
59 PGSQL_LIBS=""
60 MYSQL_LIBS=""
61 ODBC_LIBS=""
62 FORCE_INTERNAL_EXPAT="no"
63 USE_INTERNAL_LIBTRE="no"
64 FORCE_INTERNAL_LIBTRE="no"
65 USE_INTERNAL_ZLIB="no"
66 FORCE_INTERNAL_ZLIB="no"
67 FORCE_32BIT_BUILD="no"
68 LDFLAGS_PREFIX=""
69 LDFLAGS_SUFFIX=""
70
71
72 #--------------------------------------------------------------------
73 # Common compilation flags
74 #--------------------------------------------------------------------
75
76 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
77
78
79 #--------------------------------------------------------------------
80 # Parse command line parameters
81 #--------------------------------------------------------------------
82
83 AC_ARG_WITH(server,
84 [AS_HELP_STRING(--with-server,build server)],
85 [
86 COMPONENTS="$COMPONENTS sqlite snmp server agent"
87 ])
88
89 AC_ARG_WITH(snmp,
90 [AS_HELP_STRING(--with-snmp,build SNMP library and tools)],
91 [
92 COMPONENTS="$COMPONENTS snmp"
93 ])
94
95 AC_ARG_WITH(client,
96 [AS_HELP_STRING(--with-client,build client library and tools)],
97 [
98 COMPONENTS="$COMPONENTS client"
99 ])
100
101 AC_ARG_WITH(agent,
102 [AS_HELP_STRING(--with-agent,build agent)],
103 [
104 COMPONENTS="$COMPONENTS sqlite agent"
105 ])
106
107 AC_ARG_WITH(static-agent,
108 [AS_HELP_STRING(--with-static-agent,build statically linked agent)],
109 [
110 COMPONENTS="$COMPONENTS sqlite static-agent"
111 ])
112
113 AC_ARG_WITH(ipso-agent,
114 [AS_HELP_STRING(--with-ipso-agent,build statically linked IPSO agent)],
115 [
116 COMPONENTS="$COMPONENTS ipso-agent"
117 ])
118
119 AC_ARG_WITH(webui,
120 [AS_HELP_STRING(--with-webui,build web interface)],
121 [
122 COMPONENTS="$COMPONENTS webui"
123 ])
124
125 AC_ARG_WITH(mdebug,
126 [AS_HELP_STRING(--with-mdebug,use debug version of memory allocation functions)],
127 [
128 CPPFLAGS="$CPPFLAGS -DNETXMS_MEMORY_DEBUG"
129 ])
130
131 AC_ARG_WITH(internal-libexpat,
132 [AS_HELP_STRING(--with-internal-libexpat,force use of bundled libexpat)],
133 [
134 FORCE_INTERNAL_EXPAT="yes"
135 ])
136
137 AC_ARG_WITH(internal-libtre,
138 [AS_HELP_STRING(--with-internal-libtre,force use of bundled libtre)],
139 [
140 FORCE_INTERNAL_LIBTRE="yes"
141 ])
142
143 AC_ARG_WITH(internal-zlib,
144 [AS_HELP_STRING(--with-internal-zlib,force use of bundled zlib)],
145 [
146 FORCE_INTERNAL_ZLIB="yes"
147 ])
148
149 AC_ARG_WITH(sqlite,
150 [AS_HELP_STRING(--with-sqlite,build SQLite database driver)],
151 [ if test "x$withval" != "xno" ; then
152 COMPONENTS="$COMPONENTS sqlite_drv"
153 DBDRIVER_SELECTED="yes"
154 fi ])
155
156 AC_ARG_WITH(odbc,
157 [AS_HELP_STRING(--with-odbc,build ODBC database driver)],
158 [ if test "x$withval" != "xno" ; then
159 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
160 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
161 LDFLAGS="$LDFLAGS -L${withval}/lib"
162 CPPFLAGS="$CPPFLAGS -I${withval}/include"
163 fi
164 COMPONENTS="$COMPONENTS odbc"
165 DBDRIVER_SELECTED="yes"
166 fi ])
167
168 AC_ARG_WITH(oracle,
169 [AS_HELP_STRING(--with-oracle,build Oracle database driver)],
170 [ if test "x$withval" != "xno" ; then
171 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
172 if test -x "$withval/lib" ; then
173 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
174 LDFLAGS="$LDFLAGS -L${withval}/lib"
175 else
176 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
177 LDFLAGS="$LDFLAGS -L${withval}"
178 fi
179 if test -x "$withval/include" ; then
180 CPPFLAGS="$CPPFLAGS -I${withval}/include"
181 fi
182 if test -x "$withval/sdk/include" ; then
183 CPPFLAGS="$CPPFLAGS -I${withval}/sdk/include"
184 fi
185 fi
186 COMPONENTS="$COMPONENTS oracle"
187 DBDRIVER_SELECTED="yes"
188 fi ])
189
190 AC_ARG_WITH(mysql,
191 [AS_HELP_STRING(--with-mysql,build MySQL database driver)],
192 [ if test "x$withval" != "xno" ; then
193 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
194 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
195 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/mysql -L${withval}/mysql/lib"
196 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include"
197 else
198 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}"
199 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"
200 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"
201 fi
202 COMPONENTS="$COMPONENTS mysql"
203 DBDRIVER_SELECTED="yes"
204 fi ])
205
206 AC_ARG_WITH(pgsql,
207 [AS_HELP_STRING(--with-pgsql,build PostgreSQL database driver)],
208 [ if test "x$withval" != "xno" ; then
209 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
210 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
211 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/pgsql -L${withval}/lib/postgresql -L${withval}/pgsql/lib -L${withval}/postgresql/lib"
212 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/pgsql -I${withval}/include/postgresql -I${withval}/pgsql/include -I${withval}/postgresql/include"
213 else
214 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}"
215 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"
216 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"
217 fi
218 COMPONENTS="$COMPONENTS pgsql"
219 DBDRIVER_SELECTED="yes"
220 fi ])
221
222 AC_ARG_WITH(db2,
223 [AS_HELP_STRING(--with-db2,build DB2 database driver)],
224 [ if test "x$withval" != "xno" ; then
225 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
226 if test `uname -m` = 'i386' || test `uname -m` = 'i686'; then
227 DB2_LIB_DIR=lib32
228 else
229 DB2_LIB_DIR=lib64
230 fi
231 if test -x "$withval/${DB2_LIB_DIR}" ; then
232 LD_RUN_PATH="${withval}/${DB2_LIB_DIR}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
233 LDFLAGS="$LDFLAGS -L${withval}/${DB2_LIB_DIR}"
234 else
235 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
236 LDFLAGS="$LDFLAGS -L${withval}"
237 fi
238 if test -x "$withval/include" ; then
239 CPPFLAGS="$CPPFLAGS -I${withval}/include"
240 fi
241
242 unset DB2_LIB_DIR
243 fi
244 COMPONENTS="$COMPONENTS db2"
245 DBDRIVER_SELECTED="yes"
246 fi ])
247
248 AC_ARG_WITH(openssl,
249 [AS_HELP_STRING(--with-openssl,specify OpenSSL location)],
250 [
251 if test "x$withval" != "xno" ; then
252 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
253 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
254 LDFLAGS="$LDFLAGS -L${withval}/lib"
255 CPPFLAGS="$CPPFLAGS -I${withval}/include"
256 else
257 LD_RUN_PATH="/usr/local/lib:/opt/openssl/lib:/usr/local/ssl/lib:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
258 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/opt/openssl/lib"
259 CPPFLAGS="$CPPFLAGS -I/opt/openssl/include"
260 fi
261 fi
262 REQUIRE_ENCRYPTION="yes"
263 ])
264
265 AC_ARG_WITH(gd,
266 [AS_HELP_STRING(--with-gd,specify GD location)],
267 [
268 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
269 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
270 LDFLAGS="$LDFLAGS -L${withval}/lib"
271 CPPFLAGS="$CPPFLAGS -I${withval}/include"
272 fi
273 ])
274
275 AC_ARG_ENABLE(iconv,
276 [AS_HELP_STRING(--disable-iconv,do not use iconv() for text conversions)],
277 [
278 DISABLE_ICONV="yes"
279 ])
280
281 AC_ARG_ENABLE(encryption,
282 [AS_HELP_STRING(--disable-encryption,disable encryption support)],
283 [
284 DISABLE_ENCRYPTION="yes"
285 ])
286
287 AC_ARG_ENABLE(unicode,
288 [AS_HELP_STRING(--enable-unicode,enable UNICODE build)],
289 [
290 BUILD_UNICODE="yes"
291 CPPFLAGS="$CPPFLAGS -DUNICODE"
292 ])
293
294 AC_ARG_ENABLE(unstable,
295 [AS_HELP_STRING(--enable-unstable,build experimental/unstable components)],
296 [
297 ENABLE_UNSTABLE="yes"
298 ])
299
300 AC_ARG_ENABLE(debug,
301 [AS_HELP_STRING(--enable-debug,enable additional debugging functionality)],
302 [
303 ENABLE_DEBUG="yes"
304 ])
305
306 AC_ARG_ENABLE(64bit,
307 [AS_HELP_STRING(--disable-64bit,disable 64bit build (force 32bit build event on 64bit machine))],
308 [
309 FORCE_32BIT_BUILD="yes"
310 ])
311
312 AC_ARG_WITH(dist,
313 [AS_HELP_STRING(--with-dist,for maintainers only)],
314 DB_DRIVERS=" mysql pgsql odbc mssql sqlite oracle db2"
315 MODULES="libexpat libtre zlib libnetxms install sqlite snmp libnxsl libnxlp db server agent libnxmap libnxcl client nxscript tools webui"
316 SUBAGENT_DIRS="linux freebsd openbsd netbsd sunos aix ipso hpux"
317 NXCONFIG="nxconfig"
318 TOP_LEVEL_MODULES="sql images"
319 CONTRIB_MODULES="mibs backgrounds"
320 CLIENT_COMPONENTS="nxalarm nxevent nxlexer nxpush nxsms scilexer windows"
321 UNSTABLE_SUBAGENT_DIRS="odbcquery"
322 SERVER_TOOLS="nxconfig"
323 )
324
325
326 #--------------------------------------------------------------------
327 # Validate command line parameters and set various checking options
328 #--------------------------------------------------------------------
329
330 check_substr "$COMPONENTS" "sqlite"
331 if test $? = 0; then
332 MODULES="$MODULES sqlite"
333 fi
334
335 check_substr "$COMPONENTS" "static-agent"
336 if test $? = 0; then
337 if test "x$COMPONENTS" != "x sqlite static-agent"; then
338 AC_MSG_ERROR(Static agent and other components are mutually exclusive.)
339 fi
340 STATIC_BUILD="yes"
341 BUILD_STATIC_AGENT="yes"
342 MODULES="$MODULES libnxlp agent"
343 DISABLE_ICONV="yes"
344 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT"
345 STATIC_SUBAGENT_LIST="ecs logwatch ping portcheck ups"
346 SUBAGENT_LIBS="../subagents/ecs/libnsm_ecs.la ../subagents/logwatch/libnsm_logwatch.la ../subagents/ping/libnsm_ping.la ../subagents/portCheck/libnsm_portCheck.la ../subagents/ups/libnsm_ups.la"
347
348 case "$PLATFORM" in
349 Linux)
350 SUBAGENT_DIRS="linux"
351 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/linux/libnsm_linux.la"
352 STATIC_SUBAGENT_LIST="linux $STATIC_SUBAGENT_LIST"
353 ;;
354 FreeBSD)
355 SUBAGENT_DIRS="freebsd"
356 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/freebsd/libnsm_freebsd.la"
357 STATIC_SUBAGENT_LIST="freebsd $STATIC_SUBAGENT_LIST"
358 ;;
359 OpenBSD)
360 SUBAGENT_DIRS="openbsd"
361 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/openbsd/libnsm_openbsd.la"
362 STATIC_SUBAGENT_LIST="openbsd $STATIC_SUBAGENT_LIST"
363 ;;
364 NetBSD)
365 SUBAGENT_DIRS="netbsd"
366 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/netbsd/libnsm_netbsd.la"
367 STATIC_SUBAGENT_LIST="netbsd $STATIC_SUBAGENT_LIST"
368 ;;
369 SunOS)
370 SUBAGENT_DIRS="sunos"
371 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/sunos/libnsm_sunos.la"
372 STATIC_SUBAGENT_LIST="sunos $STATIC_SUBAGENT_LIST"
373 ;;
374 AIX)
375 SUBAGENT_DIRS="aix"
376 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/aix/libnsm_aix.la"
377 STATIC_SUBAGENT_LIST="aix $STATIC_SUBAGENT_LIST"
378 ;;
379 HP-UX)
380 SUBAGENT_DIRS="hpux"
381 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/hpux/libnsm_hpux.la"
382 STATIC_SUBAGENT_LIST="hpux $STATIC_SUBAGENT_LIST"
383 ;;
384 *)
385 # unknown
386 ;;
387 esac
388 fi
389
390 check_substr "$COMPONENTS" "ipso-agent"
391 if test $? = 0; then
392 if test "x$COMPONENTS" != "x ipso-agent"; then
393 AC_MSG_ERROR(IPSO agent and other components are mutually exclusive.)
394 fi
395 STATIC_BUILD="yes"
396 BUILD_STATIC_AGENT="yes"
397 DISABLE_ICONV="yes"
398 USE_PTH="yes"
399 MODULES="$MODULES libnxlp agent"
400 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT -D_IPSO -D_USE_GNU_PTH -DSQLITE_THREADSAFE=0 -I/usr/local/include"
401 LDFLAGS="$LDFLAGS -all-static"
402 STATIC_SUBAGENT_LIST="ecs ipso logwatch ping portcheck ups"
403 SUBAGENT_DIRS="ipso"
404 SUBAGENT_LIBS="../subagents/ecs/libnsm_ecs.la ../subagents/ipso/libnsm_ipso.la ../subagents/logwatch/libnsm_logwatch.la ../subagents/ping/libnsm_ping.la ../subagents/portCheck/libnsm_portCheck.la ../subagents/ups/libnsm_ups.la"
405 fi
406
407 check_substr "$COMPONENTS" "snmp"
408 if test $? = 0; then
409 NEED_ZLIB="yes"
410 MODULES="$MODULES snmp"
411 fi
412
413 check_substr "$COMPONENTS" "server"
414 if test $? = 0; then
415 if test "x$DBDRIVER_SELECTED" != "xyes"; then
416 AC_MSG_ERROR(You must select at least one database driver when building server.)
417 fi
418 BUILD_SERVER="yes"
419 MODULES="$MODULES libnxmap libnxsl libnxlp db server nxscript"
420 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES sql images"
421 CONTRIB_MODULES="$CONTRIB_MODULES mibs backgrounds"
422 fi
423
424 check_substr "$COMPONENTS" "client"
425 if test $? = 0; then
426 BUILD_CLIENT="yes"
427 NEED_ZLIB="yes"
428 MODULES="$MODULES libnxmap libnxcl client"
429 CLIENT_COMPONENTS="$CLIENT_COMPONENTS nxalarm nxevent nxpush nxsms"
430 fi
431
432 check_substr "$COMPONENTS" "agent"
433 if test $? = 0; then
434 BUILD_AGENT="yes"
435 MODULES="$MODULES libnxlp db agent"
436 if test "x$ENABLE_UNSTABLE" = "xyes"; then
437 UNSTABLE_SUBAGENT_DIRS="odbcquery"
438 fi
439
440 case "$PLATFORM" in
441 Linux)
442 SUBAGENT_DIRS="linux"
443 ;;
444 FreeBSD)
445 SUBAGENT_DIRS="freebsd"
446 ;;
447 OpenBSD)
448 SUBAGENT_DIRS="openbsd"
449 ;;
450 NetBSD)
451 SUBAGENT_DIRS="netbsd"
452 ;;
453 SunOS)
454 SUBAGENT_DIRS="sunos"
455 ;;
456 AIX)
457 SUBAGENT_DIRS="aix"
458 ;;
459 HP-UX)
460 SUBAGENT_DIRS="hpux"
461 ;;
462 *)
463 # unknown
464 ;;
465 esac
466 fi
467
468 check_substr "$COMPONENTS" "webui"
469 if test $? = 0; then
470 BUILD_NXHTTPD="yes"
471 MODULES="$MODULES libnxmap libnxcl webui"
472 fi
473
474 check_substr "$COMPONENTS" "mysql"
475 if test $? = 0; then
476 DB_DRIVERS="$DB_DRIVERS mysql"
477 fi
478
479 check_substr "$COMPONENTS" "pgsql"
480 if test $? = 0; then
481 DB_DRIVERS="$DB_DRIVERS pgsql"
482 fi
483
484 check_substr "$COMPONENTS" "sqlite_drv"
485 if test $? = 0; then
486 DB_DRIVERS="$DB_DRIVERS sqlite"
487 fi
488
489 check_substr "$COMPONENTS" "odbc"
490 if test $? = 0; then
491 DB_DRIVERS="$DB_DRIVERS odbc"
492 fi
493
494 check_substr "$COMPONENTS" "oracle"
495 if test $? = 0; then
496 DB_DRIVERS="$DB_DRIVERS oracle"
497 fi
498
499 check_substr "$COMPONENTS" "db2"
500 if test $? = 0; then
501 DB_DRIVERS="$DB_DRIVERS db2"
502 fi
503
504
505 #--------------------------------------------------------------------
506 # Check for programs
507 #--------------------------------------------------------------------
508
509 if test "x$PLATFORM" = "xHP-UX"; then
510 AC_CHECK_PROG([CCC], [aCC], [aCC])
511 fi
512 AC_PROG_CC(aCC gcc cc cl)
513 AC_PROG_CPP
514 AC_PROG_CXX
515 if test "x$CXX" = "xg++"; then
516 AC_CHECK_PROG([GPLUSPLUS], [g++], [yes], [no])
517 if test "x$GPLUSPLUS" = "xno"; then
518 AC_MSG_ERROR([*** FATAL: Cannot find any usable C++ compiler])
519 fi
520 fi
521 AC_PROG_INSTALL
522 AC_PROG_LEX
523 AC_CHECK_PROGS(YACC,bison byacc,yacc)
524 AC_PROG_LN_S
525
526 AC_ARG_VAR(PERL,local path to the perl interpreter)
527 perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin"
528 AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path)
529
530
531 #--------------------------------------------------------------------
532 # Initialize libtool
533 #--------------------------------------------------------------------
534
535 if test "x$STATIC_BUILD" = "xyes"; then
536 enable_shared=no
537 enable_static=yes
538 else
539 enable_shared=yes
540 enable_static=no
541 fi
542 AC_LIBTOOL_DLOPEN
543 AC_PROG_LIBTOOL
544
545
546 #--------------------------------------------------------------------
547 # C/C++ capabilities
548 #--------------------------------------------------------------------
549
550 AC_C_CONST
551 AC_PROG_GCC_TRADITIONAL
552 AC_C_BIGENDIAN
553
554
555 #--------------------------------------------------------------------
556 # Platform-dependent settings
557 #--------------------------------------------------------------------
558
559 case "$PLATFORM" in
560 AIX)
561 LDFLAGS_PREFIX="-no-undefined -Wl,-brtl $LDFLAGS"
562 ;;
563 HP-UX)
564 CPPFLAGS="$CPPFLAGS -D_HPUX -D_HPUX_SOURCE -D_POSIX_PTHREAD_SEMANTICS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 -D_REENTRANT -D_INCLUDE_LONGLONG"
565 if test "x$CXX" = "xaCC"; then
566 CFLAGS="$CFLAGS -AC99"
567 CXXFLAGS="-mt $CXXFLAGS +W749 +W829"
568 LDFLAGS="$LDFLAGS -mt"
569 fi
570 ;;
571 SunOS)
572 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
573 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
574 export LD_LIBRARY_PATH
575 ;;
576 Linux)
577 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
578 ;;
579 *)
580 ;;
581 esac
582
583
584 #--------------------------------------------------------------------
585 # C++ compiler tuning:
586 # * Disable C++ exceptions and RTTI
587 # * Turn on 64bit mode on HP-UX/Itanium
588 # * Turn on 64bit mode on AIX
589 #--------------------------------------------------------------------
590
591 if test "x$CC" = "xgcc" ; then
592
593 AC_LANG_PUSH([C++])
594
595 AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti)
596 OLD_CXXFLGAS="$CXXFLAGS"
597 CXXFLAGS="$CXXFLAGS -fno-rtti"
598 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
599 [ AC_MSG_RESULT(yes) ],
600 [
601 CXXFLAGS="$OLD_CXXFLAGS"
602 AC_MSG_RESULT(no)
603 ])
604
605 AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions)
606 OLD_CXXFLGAS="$CXXFLAGS"
607 CXXFLAGS="$CXXFLAGS -fno-exceptions"
608 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
609 [ AC_MSG_RESULT(yes) ],
610 [
611 CXXFLAGS="$OLD_CXXFLAGS"
612 AC_MSG_RESULT(no)
613 ])
614
615 AC_LANG_POP([C++])
616
617 if test "x$PLATFORM" = "xHP-UX"; then
618 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
619 AC_MSG_CHECKING(whether C compiler accepts -milp32)
620 OLD_CPPFLAGS="$CPPFLAGS"
621 CPPFLAGS="$CPPFLAGS -milp32"
622 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
623 [
624 LDFLAGS="-milp32 $LDFLAGS"
625 AC_MSG_RESULT(yes)
626 ],
627 [
628 CPPFLAGS="$OLD_CPPFLAGS"
629 AC_MSG_RESULT(no)
630 ])
631 else
632 AC_MSG_CHECKING(whether C compiler accepts -mlp64)
633 OLD_CPPFLAGS="$CPPFLAGS"
634 CPPFLAGS="$CPPFLAGS -mlp64"
635 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
636 [
637 LDFLAGS="-mlp64 -L/usr/lib/hpux64 -L/usr/local/lib/hpux64 $LDFLAGS"
638 AC_MSG_RESULT(yes)
639 ],
640 [
641 CPPFLAGS="$OLD_CPPFLAGS"
642 AC_MSG_RESULT(no)
643 ])
644 fi
645 fi
646
647 if test "x$PLATFORM" = "xAIX"; then
648 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
649 AC_MSG_CHECKING(whether C compiler accepts -maix32)
650 OLD_CPPFLAGS="$CPPFLAGS"
651 CPPFLAGS="$CPPFLAGS -maix32"
652 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
653 [
654 LDFLAGS="-maix32 $LDFLAGS"
655 OBJECT_MODE=32
656 AC_MSG_RESULT(yes)
657 ],
658 [
659 CPPFLAGS="$OLD_CPPFLAGS"
660 AC_MSG_RESULT(no)
661 ])
662 else
663 AC_MSG_CHECKING(whether C compiler accepts -maix64)
664 OLD_CPPFLAGS="$CPPFLAGS"
665 CPPFLAGS="$CPPFLAGS -maix64"
666 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
667 [
668 LDFLAGS="-maix64 $LDFLAGS"
669 OBJECT_MODE=64
670 AC_MSG_RESULT(yes)
671 ],
672 [
673 CPPFLAGS="$OLD_CPPFLAGS"
674 AC_MSG_RESULT(no)
675 ])
676 fi
677 fi
678
679 if test "x$ENABLE_DEBUG" = "xyes"; then
680 CPPFLAGS="$CPPFLAGS -ggdb3"
681 fi
682 fi
683
684 if test "x$CXX" = "xaCC" ; then
685 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
686 AC_MSG_CHECKING(whether C compiler accepts +DD32)
687 OLD_CPPFLAGS="$CPPFLAGS"
688 CPPFLAGS="+DD32 $CPPFLAGS"
689 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
690 [
691 LDFLAGS="+DD32 $LDFLAGS"
692 AC_MSG_RESULT(yes)
693 ],
694 [
695 CPPFLAGS="$OLD_CPPFLAGS"
696 AC_MSG_RESULT(no)
697 ])
698 else
699 AC_MSG_CHECKING(whether C compiler accepts +DD64)
700 OLD_CPPFLAGS="$CPPFLAGS"
701 CPPFLAGS="+DD64 $CPPFLAGS"
702 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
703 [
704 LDFLAGS="+DD64 $LDFLAGS"
705 AC_MSG_RESULT(yes)
706 ],
707 [
708 CPPFLAGS="$OLD_CPPFLAGS"
709 AC_MSG_RESULT(no)
710 ])
711 fi
712 fi
713
714 #--------------------------------------------------------------------
715 # Additional include and library directories
716 #--------------------------------------------------------------------
717
718 if test "x$CXX" != "xaCC"; then
719 if test -d /usr/local/include; then
720 if test "x$CC" = "xgcc"; then
721 AC_MSG_CHECKING(whether -I/usr/local/include needed)
722 OLD_CPPFLAGS="$CPPFLAGS"
723 CPPFLAGS="$CPPFLAGS -Werror -I/usr/local/include"
724 AC_TRY_COMPILE([],[],
725 [
726 CPPFLAGS="$OLD_CPPFLAGS -I/usr/local/include"
727 AC_MSG_RESULT(yes)
728 ],
729 [
730 CPPFLAGS="$OLD_CPPFLAGS"
731 AC_MSG_RESULT(no)
732 ]
733 )
734 else
735 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
736 fi
737 fi
738
739 if test -d /usr/kerberos/include; then
740 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
741 fi
742
743 if test -d /usr/local/lib; then
744 LDFLAGS="$LDFLAGS -L/usr/local/lib"
745 fi
746 fi
747
748 #--------------------------------------------------------------------
749 # Check for threads library - either POSIX or GNU
750 #--------------------------------------------------------------------
751
752 if test "x$USE_PTH" = "xyes"; then
753 AC_CHECK_HEADER(pth.h,,AC_MSG_ERROR([*** GNU Pth thread support not installed - please install first ***]))
754 else
755 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
756
757 if test "x$CXX" = "xaCC"; then
758 PTHREAD_LIBS=""
759 else
760 PTHREAD_LIBS="error"
761 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
762 AC_EGREP_CPP(yes,
763 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
764 yes
765 #endif
766 ], AC_MSG_RESULT(yes)
767 PTHREAD_LIBS="-pthread",
768 AC_MSG_RESULT(no))
769 if test "x$PTHREAD_LIBS" = "xerror"; then
770 AC_CHECK_LIB(pthread, pthread_attr_init,
771 PTHREAD_LIBS="-lpthread")
772 fi
773 # On HP-UX (at least 11.00) pthread library contains
774 # __pthread_attr_init_system instead of pthread_attr_init
775 if test "x$PTHREAD_LIBS" = "xerror"; then
776 AC_CHECK_LIB(pthread, __pthread_attr_init_system,
777 PTHREAD_LIBS="-lpthread")
778 fi
779 if test "x$PTHREAD_LIBS" = "xerror"; then
780 AC_CHECK_LIB(pthreads, pthread_attr_init,
781 PTHREAD_LIBS="-lpthreads")
782 fi
783 if test "x$PTHREAD_LIBS" = "xerror"; then
784 AC_CHECK_FUNC(pthread_attr_init,
785 PTHREAD_LIBS="")
786 fi
787 fi
788
789 if test "x$PTHREAD_LIBS" = "xerror"; then
790 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
791 fi
792 LIBS="$LIBS $PTHREAD_LIBS"
793
794 # Extensions to posix threads
795 AC_CHECK_HEADERS([pthread_np.h],,,[
796 #include <pthread.h>
797 ])
798 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
799
800 # Check for recursive mutexes
801 AC_CHECK_FUNCS([pthread_mutexattr_settype __pthread_mutexattr_settype pthread_mutexattr_setkind_np])
802 AC_CHECK_DECLS([pthread_mutexattr_settype, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
803 #include <pthread.h>
804 #if HAVE_PTHREAD_NP_H
805 #include <pthread_np.h>
806 #endif
807 ])
808
809 # Check for read/write locks
810 # On Linux, rwlock functions declared always, but pthread_rwlock_t may need
811 # additional defines
812 AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
813 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
814 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
815 [AC_TRY_COMPILE([
816 #include <sys/types.h>
817 #include <pthread.h>
818 ],
819 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
820 ac_cv_struct_pthread_rw=yes, [
821 AC_TRY_COMPILE([
822 #define _XOPEN_SOURCE 500
823 #include <sys/types.h>
824 #include <pthread.h>
825 ],
826 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
827 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
828 if test "$ac_cv_struct_pthread_rw" = "yes"; then
829 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
830 fi
831 ])])
832 if test "$ac_cv_struct_pthread_rw" = "yes"; then
833 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
834 fi
835 fi
836
837 fi
838
839
840 #--------------------------------------------------------------------
841 # Checks for OpenSSL
842 #--------------------------------------------------------------------
843
844 if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
845 AC_CHECK_LIB(crypto, RSA_new,
846 [
847 AC_DEFINE(WITH_OPENSSL,,[with openssl])
848 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
849 [], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
850 AC_CHECK_LIB(crypto, EVP_bf_cbc,
851 [], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
852 AC_CHECK_LIB(crypto, EVP_idea_cbc,
853 [], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
854 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
855 [], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
856 ],
857 [
858 if test "x$REQUIRE_ENCRYPTION" = "xyes"; then
859 AC_MSG_ERROR(libcrypto is required for encryption support)
860 else
861 AC_MSG_RESULT(libcrypto is required for encryption support)
862 fi
863 ])
864 fi
865
866
867 #--------------------------------------------------------------------
868 # Checks for header files
869 #--------------------------------------------------------------------
870
871 AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h alloca.h])
872 AC_CHECK_HEADERS([sys/int_types.h time.h sys/time.h sys/utsname.h])
873 AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h net/nh.h sys/socket.h])
874 AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
875 AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
876 AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h])
877 AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h getopt.h])
878 AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
879 [[#ifdef HAVE_SYS_TYPES_H
880 # include <sys/types.h>
881 #endif
882 #ifdef HAVE_SYS_TIME_H
883 # include <sys/time.h>
884 #endif
885 #ifdef HAVE_SYS_SOCKET_H
886 # include <sys/socket.h>
887 #endif
888 ]])
889
890
891 #--------------------------------------------------------------------
892 # Checks for other libs.
893 #--------------------------------------------------------------------
894
895 AC_CHECK_LIB(xnet, accept)
896 AC_CHECK_LIB(socket, if_nameindex)
897 AC_CHECK_LIB(dl, dlopen)
898 AC_CHECK_LIB(kstat, kstat_open)
899 AC_CHECK_LIB(gnugetopt, getopt_long)
900
901 if test "x$BUILD_SERVER" = "xyes" ; then
902 AC_CHECK_LIB(termcap, tgetstr, [], [AC_CHECK_LIB(ncurses, tgetstr, [], AC_CHECK_LIB(curses, tgetstr))])
903 AC_CHECK_LIB(readline, readline, [], [AC_CHECK_LIB(edit, readline)])
904 AC_CHECK_FUNCS([readline])
905
906 # Check if passing rl_insert to rl_bind_key needs cast
907 if test "$ac_cv_func_readline" = "yes"; then
908 AC_LANG_PUSH([C++])
909
910 AC_MSG_CHECKING(for rl_insert cast)
911
912 AC_TRY_COMPILE(
913 [
914 #include <stdio.h>
915 #include <readline/readline.h>
916 ],[ rl_bind_key('\t', (Function *)rl_insert); ],
917 [
918 AC_MSG_RESULT((Function *))
919 AC_DEFINE(RL_INSERT_CAST,(Function *),Required cast for rl_insert)
920 ],[
921 AC_TRY_COMPILE(
922 [
923 #include <stdio.h>
924 #include <readline/readline.h>
925 ],[ rl_bind_key('\t', (rl_command_func_t *)rl_insert); ],
926 [
927 AC_MSG_RESULT((rl_command_func_t *))
928 AC_DEFINE(RL_INSERT_CAST,(rl_command_func_t *),Required cast for rl_insert)
929 ],[
930 AC_MSG_RESULT(not needed)
931 AC_DEFINE(RL_INSERT_CAST,,Required cast for rl_insert)
932 ]
933 )
934 ]
935 )
936
937 AC_LANG_POP([C++])
938 fi
939 fi
940
941 if test "x$NEED_ZLIB" = "xyes"; then
942 if test "x$FORCE_INTERNAL_ZLIB" = "xyes"; then
943 HAVE_ZLIB=no
944 else
945 HAVE_ZLIB=yes
946 AC_CHECK_HEADER(zlib.h,,HAVE_ZLIB=no)
947 if test "x$HAVE_ZLIB" = "xyes"; then
948 AC_CHECK_LIB(z, deflate, [], [ HAVE_ZLIB=no ])
949 fi
950 fi
951 if test "x$HAVE_ZLIB" = "xno"; then
952 MODULES="zlib $MODULES"
953 fi
954 fi
955
956 if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
957 HAVE_LIBEXPAT=no
958 else
959 HAVE_LIBEXPAT=yes
960 AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
961 AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
962 fi
963 if test "x$HAVE_LIBEXPAT" = "xno"; then
964 MODULES="libexpat $MODULES"
965 fi
966
967 if test "x$FORCE_INTERNAL_LIBTRE" = "xyes"; then
968 HAVE_LIBTRE=no
969 else
970 HAVE_LIBTRE=yes
971 AC_CHECK_HEADER(tre/regex.h,,HAVE_LIBTRE=no)
972 AC_CHECK_LIB(tre, tre_compile, [], [ HAVE_LIBTRE=no ])
973 fi
974 if test "x$HAVE_LIBTRE" = "xno"; then
975 MODULES="libtre $MODULES"
976 AC_DEFINE(USE_BUNDLED_LIBTRE,1,Define to 1 if bundled libtre is used)
977
978 tre_version_1='0'
979 tre_version_2='8'
980 tre_version_3='0'
981 tre_version=$tre_version_1.$tre_version_2.$tre_version_3
982 AC_DEFINE_UNQUOTED(TRE_VERSION, "$tre_version", [ TRE version string. ])
983 AC_DEFINE_UNQUOTED(TRE_VERSION_1, $tre_version_1, [ TRE version level 1. ])
984 AC_DEFINE_UNQUOTED(TRE_VERSION_2, $tre_version_2, [ TRE version level 2. ])
985 AC_DEFINE_UNQUOTED(TRE_VERSION_3, $tre_version_3, [ TRE version level 3. ])
986 AC_SUBST(TRE_VERSION, $tre_version)
987
988 AC_DEFINE(TRE_REGEX_T_FIELD,value,[Define to a field in the regex_t struct where TRE should store a pointer to the internal tre_tnfa_t structure])
989 AC_DEFINE(TRE_APPROX, 1, [ Define if you want to enable approximate matching functionality. ])
990 fi
991
992 #--------------------------------------------------------------------
993 # Checks for data types
994 #--------------------------------------------------------------------
995
996 AC_CHECK_SIZEOF(short)
997 AC_CHECK_SIZEOF(int)
998 AC_CHECK_SIZEOF(long)
999 AC_CHECK_SIZEOF(long long)
1000
1001 AC_TYPE_PID_T
1002 AC_TYPE_SIGNAL
1003 AC_TYPE_SIZE_T
1004 AC_STRUCT_TIMEZONE
1005
1006 AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t])
1007 AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
1008 #if HAVE_SYS_TYPES_H
1009 #include <sys/types.h>
1010 #endif
1011 #if HAVE_SYS_SOCKET_H
1012 #include <sys/socket.h>
1013 #endif
1014 ])
1015 AC_CHECK_TYPES([struct stat64],,,[
1016 #if HAVE_SYS_STAT_H
1017 #include <sys/stat.h>
1018 #endif
1019 ])
1020
1021
1022 #--------------------------------------------------------------------
1023 # Checks for functions
1024 #--------------------------------------------------------------------
1025
1026 AC_FUNC_ERROR_AT_LINE
1027 AC_FUNC_MEMCMP
1028 AC_FUNC_SELECT_ARGTYPES
1029 AC_FUNC_STRFTIME
1030 AC_FUNC_STRTOD
1031 AC_FUNC_VPRINTF
1032
1033 AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
1034 AC_CHECK_FUNCS([strrchr strtol strtoul strtoll strtoull])
1035 AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
1036 AC_CHECK_FUNCS([usleep nanosleep getopt_long gmtime_r localtime_r lstat64])
1037
1038 AC_CHECK_DECLS([nanosleep])
1039
1040 # Check if strerror_r is POSIX-compliant
1041 if test "$ac_cv_func_strerror_r" = "yes"; then
1042 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
1043 AC_LANG_PUSH([C++])
1044 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1045 #if HAVE_STRING_H
1046 #include <string.h>
1047 #endif
1048 #if HAVE_ERRNO_H
1049 #include <errno.h>
1050 #endif
1051 ]],[[
1052 int e;
1053 char buffer[256];
1054 e = strerror_r(1, buffer, 256);
1055 return e;
1056 ]])
1057 ],[
1058 AC_MSG_RESULT(yes)
1059 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
1060 ],[
1061 AC_MSG_RESULT(no)
1062 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
1063 ])
1064 AC_LANG_POP([C++])
1065 fi
1066
1067 # Check if timezone is a function
1068 AC_MSG_CHECKING(for timezone function)
1069 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1070 #if HAVE_TIME_H
1071 #include <time.h>
1072 #endif
1073 #if HAVE_SYS_TIME_H
1074 #include <sys/time.h>
1075 #endif
1076 ]],[[
1077 timezone(0, 0);
1078 ]])
1079 ],[
1080 AC_MSG_RESULT(yes)
1081 AC_DEFINE(HAVE_TIMEZONE,1,Define to 1 if timezone function is available)
1082 ],[
1083 AC_MSG_RESULT(no)
1084 AC_CHECK_DECLS([timezone],,,[
1085 #if HAVE_TIME_H
1086 #include <time.h>
1087 #endif
1088 #if HAVE_SYS_TIME_H
1089 #include <sys/time.h>
1090 #endif
1091 ])
1092 ])
1093
1094 # Check if struct tm has tm_gmtoff member
1095 AC_MSG_CHECKING(for struct tm.tm_gmtoff)
1096 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1097 #if HAVE_TIME_H
1098 #include <time.h>
1099 #endif
1100 #if HAVE_SYS_TIME_H
1101 #include <sys/time.h>
1102 #endif
1103 ]],[[
1104 struct tm t;
1105 return t.tm_gmtoff;
1106 ]])
1107 ],[
1108 AC_MSG_RESULT(yes)
1109 AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
1110 ],[
1111 AC_MSG_RESULT(no)
1112 ])
1113
1114 AC_CHECK_DECLS([getopt_long],,,[
1115 #if HAVE_GETOPT_H
1116 #include <getopt.h>
1117 #endif
1118 ])
1119
1120 AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
1121 AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
1122
1123 # sockets/resolver (probably for solaris)
1124 AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
1125 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
1126 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
1127
1128 if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
1129 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
1130 fi
1131
1132 if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
1133 AC_MSG_CHECKING([if we can include libnsl + libsocket])
1134 LIBS="-lnsl -lsocket $LIBS"
1135 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
1136 if test "$my_ac_link_result" = "no" ; then
1137 AC_MSG_RESULT([failure])
1138 AC_MSG_ERROR([unable to use gethostbyname()])
1139 else
1140 AC_MSG_RESULT([success])
1141 fi
1142 fi
1143
1144 # asprintf, scprintf, etc.
1145 AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
1146 AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
1147
1148 AC_MSG_CHECKING(whether snprintf returns required buffer size)
1149 AC_RUN_IFELSE(
1150 [AC_LANG_PROGRAM([
1151 #include <stdio.h>
1152 #include <string.h>
1153 ], [
1154 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
1155 ])
1156 ],
1157 [ AC_MSG_RESULT(yes)
1158 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
1159 ],
1160 [ AC_MSG_RESULT(no) ],
1161 [ AC_MSG_RESULT(no) ]
1162 )
1163
1164
1165
1166 #--------------------------------------------------------------------
1167 # Checks for macros and definitions
1168 #--------------------------------------------------------------------
1169
1170 AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
1171 #ifdef HAVE_SYS_TYPES_H
1172 #include <sys/types.h>
1173 #endif
1174 #if HAVE_BYTESWAP_H
1175 #include <byteswap.h>
1176 #endif
1177 #if HAVE_NETINET_IN_H
1178 #include <netinet/in.h>
1179 #endif
1180 #if HAVE_NET_NH_H
1181 #include <net/nh.h>
1182 #endif
1183 ])
1184 AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
1185 #ifdef HAVE_UNISTD_H
1186 #include <unistd.h>
1187 #endif
1188 #ifdef HAVE_DLFCN_H
1189 #include <dlfcn.h>
1190 #endif
1191 ])
1192 AC_CHECK_DECLS([va_copy, __va_copy],,,[
1193 #ifdef HAVE_UNISTD_H
1194 #include <unistd.h>
1195 #endif
1196 #ifdef HAVE_STDARG_H
1197 #include <stdarg.h>
1198 #endif
1199 #ifdef HAVE_STDLIB_H
1200 #include <stdlib.h>
1201 #endif
1202 ])
1203
1204
1205 #--------------------------------------------------------------------
1206 # AIX specific checks
1207 #--------------------------------------------------------------------
1208
1209 if test "x$PLATFORM" = "xAIX"; then
1210 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
1211 AC_CHECK_DECLS([getkerninfo])
1212 AC_CHECK_FUNCS([getprocs64],,,[
1213 #if HAVE_PROCINFO_H
1214 #include <procinfo.h>
1215 #endif
1216 ])
1217 fi
1218
1219
1220 #--------------------------------------------------------------------
1221 # HP-UX specific checks
1222 #--------------------------------------------------------------------
1223
1224 if test "x$PLATFORM" = "xHP-UX"; then
1225 AC_CHECK_HEADERS([sys/mib.h],,,[[ ]])
1226 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
1227 #if HAVE_NET_IF_H
1228 #include <net/if.h>
1229 #endif
1230 ])
1231 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
1232 #if HAVE_SYS_MIB_H
1233 #include <sys/mib.h>
1234 #endif
1235 ])
1236
1237 AC_MSG_CHECKING(if pst_diskinfo has read/write stats fields)
1238 AC_LANG_PUSH([C++])
1239 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1240 #include <sys/pstat.h>
1241 ]], [[
1242 pst_diskinfo d;
1243 int x;
1244 x = (int)d.psd_dkread;
1245 x = (int)d.psd_dkwrite;
1246 ]])],
1247 [
1248 AC_DEFINE([HAVE_DISKINFO_RWSTATS],[1],[Define to 1 if pst_diskinfo has read/write stats fields])
1249 AC_MSG_RESULT(yes)
1250 ],
1251 [
1252 AC_MSG_RESULT(no)
1253 ])
1254 AC_LANG_POP([C++])
1255 fi
1256
1257
1258 #--------------------------------------------------------------------
1259 # *BSD specific checks
1260 #--------------------------------------------------------------------
1261
1262 AC_CHECK_LIB(kvm, kvm_open)
1263 AC_CHECK_FUNCS([kvm_getswapinfo])
1264 AC_CHECK_TYPES([struct kinfo_proc2],,,[
1265 #if HAVE_SYS_SYSCTL_H
1266 #include <sys/sysctl.h>
1267 #endif
1268 ])
1269
1270
1271
1272 #--------------------------------------------------------------------
1273 # FreeBSD specific checks
1274 #--------------------------------------------------------------------
1275
1276 if test "x$PLATFORM" = "xFreeBSD"; then
1277 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
1278 #if HAVE_SYS_TYPES_H
1279 #include <sys/types.h>
1280 #endif
1281 #if HAVE_SYS_SOCKET_H
1282 #include <sys/socket.h>
1283 #endif
1284 #include <net/route.h>
1285 ])
1286 fi
1287
1288
1289 #--------------------------------------------------------------------
1290 # Check for UNICODE stuff
1291 #--------------------------------------------------------------------
1292
1293 AC_CHECK_HEADERS([wchar.h wctype.h iconv.h])
1294 AC_CHECK_TYPES([wchar_t, wint_t],,,[
1295 #if HAVE_WCHAR_H
1296 #include <wchar.h>
1297 #endif
1298 ])
1299 AC_CHECK_SIZEOF(wchar_t)
1300 AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper wcserror wcserror_r])
1301 AC_CHECK_FUNCS([wfopen wopen wstat wgetenv wrename wunlink])
1302 AC_CHECK_FUNCS([wfopen wopen wstat wgetenv wrename wunlink])
1303
1304 if test "x$DISABLE_ICONV" != "xyes"; then
1305 AC_CHECK_LIB(iconv, libiconv_open,
1306 [ ac_found_iconv=yes
1307 LIBS="$LIBS -liconv"
1308 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
1309 ],
1310 [
1311 AC_CHECK_LIB(iconv, iconv,
1312 [ ac_found_iconv=yes
1313 LIBS="$LIBS -liconv"
1314 ])
1315 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
1316 ])
1317 else
1318 ac_found_iconv=no
1319 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
1320 fi
1321
1322 AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
1323 AC_RUN_IFELSE(
1324 [AC_LANG_PROGRAM([
1325 #if HAVE_ICONV_H
1326 #include <iconv.h>
1327 #endif
1328 ], [
1329 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
1330 ])
1331 ],
1332 [ AC_MSG_RESULT(yes)
1333 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
1334 valid_ucs2_code="UCS-2-INTERNAL"
1335 ],
1336 [ AC_MSG_RESULT(no) ],
1337 [ AC_MSG_RESULT(no) ]
1338 )
1339
1340 AC_MSG_CHECKING(whether iconv supports UCS-2)
1341 AC_RUN_IFELSE(
1342 [AC_LANG_PROGRAM([
1343 #if HAVE_ICONV_H
1344 #include <iconv.h>
1345 #endif
1346 ], [
1347 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
1348 ])
1349 ],
1350 [ AC_MSG_RESULT(yes)
1351 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
1352 valid_ucs2_code="UCS-2"
1353 ],
1354 [ AC_MSG_RESULT(no) ],
1355 [ AC_MSG_RESULT(no) ]
1356 )
1357
1358 AC_MSG_CHECKING(whether iconv supports UCS2)
1359 AC_RUN_IFELSE(
1360 [AC_LANG_PROGRAM([
1361 #if HAVE_ICONV_H
1362 #include <iconv.h>
1363 #endif
1364 ], [
1365 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
1366 ])
1367 ],
1368 [ AC_MSG_RESULT(yes)
1369 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
1370 valid_ucs2_code="UCS2"
1371 ],
1372 [ AC_MSG_RESULT(no) ],
1373 [ AC_MSG_RESULT(no) ]
1374 )
1375
1376 AC_MSG_CHECKING(whether iconv supports UCS-2BE)
1377 AC_RUN_IFELSE(
1378 [AC_LANG_PROGRAM([
1379 #if HAVE_ICONV_H
1380 #include <iconv.h>
1381 #endif
1382 ], [
1383 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
1384 ])
1385 ],
1386 [ AC_MSG_RESULT(yes)
1387 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
1388 valid_ucs2_code="UCS-2BE"
1389 ],
1390 [ AC_MSG_RESULT(no) ],
1391 [ AC_MSG_RESULT(no) ]
1392 )
1393
1394 AC_MSG_CHECKING(whether iconv supports UCS-2LE)
1395 AC_RUN_IFELSE(
1396 [AC_LANG_PROGRAM([
1397 #if HAVE_ICONV_H
1398 #include <iconv.h>
1399 #endif
1400 ], [
1401 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
1402 ])
1403 ],
1404 [ AC_MSG_RESULT(yes)
1405 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
1406 valid_ucs2_code="UCS-2LE"
1407 ],
1408 [ AC_MSG_RESULT(no) ],
1409 [ AC_MSG_RESULT(no) ]
1410 )
1411
1412 AC_MSG_CHECKING(whether iconv supports UTF-16)
1413 AC_RUN_IFELSE(
1414 [AC_LANG_PROGRAM([
1415 #if HAVE_ICONV_H
1416 #include <iconv.h>
1417 #endif
1418 ], [
1419 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
1420 ])
1421 ],
1422 [ AC_MSG_RESULT(yes)
1423 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
1424 valid_ucs2_code="UTF-16"
1425 ],
1426 [ AC_MSG_RESULT(no) ],
1427 [ AC_MSG_RESULT(no) ]
1428 )
1429
1430 AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
1431 AC_RUN_IFELSE(
1432 [AC_LANG_PROGRAM([
1433 #if HAVE_ICONV_H
1434 #include <iconv.h>
1435 #endif
1436 ], [
1437 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
1438 ])
1439 ],
1440 [ AC_MSG_RESULT(yes)
1441 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
1442 valid_ucs4_code="UCS-4-INTERNAL"
1443 ],
1444 [ AC_MSG_RESULT(no) ],
1445 [ AC_MSG_RESULT(no) ]
1446 )
1447
1448 AC_MSG_CHECKING(whether iconv supports UCS-4)
1449 AC_RUN_IFELSE(
1450 [AC_LANG_PROGRAM([
1451 #if HAVE_ICONV_H
1452 #include <iconv.h>
1453 #endif
1454 ], [
1455 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
1456 ])
1457 ],
1458 [ AC_MSG_RESULT(yes)
1459 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
1460 valid_ucs4_code="UCS-4"
1461 ],
1462 [ AC_MSG_RESULT(no) ],
1463 [ AC_MSG_RESULT(no) ]
1464 )
1465
1466 AC_MSG_CHECKING(whether iconv supports UCS4)
1467 AC_RUN_IFELSE(
1468 [AC_LANG_PROGRAM([
1469 #if HAVE_ICONV_H
1470 #include <iconv.h>
1471 #endif
1472 ], [
1473 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
1474 ])
1475 ],
1476 [ AC_MSG_RESULT(yes)
1477 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
1478 valid_ucs4_code="UCS4"
1479 ],
1480 [ AC_MSG_RESULT(no) ],
1481 [ AC_MSG_RESULT(no) ]
1482 )
1483
1484 AC_MSG_CHECKING(whether iconv supports UCS-4BE)
1485 AC_RUN_IFELSE(
1486 [AC_LANG_PROGRAM([
1487 #if HAVE_ICONV_H
1488 #include <iconv.h>
1489 #endif
1490 ], [
1491 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
1492 ])
1493 ],
1494 [ AC_MSG_RESULT(yes)
1495 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
1496 valid_ucs4_code="UCS-4BE"
1497 ],
1498 [ AC_MSG_RESULT(no) ],
1499 [ AC_MSG_RESULT(no) ]
1500 )
1501
1502 AC_MSG_CHECKING(whether iconv supports UCS-4LE)
1503 AC_RUN_IFELSE(
1504 [AC_LANG_PROGRAM([
1505 #if HAVE_ICONV_H
1506 #include <iconv.h>
1507 #endif
1508 ], [
1509 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
1510 ])
1511 ],
1512 [ AC_MSG_RESULT(yes)
1513 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
1514 valid_ucs4_code="UCS-4LE"
1515 ],
1516 [ AC_MSG_RESULT(no) ],
1517 [ AC_MSG_RESULT(no) ]
1518 )
1519
1520 AC_MSG_CHECKING(whether iconv supports UTF-32)
1521 AC_RUN_IFELSE(
1522 [AC_LANG_PROGRAM([
1523 #if HAVE_ICONV_H
1524 #include <iconv.h>
1525 #endif
1526 ], [
1527 return iconv_open("UTF-8","UTF-32")==(iconv_t)(-1);
1528 ])
1529 ],
1530 [ AC_MSG_RESULT(yes)
1531 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
1532 valid_ucs4_code="UTF-32"
1533 ],
1534 [ AC_MSG_RESULT(no) ],
1535 [ AC_MSG_RESULT(no) ]
1536 )
1537
1538 AC_MSG_CHECKING(whether iconv supports ISO8859-1)
1539 AC_RUN_IFELSE(
1540 [AC_LANG_PROGRAM([
1541 #if HAVE_ICONV_H
1542 #include <iconv.h>
1543 #endif
1544 ], [
1545 return iconv_open("UTF-8","ISO8859-1")==(iconv_t)(-1);
1546 ])
1547 ],
1548 [ AC_MSG_RESULT(yes)
1549 AC_DEFINE(HAVE_ICONV_ISO8859_1, 1, Define to 1 if iconv supports ISO8859-1)
1550 ],
1551 [ AC_MSG_RESULT(no) ],
1552 [ AC_MSG_RESULT(no) ]
1553 )
1554
1555 AC_MSG_CHECKING(whether iconv supports ISO-8859-1)
1556 AC_RUN_IFELSE(
1557 [AC_LANG_PROGRAM([
1558 #if HAVE_ICONV_H
1559 #include <iconv.h>
1560 #endif
1561 ], [
1562 return iconv_open("UTF-8","ISO-8859-1")==(iconv_t)(-1);
1563 ])
1564 ],
1565 [ AC_MSG_RESULT(yes)
1566 AC_DEFINE(HAVE_ICONV_ISO_8859_1, 1, Define to 1 if iconv supports ISO-8859-1)
1567 ],
1568 [ AC_MSG_RESULT(no) ],
1569 [ AC_MSG_RESULT(no) ]
1570 )
1571
1572 AC_MSG_CHECKING(whether iconv supports ASCII)
1573 AC_RUN_IFELSE(
1574 [AC_LANG_PROGRAM([
1575 #if HAVE_ICONV_H
1576 #include <iconv.h>
1577 #endif
1578 ], [
1579 return iconv_open("UTF-8","ASCII")==(iconv_t)(-1);
1580 ])
1581 ],
1582 [ AC_MSG_RESULT(yes)
1583 AC_DEFINE(HAVE_ICONV_ASCII, 1, Define to 1 if iconv supports ASCII)
1584 ],
1585 [ AC_MSG_RESULT(no) ],
1586 [ AC_MSG_RESULT(no) ]
1587 )
1588
1589 AC_MSG_CHECKING(whether iconv supports //IGNORE)
1590 AC_RUN_IFELSE(
1591 [AC_LANG_PROGRAM([
1592 #if HAVE_ICONV_H
1593 #include <iconv.h>
1594 #endif
1595 ], [
1596 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
1597 ])
1598 ],
1599 [ AC_MSG_RESULT(yes)
1600 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
1601 ],
1602 [ AC_MSG_RESULT(no) ],
1603 [ AC_MSG_RESULT(no) ]
1604 )
1605
1606 # taken from ZSH's configure
1607 # Check if iconv uses const in prototype declaration
1608 if test "x$ac_found_iconv" = "xyes"; then
1609 AC_LANG_PUSH([C++])
1610 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
1611 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1612 #include <stdlib.h>
1613 #if HAVE_ICONV_H
1614 #include <iconv.h>
1615 #endif
1616 ]],
1617 [[
1618 char **p = NULL;
1619 iconv(0, (const char **)p, 0, 0, 0);
1620 ]])],
1621 [ac_cv_iconv_const=const],
1622 [ac_cv_iconv_const=])])
1623 AC_LANG_POP([C++])
1624 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
1625 [Define as const if the declaration of iconv() needs const.])
1626 fi
1627
1628 if test "x$ac_cv_type_wchar_t" = "xyes"; then
1629 if test $ac_cv_sizeof_wchar_t -eq 2; then
1630 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
1631 fi
1632
1633 if test $ac_cv_sizeof_wchar_t -eq 4; then
1634 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
1635 fi
1636
1637 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
1638 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
1639 fi
1640 else
1641 if test "x$BUILD_UNICODE" = "xyes"; then
1642 AC_MSG_ERROR(wchar_t is required for UNICODE build)
1643 fi
1644 fi
1645
1646
1647 #--------------------------------------------------------------------
1648 # MySQL
1649 #--------------------------------------------------------------------
1650
1651 check_substr "$COMPONENTS" "mysql"
1652 if test $? = 0; then
1653 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
1654 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
1655
1656 OLD_LIBS="$LIBS"
1657 LIBS="$LIBS $MYSQL_LIBS"
1658
1659 AC_MSG_CHECKING(whether mysql clients can run)
1660 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1661 #include <stdio.h>
1662 #include <mysql.h>
1663 int main(void)
1664 {
1665 MYSQL *a = mysql_init(NULL);
1666 return 0;
1667 }
1668 ]])],[],[
1669 AC_MSG_RESULT(no)
1670 AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)
1671 ],[])
1672 AC_MSG_RESULT(yes)
1673
1674 AC_CHECK_FUNCS(mysql_real_escape_string)
1675 LIBS="$OLD_LIBS"
1676 fi
1677
1678
1679 #--------------------------------------------------------------------
1680 # PostgreSQL
1681 #--------------------------------------------------------------------
1682
1683 check_substr "$COMPONENTS" "pgsql"
1684 if test $? = 0; then
1685 AC_CHECK_LIB(m, floor)
1686 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"],
1687 [AC_MSG_ERROR(libpq is required for PostgreSQL support)])
1688
1689 AC_MSG_CHECKING(whether postgresql clients can run)
1690 OLD_LIBS="$LIBS"
1691 LIBS="$LIBS $PGSQL_LIBS"
1692 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1693 #include <stdio.h>
1694 #include <libpq-fe.h>
1695 int main(void)
1696 {
1697 PGconn *a = PQconnectdb("");
1698 return 0;
1699 }
1700 ]])],[AC_MSG_RESULT(yes)],[
1701 AC_MSG_RESULT(no)
1702 AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
1703 ],[])
1704 LIBS="$OLD_LIBS"
1705 AC_CHECK_LIB(pq, PQfformat, [ AC_DEFINE(HAVE_PQFFORMAT, 1, PQfformat not exist in 7.3) ])
1706 fi
1707
1708
1709 #--------------------------------------------------------------------
1710 # ODBC
1711 #--------------------------------------------------------------------
1712
1713 check_substr "$COMPONENTS" "odbc"
1714 if test $? = 0; then
1715 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
1716 [AC_MSG_ERROR(libodbc is required for ODBC support)])
1717 fi
1718
1719
1720 #--------------------------------------------------------------------
1721 # Oracle
1722 #--------------------------------------------------------------------
1723
1724 check_substr "$COMPONENTS" "oracle"
1725 if test $? = 0; then
1726 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
1727 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
1728 [
1729 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
1730 ], [-lclntsh])
1731 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
1732 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
1733 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
1734 fi
1735
1736 #--------------------------------------------------------------------
1737 # DB2
1738 #--------------------------------------------------------------------
1739
1740 check_substr "$COMPONENTS" "db2"
1741 if test $? = 0; then
1742 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
1743 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
1744 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
1745 fi
1746
1747 #--------------------------------------------------------------------
1748 # nxhttpd
1749 #--------------------------------------------------------------------
1750
1751 check_substr "$COMPONENTS" "webui"
1752 if test $? = 0; then
1753 AC_CHECK_HEADER(gd.h,,AC_MSG_ERROR([*** GD support not installed - please install first ***]))
1754 AC_CHECK_LIB(gd, gdImageCreate, [], [
1755 AC_MSG_ERROR(libgd is required for web interface)
1756 ])
1757
1758 fi
1759
1760
1761 #--------------------------------------------------------------------
1762 # Other settings
1763 #--------------------------------------------------------------------
1764
1765 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DPREFIXW=L\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\""
1766 LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $LDFLAGS_SUFFIX"
1767
1768 AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
1769 AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
1770 AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$NEED_ZLIB/$HAVE_ZLIB" = "yes/no"])
1771
1772
1773 #--------------------------------------------------------------------
1774 # Substitute variables
1775 #--------------------------------------------------------------------
1776
1777 AC_SUBST(DB_DRIVERS)
1778 AC_SUBST(MODULES)
1779 AC_SUBST(SUBAGENT_DIRS)
1780 AC_SUBST(SERVER_TOOLS)
1781 AC_SUBST(TOP_LEVEL_MODULES)
1782 AC_SUBST(CONTRIB_MODULES)
1783 AC_SUBST(CLIENT_COMPONENTS)
1784 AC_SUBST(STATIC_SUBAGENT_LIST)
1785 AC_SUBST(SUBAGENT_LIBS)
1786 AC_SUBST(BUILD_SERVER)
1787 AC_SUBST(UNSTABLE_SUBAGENT_DIRS)
1788 AC_SUBST(MYSQL_LIBS)
1789 AC_SUBST(PGSQL_LIBS)
1790 AC_SUBST(ORACLE_LIBS)
1791 AC_SUBST(ODBC_LIBS)
1792 AC_SUBST(DB2_LIBS)
1793
1794 #--------------------------------------------------------------------
1795 # Shared libs versions
1796 #
1797 # versioning scheme: current:revision:age
1798 #
1799 # current
1800 # The number of the current interface exported by the library. A current
1801 # value of `0', means that you are calling the interface exported by this
1802 # library interface 0.
1803 #
1804 # revision
1805 # The implementation number of the most recent interface exported by this
1806 # library. In this case, a revision value of `0' means that this is the
1807 # first implementation of the interface.
1808 # If the next release of this library exports the same interface, but has a
1809 # different implementation (perhaps some bugs have been fixed), the revision
1810 # number will be higher, but current number will be the same. In that case,
1811 # when given a choice, the library with the highest revision will always
1812 # be used by the runtime loader.
1813 #
1814 # age
1815 # The number of previous additional interfaces supported by this library.
1816 # If age were `2', then this library can be linked into executables which
1817 # were built with a release of this library that exported the current
1818 # interface number, current, or any of the previous two interfaces.
1819 # By definition age must be less than or equal to current. At the outset,
1820 # only the first ever interface is implemented, so age can only be `0'.
1821 #--------------------------------------------------------------------
1822
1823 NETXMS_LIBRARY_VERSION=1:0:0
1824 AC_SUBST(NETXMS_LIBRARY_VERSION)
1825
1826
1827 #--------------------------------------------------------------------
1828 # Generate output files
1829 #--------------------------------------------------------------------
1830
1831 AC_CONFIG_FILES([
1832 README
1833 Makefile
1834 contrib/Makefile
1835 contrib/startup/Makefile
1836 contrib/startup/debian/Makefile
1837 contrib/startup/gentoo/Makefile
1838 contrib/startup/redhat/Makefile
1839 contrib/startup/suse/Makefile
1840 contrib/startup/ubuntu/Makefile
1841 contrib/mibs/Makefile
1842 contrib/backgrounds/Makefile
1843 doc/Makefile
1844 doc/internal/Makefile
1845 doc/manuals/Makefile
1846 doc/misc/Makefile
1847 images/Makefile
1848 include/Makefile
1849 m4/Makefile
1850 src/Makefile
1851 src/agent/Makefile
1852 src/agent/core/Makefile
1853 src/agent/install/Makefile
1854 src/agent/subagents/Makefile
1855 src/agent/subagents/linux/Makefile
1856 src/agent/subagents/sunos/Makefile
1857 src/agent/subagents/aix/Makefile
1858 src/agent/subagents/hpux/Makefile
1859 src/agent/subagents/freebsd/Makefile
1860 src/agent/subagents/openbsd/Makefile
1861 src/agent/subagents/netbsd/Makefile
1862 src/agent/subagents/ipso/Makefile
1863 src/agent/subagents/winnt/Makefile
1864 src/agent/subagents/winperf/Makefile
1865 src/agent/subagents/wmi/Makefile
1866 src/agent/subagents/portCheck/Makefile
1867 src/agent/subagents/ping/Makefile
1868 src/agent/subagents/sms/Makefile
1869 src/agent/subagents/ups/Makefile
1870 src/agent/subagents/ecs/Makefile
1871 src/agent/subagents/odbcquery/Makefile
1872 src/agent/subagents/logwatch/Makefile
1873 src/client/Makefile
1874 src/client/install/Makefile
1875 src/client/nxalarm/Makefile
1876 src/client/nxevent/Makefile
1877 src/client/nxlexer/Makefile
1878 src/client/nxpush/Makefile
1879 src/client/nxsms/Makefile
1880 src/client/scilexer/Makefile
1881 src/client/windows/Makefile
1882 src/client/windows/nxav/Makefile
1883 src/client/windows/nxav/res/Makefile
1884 src/client/windows/nxcon/Makefile
1885 src/client/windows/nxcon/icons/Makefile
1886 src/client/windows/nxcon/res/Makefile
1887 src/client/windows/nxnotify/Makefile
1888 src/client/windows/nxnotify/res/Makefile
1889 src/client/windows/nxuilib/Makefile
1890 src/client/windows/nxuilib/res/Makefile
1891 src/client/windows/nxuilib/sounds/Makefile
1892 src/db/Makefile
1893 src/db/dbdrv/Makefile
1894 src/db/dbdrv/odbc/Makefile
1895 src/db/dbdrv/mssql/Makefile
1896 src/db/dbdrv/mysql/Makefile
1897 src/db/dbdrv/pgsql/Makefile
1898 src/db/dbdrv/sqlite/Makefile
1899 src/db/dbdrv/oracle/Makefile
1900 src/db/dbdrv/db2/Makefile
1901 src/db/libnxdb/Makefile
1902 src/install/Makefile
1903 src/install/windows/Makefile
1904 src/libexpat/Makefile
1905 src/libexpat/libexpat/Makefile
1906 src/libnetxms/Makefile
1907 src/libnxcl/Makefile
1908 src/libnxlp/Makefile
1909 src/libnxmap/Makefile
1910 src/libnxsl/Makefile
1911 src/libtre/Makefile
1912 src/libtre/win32/Makefile
1913 src/nxscript/Makefile
1914 src/server/Makefile
1915 src/server/core/Makefile
1916 src/server/drivers/Makefile
1917 src/server/drivers/baystack/Makefile
1918 src/server/drivers/cat2900xl/Makefile
1919 src/server/drivers/ers8000/Makefile
1920 src/server/drivers/lib/Makefile
1921 src/server/drivers/lib/avaya-ers/Makefile
1922 src/server/drivers/lib/cisco/Makefile
1923 src/server/include/Makefile
1924 src/server/libnxsrv/Makefile
1925 src/server/netxmsd/Makefile
1926 src/server/smsdrv/Makefile
1927 src/server/smsdrv/generic/Makefile
1928 src/server/smsdrv/nxagent/Makefile
1929 src/server/tools/Makefile
1930 src/server/tools/nxaction/Makefile
1931 src/server/tools/nxadm/Makefile
1932 src/server/tools/nxap/Makefile
1933 src/server/tools/nxconfig/Makefile
1934 src/server/tools/nxconfig/res/Makefile
1935 src/server/tools/nxdbmgr/Makefile
1936 src/server/tools/nxencpasswd/Makefile
1937 src/server/tools/nxget/Makefile
1938 src/server/tools/nxupload/Makefile
1939 src/snmp/Makefile
1940 src/snmp/libnxsnmp/Makefile
1941 src/snmp/nxmibc/Makefile
1942 src/snmp/nxsnmpget/Makefile
1943 src/snmp/nxsnmpset/Makefile
1944 src/snmp/nxsnmpwalk/Makefile
1945 src/sqlite/Makefile
1946 src/tools/Makefile
1947 src/tools/nxcptest/Makefile
1948 src/tools/nxdevcfg/Makefile
1949 src/webui/Makefile
1950 src/webui/nxhttpd/Makefile
1951 src/webui/nxhttpd/static/Makefile
1952 src/webui/nxhttpd/static/images/Makefile
1953 src/webui/nxhttpd/static/images/buttons/Makefile
1954 src/webui/nxhttpd/static/images/buttons/normal/Makefile
1955 src/webui/nxhttpd/static/images/buttons/pressed/Makefile
1956 src/webui/nxhttpd/static/images/ctrlpanel/Makefile
1957 src/webui/nxhttpd/static/images/objects/Makefile
1958 src/webui/nxhttpd/static/images/status/Makefile
1959 src/zlib/Makefile
1960 sql/Makefile
1961 tools/Makefile
1962 ])
1963
1964 AC_OUTPUT
1965
1966 echo "Updating libtool"
1967 sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
1968
1969 # On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
1970 if test "x$CC" = "xgcc" && test "x$PLATFORM" = "xHP-UX"; then
1971 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
1972 fi
1973
1974 # On AIX, correct OBJECT_MODE must be set before linking
1975 # To avoid manual setting by user, we add this to libtool script
1976 if test "x$PLATFORM" = "xAIX"; then
1977 head -n 1 ./libtool > ./libtool.new
1978 echo "export OBJECT_MODE=$OBJECT_MODE" >> ./libtool.new
1979 tail -n +2 ./libtool >> ./libtool.new
1980 mv libtool.new libtool
1981 chmod +x ./libtool
1982 fi
1983
1984 #--------------------------------------------------------------------
1985 # Print summary
1986 #--------------------------------------------------------------------
1987
1988 echo
1989 echo
1990 echo
1991 echo '---------------------------------------------------------------------'
1992 echo ' Configure results'
1993 echo '---------------------------------------------------------------------'
1994 echo
1995 echo "Prefix : ${prefix}"
1996 if test "x${BUILD_SERVER}" = "xyes"; then
1997 echo "Build Server : YES"
1998 else
1999 echo "Build Server : NO"
2000 fi
2001 if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
2002 echo "Encryption enabled : YES"
2003 else
2004 echo "Encryption enabled : NO"
2005 fi
2006 if test "x${DB_DRIVERS}" != "x"; then
2007 echo "Build DB-Drivers :${DB_DRIVERS}"
2008 else
2009 echo "Build DB-Drivers : NO"
2010 fi
2011 if test "x${BUILD_CLIENT}" = "xyes"; then
2012 echo "Build Clients : YES"
2013 else
2014 echo "Build Clients : NO"
2015 fi
2016 if test "x${BUILD_NXHTTPD}" = "xyes"; then
2017 echo "Build Web Interface : YES"
2018 else
2019 echo "Build Web Interface : NO"
2020 fi
2021 if test "x${BUILD_AGENT}" = "xyes"; then
2022 echo "Build Agent : YES"
2023 echo "Subagents list : ${SUBAGENT_DIRS}"
2024 else
2025 echo "Build Agent : NO"
2026 fi
2027 if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
2028 echo "Build Static Agent : YES"
2029 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
2030 else
2031 echo "Build Static Agent : NO"
2032 fi
2033 if test "x${BUILD_UNICODE}" = "xyes"; then
2034 echo "UNICODE build : YES"
2035 else
2036 echo "UNICODE build : NO"
2037 fi
2038 if test "x${HAVE_LIBEXPAT}" = "xno"; then
2039 echo "Use internal libexpat : YES"
2040 else
2041 echo "Use internal libexpat : NO"
2042 fi
2043 if test "x${HAVE_LIBTRE}" = "xno"; then
2044 echo "Use internal libtre : YES"
2045 else
2046 echo "Use internal libtre : NO"
2047 fi
2048 if test "x${NEED_ZLIB}" = "xyes"; then
2049 if test "x${HAVE_ZLIB}" = "xno"; then
2050 echo "Use internal zlib : YES"
2051 else
2052 echo "Use internal zlib : NO"
2053 fi
2054 fi
2055 if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
2056 echo "Force 32bit build : YES"
2057 else
2058 echo "Force 32bit build : NO"
2059 fi
2060
2061 echo "CPPFLAGS : ${CPPFLAGS}"
2062 echo "CXXFLAGS : ${CXXFLAGS}"
2063 echo "CFLAGS : ${CFLAGS}"
2064 echo "LDFLAGS : ${LDFLAGS}"
2065 echo "LIBS : ${LIBS}"
2066
2067 if test "x${MYSQL_LIBS}" != "x"; then
2068 echo "MySQL libs : ${MYSQL_LIBS}"
2069 fi
2070 if test "x${PGSQL_LIBS}" != "x"; then
2071 echo "PostgreSQL libs : ${PGSQL_LIBS}"
2072 fi
2073 if test "x${ORACLE_LIBS}" != "x"; then
2074 echo "Oracle libs : ${ORACLE_LIBS}"
2075 fi
2076 if test "x${ODBC_LIBS}" != "x"; then
2077 echo "ODBC libs : ${ODBC_LIBS}"
2078 fi
2079 if test "x${DB2_LIBS}" != "x"; then
2080 echo "DB2 libs : ${DB2_LIBS}"
2081 fi