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