b2ee351ae8e17ece44710df6274889e072755fbf
[public/netxms.git] / configure.ac
1 # $Id$
2 #
3 # NetXMS - Network Management System
4 # Configure script
5 #
6
7 AC_INIT([NetXMS], [1.2.17], [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="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 nxlexer nxpush nxsms scilexer windows"
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 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 fi
1491 LDAP_SUPPORT="$HAVE_LDAP"
1492 fi
1493
1494 #--------------------------------------------------------------------
1495 # Checks for data types
1496 #--------------------------------------------------------------------
1497
1498 AC_CHECK_SIZEOF(short)
1499 AC_CHECK_SIZEOF(int)
1500 AC_CHECK_SIZEOF(long)
1501 AC_CHECK_SIZEOF(long long)
1502
1503 AC_TYPE_PID_T
1504 AC_TYPE_SIZE_T
1505 AC_STRUCT_TIMEZONE
1506
1507 AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t])
1508 AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
1509 #if HAVE_SYS_TYPES_H
1510 #include <sys/types.h>
1511 #endif
1512 #if HAVE_SYS_SOCKET_H
1513 #include <sys/socket.h>
1514 #endif
1515 ])
1516 AC_CHECK_TYPES([struct stat64],,,[
1517 #if HAVE_SYS_STAT_H
1518 #include <sys/stat.h>
1519 #endif
1520 ])
1521
1522
1523 #--------------------------------------------------------------------
1524 # Checks for functions
1525 #--------------------------------------------------------------------
1526
1527 AC_FUNC_ERROR_AT_LINE
1528 AC_FUNC_MEMCMP
1529 AC_FUNC_SELECT_ARGTYPES
1530 AC_FUNC_STRFTIME
1531 AC_FUNC_STRTOD
1532 AC_FUNC_VPRINTF
1533
1534 AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
1535 AC_CHECK_FUNCS([strrchr strlwr strtol strtoul strtoll strtoull setlocale])
1536 AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
1537 AC_CHECK_FUNCS([usleep nanosleep gmtime_r localtime_r stat64 fstat64 lstat64])
1538 AC_CHECK_FUNCS([fopen64 strptime timegm gethostbyname2_r])
1539
1540 AC_CHECK_DECLS([nanosleep])
1541
1542 # Check if strerror_r is POSIX-compliant
1543 if test "$ac_cv_func_strerror_r" = "yes"; then
1544 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
1545 AC_LANG_PUSH([C++])
1546 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1547 #if HAVE_STRING_H
1548 #include <string.h>
1549 #endif
1550 #if HAVE_ERRNO_H
1551 #include <errno.h>
1552 #endif
1553 ]],[[
1554 int e;
1555 char buffer[256];
1556 e = strerror_r(1, buffer, 256);
1557 return e;
1558 ]])
1559 ],[
1560 AC_MSG_RESULT(yes)
1561 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
1562 ],[
1563 AC_MSG_RESULT(no)
1564 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
1565 ])
1566 AC_LANG_POP([C++])
1567 fi
1568
1569 # Check if struct tm has tm_gmtoff member
1570 AC_MSG_CHECKING(for struct tm.tm_gmtoff)
1571 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1572 #if HAVE_TIME_H
1573 #include <time.h>
1574 #endif
1575 #if HAVE_SYS_TIME_H
1576 #include <sys/time.h>
1577 #endif
1578 ]],[[
1579 struct tm t;
1580 return t.tm_gmtoff;
1581 ]])
1582 ],[
1583 AC_MSG_RESULT(yes)
1584 AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
1585 ],[
1586 AC_MSG_RESULT(no)
1587 ])
1588
1589 AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
1590 AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
1591
1592 # sockets/resolver
1593 if test "$BUILD_SERVER-$XMPP_SUPPORT" = "yes-yes"; then
1594 AC_CHECK_HEADERS([arpa/nameser_compat.h])
1595 AC_CHECK_FUNC(res_query, , [AC_CHECK_LIB(resolv, res_query, [], [AC_CHECK_LIB(resolv, __res_query)])])
1596 fi
1597 AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
1598 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
1599 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
1600
1601 if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
1602 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
1603 fi
1604
1605 if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
1606 AC_MSG_CHECKING([if we can include libnsl + libsocket])
1607 LIBS="-lnsl -lsocket $LIBS"
1608 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
1609 if test "$my_ac_link_result" = "no" ; then
1610 AC_MSG_RESULT([failure])
1611 AC_MSG_ERROR([unable to use gethostbyname()])
1612 else
1613 AC_MSG_RESULT([success])
1614 fi
1615 fi
1616
1617 # asprintf, scprintf, etc.
1618 AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
1619 AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
1620
1621 AC_MSG_CHECKING(whether snprintf returns required buffer size)
1622 AC_RUN_IFELSE(
1623 [AC_LANG_PROGRAM([
1624 #include <stdio.h>
1625 #include <string.h>
1626 ], [
1627 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
1628 ])
1629 ],
1630 [ AC_MSG_RESULT(yes)
1631 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
1632 ],
1633 [ AC_MSG_RESULT(no) ],
1634 [ AC_MSG_RESULT(no) ]
1635 )
1636
1637
1638
1639 #--------------------------------------------------------------------
1640 # Checks for macros and definitions
1641 #--------------------------------------------------------------------
1642
1643 AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
1644 #ifdef HAVE_SYS_TYPES_H
1645 #include <sys/types.h>
1646 #endif
1647 #if HAVE_BYTESWAP_H
1648 #include <byteswap.h>
1649 #endif
1650 #if HAVE_NETINET_IN_H
1651 #include <netinet/in.h>
1652 #endif
1653 #if HAVE_NET_NH_H
1654 #include <net/nh.h>
1655 #endif
1656 ])
1657 AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
1658 #ifdef HAVE_UNISTD_H
1659 #include <unistd.h>
1660 #endif
1661 #ifdef HAVE_DLFCN_H
1662 #include <dlfcn.h>
1663 #endif
1664 ])
1665 AC_CHECK_DECLS([va_copy, __va_copy],,,[
1666 #ifdef HAVE_UNISTD_H
1667 #include <unistd.h>
1668 #endif
1669 #ifdef HAVE_STDARG_H
1670 #include <stdarg.h>
1671 #endif
1672 #ifdef HAVE_STDLIB_H
1673 #include <stdlib.h>
1674 #endif
1675 ])
1676
1677
1678 #--------------------------------------------------------------------
1679 # getopt
1680 #--------------------------------------------------------------------
1681
1682 if test "x$FORCE_INTERNAL_GETOPT" = "xyes"; then
1683 AC_DEFINE([USE_BUNDLED_GETOPT], [1], [Define to 1 if bundled getopt must be used])
1684 else
1685 AC_CHECK_HEADERS([getopt.h])
1686 AC_CHECK_LIB(gnugetopt, getopt_long)
1687 AC_CHECK_DECLS([getopt_long],,,[
1688 #if HAVE_GETOPT_H
1689 #include <getopt.h>
1690 #endif
1691 ])
1692 fi
1693
1694
1695 #--------------------------------------------------------------------
1696 # Linux specific checks
1697 #--------------------------------------------------------------------
1698
1699 if test "x$PLATFORM" = "xLinux"; then
1700 AC_CHECK_HEADERS([sys/reboot.h],,,[[ ]])
1701 AC_CHECK_DECLS([reboot, RB_AUTOBOOT, RB_POWER_OFF, RB_HALT_SYSTEM],,,[
1702 #if HAVE_SYS_REBOOT_H
1703 #include <sys/reboot.h>
1704 #endif
1705 ])
1706 AC_CHECK_FUNCS([reboot],,,[
1707 #if HAVE_SYS_REBOOT_H
1708 #include <sys/reboot.h>
1709 #endif
1710 ])
1711 fi
1712
1713
1714 #--------------------------------------------------------------------
1715 # AIX specific checks
1716 #--------------------------------------------------------------------
1717
1718 if test "x$PLATFORM" = "xAIX"; then
1719 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
1720 AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64, __sync_add_and_fetch, __sync_sub_and_fetch],,,[
1721 #if HAVE_PROCINFO_H
1722 #include <procinfo.h>
1723 #endif
1724 ])
1725 AC_CHECK_FUNCS([getprocs64],,,[
1726 #if HAVE_PROCINFO_H
1727 #include <procinfo.h>
1728 #endif
1729 ])
1730 fi
1731
1732
1733 #--------------------------------------------------------------------
1734 # Solaris specific checks
1735 #--------------------------------------------------------------------
1736
1737 if test "x$PLATFORM" = "xSunOS"; then
1738 AC_CHECK_FUNCS([atomic_inc_32_nv atomic_dec_32_nv],,,[
1739 #include <sys/atomic.h>
1740 ])
1741 fi
1742
1743
1744 #--------------------------------------------------------------------
1745 # HP-UX specific checks
1746 #--------------------------------------------------------------------
1747
1748 if test "x$PLATFORM" = "xHP-UX"; then
1749 AC_CHECK_HEADERS([atomic.h sys/mib.h],,,[[ ]])
1750 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
1751 #if HAVE_NET_IF_H
1752 #include <net/if.h>
1753 #endif
1754 ])
1755 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
1756 #if HAVE_SYS_MIB_H
1757 #include <sys/mib.h>
1758 #endif
1759 ])
1760
1761 AC_MSG_CHECKING(if pst_diskinfo has read/write stats fields)
1762 AC_LANG_PUSH([C++])
1763 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1764 #include <sys/pstat.h>
1765 ]], [[
1766 pst_diskinfo d;
1767 int x;
1768 x = (int)d.psd_dkread;
1769 x = (int)d.psd_dkwrite;
1770 ]])],
1771 [
1772 AC_DEFINE([HAVE_DISKINFO_RWSTATS],[1],[Define to 1 if pst_diskinfo has read/write stats fields])
1773 AC_MSG_RESULT(yes)
1774 ],
1775 [
1776 AC_MSG_RESULT(no)
1777 ])
1778 AC_LANG_POP([C++])
1779 fi
1780
1781
1782 #--------------------------------------------------------------------
1783 # *BSD specific checks
1784 #--------------------------------------------------------------------
1785
1786 AC_CHECK_LIB(kvm, kvm_open)
1787 AC_CHECK_FUNCS([kvm_getswapinfo])
1788 AC_CHECK_TYPES([struct kinfo_proc2],,,[
1789 #if HAVE_SYS_SYSCTL_H
1790 #include <sys/sysctl.h>
1791 #endif
1792 ])
1793
1794
1795 #--------------------------------------------------------------------
1796 # FreeBSD specific checks
1797 #--------------------------------------------------------------------
1798
1799 if test "x$PLATFORM" = "xFreeBSD"; then
1800 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
1801 #if HAVE_SYS_TYPES_H
1802 #include <sys/types.h>
1803 #endif
1804 #if HAVE_SYS_SOCKET_H
1805 #include <sys/socket.h>
1806 #endif
1807 #include <net/route.h>
1808 ])
1809 fi
1810
1811
1812 #--------------------------------------------------------------------
1813 # OpenBSD specific checks
1814 #--------------------------------------------------------------------
1815
1816 if test "x$PLATFORM" = "xOpenBSD"; then
1817 AC_MSG_CHECKING(if kvm_getprocs requires sizeof kinfo_proc argument)
1818 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1819 #include <sys/param.h>
1820 #include <sys/proc.h>
1821 #include <kvm.h>
1822 #include <sys/user.h>
1823 ]],[[
1824 int count;
1825 kvm_getprocs(NULL, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
1826 return 0;
1827 ]])
1828 ],[
1829 AC_MSG_RESULT(yes)
1830 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,1,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1831 ],[
1832 AC_MSG_RESULT(no)
1833 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,0,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1834 ])
1835
1836 AC_MSG_CHECKING(if struct kinfo_proc has member kp_proc)
1837 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1838 #include <sys/param.h>
1839 #include <sys/proc.h>
1840 #include <kvm.h>
1841 #include <sys/user.h>
1842 ]],[[
1843 struct kinfo_proc p;
1844 return p.kp_proc.p_pid;
1845 ]])
1846 ],[
1847 AC_MSG_RESULT(yes)
1848 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,1,Define to 1 if struct kinfo_proc has member kp_proc)
1849 ],[
1850 AC_MSG_RESULT(no)
1851 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,0,Define to 1 if struct kinfo_proc has member kp_proc)
1852 ])
1853 fi
1854
1855
1856 #--------------------------------------------------------------------
1857 # Check for UNICODE stuff
1858 #--------------------------------------------------------------------
1859
1860 AC_CHECK_HEADERS([wchar.h wctype.h iconv.h])
1861 AC_CHECK_TYPES([wchar_t, wint_t],,,[
1862 #if HAVE_WCHAR_H
1863 #include <wchar.h>
1864 #endif
1865 ])
1866 AC_CHECK_SIZEOF(wchar_t,,[
1867 #if HAVE_WCHAR_H
1868 #include <wchar.h>
1869 #endif
1870 ])
1871 AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper towlower])
1872 AC_CHECK_FUNCS([wcslwr wcserror wcserror_r wfopen wfopen64 fputws putws])
1873 AC_CHECK_FUNCS([wopen wstat waccess wgetenv wrename wunlink wremove wchdir])
1874 AC_CHECK_FUNCS([wmkdir wrmdir wsystem wmkstemp wpopen wctime wchmod vwscanf])
1875 AC_CHECK_FUNCS([vswscanf vfwscanf wcscasecmp wcsncasecmp wcstombs wcsrtombs])
1876
1877 if test "x$DISABLE_ICONV" != "xyes"; then
1878 AC_CHECK_LIB(iconv, libiconv_open,
1879 [ ac_found_iconv=yes
1880 LIBS="$LIBS -liconv"
1881 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
1882 ],
1883 [
1884 AC_CHECK_LIB(iconv, iconv,
1885 [ ac_found_iconv=yes
1886 LIBS="$LIBS -liconv"
1887 ])
1888 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
1889 ])
1890 else
1891 ac_found_iconv=no
1892 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
1893 fi
1894
1895 AC_MSG_CHECKING(whether fgetws can be used with popen)
1896 AC_RUN_IFELSE(
1897 [AC_LANG_PROGRAM([
1898 #include <stdio.h>
1899 #ifdef HAVE_UNISTD_H
1900 #include <unistd.h>
1901 #endif
1902 #if HAVE_WCHAR_H
1903 #include <wchar.h>
1904 #endif
1905 ], [[
1906 int rc = 1;
1907 wchar_t line[4096];
1908 FILE *f = popen("echo test", "r");
1909 if(f!=NULL)
1910 {
1911 fgetws(line, 4096, f);
1912 pclose(f);
1913 rc = 0;
1914 }
1915 return rc;
1916 ]])
1917 ],
1918 [ AC_MSG_RESULT(yes)
1919 AC_DEFINE(SAFE_FGETWS_WITH_POPEN, 1, Define to 1 if fgetws can be used with popen)
1920 ],
1921 [ AC_MSG_RESULT(no) ],
1922 [ AC_MSG_RESULT(no) ]
1923 )
1924
1925 AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
1926 AC_RUN_IFELSE(
1927 [AC_LANG_PROGRAM([
1928 #if HAVE_ICONV_H
1929 #include <iconv.h>
1930 #endif
1931 ], [
1932 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
1933 ])
1934 ],
1935 [ AC_MSG_RESULT(yes)
1936 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
1937 valid_ucs2_code="UCS-2-INTERNAL"
1938 ],
1939 [ AC_MSG_RESULT(no) ],
1940 [ AC_MSG_RESULT(no) ]
1941 )
1942
1943 AC_MSG_CHECKING(whether iconv supports UCS-2)
1944 AC_RUN_IFELSE(
1945 [AC_LANG_PROGRAM([
1946 #if HAVE_ICONV_H
1947 #include <iconv.h>
1948 #endif
1949 ], [
1950 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
1951 ])
1952 ],
1953 [ AC_MSG_RESULT(yes)
1954 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
1955 valid_ucs2_code="UCS-2"
1956 ],
1957 [ AC_MSG_RESULT(no) ],
1958 [ AC_MSG_RESULT(no) ]
1959 )
1960
1961 AC_MSG_CHECKING(whether iconv supports UCS2)
1962 AC_RUN_IFELSE(
1963 [AC_LANG_PROGRAM([
1964 #if HAVE_ICONV_H
1965 #include <iconv.h>
1966 #endif
1967 ], [
1968 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
1969 ])
1970 ],
1971 [ AC_MSG_RESULT(yes)
1972 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
1973 valid_ucs2_code="UCS2"
1974 ],
1975 [ AC_MSG_RESULT(no) ],
1976 [ AC_MSG_RESULT(no) ]
1977 )
1978
1979 AC_MSG_CHECKING(whether iconv supports UCS-2BE)
1980 AC_RUN_IFELSE(
1981 [AC_LANG_PROGRAM([
1982 #if HAVE_ICONV_H
1983 #include <iconv.h>
1984 #endif
1985 ], [
1986 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
1987 ])
1988 ],
1989 [ AC_MSG_RESULT(yes)
1990 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
1991 valid_ucs2_code="UCS-2BE"
1992 ],
1993 [ AC_MSG_RESULT(no) ],
1994 [ AC_MSG_RESULT(no) ]
1995 )
1996
1997 AC_MSG_CHECKING(whether iconv supports UCS-2LE)
1998 AC_RUN_IFELSE(
1999 [AC_LANG_PROGRAM([
2000 #if HAVE_ICONV_H
2001 #include <iconv.h>
2002 #endif
2003 ], [
2004 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
2005 ])
2006 ],
2007 [ AC_MSG_RESULT(yes)
2008 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
2009 valid_ucs2_code="UCS-2LE"
2010 ],
2011 [ AC_MSG_RESULT(no) ],
2012 [ AC_MSG_RESULT(no) ]
2013 )
2014
2015 AC_MSG_CHECKING(whether iconv supports UTF-16)
2016 AC_RUN_IFELSE(
2017 [AC_LANG_PROGRAM([
2018 #if HAVE_ICONV_H
2019 #include <iconv.h>
2020 #endif
2021 ], [
2022 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
2023 ])
2024 ],
2025 [ AC_MSG_RESULT(yes)
2026 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
2027 valid_ucs2_code="UTF-16"
2028 ],
2029 [ AC_MSG_RESULT(no) ],
2030 [ AC_MSG_RESULT(no) ]
2031 )
2032
2033 AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
2034 AC_RUN_IFELSE(
2035 [AC_LANG_PROGRAM([
2036 #if HAVE_ICONV_H
2037 #include <iconv.h>
2038 #endif
2039 ], [
2040 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
2041 ])
2042 ],
2043 [ AC_MSG_RESULT(yes)
2044 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
2045 valid_ucs4_code="UCS-4-INTERNAL"
2046 ],
2047 [ AC_MSG_RESULT(no) ],
2048 [ AC_MSG_RESULT(no) ]
2049 )
2050
2051 AC_MSG_CHECKING(whether iconv supports UCS-4)
2052 AC_RUN_IFELSE(
2053 [AC_LANG_PROGRAM([
2054 #if HAVE_ICONV_H
2055 #include <iconv.h>
2056 #endif
2057 ], [
2058 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
2059 ])
2060 ],
2061 [ AC_MSG_RESULT(yes)
2062 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
2063 valid_ucs4_code="UCS-4"
2064 ],
2065 [ AC_MSG_RESULT(no) ],
2066 [ AC_MSG_RESULT(no) ]
2067 )
2068
2069 AC_MSG_CHECKING(whether iconv supports UCS4)
2070 AC_RUN_IFELSE(
2071 [AC_LANG_PROGRAM([
2072 #if HAVE_ICONV_H
2073 #include <iconv.h>
2074 #endif
2075 ], [
2076 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
2077 ])
2078 ],
2079 [ AC_MSG_RESULT(yes)
2080 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
2081 valid_ucs4_code="UCS4"
2082 ],
2083 [ AC_MSG_RESULT(no) ],
2084 [ AC_MSG_RESULT(no) ]
2085 )
2086
2087 AC_MSG_CHECKING(whether iconv supports UCS-4BE)
2088 AC_RUN_IFELSE(
2089 [AC_LANG_PROGRAM([
2090 #if HAVE_ICONV_H
2091 #include <iconv.h>
2092 #endif
2093 ], [
2094 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
2095 ])
2096 ],
2097 [ AC_MSG_RESULT(yes)
2098 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
2099 valid_ucs4_code="UCS-4BE"
2100 ],
2101 [ AC_MSG_RESULT(no) ],
2102 [ AC_MSG_RESULT(no) ]
2103 )
2104
2105 AC_MSG_CHECKING(whether iconv supports UCS-4LE)
2106 AC_RUN_IFELSE(
2107 [AC_LANG_PROGRAM([
2108 #if HAVE_ICONV_H
2109 #include <iconv.h>
2110 #endif
2111 ], [
2112 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
2113 ])
2114 ],
2115 [ AC_MSG_RESULT(yes)
2116 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
2117 valid_ucs4_code="UCS-4LE"
2118 ],
2119 [ AC_MSG_RESULT(no) ],
2120 [ AC_MSG_RESULT(no) ]
2121 )
2122
2123 AC_MSG_CHECKING(whether iconv supports UTF-32)
2124 AC_RUN_IFELSE(
2125 [AC_LANG_PROGRAM([
2126 #if HAVE_ICONV_H
2127 #include <iconv.h>
2128 #endif
2129 ], [
2130 return iconv_open("UTF-8","UTF-32")==(iconv_t)(-1);
2131 ])
2132 ],
2133 [ AC_MSG_RESULT(yes)
2134 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
2135 valid_ucs4_code="UTF-32"
2136 ],
2137 [ AC_MSG_RESULT(no) ],
2138 [ AC_MSG_RESULT(no) ]
2139 )
2140
2141 AC_MSG_CHECKING(whether iconv supports //IGNORE)
2142 AC_RUN_IFELSE(
2143 [AC_LANG_PROGRAM([
2144 #if HAVE_ICONV_H
2145 #include <iconv.h>
2146 #endif
2147 ], [
2148 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
2149 ])
2150 ],
2151 [ AC_MSG_RESULT(yes)
2152 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
2153 ],
2154 [ AC_MSG_RESULT(no) ],
2155 [ AC_MSG_RESULT(no) ]
2156 )
2157
2158 AC_MSG_CHECKING(whether iconv supports state reset)
2159 AC_RUN_IFELSE(
2160 [AC_LANG_PROGRAM([
2161 #include <stdio.h>
2162 #if HAVE_ICONV_H
2163 #include <iconv.h>
2164 #endif
2165 ], [
2166 iconv_t cd = iconv_open("UTF-8","$valid_ucs2_code");
2167 if (cd == (iconv_t)(-1)) return 1;
2168 return iconv(cd, NULL, NULL, NULL, NULL) != 0;
2169 ])
2170 ],
2171 [ AC_MSG_RESULT(yes)
2172 AC_DEFINE(HAVE_ICONV_STATE_RESET, 1, Define to 1 if iconv supports state reset)
2173 ],
2174 [ AC_MSG_RESULT(no) ],
2175 [ AC_MSG_RESULT(no) ]
2176 )
2177
2178 AC_MSG_CHECKING(whether iconv descriptor cache is needed)
2179 case $enable_iconv_cache in
2180 auto)
2181 case $PLATFORM in
2182 SunOS|HP-UX|AIX)
2183 enable_iconv_cache=yes
2184 ;;
2185 *)
2186 enable_iconv_cache=no
2187 ;;
2188 esac
2189 ;;
2190 yes|no)
2191 ;;
2192 *)
2193 AC_MSG_ERROR([Value given to --enable-iconv-cache must be one of yes, no or auto])
2194 ;;
2195 esac
2196 if test "x$enable_iconv_cache" = "xyes"; then
2197 AC_DEFINE(WITH_ICONV_CACHE, 1, Define to 1 to enable iconv descriptor cache)
2198 fi
2199 AC_MSG_RESULT($enable_iconv_cache)
2200
2201 # taken from ZSH's configure
2202 # Check if iconv uses const in prototype declaration
2203 if test "x$ac_found_iconv" = "xyes"; then
2204 AC_LANG_PUSH([C++])
2205 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
2206 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2207 #include <stdlib.h>
2208 #if HAVE_ICONV_H
2209 #include <iconv.h>
2210 #endif
2211 ]],
2212 [[
2213 char **p = NULL;
2214 iconv(0, (const char **)p, 0, 0, 0);
2215 ]])],
2216 [ac_cv_iconv_const=const],
2217 [ac_cv_iconv_const=])])
2218 AC_LANG_POP([C++])
2219 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
2220 [Define as const if the declaration of iconv() needs const.])
2221 fi
2222
2223 AC_MSG_CHECKING(if iconv descriptor cache is needed)
2224
2225
2226 if test "x$ac_cv_type_wchar_t" = "xyes"; then
2227 if test $ac_cv_sizeof_wchar_t -eq 2; then
2228 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
2229 fi
2230
2231 if test $ac_cv_sizeof_wchar_t -eq 4; then
2232 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
2233 fi
2234
2235 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
2236 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
2237 fi
2238 else
2239 if test "x$BUILD_UNICODE" = "xyes"; then
2240 AC_MSG_ERROR(wchar_t is required for UNICODE build)
2241 fi
2242 fi
2243
2244
2245 #--------------------------------------------------------------------
2246 # MySQL
2247 #--------------------------------------------------------------------
2248
2249 check_substr "$COMPONENTS" "mysql"
2250 if test $? = 0; then
2251 OLD_CPPFLAGS="$CPPFLAGS"
2252 OLD_LDFLAGS="$LDFLAGS"
2253 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2254
2255 CPPFLAGS="$CPPFLAGS $MYSQL_CPPFLAGS"
2256 LDFLAGS="$LDFLAGS $MYSQL_LDFLAGS"
2257 if test "x$MYSQL_LD_RUN_PATH" != "x"; then
2258 LD_RUN_PATH="${MYSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2259 fi
2260
2261 AC_CHECK_HEADER(mysql.h,,AC_MSG_ERROR([Cannot find mysql.h - check your PostgreSQL client installation]))
2262
2263 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
2264 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
2265
2266 OLD_LIBS="$LIBS"
2267 LIBS="$LIBS $MYSQL_LIBS"
2268
2269 AC_CHECK_FUNCS(mysql_real_escape_string)
2270
2271 CPPFLAGS="$OLD_CPPFLAGS"
2272 LDFLAGS="$OLD_LDFLAGS"
2273 LD_RUN_PATH="$OLD_LD_RUN_PATH"
2274 LIBS="$OLD_LIBS"
2275 fi
2276
2277
2278 #--------------------------------------------------------------------
2279 # PostgreSQL
2280 #--------------------------------------------------------------------
2281
2282 check_substr "$COMPONENTS" "pgsql"
2283 if test $? = 0; then
2284 OLD_CPPFLAGS="$CPPFLAGS"
2285 OLD_LDFLAGS="$LDFLAGS"
2286 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2287
2288 CPPFLAGS="$CPPFLAGS $PGSQL_CPPFLAGS"
2289 LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
2290 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
2291 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2292 fi
2293
2294 AC_CHECK_HEADER(libpq-fe.h,,AC_MSG_ERROR([Cannot find libpq-fe.h - check your PostgreSQL client installation]))
2295
2296 AC_CHECK_LIB(m, floor)
2297 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
2298 if test "x$PLATFORM" = "xSunOS"; then
2299 PGSQL_LDFLAGS="$PGSQL_LDFLAGS/sparcv9"
2300 LDFLAGS="$OLD_LDFLAGS $PGSQL_LDFLAGS"
2301 if test "x$PGSQL_LD_RUN_PATH" != "x"; then
2302 PGSQL_LD_RUN_PATH="$PGSQL_LD_RUN_PATH/sparcv9"
2303 LD_RUN_PATH="${PGSQL_LD_RUN_PATH}${OLD_LD_RUN_PATH:+:}${OLD_LD_RUN_PATH}"
2304 fi
2305 unset ac_cv_lib_pq_PQconnectdb
2306 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"], [
2307 AC_MSG_ERROR(libpq is required for PostgreSQL support)])
2308 else
2309 AC_MSG_ERROR(libpq is required for PostgreSQL support)
2310 fi
2311 ])
2312
2313 CPPFLAGS="$OLD_CPPFLAGS"
2314 LDFLAGS="$OLD_LDFLAGS"
2315 LD_RUN_PATH="$OLD_LD_RUN_PATH"
2316 fi
2317
2318
2319 #--------------------------------------------------------------------
2320 # ODBC
2321 #--------------------------------------------------------------------
2322
2323 check_substr "$COMPONENTS" "odbc"
2324 if test $? = 0; then
2325 OLD_CPPFLAGS="$CPPFLAGS"
2326 OLD_LDFLAGS="$LDFLAGS"
2327 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2328
2329 CPPFLAGS="$CPPFLAGS $ODBC_CPPFLAGS"
2330 LDFLAGS="$LDFLAGS $ODBC_LDFLAGS"
2331 if test "x$ODBC_LD_RUN_PATH" != "x"; then
2332 LD_RUN_PATH="${ODBC_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2333 fi
2334
2335 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
2336 [AC_MSG_ERROR(libodbc is required for ODBC support)])
2337 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2338 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
2339 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
2340 fi
2341
2342 CPPFLAGS="$OLD_CPPFLAGS"
2343 LDFLAGS="$OLD_LDFLAGS"
2344 LD_RUN_PATH="$OLD_LD_RUN_PATH"
2345 fi
2346
2347
2348 #--------------------------------------------------------------------
2349 # Oracle
2350 #--------------------------------------------------------------------
2351
2352 check_substr "$COMPONENTS" "oracle"
2353 if test $? = 0; then
2354 OLD_CPPFLAGS="$CPPFLAGS"
2355 OLD_LDFLAGS="$LDFLAGS"
2356 OLD_LD_RUN_PATH="$LD_RUN_PATH"
2357
2358 CPPFLAGS="$CPPFLAGS $ORACLE_CPPFLAGS"
2359 LDFLAGS="$LDFLAGS $ORACLE_LDFLAGS"
2360 if test "x$ORACLE_LD_RUN_PATH" != "x"; then
2361 LD_RUN_PATH="${ORACLE_LD_RUN_PATH}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
2362 fi
2363
2364 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
2365 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
2366 [
2367 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
2368 ], [-lclntsh])
2369 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
2370 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
2371 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
2372 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2373 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
2374 fi
2375
2376 CPPFLAGS="$OLD_CPPFLAGS"
2377 LDFLAGS="$OLD_LDFLAGS"
2378 LD_RUN_PATH="$OLD_LD_RUN_PATH"
2379 fi
2380
2381 #--------------------------------------------------------------------
2382 # DB2
2383 #--------------------------------------------------------------------
2384
2385 check_substr "$COMPONENTS" "db2"
2386 if test $? = 0; then
2387 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
2388 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
2389 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
2390 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2391 SUBAGENT_LIBS="$SUBAGENT_LIBS $DB2_LIBS"
2392 fi
2393 fi
2394
2395 #--------------------------------------------------------------------
2396 # Informix
2397 #--------------------------------------------------------------------
2398
2399 check_substr "$COMPONENTS" "informix"
2400 if test $? = 0; then
2401 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
2402 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
2403 [AC_MSG_ERROR(libthcli is required for Informix support)])
2404 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2405 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
2406 fi
2407 fi
2408
2409
2410 #--------------------------------------------------------------------
2411 # Java
2412 #--------------------------------------------------------------------
2413
2414 check_substr "$COMPONENTS" "java"
2415 if test $? = 0; then
2416 AC_CHECK_HEADER(jni.h,,AC_MSG_ERROR([*** Cannot find jni.h - check your JDK installation ***]))
2417 AC_CHECK_LIB(jvm, SQLAllocHandle, [JAVA_LIBS="-ljvm"],
2418 [AC_MSG_ERROR(libjvm is required for Java support)])
2419 fi
2420
2421
2422 #--------------------------------------------------------------------
2423 # Other settings
2424 #--------------------------------------------------------------------
2425
2426 if test "x$RUNTIME_PREFIX" = "x"; then
2427 if test "x${BUILD_UNICODE}" = "xyes"; then
2428 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\""
2429 else
2430 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\""
2431 fi
2432 else
2433 if test "x${BUILD_UNICODE}" = "xyes"; then
2434 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\\\""
2435 else
2436 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"$RUNTIME_PREFIX\\\" -DDATADIR=\\\"$RUNTIME_PREFIX/share/netxms\\\" -DBINDIR=\\\"$RUNTIME_PREFIX/bin\\\" -DLIBDIR=\\\"$RUNTIME_PREFIX/lib\\\" -DPKGLIBDIR=\\\"$RUNTIME_PREFIX/lib/netxms\\\""
2437 fi
2438 fi
2439 LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $LDFLAGS_SUFFIX"
2440
2441 if test "x${ENABLE_WERROR}" = "xyes"; then
2442 CPPFLAGS="$CPPFLAGS -Werror"
2443 fi
2444
2445 if test "x$PLATFORM" = "xDarwin"; then
2446 SHLIB_SUFFIX=".so"
2447 else
2448 if test "x$shrext_cmds" != "x"; then
2449 SHLIB_SUFFIX="$shrext_cmds"
2450 else
2451 SHLIB_SUFFIX=".so"
2452 fi
2453 fi
2454 AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], _T("$SHLIB_SUFFIX"), [Define to platform's shared library suffix])
2455
2456 if test "x$ENABLE_DEBUG" = "xno"; then
2457 CPPFLAGS="$CPPFLAGS -DNDEBUG"
2458 fi
2459
2460 AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
2461 AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
2462 AM_CONDITIONAL([USE_INTERNAL_JANSSON], [test "x$HAVE_JANSSON" = "xno"])
2463 AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$NEED_ZLIB/$HAVE_ZLIB" = "yes/no"])
2464 AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
2465 AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
2466 AM_CONDITIONAL([USE_ENCRYPTION], [test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"])
2467 AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
2468 AM_CONDITIONAL([XMPP_SUPPORT], [test "x$XMPP_SUPPORT" = "xyes"])
2469
2470
2471 #--------------------------------------------------------------------
2472 # Substitute variables
2473 #--------------------------------------------------------------------
2474
2475 AC_SUBST(DB_DRIVERS)
2476 AC_SUBST(MODULES)
2477 AC_SUBST(SUBAGENT_DIRS)
2478 AC_SUBST(SERVER_INCLUDE)
2479 AC_SUBST(SERVER_LIBS)
2480 AC_SUBST(SERVER_TOOLS)
2481 AC_SUBST(SMSDRV_DIRS)
2482 AC_SUBST(HDLINK_DIRS)
2483 AC_SUBST(PDSDRV_DIRS)
2484 AC_SUBST(TOP_LEVEL_MODULES)
2485 AC_SUBST(CONTRIB_MODULES)
2486 AC_SUBST(CLIENT_COMPONENTS)
2487 AC_SUBST(STATIC_SUBAGENT_LIST)
2488 AC_SUBST(SUBAGENT_LIBS)
2489 AC_SUBST(BUILD_SERVER)
2490 AC_SUBST(BUILD_SDK)
2491 AC_SUBST(MYSQL_CPPFLAGS)
2492 AC_SUBST(MYSQL_LDFLAGS)
2493 AC_SUBST(MYSQL_LIBS)
2494 AC_SUBST(PGSQL_CPPFLAGS)
2495 AC_SUBST(PGSQL_LDFLAGS)
2496 AC_SUBST(PGSQL_LIBS)
2497 AC_SUBST(ORACLE_CPPFLAGS)
2498 AC_SUBST(ORACLE_LDFLAGS)
2499 AC_SUBST(ORACLE_LIBS)
2500 AC_SUBST(ODBC_CPPFLAGS)
2501 AC_SUBST(ODBC_LDFLAGS)
2502 AC_SUBST(ODBC_LIBS)
2503 AC_SUBST(DB2_CPPFLAGS)
2504 AC_SUBST(DB2_LDFLAGS)
2505 AC_SUBST(DB2_LIBS)
2506 AC_SUBST(INFORMIX_CPPFLAGS)
2507 AC_SUBST(INFORMIX_LDFLAGS)
2508 AC_SUBST(INFORMIX_LIBS)
2509 AC_SUBST(OBJECT_MODE)
2510 AC_SUBST(SQLFLAGS)
2511 AC_SUBST(SHLIB_SUFFIX)
2512
2513 #--------------------------------------------------------------------
2514 # Shared libs versions
2515 #
2516 # versioning scheme: current:revision:age
2517 #
2518 # current
2519 # The number of the current interface exported by the library. A current
2520 # value of `0', means that you are calling the interface exported by this
2521 # library interface 0.
2522 #
2523 # revision
2524 # The implementation number of the most recent interface exported by this
2525 # library. In this case, a revision value of `0' means that this is the
2526 # first implementation of the interface.
2527 # If the next release of this library exports the same interface, but has a
2528 # different implementation (perhaps some bugs have been fixed), the revision
2529 # number will be higher, but current number will be the same. In that case,
2530 # when given a choice, the library with the highest revision will always
2531 # be used by the runtime loader.
2532 #
2533 # age
2534 # The number of previous additional interfaces supported by this library.
2535 # If age were `2', then this library can be linked into executables which
2536 # were built with a release of this library that exported the current
2537 # interface number, current, or any of the previous two interfaces.
2538 # By definition age must be less than or equal to current. At the outset,
2539 # only the first ever interface is implemented, so age can only be `0'.
2540 #--------------------------------------------------------------------
2541
2542 NETXMS_LIBRARY_VERSION=1:0:0
2543 AC_SUBST(NETXMS_LIBRARY_VERSION)
2544
2545 #--------------------------------------------------------------------
2546 # Generate output files
2547 #--------------------------------------------------------------------
2548
2549 AC_CONFIG_FILES([
2550 Makefile
2551 contrib/Makefile
2552 contrib/backgrounds/Makefile
2553 contrib/integration/Makefile
2554 contrib/integration/HP_EVA/Makefile
2555 contrib/integration/HP_P2000/Makefile
2556 contrib/mibs/Makefile
2557 contrib/startup/Makefile
2558 contrib/startup/debian/Makefile
2559 contrib/startup/gentoo/Makefile
2560 contrib/startup/hp-ux/Makefile
2561 contrib/startup/redhat/Makefile
2562 contrib/startup/suse/Makefile
2563 contrib/startup/ubuntu/Makefile
2564 contrib/startup/solaris/Makefile
2565 doc/Makefile
2566 doc/internal/Makefile
2567 doc/manuals/Makefile
2568 doc/misc/Makefile
2569 images/Makefile
2570 include/Makefile
2571 m4/Makefile
2572 src/Makefile
2573 src/agent/Makefile
2574 src/agent/appagent/Makefile
2575 src/agent/core/Makefile
2576 src/agent/install/Makefile
2577 src/agent/libnxsd/Makefile
2578 src/agent/subagents/Makefile
2579 src/agent/subagents/aix/Makefile
2580 src/agent/subagents/darwin/Makefile
2581 src/agent/subagents/db2/Makefile
2582 src/agent/subagents/dbquery/Makefile
2583 src/agent/subagents/devemu/Makefile
2584 src/agent/subagents/ecs/Makefile
2585 src/agent/subagents/filemgr/Makefile
2586 src/agent/subagents/freebsd/Makefile
2587 src/agent/subagents/hpux/Makefile
2588 src/agent/subagents/informix/Makefile
2589 src/agent/subagents/ipso/Makefile
2590 src/agent/subagents/java/Makefile
2591 src/agent/subagents/java/java/Makefile
2592 src/agent/subagents/java/java/src/Makefile
2593 src/agent/subagents/java/java/src/main/Makefile
2594 src/agent/subagents/java/java/src/main/java/Makefile
2595 src/agent/subagents/java/java/src/main/java/org/Makefile
2596 src/agent/subagents/java/java/src/main/java/org/netxms/Makefile
2597 src/agent/subagents/java/java/src/main/java/org/netxms/agent/Makefile
2598 src/agent/subagents/linux/Makefile
2599 src/agent/subagents/lmsensors/Makefile
2600 src/agent/subagents/logwatch/Makefile
2601 src/agent/subagents/netbsd/Makefile
2602 src/agent/subagents/netsvc/Makefile
2603 src/agent/subagents/odbcquery/Makefile
2604 src/agent/subagents/openbsd/Makefile
2605 src/agent/subagents/oracle/Makefile
2606 src/agent/subagents/ping/Makefile
2607 src/agent/subagents/portCheck/Makefile
2608 src/agent/subagents/rpi/Makefile
2609 src/agent/subagents/sms/Makefile
2610 src/agent/subagents/sunos/Makefile
2611 src/agent/subagents/ups/Makefile
2612 src/agent/subagents/winnt/Makefile
2613 src/agent/subagents/winperf/Makefile
2614 src/agent/subagents/wmi/Makefile
2615 src/agent/tools/Makefile
2616 src/agent/tools/nxappget/Makefile
2617 src/agent/tools/nxapush/Makefile
2618 src/client/Makefile
2619 src/client/install/Makefile
2620 src/client/nxalarm/Makefile
2621 src/client/nxevent/Makefile
2622 src/client/nxlexer/Makefile
2623 src/client/nxpush/Makefile
2624 src/client/nxsms/Makefile
2625 src/client/scilexer/Makefile
2626 src/client/windows/Makefile
2627 src/client/windows/nxav/Makefile
2628 src/client/windows/nxav/res/Makefile
2629 src/client/windows/nxcon/Makefile
2630 src/client/windows/nxcon/icons/Makefile
2631 src/client/windows/nxcon/res/Makefile
2632 src/client/windows/nxnotify/Makefile
2633 src/client/windows/nxnotify/res/Makefile
2634 src/client/windows/nxuilib/Makefile
2635 src/client/windows/nxuilib/res/Makefile
2636 src/client/windows/nxuilib/sounds/Makefile
2637 src/db/Makefile
2638 src/db/dbdrv/Makefile
2639 src/db/dbdrv/db2/Makefile
2640 src/db/dbdrv/informix/Makefile
2641 src/db/dbdrv/odbc/Makefile
2642 src/db/dbdrv/mssql/Makefile
2643 src/db/dbdrv/mysql/Makefile
2644 src/db/dbdrv/oracle/Makefile
2645 src/db/dbdrv/pgsql/Makefile
2646 src/db/dbdrv/sqlite/Makefile
2647 src/db/libnxdb/Makefile
2648 src/install/Makefile
2649 src/install/windows/Makefile
2650 src/jansson/Makefile
2651 src/libexpat/Makefile
2652 src/libexpat/libexpat/Makefile
2653 src/libnetxms/Makefile
2654 src/libnxcl/Makefile
2655 src/libnxlp/Makefile
2656 src/libnxmap/Makefile
2657 src/libnxsl/Makefile
2658 src/libstrophe/Makefile
2659 src/libtre/Makefile
2660 src/libtre/win32/Makefile
2661 src/nxcproxy/Makefile
2662 src/nxlptest/Makefile
2663 src/nxscript/Makefile
2664 src/server/Makefile
2665 src/server/core/Makefile
2666 src/server/drivers/Makefile
2667 src/server/drivers/airespace/Makefile
2668 src/server/drivers/at/Makefile
2669 src/server/drivers/baystack/Makefile
2670 src/server/drivers/cat2900xl/Makefile
2671 src/server/drivers/catalyst/Makefile
2672 src/server/drivers/cisco-esw/Makefile
2673 src/server/drivers/cisco-sb/Makefile
2674 src/server/drivers/dell-pwc/Makefile
2675 src/server/drivers/dlink/Makefile
2676 src/server/drivers/ers8000/Makefile
2677 src/server/drivers/h3c/Makefile
2678 src/server/drivers/lib/Makefile
2679 src/server/drivers/lib/avaya-ers/Makefile
2680 src/server/drivers/lib/cisco/Makefile
2681 src/server/drivers/mikrotik/Makefile
2682 src/server/drivers/netscreen/Makefile
2683 src/server/drivers/ntws/Makefile
2684 src/server/drivers/ping3/Makefile
2685 src/server/drivers/procurve/Makefile
2686 src/server/drivers/symbol-ws/Makefile
2687 src/server/drivers/ubnt/Makefile
2688 src/server/hdlink/Makefile
2689 src/server/hdlink/jira/Makefile
2690 src/server/include/Makefile
2691 src/server/libnxsrv/Makefile
2692 src/server/netxmsd/Makefile
2693 src/server/pdsdrv/Makefile
2694 src/server/pdsdrv/rrdtool/Makefile
2695 src/server/smsdrv/Makefile
2696 src/server/smsdrv/dummy/Makefile
2697 src/server/smsdrv/generic/Makefile
2698 src/server/smsdrv/nxagent/Makefile
2699 src/server/smsdrv/portech/Makefile
2700 src/server/smsdrv/websms/Makefile
2701 src/server/tools/Makefile
2702 src/server/tools/nxaction/Makefile
2703 src/server/tools/nxadm/Makefile
2704 src/server/tools/nxap/Makefile
2705 src/server/tools/nxconfig/Makefile
2706 src/server/tools/nxconfig/res/Makefile
2707 src/server/tools/nxdbmgr/Makefile
2708 src/server/tools/nxget/Makefile
2709 src/server/tools/nxupload/Makefile
2710 src/snmp/Makefile
2711 src/snmp/libnxsnmp/Makefile
2712 src/snmp/nxmibc/Makefile
2713 src/snmp/nxsnmpget/Makefile
2714 src/snmp/nxsnmpset/Makefile
2715 src/snmp/nxsnmpwalk/Makefile
2716 src/sqlite/Makefile
2717 src/tools/Makefile
2718 src/tools/nxdevcfg/Makefile
2719 src/tools/nxencpasswd/Makefile
2720 src/zlib/Makefile
2721 sql/Makefile
2722 tests/Makefile
2723 tests/include/Makefile
2724 tests/test-libnetxms/Makefile
2725 tools/Makefile
2726 ])
2727
2728 AC_OUTPUT
2729
2730 echo "Updating libtool"
2731 sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2732
2733 # On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
2734 if test "x$ac_compiler_gnu" = "xyes" && test "x$PLATFORM" = "xHP-UX"; then
2735 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2736 fi
2737
2738 # On AIX, correct OBJECT_MODE must be set before linking
2739 # To avoid manual setting by user, we add this to libtool script
2740 if test "x$PLATFORM" = "xAIX"; then
2741 head -n 1 ./libtool > ./libtool.new
2742 echo "export OBJECT_MODE=$OBJECT_MODE" >> ./libtool.new
2743 tail -n +2 ./libtool >> ./libtool.new
2744 mv libtool.new libtool
2745 chmod +x ./libtool
2746 fi
2747
2748 #--------------------------------------------------------------------
2749 # Print summary
2750 #--------------------------------------------------------------------
2751
2752 echo
2753 echo
2754 echo
2755 echo '---------------------------------------------------------------------'
2756 echo ' Configure results'
2757 echo '---------------------------------------------------------------------'
2758 echo
2759 echo "Prefix : ${prefix}"
2760 echo "Platform : ${PLATFORM}"
2761 echo "Shared library suffix : ${SHLIB_SUFFIX}"
2762 if test "x${BUILD_SERVER}" = "xyes"; then
2763 echo "Build Server : YES"
2764 echo "Server libs : ${SERVER_LIBS}"
2765 if test "x${LDAP_SUPPORT}" = "xyes"; then
2766 echo "LDAP support : YES"
2767 else
2768 echo "LDAP support : NO"
2769 fi
2770 if test "x${XMPP_SUPPORT}" = "xyes"; then
2771 echo "XMPP support : YES"
2772 else
2773 echo "XMPP support : NO"
2774 fi
2775 else
2776 echo "Build Server : NO"
2777 fi
2778 if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
2779 echo "Encryption enabled : YES"
2780 else
2781 echo "Encryption enabled : NO"
2782 fi
2783 if test "x${DB_DRIVERS}" != "x"; then
2784 echo "Build DB-Drivers :${DB_DRIVERS}"
2785 else
2786 echo "Build DB-Drivers : NO"
2787 fi
2788 if test "x${BUILD_CLIENT}" = "xyes"; then
2789 echo "Build Clients : YES"
2790 else
2791 echo "Build Clients : NO"
2792 fi
2793 if test "x${BUILD_AGENT}" = "xyes"; then
2794 echo "Build Agent : YES"
2795 echo "Subagents list : ${SUBAGENT_DIRS}"
2796 else
2797 echo "Build Agent : NO"
2798 fi
2799 if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
2800 echo "Build Static Agent : YES"
2801 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
2802 else
2803 echo "Build Static Agent : NO"
2804 fi
2805 if test "x${BUILD_UNICODE}" = "xyes"; then
2806 echo "UNICODE build : YES"
2807 else
2808 echo "UNICODE build : NO"
2809 fi
2810 if test "x${HAVE_LIBEXPAT}" = "xno"; then
2811 echo "Use internal libexpat : YES"
2812 else
2813 echo "Use internal libexpat : NO"
2814 fi
2815 if test "x${HAVE_LIBTRE}" = "xno"; then
2816 echo "Use internal libtre : YES"
2817 else
2818 echo "Use internal libtre : NO"
2819 fi
2820 if test "x${HAVE_JANSSON}" = "xno"; then
2821 echo "Use internal libjansson : YES"
2822 else
2823 echo "Use internal libjansson : NO"
2824 fi
2825 if test "x${NEED_ZLIB}" = "xyes"; then
2826 if test "x${HAVE_ZLIB}" = "xno"; then
2827 echo "Use internal zlib : YES"
2828 else
2829 echo "Use internal zlib : NO"
2830 fi
2831 fi
2832 if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
2833 echo "Force 32bit build : YES"
2834 else
2835 echo "Force 32bit build : NO"
2836 fi
2837
2838 echo "C compiler : ${CC}"
2839 echo "C++ compiler : ${CXX}"
2840 echo "CPPFLAGS : ${CPPFLAGS}"
2841 echo "CXXFLAGS : ${CXXFLAGS}"
2842 echo "CFLAGS : ${CFLAGS}"
2843 echo "LDFLAGS : ${LDFLAGS}"
2844 echo "LIBS : ${LIBS}"
2845
2846 if test "x${MYSQL_CPPFLAGS}" != "x"; then
2847 echo "MySQL CPPFLAGS : ${MYSQL_CPPFLAGS}"
2848 fi
2849 if test "x${MYSQL_LDFLAGS}" != "x"; then
2850 echo "MySQL LDFLAGS : ${MYSQL_LDFLAGS}"
2851 fi
2852 if test "x${MYSQL_LIBS}" != "x"; then
2853 echo "MySQL LIBS : ${MYSQL_LIBS}"
2854 fi
2855
2856 if test "x${PGSQL_CPPFLAGS}" != "x"; then
2857 echo "PostgreSQL CPPFLAGS : ${PGSQL_CPPFLAGS}"
2858 fi
2859 if test "x${PGSQL_LDFLAGS}" != "x"; then
2860 echo "PostgreSQL LDFLAGS : ${PGSQL_LDFLAGS}"
2861 fi
2862 if test "x${PGSQL_LIBS}" != "x"; then
2863 echo "PostgreSQL LIBS : ${PGSQL_LIBS}"
2864 fi
2865
2866 if test "x${ORACLE_CPPFLAGS}" != "x"; then
2867 echo "Oracle CPPFLAGS : ${ORACLE_CPPFLAGS}"
2868 fi
2869 if test "x${ORACLE_LDFLAGS}" != "x"; then
2870 echo "Oracle LDFLAGS : ${ORACLE_LDFLAGS}"
2871 fi
2872 if test "x${ORACLE_LIBS}" != "x"; then
2873 echo "Oracle LIBS : ${ORACLE_LIBS}"
2874 fi
2875
2876 if test "x${ODBC_CPPFLAGS}" != "x"; then
2877 echo "ODBC CPPFLAGS : ${ODBC_CPPFLAGS}"
2878 fi
2879 if test "x${ODBC_LDFLAGS}" != "x"; then
2880 echo "ODBC LDFLAGS : ${ODBC_LDFLAGS}"
2881 fi
2882 if test "x${ODBC_LIBS}" != "x"; then
2883 echo "ODBC LIBS : ${ODBC_LIBS}"
2884 fi
2885
2886 if test "x${DB2_CPPFLAGS}" != "x"; then
2887 echo "DB2 CPPFLAGS : ${DB2_CPPFLAGS}"
2888 fi
2889 if test "x${DB2_LDFLAGS}" != "x"; then
2890 echo "DB2 LDFLAGS : ${DB2_LDFLAGS}"
2891 fi
2892 if test "x${DB2_LIBS}" != "x"; then
2893 echo "DB2 LIBS : ${DB2_LIBS}"
2894 fi
2895
2896 if test "x${INFORMIX_CPPFLAGS}" != "x"; then
2897 echo "Informix CPPFLAGS : ${INFORMIX_CPPFLAGS}"
2898 fi
2899 if test "x${INFORMIX_LDFLAGS}" != "x"; then
2900 echo "Informix LDFLAGS : ${INFORMIX_LDFLAGS}"
2901 fi
2902 if test "x${INFORMIX_LIBS}" != "x"; then
2903 echo "Informix LIBS : ${INFORMIX_LIBS}"
2904 fi
2905
2906 FLAGS_CPP="src/tools/nxdevcfg/flags.cpp"
2907 echo "/* Automatically generated by configure */" > $FLAGS_CPP
2908 echo "#include <nms_common.h>" >> $FLAGS_CPP
2909 echo "const TCHAR *g_cppFlags = _T(\"${CPPFLAGS}\");" >> $FLAGS_CPP
2910 echo "const TCHAR *g_cFlags = _T(\"${CFLAGS}\");" >> $FLAGS_CPP
2911 echo "const TCHAR *g_cxxFlags = _T(\"${CXXFLAGS}\");" >> $FLAGS_CPP
2912 echo "const TCHAR *g_ldFlags = _T(\"${LDFLAGS}\");" >> $FLAGS_CPP
2913 echo "const TCHAR *g_libs = _T(\"${LIBS}\");" >> $FLAGS_CPP
2914 echo "const TCHAR *g_cc = _T(\"${CC}\");" >> $FLAGS_CPP
2915 echo "const TCHAR *g_cxx = _T(\"${CXX}\");" >> $FLAGS_CPP
2916 echo "const TCHAR *g_ld = _T(\"${LD}\");" >> $FLAGS_CPP
2917 echo "const TCHAR *g_perl = _T(\"${PERL}\");" >> $FLAGS_CPP