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