- Implemented random secret generation in console
[public/netxms.git] / configure.ac
CommitLineData
eb64d74c 1# $Id: configure.ac,v 1.168 2006-08-23 13:05:03 victor Exp $
d16cf8a5
AK
2#
3# Process this file with autoconf to produce a configure script.
4#
5
eb64d74c 6AC_INIT([NetXMS], [0.2.13-rc2], [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
0c3c0c39
AK
310AC_ARG_WITH(dist,
311[AS_HELP_STRING(--with-dist,for maintainers only)],
c2eaebc6 312 DB_DRIVERS="mysql pgsql odbc mssql sqlite"
1d410d50 313 MODULES="libnxsnmp libnxsl server agent libnxmap libnxcl nxevent nxreport nxmibc console nxhttpd nxscript"
2b23dc1e 314 SUBAGENT_DIRS="linux freebsd openbsd sunos aix ipso"
5b0c7d0d 315 NXCONFIG="nxconfig"
abc48356 316 TOP_LEVEL_MODULES="sql images"
3f2f9f2b 317 CONTRIB_MODULES="mibs backgrounds"
0c3c0c39
AK
318)
319
2654e540 320AC_ARG_WITH(nxhttpd,
9b648a2f 321[AS_HELP_STRING(--with-nxhttpd,build web interface)],
b97191d2 322[
987b646a 323 if test "x$withval" != "xno" ; then
1d410d50 324 MODULES="$MODULES libnxmap libnxcl nxhttpd"
987b646a
AK
325 BUILD_WEB_CLIENT="yes"
326 DYNAMIC_COMPONENTS="yes"
327 fi
b97191d2
AK
328])
329
a7442678
AK
330AC_ARG_WITH(openssl,
331 [AS_HELP_STRING(--with-openssl,specify OpenSSL location)],
332 [
a7442678
AK
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
2b23dc1e 339 LD_RUN_PATH="/usr/local/lib:/opt/openssl/lib:/usr/local/ssl/lib:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
a7442678
AK
340 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/opt/openssl/lib"
341 CPPFLAGS="$CPPFLAGS -I/usr/local/include -I/opt/openssl/include"
342 fi
ad6eb83b
AK
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 ],
a7442678
AK
355 [AC_MSG_ERROR(libcrypto is required for encryption support)])
356 fi
a7442678 357 ],
ad6eb83b
AK
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 ])
6619a6b0 373
0c3c0c39
AK
374AC_SUBST(DB_DRIVERS)
375AC_SUBST(MODULES)
3a7ce527 376AC_SUBST(SUBAGENT_DIRS)
5b0c7d0d 377AC_SUBST(NXCONFIG)
abc48356
VK
378AC_SUBST(TOP_LEVEL_MODULES)
379AC_SUBST(CONTRIB_MODULES)
e8636669
VK
380AC_SUBST(STATIC_SUBAGENT_LIST)
381AC_SUBST(SUBAGENT_LIBS)
c2eaebc6 382AC_SUBST(BUILD_SERVER)
e8636669
VK
383
384# --------------------------------------------------------------------------
385# If --with-static-agent selected, other components cannot be selected
386# Select shared or static libraries depending on agent build type
387if 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
172b3b8e 391 enable_shared=no
e8636669 392else
172b3b8e 393 enable_static=no
e8636669
VK
394fi
395
396AC_LIBTOOL_DLOPEN
397AC_PROG_LIBTOOL
3a7ce527 398
d16cf8a5
AK
399# --------------------------------------------------------------------------
400# checks for libs.
401
402#AC_CHECK_LIB([socket], [socket])
403#AC_CHECK_LIB([nsl], [gethostbyname])
404
521d90e7 405AC_CHECK_LIB(socket, if_nameindex)
87bb64a7 406AC_CHECK_LIB(dl, dlopen)
1b3c0ef0 407AC_CHECK_LIB(kstat, kstat_open)
d16cf8a5 408
e0760102
VK
409if 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)
412fi
413
d16cf8a5
AK
414# --------------------------------------------------------------------------
415# checks for headers.
416
417AC_HEADER_STDC
418AC_HEADER_STAT
419AC_HEADER_TIME
ade50e8b 420AC_CHECK_HEADERS([sys/int_types.h sys/time.h])
d16cf8a5 421AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h sys/socket.h])
49e240fb 422AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termio.h termios.h])
ade50e8b
AK
423AC_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]])
14ab1131 434AC_CHECK_HEADERS([readline/readline.h])
f52be742 435AC_CHECK_HEADERS([byteswap.h])
eca0b061 436AC_CHECK_HEADERS([sys/mman.h])
31a11006 437AC_CHECK_HEADERS([sys/utsname.h])
d16cf8a5 438
d16cf8a5
AK
439# --------------------------------------------------------------------------
440# types
441AC_CHECK_SIZEOF(short)
442AC_CHECK_SIZEOF(int)
443AC_CHECK_SIZEOF(long)
444AC_CHECK_SIZEOF(long long)
445
446AC_TYPE_PID_T
447AC_TYPE_SIGNAL
448AC_TYPE_SIZE_T
449AC_STRUCT_TIMEZONE
450
521d90e7 451AC_CHECK_TYPES([int64_t, uint64_t, u_int64_t])
2b23dc1e 452AC_CHECK_TYPES([off_t, socklen_t])
521d90e7 453
d16cf8a5
AK
454# --------------------------------------------------------------------------
455# C/CPP caps
456
457AC_PROG_GCC_TRADITIONAL
458AC_C_CONST
459AC_C_BIGENDIAN
460
f52be742
VK
461# --------------------------------------------------------------------------
462# macros
463
343e29ae 464AC_CHECK_DECLS([__bswap_32, __bswap_64],,,[
f52be742
VK
465#if HAVE_BYTESWAP_H
466#include <byteswap.h>
467#endif
468])
85303064
VK
469AC_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])
f52be742 477
d16cf8a5
AK
478# --------------------------------------------------------------------------
479# library functions
480
481AC_FUNC_ERROR_AT_LINE
abc48356
VK
482#AC_FUNC_MALLOC
483#AC_FUNC_REALLOC
d16cf8a5 484AC_FUNC_MEMCMP
d16cf8a5
AK
485AC_FUNC_SELECT_ARGTYPES
486AC_FUNC_STRFTIME
487AC_FUNC_STRTOD
488AC_FUNC_VPRINTF
489
b50f1100
VK
490AC_CHECK_FUNCS([gettimeofday memmove memset strchr strcspn strdup strerror])
491AC_CHECK_FUNCS([strrchr strtol strtoul strtoll strtoull])
467e30e1 492AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
d16cf8a5 493
2a1e4b34 494AC_CHECK_HEADERS([sys/sysctl.h vm/vm_param.h])
f91feddc 495AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
2a1e4b34 496
d16cf8a5
AK
497# sockets/resolver (probably for solaris)
498AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
499AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
500AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
501
502if 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)])
504fi
505
506if 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
516fi
517
3d9b275c 518#ALK: CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" PTHREAD_LIBS="-pthread",
d16cf8a5
AK
519# posix threads
520AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
521
522PTHREAD_LIBS=error
523AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
524AC_EGREP_CPP(yes,
a910e139 525 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
d16cf8a5
AK
526 yes
527 #endif
528 ], AC_MSG_RESULT(yes)
6693a1d0 529 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" PTHREAD_LIBS="-pthread",
d16cf8a5
AK
530 AC_MSG_RESULT(no))
531if test "x$PTHREAD_LIBS" = xerror; then
532 AC_CHECK_LIB(pthread, pthread_attr_init,
6693a1d0 533 PTHREAD_LIBS="-lpthread")
d16cf8a5
AK
534fi
535if test "x$PTHREAD_LIBS" = xerror; then
536 AC_CHECK_LIB(pthreads, pthread_attr_init,
6693a1d0 537 PTHREAD_LIBS="-lpthreads")
d16cf8a5 538fi
d16cf8a5 539if test "x$PTHREAD_LIBS" = xerror; then
6693a1d0
AK
540 AC_CHECK_FUNC(pthread_attr_init,
541 PTHREAD_LIBS="")
d16cf8a5
AK
542fi
543if test "x$PTHREAD_LIBS" = xerror; then
544 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
545fi
a0537937 546LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
d16cf8a5
AK
547AC_SUBST(PTHREAD_LIBS)
548
696fc54f 549# Extensions to posix threads
6cd41ceb
VK
550AC_CHECK_HEADERS([pthread_np.h],,,[
551#include <pthread.h>
552])
696fc54f
VK
553AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
554
a0537937
VK
555# Check for recursive mutexes
556AC_CHECK_FUNCS([pthread_mutexattr_settype pthread_mutexattr_setkind_np])
6cd41ceb 557AC_CHECK_DECLS([PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
a0537937 558#include <pthread.h>
6cd41ceb
VK
559#if HAVE_PTHREAD_NP_H
560#include <pthread_np.h>
561#endif
a0537937
VK
562])
563
7e56bf2e
VK
564# Check for read/write locks
565# On Linux, rwlock functions declared always, but pthread_rwlock_t may need
566# additional defines
567AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
568if 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
df7156b3 584 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
7e56bf2e
VK
585 fi
586fi
587
82fa7c5d 588# misc
f8a000b8 589CPPFLAGS="$CPPFLAGS -DDATADIR=\\\"\${pkgdatadir}\\\" -DLIBDIR=\\\"\${libdir}\\\""
82fa7c5d 590
d16cf8a5
AK
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
d8f2e39b
VK
623LIBNETXMS_LIBRARY_VERSION=0:2:0
624LIBNXCSCP_LIBRARY_VERSION=0:2:0
1d410d50
VK
625LIBNXMAP_LIBRARY_VERSION=0:2:0
626LIBNXCL_LIBRARY_VERSION=0:2:0
d8f2e39b
VK
627LIBNXSNMP_LIBRARY_VERSION=0:2:0
628LIBNXSRV_LIBRARY_VERSION=0:2:0
629LIBNXCORE_LIBRARY_VERSION=0:2:0
630DBDRV_LIBRARY_VERSION=0:2:0
631SMSDRV_LIBRARY_VERSION=0:2:0
c002b04a 632LIBNXSL_LIBRARY_VERSION=0:2:0
d16cf8a5 633AC_SUBST(LIBNETXMS_LIBRARY_VERSION)
3e7f0791 634AC_SUBST(LIBNXCSCP_LIBRARY_VERSION)
1d410d50
VK
635AC_SUBST(LIBNXMAP_LIBRARY_VERSION)
636AC_SUBST(LIBNXCL_LIBRARY_VERSION)
d853cd74 637AC_SUBST(LIBNXSNMP_LIBRARY_VERSION)
aa3b26fd 638AC_SUBST(LIBNXSRV_LIBRARY_VERSION)
17a48052 639AC_SUBST(LIBNXCORE_LIBRARY_VERSION)
b900a78b 640AC_SUBST(DBDRV_LIBRARY_VERSION)
d8f2e39b 641AC_SUBST(SMSDRV_LIBRARY_VERSION)
c002b04a 642AC_SUBST(LIBNXSL_LIBRARY_VERSION)
d16cf8a5
AK
643
644# --------------------------------------------------------------------------
645
646AC_CONFIG_FILES([
d16cf8a5 647 README
0c3c0c39
AK
648 Makefile
649 contrib/Makefile
0c3c0c39
AK
650 contrib/dct/Makefile
651 contrib/startup/Makefile
daaefaaf 652 contrib/startup/gentoo/Makefile
0c3c0c39 653 contrib/startup/redhat/Makefile
82fa7c5d 654 contrib/mibs/Makefile
3f2f9f2b 655 contrib/backgrounds/Makefile
0c3c0c39 656 doc/Makefile
a48203d2
VK
657 doc/internal/Makefile
658 doc/manuals/Makefile
659 doc/misc/Makefile
0c3c0c39
AK
660 images/Makefile
661 include/Makefile
662 m4/Makefile
663 netware/Makefile
664 sql/Makefile
0c3c0c39
AK
665 src/Makefile
666 src/libnetxms/Makefile
667 src/libnxcscp/Makefile
d853cd74 668 src/libnxsnmp/Makefile
0c3c0c39 669 src/libnxcl/Makefile
c002b04a 670 src/libnxsl/Makefile
1d410d50 671 src/libnxmap/Makefile
1b1edd49
VK
672 src/install/Makefile
673 src/install/windows/Makefile
0c3c0c39 674 src/console/Makefile
8c7d057b
VK
675 src/console/nxuilib/Makefile
676 src/console/nxuilib/res/Makefile
f7d8c3b2 677 src/console/nxuilib/sounds/Makefile
e4d08190 678 src/console/nxlexer/Makefile
0c3c0c39
AK
679 src/console/win32/Makefile
680 src/console/win32/icons/Makefile
681 src/console/win32/res/Makefile
682 src/console/win32starter/Makefile
672441ac 683 src/console/nxav/Makefile
2b463d08 684 src/console/nxav/res/Makefile
52996299
VK
685 src/console/nxnotify/Makefile
686 src/console/nxnotify/res/Makefile
672441ac 687 src/console/cmdline/Makefile
2b463d08
VK
688 src/console/PocketPC/Makefile
689 src/console/PocketPC/res/Makefile
0c3c0c39 690 src/nxevent/Makefile
1e8eed7a 691 src/nxreport/Makefile
148f47cf 692 src/nxmibc/Makefile
f519aa3e 693 src/nxscript/Makefile
0c3c0c39
AK
694 src/server/Makefile
695 src/server/core/Makefile
a551fe4d 696 src/server/netxmsd/Makefile
0c3c0c39
AK
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
9486b324 702 src/server/dbdrv/sqlite/Makefile
d8f2e39b
VK
703 src/server/smsdrv/Makefile
704 src/server/smsdrv/generic/Makefile
0c3c0c39
AK
705 src/server/tools/Makefile
706 src/server/tools/nxget/Makefile
707 src/server/tools/nxaction/Makefile
708 src/server/tools/nxadm/Makefile
5b0c7d0d
VK
709 src/server/tools/nxconfig/Makefile
710 src/server/tools/nxconfig/res/Makefile
f90d7fc5 711 src/server/tools/nxdbmgr/Makefile
d853cd74 712 src/server/tools/nxsnmpget/Makefile
734c670f 713 src/server/tools/nxsnmpwalk/Makefile
665b4ccf 714 src/server/tools/nxsnmpset/Makefile
d24fdaf4 715 src/server/tools/nxupload/Makefile
0c3c0c39
AK
716 src/server/libnxsrv/Makefile
717 src/agent/Makefile
718 src/agent/core/Makefile
5795bf90 719 src/agent/install/Makefile
0c3c0c39
AK
720 src/agent/subagents/Makefile
721 src/agent/subagents/linux/Makefile
722 src/agent/subagents/sunos/Makefile
d0b5a098 723 src/agent/subagents/aix/Makefile
0c3c0c39
AK
724 src/agent/subagents/skeleton/Makefile
725 src/agent/subagents/freebsd/Makefile
992ba479 726 src/agent/subagents/openbsd/Makefile
2b23dc1e 727 src/agent/subagents/ipso/Makefile
0c3c0c39 728 src/agent/subagents/netware/Makefile
1bc607cc
VK
729 src/agent/subagents/winnt/Makefile
730 src/agent/subagents/win9x/Makefile
0c3c0c39 731 src/agent/subagents/winperf/Makefile
93f15c2a 732 src/agent/subagents/portCheck/Makefile
b36a6eb9 733 src/agent/subagents/logscan/Makefile
abc48356 734 src/agent/subagents/ping/Makefile
2f06a66e 735 src/agent/subagents/ups/Makefile
9b648a2f
AK
736 src/nxhttpd/Makefile
737 src/nxhttpd/static/Makefile
2654e540 738 src/nxhttpd/static/images/Makefile
0c3c0c39 739 tools/Makefile
d16cf8a5
AK
740])
741
12249937
VK
742AC_OUTPUT
743
6f926182
AK
744#echo "Updating libtool-1"
745#sed 's/-lc_r/-lc_rXXX/' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
5cecf50e
AK
746
747echo "Updating libtool-2"
748sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
749
6f926182
AK
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
a7442678
AK
756
757
758
759###########################
760#
761echo
762echo
763echo
764echo '---------------------------------------------------------------------'
765echo ' Configure results'
766echo '---------------------------------------------------------------------'
767echo
768 echo "Prefix : ${prefix}"
769if test "x${BUILD_SERVER}" = "xyes"; then
770 echo "Build Server : YES"
771else
772 echo "Build Server : NO"
773fi
774if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
775 echo "Encryption enabled : YES"
776else
777 echo "Encryption enabled : NO"
778fi
779if test "x${DB_DRIVERS}" != "x"; then
780 echo "Build DB-Drivers : ${DB_DRIVERS}"
781else
782 echo "Build DB-Drivers : NO"
783fi
784if test "x${BUILD_CLIENT}" = "xyes"; then
785 echo "Build Clients : YES"
786else
787 echo "Build Clients : NO"
788fi
2654e540
AK
789if test "x${BUILD_WEB_CLIENT}" = "xyes"; then
790 echo "Build Web Interface : YES"
791else
792 echo "Build Web Interface : YES"
793fi
a7442678
AK
794if test "x${BUILD_AGENT}" = "xyes"; then
795 echo "Build Agent : YES"
796 echo "Subagents list : ${SUBAGENT_DIRS}"
797else
798 echo "Build Agent : NO"
799fi
e8636669
VK
800if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
801 echo "Build Static Agent : YES"
802 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
803else
804 echo "Build Static Agent : NO"
805fi