Yet another Linux UNICODE fix
[public/netxms.git] / configure.ac
CommitLineData
3e39fcde 1# $Id: configure.ac,v 1.189 2006-10-01 15:26:28 victor Exp $
d16cf8a5
AK
2#
3# Process this file with autoconf to produce a configure script.
4#
5
fb6ad91b 6AC_INIT([NetXMS], [0.2.14-dev], [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 24# Misc. settings
463b332e
VK
25CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 -D_THREAD_SAFE"
26CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 -D_THREAD_SAFE"
e8636669 27SUBAGENT_LIBS=""
5387ff75 28
d3c8926d
VK
29# --------------------------------------------------------------------------
30# disable C++ exceptions
31
32AC_LANG_PUSH([C++])
33
44adbac8 34AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti)
d3c8926d
VK
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
44adbac8 44AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions)
d3c8926d
VK
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])
ca6ad6bb 430AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h net/nh.h sys/socket.h])
70fed300 431AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.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])
4c779d83
VK
461AC_CHECK_TYPES([off_t, socklen_t],,,[
462#if HAVE_SYS_TYPES_H
463#include <sys/types.h>
464#endif
465#if HAVE_SYS_SOCKET_H
466#include <sys/socket.h>
467#endif
468])
521d90e7 469
d16cf8a5
AK
470# --------------------------------------------------------------------------
471# C/CPP caps
472
473AC_PROG_GCC_TRADITIONAL
474AC_C_CONST
475AC_C_BIGENDIAN
476
f52be742
VK
477# --------------------------------------------------------------------------
478# macros
479
ca6ad6bb
VK
480AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
481#ifdef HAVE_SYS_TYPES_H
482# include <sys/types.h>
483#endif
f52be742
VK
484#if HAVE_BYTESWAP_H
485#include <byteswap.h>
486#endif
ca6ad6bb
VK
487#if HAVE_NETINET_IN_H
488#include <netinet/in.h>
489#endif
490#if HAVE_NET_NH_H
491#include <net/nh.h>
492#endif
f52be742 493])
85303064
VK
494AC_CHECK_DECLS([SIOCGIFADDR, SIOCGIFNETMASK, SIOCGIFHWADDR],,,[
495#if HAVE_SYS_IOCTL_H
496#include <sys/ioctl.h>
497#endif
498#if HAVE_SYS_SOCKIO_H
499#include <sys/sockio.h>
500#endif
501])
f52be742 502
e25cadc9
VK
503# --------------------------------------------------------------------------
504# AIX specific
505
ca6ad6bb 506AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
e25cadc9 507AC_CHECK_DECLS([getkerninfo])
ca6ad6bb
VK
508AC_CHECK_FUNCS([getprocs64],,,[
509#if HAVE_PROCINFO_H
510#include <procinfo.h>
511#endif
512])
e25cadc9 513
d16cf8a5
AK
514# --------------------------------------------------------------------------
515# library functions
516
517AC_FUNC_ERROR_AT_LINE
abc48356
VK
518#AC_FUNC_MALLOC
519#AC_FUNC_REALLOC
d16cf8a5 520AC_FUNC_MEMCMP
d16cf8a5
AK
521AC_FUNC_SELECT_ARGTYPES
522AC_FUNC_STRFTIME
523AC_FUNC_STRTOD
524AC_FUNC_VPRINTF
525
b50f1100
VK
526AC_CHECK_FUNCS([gettimeofday memmove memset strchr strcspn strdup strerror])
527AC_CHECK_FUNCS([strrchr strtol strtoul strtoll strtoull])
467e30e1 528AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
d16cf8a5 529
2a1e4b34 530AC_CHECK_HEADERS([sys/sysctl.h vm/vm_param.h])
f91feddc 531AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
2a1e4b34 532
70fed300
AK
533AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
534
d16cf8a5
AK
535# sockets/resolver (probably for solaris)
536AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
537AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
538AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
539
540if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
541 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
542fi
543
544if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
545 AC_MSG_CHECKING([if we can include libnsl + libsocket])
546 LIBS="-lnsl -lsocket $LIBS"
547 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
548 if test "$my_ac_link_result" = "no" ; then
549 AC_MSG_RESULT([failure])
550 AC_MSG_ERROR([unable to use gethostbyname()])
551 else
552 AC_MSG_RESULT([success])
553 fi
554fi
555
3d9b275c 556#ALK: CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" PTHREAD_LIBS="-pthread",
d16cf8a5
AK
557# posix threads
558AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
559
560PTHREAD_LIBS=error
561AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
562AC_EGREP_CPP(yes,
a910e139 563 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
d16cf8a5
AK
564 yes
565 #endif
566 ], AC_MSG_RESULT(yes)
6693a1d0 567 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" PTHREAD_LIBS="-pthread",
d16cf8a5
AK
568 AC_MSG_RESULT(no))
569if test "x$PTHREAD_LIBS" = xerror; then
570 AC_CHECK_LIB(pthread, pthread_attr_init,
6693a1d0 571 PTHREAD_LIBS="-lpthread")
d16cf8a5
AK
572fi
573if test "x$PTHREAD_LIBS" = xerror; then
574 AC_CHECK_LIB(pthreads, pthread_attr_init,
6693a1d0 575 PTHREAD_LIBS="-lpthreads")
d16cf8a5 576fi
d16cf8a5 577if test "x$PTHREAD_LIBS" = xerror; then
6693a1d0
AK
578 AC_CHECK_FUNC(pthread_attr_init,
579 PTHREAD_LIBS="")
d16cf8a5 580fi
b9e22217
AK
581# HP-UX
582if test "x$PTHREAD_LIBS" = xerror; then
8be1f708
AK
583 AC_CHECK_LIB(pthread, __pthread_attr_init_system,
584 PTHREAD_LIBS="-lpthread")
b9e22217 585fi
d16cf8a5
AK
586if test "x$PTHREAD_LIBS" = xerror; then
587 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
588fi
a0537937 589LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
d16cf8a5
AK
590AC_SUBST(PTHREAD_LIBS)
591
696fc54f 592# Extensions to posix threads
6cd41ceb
VK
593AC_CHECK_HEADERS([pthread_np.h],,,[
594#include <pthread.h>
595])
696fc54f
VK
596AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
597
a0537937
VK
598# Check for recursive mutexes
599AC_CHECK_FUNCS([pthread_mutexattr_settype pthread_mutexattr_setkind_np])
6cd41ceb 600AC_CHECK_DECLS([PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
a0537937 601#include <pthread.h>
6cd41ceb
VK
602#if HAVE_PTHREAD_NP_H
603#include <pthread_np.h>
604#endif
a0537937
VK
605])
606
7e56bf2e
VK
607# Check for read/write locks
608# On Linux, rwlock functions declared always, but pthread_rwlock_t may need
609# additional defines
610AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
611if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
612 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
613 [AC_TRY_COMPILE([#include <sys/types.h>
614 #include <pthread.h>],
615 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
616 ac_cv_struct_pthread_rw=yes, [
617 AC_TRY_COMPILE([#define _XOPEN_SOURCE 500
618 #include <sys/types.h>
619 #include <pthread.h>],
620 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
621 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
622 if test "$ac_cv_struct_pthread_rw" = "yes"; then
623 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
624 fi
625 ])])
626 if test "$ac_cv_struct_pthread_rw" = "yes"; then
df7156b3 627 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
7e56bf2e
VK
628 fi
629fi
630
3e39fcde
VK
631# --------------------------------------------------------------------------
632# check for UNICODE stuff
633
634AC_CHECK_HEADERS([wchar.h])
635AC_CHECK_SIZEOF(wchar_t)
636
637if test $ac_cv_sizeof_wchar = 2; then
638 AC_DEFINE(HAVE_USEABLE_WCHAR_T, 1, Define to 1 if you have useable wchar_t)
639fi
640
82fa7c5d 641# misc
f8a000b8 642CPPFLAGS="$CPPFLAGS -DDATADIR=\\\"\${pkgdatadir}\\\" -DLIBDIR=\\\"\${libdir}\\\""
82fa7c5d 643
d16cf8a5
AK
644# --------------------------------------------------------------------------
645
646# shared libs versions
647#
648# versioning scheme: current:revision:age
649#
650# current
651# The number of the current interface exported by the library. A current
652# value of `0', means that you are calling the interface exported by this
653# library interface 0.
654#
655# revision
656# The implementation number of the most recent interface exported by this
657# library. In this case, a revision value of `0' means that this is the
658# first implementation of the interface.
659# If the next release of this library exports the same interface, but has a
660# different implementation (perhaps some bugs have been fixed), the revision
661# number will be higher, but current number will be the same. In that case,
662# when given a choice, the library with the highest revision will always
663# be used by the runtime loader.
664#
665# age
666# The number of previous additional interfaces supported by this library.
667# If age were `2', then this library can be linked into executables which
668# were built with a release of this library that exported the current
669# interface number, current, or any of the previous two interfaces.
670# By definition age must be less than or equal to current. At the outset,
671# only the first ever interface is implemented, so age can only be `0'.
672#
673#
674#
675
d8f2e39b
VK
676LIBNETXMS_LIBRARY_VERSION=0:2:0
677LIBNXCSCP_LIBRARY_VERSION=0:2:0
1d410d50
VK
678LIBNXMAP_LIBRARY_VERSION=0:2:0
679LIBNXCL_LIBRARY_VERSION=0:2:0
d8f2e39b
VK
680LIBNXSNMP_LIBRARY_VERSION=0:2:0
681LIBNXSRV_LIBRARY_VERSION=0:2:0
682LIBNXCORE_LIBRARY_VERSION=0:2:0
683DBDRV_LIBRARY_VERSION=0:2:0
684SMSDRV_LIBRARY_VERSION=0:2:0
c002b04a 685LIBNXSL_LIBRARY_VERSION=0:2:0
d16cf8a5 686AC_SUBST(LIBNETXMS_LIBRARY_VERSION)
3e7f0791 687AC_SUBST(LIBNXCSCP_LIBRARY_VERSION)
1d410d50
VK
688AC_SUBST(LIBNXMAP_LIBRARY_VERSION)
689AC_SUBST(LIBNXCL_LIBRARY_VERSION)
d853cd74 690AC_SUBST(LIBNXSNMP_LIBRARY_VERSION)
aa3b26fd 691AC_SUBST(LIBNXSRV_LIBRARY_VERSION)
17a48052 692AC_SUBST(LIBNXCORE_LIBRARY_VERSION)
b900a78b 693AC_SUBST(DBDRV_LIBRARY_VERSION)
d8f2e39b 694AC_SUBST(SMSDRV_LIBRARY_VERSION)
c002b04a 695AC_SUBST(LIBNXSL_LIBRARY_VERSION)
d16cf8a5
AK
696
697# --------------------------------------------------------------------------
698
699AC_CONFIG_FILES([
d16cf8a5 700 README
0c3c0c39
AK
701 Makefile
702 contrib/Makefile
0c3c0c39
AK
703 contrib/dct/Makefile
704 contrib/startup/Makefile
daaefaaf 705 contrib/startup/gentoo/Makefile
0c3c0c39 706 contrib/startup/redhat/Makefile
82fa7c5d 707 contrib/mibs/Makefile
3f2f9f2b 708 contrib/backgrounds/Makefile
0c3c0c39 709 doc/Makefile
a48203d2
VK
710 doc/internal/Makefile
711 doc/manuals/Makefile
712 doc/misc/Makefile
0c3c0c39
AK
713 images/Makefile
714 include/Makefile
715 m4/Makefile
716 netware/Makefile
717 sql/Makefile
0c3c0c39
AK
718 src/Makefile
719 src/libnetxms/Makefile
720 src/libnxcscp/Makefile
d853cd74 721 src/libnxsnmp/Makefile
0c3c0c39 722 src/libnxcl/Makefile
c002b04a 723 src/libnxsl/Makefile
1d410d50 724 src/libnxmap/Makefile
1b1edd49
VK
725 src/install/Makefile
726 src/install/windows/Makefile
0c3c0c39 727 src/console/Makefile
8c7d057b
VK
728 src/console/nxuilib/Makefile
729 src/console/nxuilib/res/Makefile
f7d8c3b2 730 src/console/nxuilib/sounds/Makefile
e4d08190 731 src/console/nxlexer/Makefile
0c3c0c39
AK
732 src/console/win32/Makefile
733 src/console/win32/icons/Makefile
734 src/console/win32/res/Makefile
735 src/console/win32starter/Makefile
672441ac 736 src/console/nxav/Makefile
2b463d08 737 src/console/nxav/res/Makefile
52996299
VK
738 src/console/nxnotify/Makefile
739 src/console/nxnotify/res/Makefile
672441ac 740 src/console/cmdline/Makefile
2b463d08
VK
741 src/console/PocketPC/Makefile
742 src/console/PocketPC/res/Makefile
0c3c0c39 743 src/nxevent/Makefile
1e8eed7a 744 src/nxreport/Makefile
148f47cf 745 src/nxmibc/Makefile
f519aa3e 746 src/nxscript/Makefile
0c3c0c39
AK
747 src/server/Makefile
748 src/server/core/Makefile
a551fe4d 749 src/server/netxmsd/Makefile
0c3c0c39
AK
750 src/server/dbdrv/Makefile
751 src/server/dbdrv/odbc/Makefile
752 src/server/dbdrv/mssql/Makefile
753 src/server/dbdrv/mysql/Makefile
754 src/server/dbdrv/pgsql/Makefile
9486b324 755 src/server/dbdrv/sqlite/Makefile
d8f2e39b
VK
756 src/server/smsdrv/Makefile
757 src/server/smsdrv/generic/Makefile
0c3c0c39
AK
758 src/server/tools/Makefile
759 src/server/tools/nxget/Makefile
760 src/server/tools/nxaction/Makefile
761 src/server/tools/nxadm/Makefile
5b0c7d0d
VK
762 src/server/tools/nxconfig/Makefile
763 src/server/tools/nxconfig/res/Makefile
f90d7fc5 764 src/server/tools/nxdbmgr/Makefile
d853cd74 765 src/server/tools/nxsnmpget/Makefile
734c670f 766 src/server/tools/nxsnmpwalk/Makefile
665b4ccf 767 src/server/tools/nxsnmpset/Makefile
d24fdaf4 768 src/server/tools/nxupload/Makefile
0c3c0c39
AK
769 src/server/libnxsrv/Makefile
770 src/agent/Makefile
771 src/agent/core/Makefile
5795bf90 772 src/agent/install/Makefile
0c3c0c39
AK
773 src/agent/subagents/Makefile
774 src/agent/subagents/linux/Makefile
775 src/agent/subagents/sunos/Makefile
d0b5a098 776 src/agent/subagents/aix/Makefile
0c3c0c39
AK
777 src/agent/subagents/skeleton/Makefile
778 src/agent/subagents/freebsd/Makefile
992ba479 779 src/agent/subagents/openbsd/Makefile
2b23dc1e 780 src/agent/subagents/ipso/Makefile
0c3c0c39 781 src/agent/subagents/netware/Makefile
1bc607cc
VK
782 src/agent/subagents/winnt/Makefile
783 src/agent/subagents/win9x/Makefile
0c3c0c39 784 src/agent/subagents/winperf/Makefile
93f15c2a 785 src/agent/subagents/portCheck/Makefile
b36a6eb9 786 src/agent/subagents/logscan/Makefile
abc48356 787 src/agent/subagents/ping/Makefile
2f06a66e 788 src/agent/subagents/ups/Makefile
9b648a2f
AK
789 src/nxhttpd/Makefile
790 src/nxhttpd/static/Makefile
2654e540 791 src/nxhttpd/static/images/Makefile
0c3c0c39 792 tools/Makefile
d16cf8a5
AK
793])
794
12249937
VK
795AC_OUTPUT
796
6f926182
AK
797#echo "Updating libtool-1"
798#sed 's/-lc_r/-lc_rXXX/' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
5cecf50e
AK
799
800echo "Updating libtool-2"
801sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
802
6f926182
AK
803#if test ! "x$BUILD_SERVER" = "xyes" ; then
804# echo "Updating libtool-3"
805# $PERL tools/patch_libtool.pl <libtool >libtool.new
806# mv libtool.new libtool
807# chmod 755 libtool
808#fi
a7442678
AK
809
810
811
812###########################
813#
814echo
815echo
816echo
817echo '---------------------------------------------------------------------'
818echo ' Configure results'
819echo '---------------------------------------------------------------------'
820echo
821 echo "Prefix : ${prefix}"
822if test "x${BUILD_SERVER}" = "xyes"; then
823 echo "Build Server : YES"
824else
825 echo "Build Server : NO"
826fi
827if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
828 echo "Encryption enabled : YES"
829else
830 echo "Encryption enabled : NO"
831fi
832if test "x${DB_DRIVERS}" != "x"; then
833 echo "Build DB-Drivers : ${DB_DRIVERS}"
834else
835 echo "Build DB-Drivers : NO"
836fi
837if test "x${BUILD_CLIENT}" = "xyes"; then
838 echo "Build Clients : YES"
839else
840 echo "Build Clients : NO"
841fi
2654e540
AK
842if test "x${BUILD_WEB_CLIENT}" = "xyes"; then
843 echo "Build Web Interface : YES"
844else
c2503081 845 echo "Build Web Interface : NO"
2654e540 846fi
a7442678
AK
847if test "x${BUILD_AGENT}" = "xyes"; then
848 echo "Build Agent : YES"
849 echo "Subagents list : ${SUBAGENT_DIRS}"
850else
851 echo "Build Agent : NO"
852fi
e8636669
VK
853if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
854 echo "Build Static Agent : YES"
855 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
856else
857 echo "Build Static Agent : NO"
858fi