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