Updated change log
[public/netxms.git] / configure.ac
1 # $Id: configure.ac,v 1.40 2004-11-29 08:30:06 victor Exp $
2 #
3 # Process this file with autoconf to produce a configure script.
4 #
5
6 AC_INIT([NetXMS], [0.1.8], [NetXMS Team <bugs@netxms.org>])
7 AC_CONFIG_AUX_DIR([config])
8 AM_CONFIG_HEADER([config.h])
9 AM_INIT_AUTOMAKE
10
11 # --------------------------------------------------------------------------
12 # misc
13
14 AC_ARG_VAR(PERL,local path to the perl interpreter)
15 perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin"
16 AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path)
17
18 if test -d /usr/local/include; then
19 CFLAGS="$CFLAGS -I/usr/local/include"
20 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
21 fi
22
23 if test -d /usr/kerberos/include; then
24 CFLAGS="$CFLAGS -I/usr/kerberos/include"
25 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
26 fi
27
28 #if test -d /usr/local/ssl/include; then
29 # CFLAGS="$CFLAGS -I/usr/local/ssl/include"
30 # CPPFLAGS="$CPPFLAGS -I/usr/local/ssl/include"
31 #fi
32
33 if test -d /usr/local/lib; then
34 LDFLAGS="$LDFLAGS -L/usr/local/lib"
35 fi
36
37 # --------------------------------------------------------------------------
38 # command line options
39
40 AC_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"
46 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include"
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"
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"
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])
56 DB_DRIVERS="$DB_DRIVERS mysql"
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)
74 fi ])
75
76 AC_ARG_WITH(pgsql,
77 [AS_HELP_STRING(--with-pgsql,enable postgres backend)],
78 [ if test "x$withval" != "xno" ; then
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)
109 fi ])
110
111 AC_ARG_WITH(server,
112 [AS_HELP_STRING(--with-server,build server)],
113 [
114 MODULES="$MODULES server"
115 BUILD_SERVER="yes"
116 ])
117
118
119 SUBAGENT_DIRS=""
120 AC_ARG_WITH(agent,
121 [AS_HELP_STRING(--with-agent,build agent)],
122 [
123 MODULES="$MODULES agent"
124 case `uname -s` in
125 Linux)
126 SUBAGENT_DIRS="linux"
127 ;;
128 FreeBSD)
129 SUBAGENT_DIRS="freebsd"
130 ;;
131 SunOS)
132 SUBAGENT_DIRS="sunos"
133 ;;
134 *)
135 # unknown
136 ;;
137 esac
138 ])
139
140 AC_ARG_WITH(dist,
141 [AS_HELP_STRING(--with-dist,for maintainers only)],
142 DB_DRIVERS="mysql pgsql odbc mssql"
143 MODULES="server agent"
144 SUBAGENT_DIRS="linux freebsd sunos"
145 )
146
147 AC_SUBST(DB_DRIVERS)
148 AC_SUBST(MODULES)
149 AC_SUBST(SUBAGENT_DIRS)
150
151
152 # --------------------------------------------------------------------------
153 # checks for programs.
154
155 AC_PROG_CC
156 AC_PROG_CPP
157 AC_PROG_INSTALL
158
159 AC_LIBTOOL_DLOPEN
160 AC_PROG_LIBTOOL
161
162 # --------------------------------------------------------------------------
163 # checks for libs.
164
165 #AC_CHECK_LIB([socket], [socket])
166 #AC_CHECK_LIB([nsl], [gethostbyname])
167
168 #AC_CHECK_LIB(crypto, DH_new)
169 #AC_CHECK_LIB(ssl, SSL_accept)
170 AC_CHECK_LIB(termcap, tgetstr, [], [AC_CHECK_LIB(ncurses, tgetstr, [], AC_CHECK_LIB(curses, tgetstr))])
171 AC_CHECK_LIB(readline, readline)
172 AC_CHECK_LIB(socket, if_nameindex)
173 AC_CHECK_LIB(dl, dlopen)
174
175 # --------------------------------------------------------------------------
176 # checks for headers.
177
178 AC_HEADER_STDC
179 AC_HEADER_STAT
180 AC_HEADER_TIME
181 AC_CHECK_HEADERS([sys/int_types.h])
182 AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h sys/socket.h])
183 AC_CHECK_HEADERS([sys/ioctl.h sys/sockio.h])
184 AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h])
185 AC_CHECK_HEADERS([readline/readline.h])
186 AC_CHECK_HEADERS([byteswap.h])
187 AC_CHECK_HEADERS([sys/mman.h])
188 AC_CHECK_HEADERS([sys/utsname.h])
189
190 # --------------------------------------------------------------------------
191 # types
192 AC_CHECK_SIZEOF(short)
193 AC_CHECK_SIZEOF(int)
194 AC_CHECK_SIZEOF(long)
195 AC_CHECK_SIZEOF(long long)
196
197 AC_TYPE_PID_T
198 AC_TYPE_SIGNAL
199 AC_TYPE_SIZE_T
200 AC_STRUCT_TIMEZONE
201
202 AC_CHECK_TYPES([int64_t, uint64_t, u_int64_t])
203 AC_CHECK_TYPES([off_t])
204
205 # --------------------------------------------------------------------------
206 # C/CPP caps
207
208 AC_PROG_GCC_TRADITIONAL
209 AC_C_CONST
210 AC_C_BIGENDIAN
211
212 # --------------------------------------------------------------------------
213 # macros
214
215 AC_CHECK_DECLS([__bswap_64],,,[
216 #if HAVE_BYTESWAP_H
217 #include <byteswap.h>
218 #endif
219 ])
220 AC_CHECK_DECLS([SIOCGIFADDR, SIOCGIFNETMASK, SIOCGIFHWADDR],,,[
221 #if HAVE_SYS_IOCTL_H
222 #include <sys/ioctl.h>
223 #endif
224 #if HAVE_SYS_SOCKIO_H
225 #include <sys/sockio.h>
226 #endif
227 ])
228
229 # --------------------------------------------------------------------------
230 # library functions
231
232 AC_FUNC_ERROR_AT_LINE
233 AC_FUNC_MALLOC
234 AC_FUNC_MEMCMP
235 AC_FUNC_REALLOC
236 AC_FUNC_SELECT_ARGTYPES
237 AC_FUNC_STRFTIME
238 AC_FUNC_STRTOD
239 AC_FUNC_VPRINTF
240
241 AC_CHECK_FUNCS([gettimeofday memmove memset strchr strcspn strdup strerror])
242 AC_CHECK_FUNCS([strrchr strtol strtoul strtoll strtoull])
243 AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir])
244
245 # --------------------------------------------------------------------------
246 # UNICODE support
247
248 AC_CHECK_HEADERS([wchar.h])
249 AC_CHECK_TYPES([wchar_t])
250 AC_CHECK_FUNCS([wctomb mbtowc wcslen])
251
252
253 # sockets/resolver (probably for solaris)
254 AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
255 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
256 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
257
258 if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
259 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
260 fi
261
262 if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
263 AC_MSG_CHECKING([if we can include libnsl + libsocket])
264 LIBS="-lnsl -lsocket $LIBS"
265 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
266 if test "$my_ac_link_result" = "no" ; then
267 AC_MSG_RESULT([failure])
268 AC_MSG_ERROR([unable to use gethostbyname()])
269 else
270 AC_MSG_RESULT([success])
271 fi
272 fi
273
274 # posix threads
275 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
276
277 PTHREAD_LIBS=error
278 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
279 AC_EGREP_CPP(yes,
280 [#if (defined(__FreeBSD_cc_version) && __FreeBSD_cc_version <= 500001) || defined(__OpenBSD__)
281 yes
282 #endif
283 ], AC_MSG_RESULT(yes)
284 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" PTHREAD_LIBS="-pthread",
285 AC_MSG_RESULT(no))
286 if test "x$PTHREAD_LIBS" = xerror; then
287 AC_CHECK_LIB(pthread, pthread_attr_init,
288 PTHREAD_LIBS="-lpthread")
289 fi
290 if test "x$PTHREAD_LIBS" = xerror; then
291 AC_CHECK_LIB(pthreads, pthread_attr_init,
292 PTHREAD_LIBS="-lpthreads")
293 fi
294 if test "x$PTHREAD_LIBS" = xerror; then
295 AC_CHECK_LIB(c_r, pthread_attr_init,
296 PTHREAD_LIBS="-lc_r")
297 fi
298 if test "x$PTHREAD_LIBS" = xerror; then
299 AC_CHECK_FUNC(pthread_attr_init,
300 PTHREAD_LIBS="")
301 fi
302 if test "x$PTHREAD_LIBS" = xerror; then
303 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
304 fi
305 AC_SUBST(PTHREAD_LIBS)
306
307 # Extensions to posix threads
308 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
309
310 # --------------------------------------------------------------------------
311
312 # shared libs versions
313 #
314 # versioning scheme: current:revision:age
315 #
316 # current
317 # The number of the current interface exported by the library. A current
318 # value of `0', means that you are calling the interface exported by this
319 # library interface 0.
320 #
321 # revision
322 # The implementation number of the most recent interface exported by this
323 # library. In this case, a revision value of `0' means that this is the
324 # first implementation of the interface.
325 # If the next release of this library exports the same interface, but has a
326 # different implementation (perhaps some bugs have been fixed), the revision
327 # number will be higher, but current number will be the same. In that case,
328 # when given a choice, the library with the highest revision will always
329 # be used by the runtime loader.
330 #
331 # age
332 # The number of previous additional interfaces supported by this library.
333 # If age were `2', then this library can be linked into executables which
334 # were built with a release of this library that exported the current
335 # interface number, current, or any of the previous two interfaces.
336 # By definition age must be less than or equal to current. At the outset,
337 # only the first ever interface is implemented, so age can only be `0'.
338 #
339 #
340 #
341
342 LIBNETXMS_LIBRARY_VERSION=0:1:0
343 LIBNXCSCP_LIBRARY_VERSION=0:1:0
344 LIBNXSNMP_LIBRARY_VERSION=0:1:0
345 LIBNXSRV_LIBRARY_VERSION=0:1:0
346 DBDRV_LIBRARY_VERSION=0:1:0
347 AC_SUBST(LIBNETXMS_LIBRARY_VERSION)
348 AC_SUBST(LIBNXCSCP_LIBRARY_VERSION)
349 AC_SUBST(LIBNXSNMP_LIBRARY_VERSION)
350 AC_SUBST(LIBNXSRV_LIBRARY_VERSION)
351 AC_SUBST(DBDRV_LIBRARY_VERSION)
352
353 # --------------------------------------------------------------------------
354
355 AC_CONFIG_FILES([
356 README
357 Makefile
358 contrib/Makefile
359 contrib/config/Makefile
360 contrib/dct/Makefile
361 contrib/startup/Makefile
362 contrib/startup/redhat/Makefile
363 doc/Makefile
364 images/Makefile
365 include/Makefile
366 m4/Makefile
367 netware/Makefile
368 sql/Makefile
369 sql/upgrade/Makefile
370 src/Makefile
371 src/libnetxms/Makefile
372 src/libnxcscp/Makefile
373 src/libnxsnmp/Makefile
374 src/libnxcl/Makefile
375 src/console/Makefile
376 src/console/win32/Makefile
377 src/console/win32/icons/Makefile
378 src/console/win32/res/Makefile
379 src/console/win32starter/Makefile
380 src/nxevent/Makefile
381 src/server/Makefile
382 src/server/core/Makefile
383 src/server/dbdrv/Makefile
384 src/server/dbdrv/odbc/Makefile
385 src/server/dbdrv/mssql/Makefile
386 src/server/dbdrv/mysql/Makefile
387 src/server/dbdrv/pgsql/Makefile
388 src/server/tools/Makefile
389 src/server/tools/nxget/Makefile
390 src/server/tools/nxaction/Makefile
391 src/server/tools/nxadm/Makefile
392 src/server/tools/nxdbmgr/Makefile
393 src/server/tools/nxsnmpget/Makefile
394 src/server/tools/nxsnmpwalk/Makefile
395 src/server/libnxsrv/Makefile
396 src/agent/Makefile
397 src/agent/core/Makefile
398 src/agent/subagents/Makefile
399 src/agent/subagents/linux/Makefile
400 src/agent/subagents/sunos/Makefile
401 src/agent/subagents/skeleton/Makefile
402 src/agent/subagents/freebsd/Makefile
403 src/agent/subagents/netware/Makefile
404 src/agent/subagents/winperf/Makefile
405 tools/Makefile
406 ])
407
408 AC_OUTPUT