Version number changed
[public/netxms.git] / configure.ac
1 # $Id: configure.ac,v 1.220 2006-11-15 16:45:44 victor Exp $
2 #
3 # Process this file with autoconf to produce a configure script.
4 #
5
6 AC_INIT([NetXMS], [0.2.14], [NetXMS Team <bugs@netxms.org>])
7 AC_CONFIG_AUX_DIR(config)
8 AM_CONFIG_HEADER(config.h)
9 AM_INIT_AUTOMAKE
10
11 PLATFORM=`uname -s`
12
13 ALL_STATIC_FLAG=""
14
15 # --------------------------------------------------------------------------
16 # checks for programs.
17
18 if test "x$PLATFORM" = "xHP-UX"; then
19 CCC="aCC"
20 fi
21 AC_PROG_CC(aCC gcc cc cl)
22 AC_PROG_CPP
23 AC_PROG_CXX
24 AC_PROG_INSTALL
25 AC_PROG_LEX
26 AC_PROG_YACC
27 AC_PROG_LN_S
28
29 # --------------------------------------------------------------------------
30 # Misc. settings
31 #CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 -D_THREAD_SAFE"
32 CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 -D_THREAD_SAFE"
33 SUBAGENT_LIBS=""
34
35 # --------------------------------------------------------------------------
36 # disable C++ exceptions
37
38 if test "x$CC" = "xgcc" ; then
39
40 AC_LANG_PUSH([C++])
41
42 AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti)
43 OLD_CXXFLGAS="$CXXFLAGS"
44 CXXFLAGS="$CXXFLAGS -fno-rtti"
45 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
46 [ AC_MSG_RESULT(yes) ],
47 [
48 CXXFLAGS="$OLD_CXXFLAGS"
49 AC_MSG_RESULT(no)
50 ])
51
52 AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions)
53 OLD_CXXFLGAS="$CXXFLAGS"
54 CXXFLAGS="$CXXFLAGS -fno-exceptions"
55 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
56 [ AC_MSG_RESULT(yes) ],
57 [
58 CXXFLAGS="$OLD_CXXFLAGS"
59 AC_MSG_RESULT(no)
60 ])
61
62 AC_LANG_POP([C++])
63
64 fi
65
66 # --------------------------------------------------------------------------
67 # set CPPFLAGS and LDFLAGS depending on OS
68
69 case "$PLATFORM" in
70 AIX)
71 LDFLAGS="-no-undefined $LDFLAGS"
72 ;;
73 HP-UX)
74 CPPFLAGS="$CPPFLAGS -D_HPUX -D_HPUX_SOURCE"
75 if test "x$CXX" = "xaCC"; then
76 CXXFLAGS="-mt $CXXFLAGS +W749 +W829"
77 LDFLAGS="$LDFLAGS -mt"
78 fi
79 ;;
80 *)
81 ;;
82 esac
83
84 # --------------------------------------------------------------------------
85 # misc
86
87 AC_ARG_VAR(PERL,local path to the perl interpreter)
88 perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin"
89 AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path)
90
91 if test -d /usr/local/include; then
92 CFLAGS="$CFLAGS -I/usr/local/include"
93 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
94 fi
95
96 if test -d /usr/kerberos/include; then
97 CFLAGS="$CFLAGS -I/usr/kerberos/include"
98 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
99 fi
100
101 if test -d /usr/local/lib; then
102 LDFLAGS="$LDFLAGS -L/usr/local/lib"
103 fi
104
105 # --------------------------------------------------------------------------
106 # command line options
107
108 AC_ARG_WITH(sqlite,
109 [AS_HELP_STRING(--with-sqlite,build SQLite database driver)],
110 [ if test "x$withval" != "xno" ; then
111 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
112 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
113 LDFLAGS="$LDFLAGS -L${withval}/lib"
114 CPPFLAGS="$CPPFLAGS -I${withval}/include"
115 fi
116 DYNAMIC_COMPONENTS="yes"
117 with_sqlite="yes"
118 AC_DEFINE(WITH_SQLITE,,[with sqlite])
119 DB_DRIVERS="$DB_DRIVERS sqlite"
120 AC_CHECK_LIB(sqlite3, sqlite3_open, ,
121 [AC_MSG_ERROR(libsqlite3 is required for SQLite support)])
122 fi ])
123
124 AC_ARG_WITH(odbc,
125 [AS_HELP_STRING(--with-odbc,build ODBC database driver)],
126 [ if test "x$withval" != "xno" ; then
127 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
128 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
129 LDFLAGS="$LDFLAGS -L${withval}/lib"
130 CPPFLAGS="$CPPFLAGS -I${withval}/include"
131 fi
132 DYNAMIC_COMPONENTS="yes"
133 with_odbc="yes"
134 AC_DEFINE(WITH_ODBC,,[with odbc])
135 DB_DRIVERS="$DB_DRIVERS odbc"
136 AC_CHECK_LIB(odbc, SQLAllocHandle, ,
137 [AC_MSG_ERROR(libodbc is required for ODBC support)])
138 fi ])
139
140 AC_ARG_WITH(mysql,
141 [AS_HELP_STRING(--with-mysql,build MySQL database driver)],
142 [ if test "x$withval" != "xno" ; then
143 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
144 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
145 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/mysql -L${withval}/mysql/lib"
146 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include"
147 else
148 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}"
149 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"
150 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"
151 fi
152 DYNAMIC_COMPONENTS="yes"
153 AC_CHECK_LIB(m, floor)
154 with_mysql="yes"
155 AC_DEFINE(WITH_MYSQL,,[with mysql])
156 DB_DRIVERS="$DB_DRIVERS mysql"
157 AC_CHECK_LIB(mysqlclient, mysql_init, ,
158 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
159 AC_MSG_CHECKING(whether mysql clients can run)
160 AC_RUN_IFELSE([AC_LANG_SOURCE([[
161 #include <stdio.h>
162 #include <mysql.h>
163 int main(void)
164 {
165 MYSQL *a = mysql_init(NULL);
166 return 0;
167 }
168 ]])],[],[
169 AC_MSG_RESULT(no)
170 AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)
171 ],[])
172 AC_MSG_RESULT(yes)
173 AC_CHECK_FUNCS(mysql_real_escape_string)
174 fi ])
175
176 AC_ARG_WITH(pgsql,
177 [AS_HELP_STRING(--with-pgsql,build PostgreSQL database driver)],
178 [ if test "x$withval" != "xno" ; then
179 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
180 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
181 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/pgsql -L${withval}/lib/postgresql -L${withval}/pgsql/lib -L${withval}/postgresql/lib"
182 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/pgsql -I${withval}/include/postgresql -I${withval}/pgsql/include -I${withval}/postgresql/include"
183 else
184 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}"
185 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"
186 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"
187 fi
188 DYNAMIC_COMPONENTS="yes"
189 AC_CHECK_LIB(m, floor)
190 with_pgsql="yes"
191 DB_DRIVERS="$DB_DRIVERS pgsql"
192 AC_DEFINE(WITH_PGSQL,,[with pgsql])
193 AC_CHECK_LIB(pq, PQconnectdb, ,
194 [AC_MSG_ERROR(libpq is required for PostgreSQL support)])
195 AC_MSG_CHECKING(whether postgresql clients can run)
196 AC_RUN_IFELSE([AC_LANG_SOURCE([[
197 #include <stdio.h>
198 #include <libpq-fe.h>
199 int main(void)
200 {
201 PGconn *a = PQconnectdb("");
202 return 0;
203 }
204 ]])],[],[
205 AC_MSG_RESULT(no)
206 AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
207 ],[])
208 AC_MSG_RESULT(yes)
209 fi ])
210
211 AC_ARG_WITH(server,
212 [AS_HELP_STRING(--with-server,build server)],
213 [
214 MODULES="$MODULES libnxmap libnxsnmp libnxsl server nxmibc nxscript"
215 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES sql images"
216 CONTRIB_MODULES="$CONTRIB_MODULES mibs backgrounds"
217 BUILD_SERVER="yes"
218 DYNAMIC_COMPONENTS="yes"
219 NEED_ZLIB="yes"
220 ])
221
222
223 AC_ARG_WITH(client,
224 [AS_HELP_STRING(--with-client,build client library and tools)],
225 [
226 MODULES="$MODULES libnxmap libnxcl nxevent nxpush nxreport console"
227 BUILD_CLIENT="yes"
228 DYNAMIC_COMPONENTS="yes"
229 ])
230
231
232 AC_ARG_WITH(mdebug,
233 [AS_HELP_STRING(--with-mdebug,use debug version of memory allocation functions)],
234 [
235 CFLAGS="$CFLAGS -DNETXMS_MEMORY_DEBUG"
236 CPPFLAGS="$CPPFLAGS -DNETXMS_MEMORY_DEBUG"
237 ])
238
239
240 SUBAGENT_DIRS=""
241 AC_ARG_WITH(agent,
242 [AS_HELP_STRING(--with-agent,build agent)],
243 [
244 BUILD_AGENT=yes
245 MODULES="$MODULES agent"
246 case "$PLATFORM" in
247 Linux)
248 SUBAGENT_DIRS="linux"
249 ;;
250 FreeBSD)
251 SUBAGENT_DIRS="freebsd"
252 ;;
253 OpenBSD)
254 SUBAGENT_DIRS="openbsd"
255 ;;
256 SunOS)
257 SUBAGENT_DIRS="sunos"
258 ;;
259 AIX)
260 SUBAGENT_DIRS="aix"
261 ;;
262 HP-UX)
263 SUBAGENT_DIRS="hpux"
264 ;;
265 *)
266 # unknown
267 ;;
268 esac
269 DYNAMIC_COMPONENTS="yes"
270 ])
271
272 AC_ARG_WITH(static-agent,
273 [AS_HELP_STRING(--with-static-agent,build statically linked agent)],
274 [
275 BUILD_STATIC_AGENT="yes"
276 MODULES="$MODULES agent"
277 CFLAGS="$CFLAGS -D_STATIC_AGENT"
278 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT"
279 LDFLAGS="$LDFLAGS"
280 ALL_STATIC_FLAG="-all-static"
281 #STATIC_SUBAGENT_LIST="ping portcheck"
282 case `uname -s` in
283 Linux)
284 SUBAGENT_DIRS="linux"
285 SUBAGENT_LIBS="../subagents/linux/libnsm_linux.la"
286 STATIC_SUBAGENT_LIST="linux $STATIC_SUBAGENT_LIST"
287 ;;
288 FreeBSD)
289 SUBAGENT_DIRS="freebsd"
290 SUBAGENT_LIBS="../subagents/freebsd/libnsm_freebsd.la"
291 STATIC_SUBAGENT_LIST="freebsd $STATIC_SUBAGENT_LIST"
292 ;;
293 OpenBSD)
294 SUBAGENT_DIRS="openbsd"
295 SUBAGENT_LIBS="../subagents/openbsd/libnsm_openbsd.la"
296 STATIC_SUBAGENT_LIST="openbsd $STATIC_SUBAGENT_LIST"
297 ;;
298 SunOS)
299 SUBAGENT_DIRS="sunos"
300 SUBAGENT_LIBS="../subagents/sunos/libnsm_sunos.la"
301 STATIC_SUBAGENT_LIST="sunos $STATIC_SUBAGENT_LIST"
302 ;;
303 AIX)
304 SUBAGENT_DIRS="aix"
305 SUBAGENT_LIBS="../subagents/aix/libnsm_aix.la"
306 STATIC_SUBAGENT_LIST="aix $STATIC_SUBAGENT_LIST"
307 ;;
308 HP-UX)
309 SUBAGENT_DIRS="hpux"
310 SUBAGENT_LIBS="../subagents/hpux/libnsm_hpux.la"
311 STATIC_SUBAGENT_LIST="hpux $STATIC_SUBAGENT_LIST"
312 ;;
313 *)
314 # unknown
315 ;;
316 esac
317 ])
318
319 AC_ARG_WITH(ipso-agent,
320 [AS_HELP_STRING(--with-ipso-agent,build statically linked IPSO agent)],
321 [
322 BUILD_STATIC_AGENT="yes"
323 MODULES="$MODULES agent"
324 CFLAGS="$CFLAGS -D_STATIC_AGENT -D_IPSO"
325 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT -D_IPSO"
326 LDFLAGS="$LDFLAGS -all-static"
327 STATIC_SUBAGENT_LIST="ipso ping portcheck ups"
328 SUBAGENT_DIRS="ipso"
329 SUBAGENT_LIBS="../subagents/ipso/libnsm_ipso.la ../subagents/ping/libnsm_ping.la ../subagents/portCheck/libnsm_portCheck.la ../subagents/ups/libnsm_ups.la"
330 ])
331
332 UNSTABLE_SUBAGENT_DIRS=""
333 AC_ARG_ENABLE(unstable,
334 [AS_HELP_STRING(--enable-unstable,build experimental/unstable components)],
335 [
336 UNSTABLE_SUBAGENT_DIRS="logscan"
337 ])
338
339 AC_ARG_ENABLE(iconv,
340 [AS_HELP_STRING(--disable-iconv,do not use iconv() for text conversions)],
341 [
342 DISABLE_ICONV="yes"
343 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
344 ])
345
346 AC_ARG_WITH(dist,
347 [AS_HELP_STRING(--with-dist,for maintainers only)],
348 DB_DRIVERS="mysql pgsql odbc mssql sqlite"
349 MODULES="libnxsnmp libnxsl server agent libnxmap libnxcl nxevent nxpush nxreport nxmibc console nxhttpd nxscript"
350 SUBAGENT_DIRS="linux freebsd openbsd sunos aix ipso hpux"
351 NXCONFIG="nxconfig"
352 TOP_LEVEL_MODULES="sql images"
353 CONTRIB_MODULES="mibs backgrounds"
354 UNSTABLE_SUBAGENT_DIRS="logscan"
355 )
356
357 AC_ARG_WITH(nxhttpd,
358 [AS_HELP_STRING(--with-nxhttpd,build web interface)],
359 [
360 if test "x$withval" != "xno" ; then
361 MODULES="$MODULES libnxmap libnxcl nxhttpd"
362 BUILD_WEB_CLIENT="yes"
363 DYNAMIC_COMPONENTS="yes"
364 fi
365 ])
366
367 AC_ARG_ENABLE(encryption,
368 [AS_HELP_STRING(--disable-encryption,disable encryption support)],
369 [
370 DISABLE_ENCRYPTION="yes"
371 ])
372
373 if test "x$DISABLE_ENCRYPTION" != "xyes"; then
374 AC_ARG_WITH(openssl,
375 [AS_HELP_STRING(--with-openssl,specify OpenSSL location)],
376 [
377 if test "x$withval" != "xno" ; then
378 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
379 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
380 LDFLAGS="$LDFLAGS -L${withval}/lib"
381 CPPFLAGS="$CPPFLAGS -I${withval}/include"
382 else
383 LD_RUN_PATH="/usr/local/lib:/opt/openssl/lib:/usr/local/ssl/lib:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
384 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/opt/openssl/lib"
385 CPPFLAGS="$CPPFLAGS -I/usr/local/include -I/opt/openssl/include"
386 fi
387 AC_CHECK_LIB(crypto, RSA_new,
388 [
389 AC_DEFINE(WITH_OPENSSL,,[with openssl])
390 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
391 [], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
392 AC_CHECK_LIB(crypto, EVP_bf_cbc,
393 [], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
394 AC_CHECK_LIB(crypto, EVP_idea_cbc,
395 [], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
396 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
397 [], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
398 ],
399 [AC_MSG_ERROR(libcrypto is required for encryption support)])
400 fi
401 ],
402 [
403 AC_CHECK_LIB(crypto, RSA_new,
404 [
405 AC_DEFINE(WITH_OPENSSL,,[with openssl])
406 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
407 [], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
408 AC_CHECK_LIB(crypto, EVP_bf_cbc,
409 [], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
410 AC_CHECK_LIB(crypto, EVP_idea_cbc,
411 [], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
412 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
413 [], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
414 ],
415 [AC_MSG_RESULT(libcrypto is required for encryption support)])
416 ])
417 fi
418
419 AC_SUBST(DB_DRIVERS)
420 AC_SUBST(MODULES)
421 AC_SUBST(SUBAGENT_DIRS)
422 AC_SUBST(NXCONFIG)
423 AC_SUBST(TOP_LEVEL_MODULES)
424 AC_SUBST(CONTRIB_MODULES)
425 AC_SUBST(STATIC_SUBAGENT_LIST)
426 AC_SUBST(SUBAGENT_LIBS)
427 AC_SUBST(BUILD_SERVER)
428 AC_SUBST(UNSTABLE_SUBAGENT_DIRS)
429
430 # --------------------------------------------------------------------------
431 # If --with-static-agent selected, other components cannot be selected
432 # Select shared or static libraries depending on agent build type
433 if test "x$BUILD_STATIC_AGENT" = "xyes" ; then
434 if test "x$DYNAMIC_COMPONENTS" = "xyes" ; then
435 AC_MSG_ERROR(Static agent and other components are mutally exclusive.)
436 fi
437 enable_shared=no
438 else
439 enable_static=no
440 fi
441
442 AC_LIBTOOL_DLOPEN
443 AC_PROG_LIBTOOL
444
445 # --------------------------------------------------------------------------
446 # checks for libs.
447
448 #AC_CHECK_LIB([socket], [socket])
449 #AC_CHECK_LIB([nsl], [gethostbyname])
450
451 AC_CHECK_LIB(socket, if_nameindex)
452 AC_CHECK_LIB(dl, dlopen)
453 AC_CHECK_LIB(kstat, kstat_open)
454
455 if test "x$BUILD_SERVER" = "xyes" ; then
456 AC_CHECK_LIB(termcap, tgetstr, [], [AC_CHECK_LIB(ncurses, tgetstr, [], AC_CHECK_LIB(curses, tgetstr))])
457 AC_CHECK_LIB(readline, readline)
458 fi
459
460 # --------------------------------------------------------------------------
461 # checks for headers.
462
463 AC_HEADER_STDC
464 AC_HEADER_STAT
465 AC_HEADER_TIME
466 AC_CHECK_HEADERS([stdarg.h])
467 AC_CHECK_HEADERS([sys/int_types.h sys/time.h])
468 AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h net/nh.h sys/socket.h])
469 AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
470 AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h],,,
471 [[#ifdef HAVE_SYS_TYPES_H
472 # include <sys/types.h>
473 #endif
474 #ifdef HAVE_SYS_TIME_H
475 # include <sys/time.h>
476 #endif
477 #ifdef HAVE_SYS_SOCKET_H
478 # include <sys/socket.h>
479 #endif
480 ]])
481 AC_CHECK_HEADERS([readline/readline.h])
482 AC_CHECK_HEADERS([byteswap.h])
483 AC_CHECK_HEADERS([sys/mman.h])
484 AC_CHECK_HEADERS([sys/utsname.h])
485
486 # --------------------------------------------------------------------------
487 # types
488 AC_CHECK_SIZEOF(short)
489 AC_CHECK_SIZEOF(int)
490 AC_CHECK_SIZEOF(long)
491 AC_CHECK_SIZEOF(long long)
492
493 AC_TYPE_PID_T
494 AC_TYPE_SIGNAL
495 AC_TYPE_SIZE_T
496 AC_STRUCT_TIMEZONE
497
498 AC_CHECK_TYPES([int64_t, uint64_t, u_int64_t])
499 AC_CHECK_TYPES([off_t, socklen_t],,,[
500 #if HAVE_SYS_TYPES_H
501 #include <sys/types.h>
502 #endif
503 #if HAVE_SYS_SOCKET_H
504 #include <sys/socket.h>
505 #endif
506 ])
507
508 # --------------------------------------------------------------------------
509 # C/CPP caps
510
511 AC_PROG_GCC_TRADITIONAL
512 AC_C_CONST
513 AC_C_BIGENDIAN
514
515 # --------------------------------------------------------------------------
516 # check for zlib
517
518 if test "x$NEED_ZLIB" = "xyes"; then
519 AC_CHECK_HEADER(zlib.h,,AC_MSG_ERROR([*** ZLib development package not installed - please install first ***]))
520 AC_CHECK_LIB(z, deflate)
521 fi
522
523 # --------------------------------------------------------------------------
524 # macros
525
526 AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
527 #ifdef HAVE_SYS_TYPES_H
528 # include <sys/types.h>
529 #endif
530 #if HAVE_BYTESWAP_H
531 #include <byteswap.h>
532 #endif
533 #if HAVE_NETINET_IN_H
534 #include <netinet/in.h>
535 #endif
536 #if HAVE_NET_NH_H
537 #include <net/nh.h>
538 #endif
539 ])
540 AC_CHECK_DECLS([SIOCGIFADDR, SIOCGIFNETMASK, SIOCGIFHWADDR],,,[
541 #if HAVE_SYS_IOCTL_H
542 #include <sys/ioctl.h>
543 #endif
544 #if HAVE_SYS_SOCKIO_H
545 #include <sys/sockio.h>
546 #endif
547 ])
548
549 # --------------------------------------------------------------------------
550 # AIX specific
551
552 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
553 AC_CHECK_DECLS([getkerninfo])
554 AC_CHECK_FUNCS([getprocs64],,,[
555 #if HAVE_PROCINFO_H
556 #include <procinfo.h>
557 #endif
558 ])
559
560 # --------------------------------------------------------------------------
561 # library functions
562
563 AC_FUNC_ERROR_AT_LINE
564 #AC_FUNC_MALLOC
565 #AC_FUNC_REALLOC
566 AC_FUNC_MEMCMP
567 AC_FUNC_SELECT_ARGTYPES
568 AC_FUNC_STRFTIME
569 AC_FUNC_STRTOD
570 AC_FUNC_VPRINTF
571
572 AC_CHECK_FUNCS([gettimeofday memmove memset strchr strcspn strdup strerror])
573 AC_CHECK_FUNCS([strrchr strtol strtoul strtoll strtoull])
574 AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
575 AC_CHECK_FUNCS([nanosleep getopt_long])
576
577 AC_CHECK_HEADERS([sys/sysctl.h vm/vm_param.h])
578 AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
579
580 AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
581
582 # sockets/resolver (probably for solaris)
583 AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
584 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
585 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
586
587 if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
588 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
589 fi
590
591 if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
592 AC_MSG_CHECKING([if we can include libnsl + libsocket])
593 LIBS="-lnsl -lsocket $LIBS"
594 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
595 if test "$my_ac_link_result" = "no" ; then
596 AC_MSG_RESULT([failure])
597 AC_MSG_ERROR([unable to use gethostbyname()])
598 else
599 AC_MSG_RESULT([success])
600 fi
601 fi
602
603 #ALK: CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" PTHREAD_LIBS="-pthread",
604 # posix threads
605 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
606
607
608 # --------------------------------------------------------------------------
609 # check for pthread library
610
611 if test "x$CXX" = "xaCC"; then
612 PTHREAD_LIBS=""
613 else
614 PTHREAD_LIBS=error
615 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
616 AC_EGREP_CPP(yes,
617 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
618 yes
619 #endif
620 ], AC_MSG_RESULT(yes)
621 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" PTHREAD_LIBS="-pthread",
622 AC_MSG_RESULT(no))
623 if test "x$PTHREAD_LIBS" = xerror; then
624 AC_CHECK_LIB(pthread, pthread_attr_init,
625 PTHREAD_LIBS="-lpthread")
626 fi
627 if test "x$PTHREAD_LIBS" = xerror; then
628 AC_CHECK_LIB(pthreads, pthread_attr_init,
629 PTHREAD_LIBS="-lpthreads")
630 fi
631 if test "x$PTHREAD_LIBS" = xerror; then
632 AC_CHECK_FUNC(pthread_attr_init,
633 PTHREAD_LIBS="")
634 fi
635 fi
636
637 # HP-UX
638 #if test "x$PTHREAD_LIBS" = xerror; then
639 # AC_CHECK_LIB(pthread, __pthread_attr_init_system,
640 # PTHREAD_LIBS="-lpthread")
641 #fi
642
643 if test "x$PTHREAD_LIBS" = xerror; then
644 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
645 fi
646 LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
647 AC_SUBST(PTHREAD_LIBS)
648
649 # Extensions to posix threads
650 AC_CHECK_HEADERS([pthread_np.h],,,[
651 #include <pthread.h>
652 ])
653 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
654
655 # Check for recursive mutexes
656 AC_CHECK_FUNCS([pthread_mutexattr_settype pthread_mutexattr_setkind_np])
657 AC_CHECK_DECLS([PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
658 #include <pthread.h>
659 #if HAVE_PTHREAD_NP_H
660 #include <pthread_np.h>
661 #endif
662 ])
663
664 # Check for read/write locks
665 # On Linux, rwlock functions declared always, but pthread_rwlock_t may need
666 # additional defines
667 AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
668 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
669 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
670 [AC_TRY_COMPILE([#include <sys/types.h>
671 #include <pthread.h>],
672 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
673 ac_cv_struct_pthread_rw=yes, [
674 AC_TRY_COMPILE([#define _XOPEN_SOURCE 500
675 #include <sys/types.h>
676 #include <pthread.h>],
677 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
678 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
679 if test "$ac_cv_struct_pthread_rw" = "yes"; then
680 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
681 fi
682 ])])
683 if test "$ac_cv_struct_pthread_rw" = "yes"; then
684 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
685 fi
686 fi
687
688 # --------------------------------------------------------------------------
689 # check for UNICODE stuff
690
691 AC_CHECK_HEADERS([wchar.h iconv.h])
692 AC_CHECK_SIZEOF(wchar_t)
693
694 if test "x$DISABLE_ICONV" != "xyes"; then
695 AC_CHECK_LIB(iconv, iconv,
696 [ ac_found_iconv=yes
697 LDFLAGS="$LDFLAGS -liconv"
698 ])
699 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
700 else
701 ac_found_iconv=no
702 fi
703
704 AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
705 AC_RUN_IFELSE(
706 [AC_LANG_PROGRAM([
707 #if HAVE_ICONV_H
708 #include <iconv.h>
709 #endif
710 ], [
711 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
712 ])
713 ],
714 [ AC_MSG_RESULT(yes)
715 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
716 valid_ucs2_code="UCS-2-INTERNAL"
717 ],
718 [ AC_MSG_RESULT(no) ],
719 [ AC_MSG_RESULT(no) ]
720 )
721
722 AC_MSG_CHECKING(whether iconv supports UCS-2)
723 AC_RUN_IFELSE(
724 [AC_LANG_PROGRAM([
725 #if HAVE_ICONV_H
726 #include <iconv.h>
727 #endif
728 ], [
729 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
730 ])
731 ],
732 [ AC_MSG_RESULT(yes)
733 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
734 valid_ucs2_code="UCS-2"
735 ],
736 [ AC_MSG_RESULT(no) ],
737 [ AC_MSG_RESULT(yes)
738 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
739 ]
740 )
741
742 AC_MSG_CHECKING(whether iconv supports UCS2)
743 AC_RUN_IFELSE(
744 [AC_LANG_PROGRAM([
745 #if HAVE_ICONV_H
746 #include <iconv.h>
747 #endif
748 ], [
749 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
750 ])
751 ],
752 [ AC_MSG_RESULT(yes)
753 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
754 valid_ucs2_code="UCS2"
755 ],
756 [ AC_MSG_RESULT(no) ],
757 [ AC_MSG_RESULT(no) ]
758 )
759
760 AC_MSG_CHECKING(whether iconv supports UCS-2BE)
761 AC_RUN_IFELSE(
762 [AC_LANG_PROGRAM([
763 #if HAVE_ICONV_H
764 #include <iconv.h>
765 #endif
766 ], [
767 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
768 ])
769 ],
770 [ AC_MSG_RESULT(yes)
771 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
772 valid_ucs2_code="UCS-2BE"
773 ],
774 [ AC_MSG_RESULT(no) ],
775 [ AC_MSG_RESULT(no) ]
776 )
777
778 AC_MSG_CHECKING(whether iconv supports //IGNORE)
779 AC_RUN_IFELSE(
780 [AC_LANG_PROGRAM([
781 #if HAVE_ICONV_H
782 #include <iconv.h>
783 #endif
784 ], [
785 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
786 ])
787 ],
788 [ AC_MSG_RESULT(yes)
789 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
790 ],
791 [ AC_MSG_RESULT(no) ],
792 [ AC_MSG_RESULT(no) ]
793 )
794
795 # taken from ZSH's configure
796 # Check if iconv uses const in prototype declaration
797 if test "x$ac_found_iconv" = "xyes"; then
798 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
799 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
800 #include <iconv.h>]],
801 [[#ifdef __cplusplus
802 "C"
803 #endif
804 #if defined(__STDC__) || defined(__cplusplus)
805 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
806 #else
807 size_t iconv();
808 #endif]])],
809 [ac_cv_iconv_const=],
810 [ac_cv_iconv_const=const])])
811 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
812 [Define as const if the declaration of iconv() needs const.])
813 fi
814
815
816 if test $ac_cv_sizeof_wchar_t -eq 2; then
817 AC_DEFINE(HAVE_USEABLE_WCHAR_T, 1, Define to 1 if you have useable wchar_t)
818 fi
819
820 # --------------------------------------------------------------------------
821 # variables
822
823 AC_SUBST(ALL_STATIC_FLAG)
824
825 # misc
826 CPPFLAGS="$CPPFLAGS -DDATADIR=\\\"\${pkgdatadir}\\\" -DLIBDIR=\\\"\${libdir}\\\""
827
828 # --------------------------------------------------------------------------
829
830 # shared libs versions
831 #
832 # versioning scheme: current:revision:age
833 #
834 # current
835 # The number of the current interface exported by the library. A current
836 # value of `0', means that you are calling the interface exported by this
837 # library interface 0.
838 #
839 # revision
840 # The implementation number of the most recent interface exported by this
841 # library. In this case, a revision value of `0' means that this is the
842 # first implementation of the interface.
843 # If the next release of this library exports the same interface, but has a
844 # different implementation (perhaps some bugs have been fixed), the revision
845 # number will be higher, but current number will be the same. In that case,
846 # when given a choice, the library with the highest revision will always
847 # be used by the runtime loader.
848 #
849 # age
850 # The number of previous additional interfaces supported by this library.
851 # If age were `2', then this library can be linked into executables which
852 # were built with a release of this library that exported the current
853 # interface number, current, or any of the previous two interfaces.
854 # By definition age must be less than or equal to current. At the outset,
855 # only the first ever interface is implemented, so age can only be `0'.
856 #
857 #
858 #
859
860 NETXMS_LIBRARY_VERSION=0:2:0
861 AC_SUBST(NETXMS_LIBRARY_VERSION)
862
863 # --------------------------------------------------------------------------
864
865 AC_CONFIG_FILES([
866 README
867 Makefile
868 contrib/Makefile
869 contrib/dct/Makefile
870 contrib/startup/Makefile
871 contrib/startup/gentoo/Makefile
872 contrib/startup/redhat/Makefile
873 contrib/mibs/Makefile
874 contrib/backgrounds/Makefile
875 doc/Makefile
876 doc/internal/Makefile
877 doc/manuals/Makefile
878 doc/misc/Makefile
879 images/Makefile
880 include/Makefile
881 m4/Makefile
882 netware/Makefile
883 sql/Makefile
884 src/Makefile
885 src/libnetxms/Makefile
886 src/libnxsnmp/Makefile
887 src/libnxcl/Makefile
888 src/libnxsl/Makefile
889 src/libnxmap/Makefile
890 src/install/Makefile
891 src/install/windows/Makefile
892 src/console/Makefile
893 src/console/nxuilib/Makefile
894 src/console/nxuilib/res/Makefile
895 src/console/nxuilib/sounds/Makefile
896 src/console/nxlexer/Makefile
897 src/console/win32/Makefile
898 src/console/win32/icons/Makefile
899 src/console/win32/res/Makefile
900 src/console/win32starter/Makefile
901 src/console/nxav/Makefile
902 src/console/nxav/res/Makefile
903 src/console/nxnotify/Makefile
904 src/console/nxnotify/res/Makefile
905 src/console/cmdline/Makefile
906 src/console/PocketPC/Makefile
907 src/console/PocketPC/res/Makefile
908 src/nxevent/Makefile
909 src/nxpush/Makefile
910 src/nxreport/Makefile
911 src/nxmibc/Makefile
912 src/nxscript/Makefile
913 src/server/Makefile
914 src/server/core/Makefile
915 src/server/netxmsd/Makefile
916 src/server/dbdrv/Makefile
917 src/server/dbdrv/odbc/Makefile
918 src/server/dbdrv/mssql/Makefile
919 src/server/dbdrv/mysql/Makefile
920 src/server/dbdrv/pgsql/Makefile
921 src/server/dbdrv/sqlite/Makefile
922 src/server/smsdrv/Makefile
923 src/server/smsdrv/generic/Makefile
924 src/server/tools/Makefile
925 src/server/tools/nxget/Makefile
926 src/server/tools/nxaction/Makefile
927 src/server/tools/nxadm/Makefile
928 src/server/tools/nxconfig/Makefile
929 src/server/tools/nxconfig/res/Makefile
930 src/server/tools/nxdbmgr/Makefile
931 src/server/tools/nxsnmpget/Makefile
932 src/server/tools/nxsnmpwalk/Makefile
933 src/server/tools/nxsnmpset/Makefile
934 src/server/tools/nxupload/Makefile
935 src/server/libnxsrv/Makefile
936 src/agent/Makefile
937 src/agent/core/Makefile
938 src/agent/install/Makefile
939 src/agent/subagents/Makefile
940 src/agent/subagents/linux/Makefile
941 src/agent/subagents/sunos/Makefile
942 src/agent/subagents/aix/Makefile
943 src/agent/subagents/hpux/Makefile
944 src/agent/subagents/skeleton/Makefile
945 src/agent/subagents/freebsd/Makefile
946 src/agent/subagents/openbsd/Makefile
947 src/agent/subagents/ipso/Makefile
948 src/agent/subagents/netware/Makefile
949 src/agent/subagents/winnt/Makefile
950 src/agent/subagents/win9x/Makefile
951 src/agent/subagents/winperf/Makefile
952 src/agent/subagents/portCheck/Makefile
953 src/agent/subagents/logscan/Makefile
954 src/agent/subagents/ping/Makefile
955 src/agent/subagents/ups/Makefile
956 src/nxhttpd/Makefile
957 src/nxhttpd/static/Makefile
958 src/nxhttpd/static/images/Makefile
959 tools/Makefile
960 ])
961
962 AC_OUTPUT
963
964 #echo "Updating libtool-1"
965 #sed 's/-lc_r/-lc_rXXX/' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
966
967 echo "Updating libtool-2"
968 sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
969
970 #if test ! "x$BUILD_SERVER" = "xyes" ; then
971 # echo "Updating libtool-3"
972 # $PERL tools/patch_libtool.pl <libtool >libtool.new
973 # mv libtool.new libtool
974 # chmod 755 libtool
975 #fi
976
977
978
979 ###########################
980 #
981 echo
982 echo
983 echo
984 echo '---------------------------------------------------------------------'
985 echo ' Configure results'
986 echo '---------------------------------------------------------------------'
987 echo
988 echo "Prefix : ${prefix}"
989 if test "x${BUILD_SERVER}" = "xyes"; then
990 echo "Build Server : YES"
991 else
992 echo "Build Server : NO"
993 fi
994 if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
995 echo "Encryption enabled : YES"
996 else
997 echo "Encryption enabled : NO"
998 fi
999 if test "x${DB_DRIVERS}" != "x"; then
1000 echo "Build DB-Drivers : ${DB_DRIVERS}"
1001 else
1002 echo "Build DB-Drivers : NO"
1003 fi
1004 if test "x${BUILD_CLIENT}" = "xyes"; then
1005 echo "Build Clients : YES"
1006 else
1007 echo "Build Clients : NO"
1008 fi
1009 if test "x${BUILD_WEB_CLIENT}" = "xyes"; then
1010 echo "Build Web Interface : YES"
1011 else
1012 echo "Build Web Interface : NO"
1013 fi
1014 if test "x${BUILD_AGENT}" = "xyes"; then
1015 echo "Build Agent : YES"
1016 echo "Subagents list : ${SUBAGENT_DIRS}"
1017 else
1018 echo "Build Agent : NO"
1019 fi
1020 if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
1021 echo "Build Static Agent : YES"
1022 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
1023 else
1024 echo "Build Static Agent : NO"
1025 fi