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