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