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