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