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