- Database structure changes: all IP addresses now stored as strings, not as integers
[public/netxms.git] / configure.ac
CommitLineData
9f046a52 1# $Id: configure.ac,v 1.29 2004-10-13 10:24:37 victor Exp $
d16cf8a5
AK
2#
3# Process this file with autoconf to produce a configure script.
4#
5
9f046a52 6AC_INIT([NetXMS], [0.1.5], [NetXMS Team <bugs@netxms.org>])
d16cf8a5
AK
7AC_CONFIG_AUX_DIR([config])
8AM_CONFIG_HEADER([config.h])
9AM_INIT_AUTOMAKE
10
11# --------------------------------------------------------------------------
12# misc
13
14AC_ARG_VAR(PERL,local path to the perl interpreter)
15perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin"
16AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path)
17
18if test -d /usr/local/include; then
19 CFLAGS="$CFLAGS -I/usr/local/include"
2cb1fb26 20 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
d16cf8a5
AK
21fi
22
23if test -d /usr/kerberos/include; then
24 CFLAGS="$CFLAGS -I/usr/kerberos/include"
2cb1fb26 25 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
d16cf8a5 26fi
521d90e7
VK
27
28if test -d /usr/local/ssl/include; then
29 CFLAGS="$CFLAGS -I/usr/local/ssl/include"
30 CPPFLAGS="$CPPFLAGS -I/usr/local/ssl/include"
31fi
32
d16cf8a5
AK
33if test -d /usr/local/lib; then
34 LDFLAGS="$LDFLAGS -L/usr/local/lib"
35fi
36
37# --------------------------------------------------------------------------
38# command line options
39
40AC_ARG_WITH(mysql,
41[AS_HELP_STRING(--with-mysql,enable mysql backend)],
42[ if test "x$withval" != "xno" ; then
43 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
44 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
45 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/mysql -L${withval}/mysql/lib"
6693a1d0 46 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include"
d16cf8a5
AK
47 else
48 LD_RUN_PATH="/usr/local/mysql/lib:/usr/local/mysql/lib/mysql:/usr/lib/mysql:/usr/mysql/lib:/usr/mysql/lib/mysql:/usr/local/lib/mysql:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
49 LDFLAGS="$LDFLAGS -L/usr/local/mysql/lib -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 50 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
AK
51 fi
52 AC_CHECK_LIB(m, floor)
53 AC_CHECK_LIB(z, gzclose)
54 with_mysql="yes"
55 AC_DEFINE(WITH_MYSQL,,[with mysql])
6693a1d0 56 DB_DRIVERS="$DB_DRIVERS mysql"
d16cf8a5
AK
57 AC_CHECK_LIB(mysqlclient, mysql_init, ,
58 [AC_MSG_ERROR(libmysqlclient is needed for MySQL support)])
59 AC_MSG_CHECKING(whether mysql clients can run)
60 AC_RUN_IFELSE([AC_LANG_SOURCE([[
61 #include <stdio.h>
62 #include <mysql.h>
63 int main(void)
64 {
65 MYSQL *a = mysql_init(NULL);
66 return 0;
67 }
68 ]])],[],[
69 AC_MSG_RESULT(no)
70 AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)
71 ],[])
72 AC_MSG_RESULT(yes)
73 AC_CHECK_FUNCS(mysql_real_escape_string)
6693a1d0 74fi ])
d16cf8a5
AK
75
76AC_ARG_WITH(pgsql,
77[AS_HELP_STRING(--with-pgsql,enable postgres backend)],
78[ if test "x$withval" != "xno" ; then
6693a1d0
AK
79 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
80 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
81 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/pgsql -L${withval}/lib/postgresql -L${withval}/pgsql/lib -L${withval}/postgresql/lib"
82 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/pgsql -I${withval}/include/postgresql -I${withval}/pgsql/include -I${withval}/postgresql/include"
83 else
84 LD_RUN_PATH="/usr/local/pgsql/lib:/usr/local/pgsql/lib/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}"
85 LDFLAGS="$LDFLAGS -L/usr/local/pgsql/lib -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"
86 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"
87 fi
88 AC_CHECK_LIB(m, floor)
89 AC_CHECK_LIB(z, gzclose)
90 with_pgsql="yes"
91 DB_DRIVERS="$DB_DRIVERS pgsql"
92 AC_DEFINE(WITH_PGSQL,,[with pgsql])
93 AC_CHECK_LIB(pq, PQconnectdb, ,
94 [AC_MSG_ERROR(libpq is needed for PostgreSQL support)])
95 AC_MSG_CHECKING(whether postgresql clients can run)
96 AC_RUN_IFELSE([AC_LANG_SOURCE([[
97 #include <stdio.h>
98 #include <libpq-fe.h>
99 int main(void)
100 {
101 PGconn *a = PQconnectdb("");
102 return 0;
103 }
104 ]])],[],[
105 AC_MSG_RESULT(no)
106 AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
107 ],[])
108 AC_MSG_RESULT(yes)
109fi ])
d16cf8a5 110
6693a1d0 111AC_SUBST(DB_DRIVERS)
d16cf8a5
AK
112
113
3a7ce527
AK
114
115AC_ARG_WITH(server,
116[AS_HELP_STRING(--with-server,build server)],
117[
118 MODULES="$MODULES server"
119])
120AC_SUBST(MODULES)
121
122
123SUBAGENT_DIRS=""
124AC_ARG_WITH(agent,
125[AS_HELP_STRING(--with-agent,build agent)],
126[
127 case `uname -s` in
128 Linux)
129 SUBAGENT_DIRS="linux"
130 ;;
131 FreeBSD)
132 SUBAGENT_DIRS="freebsd"
133 ;;
134 SunOS)
135 SUBAGENT_DIRS="sunos"
136 ;;
137 *)
138 # unknown
139 ;;
140 esac
141])
142AC_SUBST(SUBAGENT_DIRS)
143
144
d16cf8a5
AK
145# --------------------------------------------------------------------------
146# checks for programs.
147
148AC_PROG_CC
149AC_PROG_CPP
150AC_PROG_INSTALL
151
152AC_LIBTOOL_DLOPEN
153AC_PROG_LIBTOOL
154
155# --------------------------------------------------------------------------
156# checks for libs.
157
158#AC_CHECK_LIB([socket], [socket])
159#AC_CHECK_LIB([nsl], [gethostbyname])
160
161AC_CHECK_LIB(crypto, DH_new)
162AC_CHECK_LIB(ssl, SSL_accept)
a7cfdbbf 163AC_CHECK_LIB(termcap, tgetstr, [], [AC_CHECK_LIB(ncurses, tgetstr, [], AC_CHECK_LIB(curses, tgetstr))])
184d2b95 164AC_CHECK_LIB(readline, readline)
521d90e7 165AC_CHECK_LIB(socket, if_nameindex)
d16cf8a5
AK
166
167# --------------------------------------------------------------------------
168# checks for headers.
169
170AC_HEADER_STDC
171AC_HEADER_STAT
172AC_HEADER_TIME
521d90e7 173AC_CHECK_HEADERS([sys/int_types.h])
d16cf8a5 174AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h sys/socket.h])
85303064
VK
175AC_CHECK_HEADERS([sys/ioctl.h sys/sockio.h])
176AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h])
d16cf8a5 177AC_CHECK_HEADERS([openssl/ssl.h])
14ab1131 178AC_CHECK_HEADERS([readline/readline.h])
f52be742 179AC_CHECK_HEADERS([byteswap.h])
eca0b061 180AC_CHECK_HEADERS([sys/mman.h])
31a11006 181AC_CHECK_HEADERS([sys/utsname.h])
d16cf8a5
AK
182
183if test "x$ac_cv_header_openssl_ssl_h" != "xyes" ; then
184 AC_MSG_ERROR(OpenSSL headers not found.)
185fi
186
187# --------------------------------------------------------------------------
188# types
189AC_CHECK_SIZEOF(short)
190AC_CHECK_SIZEOF(int)
191AC_CHECK_SIZEOF(long)
192AC_CHECK_SIZEOF(long long)
193
194AC_TYPE_PID_T
195AC_TYPE_SIGNAL
196AC_TYPE_SIZE_T
197AC_STRUCT_TIMEZONE
198
521d90e7 199AC_CHECK_TYPES([int64_t, uint64_t, u_int64_t])
eca0b061 200AC_CHECK_TYPES([off_t])
521d90e7 201
d16cf8a5
AK
202# --------------------------------------------------------------------------
203# C/CPP caps
204
205AC_PROG_GCC_TRADITIONAL
206AC_C_CONST
207AC_C_BIGENDIAN
208
f52be742
VK
209# --------------------------------------------------------------------------
210# macros
211
212AC_CHECK_DECLS([__bswap_64],,,[
213#if HAVE_BYTESWAP_H
214#include <byteswap.h>
215#endif
216])
85303064
VK
217AC_CHECK_DECLS([SIOCGIFADDR, SIOCGIFNETMASK, SIOCGIFHWADDR],,,[
218#if HAVE_SYS_IOCTL_H
219#include <sys/ioctl.h>
220#endif
221#if HAVE_SYS_SOCKIO_H
222#include <sys/sockio.h>
223#endif
224])
f52be742 225
d16cf8a5
AK
226# --------------------------------------------------------------------------
227# library functions
228
229AC_FUNC_ERROR_AT_LINE
230AC_FUNC_MALLOC
231AC_FUNC_MEMCMP
232AC_FUNC_REALLOC
233AC_FUNC_SELECT_ARGTYPES
234AC_FUNC_STRFTIME
235AC_FUNC_STRTOD
236AC_FUNC_VPRINTF
237
b50f1100
VK
238AC_CHECK_FUNCS([gettimeofday memmove memset strchr strcspn strdup strerror])
239AC_CHECK_FUNCS([strrchr strtol strtoul strtoll strtoull])
696fc54f 240AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r])
d16cf8a5 241
408a78b9
VK
242# --------------------------------------------------------------------------
243# UNICODE support
244
245AC_CHECK_HEADERS([wchar.h])
246AC_CHECK_TYPES([wchar_t])
247AC_CHECK_FUNCS([wctomb mbtowc wcslen])
248
d16cf8a5
AK
249
250# sockets/resolver (probably for solaris)
251AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
252AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
253AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
254
255if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
256 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
257fi
258
259if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
260 AC_MSG_CHECKING([if we can include libnsl + libsocket])
261 LIBS="-lnsl -lsocket $LIBS"
262 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
263 if test "$my_ac_link_result" = "no" ; then
264 AC_MSG_RESULT([failure])
265 AC_MSG_ERROR([unable to use gethostbyname()])
266 else
267 AC_MSG_RESULT([success])
268 fi
269fi
270
271# posix threads
272AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
273
274PTHREAD_LIBS=error
275AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
276AC_EGREP_CPP(yes,
277 [#if (defined(__FreeBSD_cc_version) && __FreeBSD_cc_version <= 500001) || defined(__OpenBSD__)
278 yes
279 #endif
280 ], AC_MSG_RESULT(yes)
6693a1d0 281 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" PTHREAD_LIBS="-pthread",
d16cf8a5
AK
282 AC_MSG_RESULT(no))
283if test "x$PTHREAD_LIBS" = xerror; then
284 AC_CHECK_LIB(pthread, pthread_attr_init,
6693a1d0 285 PTHREAD_LIBS="-lpthread")
d16cf8a5
AK
286fi
287if test "x$PTHREAD_LIBS" = xerror; then
288 AC_CHECK_LIB(pthreads, pthread_attr_init,
6693a1d0 289 PTHREAD_LIBS="-lpthreads")
d16cf8a5
AK
290fi
291if test "x$PTHREAD_LIBS" = xerror; then
292 AC_CHECK_LIB(c_r, pthread_attr_init,
6693a1d0 293 PTHREAD_LIBS="-lc_r")
d16cf8a5
AK
294fi
295if test "x$PTHREAD_LIBS" = xerror; then
6693a1d0
AK
296 AC_CHECK_FUNC(pthread_attr_init,
297 PTHREAD_LIBS="")
d16cf8a5
AK
298fi
299if test "x$PTHREAD_LIBS" = xerror; then
300 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
301fi
302AC_SUBST(PTHREAD_LIBS)
303
696fc54f
VK
304# Extensions to posix threads
305AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
306
d16cf8a5
AK
307# --------------------------------------------------------------------------
308
309# shared libs versions
310#
311# versioning scheme: current:revision:age
312#
313# current
314# The number of the current interface exported by the library. A current
315# value of `0', means that you are calling the interface exported by this
316# library interface 0.
317#
318# revision
319# The implementation number of the most recent interface exported by this
320# library. In this case, a revision value of `0' means that this is the
321# first implementation of the interface.
322# If the next release of this library exports the same interface, but has a
323# different implementation (perhaps some bugs have been fixed), the revision
324# number will be higher, but current number will be the same. In that case,
325# when given a choice, the library with the highest revision will always
326# be used by the runtime loader.
327#
328# age
329# The number of previous additional interfaces supported by this library.
330# If age were `2', then this library can be linked into executables which
331# were built with a release of this library that exported the current
332# interface number, current, or any of the previous two interfaces.
333# By definition age must be less than or equal to current. At the outset,
334# only the first ever interface is implemented, so age can only be `0'.
335#
336#
337#
338
339LIBNETXMS_LIBRARY_VERSION=0:1:0
e896a639 340LIBNXCSCP_LIBRARY_VERSION=0:1:0
aa3b26fd 341LIBNXSRV_LIBRARY_VERSION=0:1:0
b900a78b 342DBDRV_LIBRARY_VERSION=0:1:0
d16cf8a5 343AC_SUBST(LIBNETXMS_LIBRARY_VERSION)
3e7f0791 344AC_SUBST(LIBNXCSCP_LIBRARY_VERSION)
aa3b26fd 345AC_SUBST(LIBNXSRV_LIBRARY_VERSION)
b900a78b 346AC_SUBST(DBDRV_LIBRARY_VERSION)
d16cf8a5
AK
347
348# --------------------------------------------------------------------------
349
350AC_CONFIG_FILES([
351 Makefile
352 README
353 doc/Makefile
354 m4/Makefile
355 sql/Makefile
356 include/Makefile
357 src/Makefile
358 src/libnetxms/Makefile
3e7f0791 359 src/libnxcscp/Makefile
006f9563 360 src/libnxcl/Makefile
d16cf8a5 361 src/server/Makefile
aa3b26fd 362 src/server/libnxsrv/Makefile
d16cf8a5 363 src/server/core/Makefile
aa3b26fd
VK
364 src/server/tools/Makefile
365 src/server/tools/nxget/Makefile
3c774461 366 src/server/tools/nxaction/Makefile
6693a1d0
AK
367 src/server/dbdrv/Makefile
368 src/server/dbdrv/mysql/Makefile
369 src/server/dbdrv/pgsql/Makefile
eca0b061 370 src/agent/Makefile
aa3b26fd 371 src/agent/core/Makefile
449e3da9 372 src/agent/subagents/Makefile
962b3915 373 src/agent/subagents/skeleton/Makefile
9cdb0f18 374 src/agent/subagents/linux/Makefile
d16cf8a5
AK
375])
376
377AC_OUTPUT