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