Added check for swig
[public/netxms.git] / configure.ac
CommitLineData
a5e561bf 1# $Id: configure.ac,v 1.123 2005-12-28 14:38:34 victor Exp $
d16cf8a5
AK
2#
3# Process this file with autoconf to produce a configure script.
4#
5
6e99a8ab 6AC_INIT([NetXMS], [0.2.8], [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
a5e561bf 22AC_PROG_SWIG
5387ff75 23
e0760102
VK
24# --------------------------------------------------------------------------
25# disable C++ exceptions
063e34ad 26CFLAGS="$CFLAGS -fno-exceptions"
e0760102 27CPPFLAGS="$CPPFLAGS -fno-exceptions"
6f926182 28LDFLAGS="$LDFLAGS"
e8636669 29SUBAGENT_LIBS=""
5387ff75 30
7c9c94a7
VK
31# --------------------------------------------------------------------------
32# set LDFLAGS depending on OS
33
34case `uname -s` in
35 AIX)
36 LDFLAGS="-no-undefined $LDFLAGS"
37 ;;
38 *)
39 ;;
40esac
41
d16cf8a5
AK
42# --------------------------------------------------------------------------
43# misc
44
45AC_ARG_VAR(PERL,local path to the perl interpreter)
46perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin"
47AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path)
48
49if test -d /usr/local/include; then
50 CFLAGS="$CFLAGS -I/usr/local/include"
2cb1fb26 51 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
d16cf8a5
AK
52fi
53
54if test -d /usr/kerberos/include; then
55 CFLAGS="$CFLAGS -I/usr/kerberos/include"
2cb1fb26 56 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
d16cf8a5 57fi
521d90e7 58
d16cf8a5
AK
59if test -d /usr/local/lib; then
60 LDFLAGS="$LDFLAGS -L/usr/local/lib"
61fi
62
ae82f88f
VK
63# --------------------------------------------------------------------------
64# check for system pthread.h
65
66AC_CHECK_HEADERS([/usr/include/pthread.h])
67
d16cf8a5
AK
68# --------------------------------------------------------------------------
69# command line options
70
9486b324
VK
71AC_ARG_WITH(sqlite,
72[AS_HELP_STRING(--with-sqlite,build SQLite database driver)],
73[ if test "x$withval" != "xno" ; then
74 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
75 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
76 LDFLAGS="$LDFLAGS -L${withval}/lib"
77 CPPFLAGS="$CPPFLAGS -I${withval}/include"
78 fi
79 DYNAMIC_COMPONENTS="yes"
80 with_sqlite="yes"
81 AC_DEFINE(WITH_SQLITE,,[with sqlite])
82 DB_DRIVERS="$DB_DRIVERS sqlite"
83 AC_CHECK_LIB(sqlite3, sqlite3_open, ,
84 [AC_MSG_ERROR(libsqlite3 is required for SQLite support)])
85fi ])
86
c4b88c3d
VK
87AC_ARG_WITH(odbc,
88[AS_HELP_STRING(--with-odbc,build ODBC database driver)],
89[ if test "x$withval" != "xno" ; then
90 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
91 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
92 LDFLAGS="$LDFLAGS -L${withval}/lib"
93 CPPFLAGS="$CPPFLAGS -I${withval}/include"
94 fi
e8636669 95 DYNAMIC_COMPONENTS="yes"
c4b88c3d
VK
96 with_odbc="yes"
97 AC_DEFINE(WITH_ODBC,,[with odbc])
98 DB_DRIVERS="$DB_DRIVERS odbc"
99 AC_CHECK_LIB(odbc, SQLAllocHandle, ,
b11f69d6 100 [AC_MSG_ERROR(libodbc is required for ODBC support)])
c4b88c3d
VK
101fi ])
102
d16cf8a5 103AC_ARG_WITH(mysql,
c4b88c3d 104[AS_HELP_STRING(--with-mysql,build MySQL database driver)],
d16cf8a5
AK
105[ if test "x$withval" != "xno" ; then
106 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
107 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
108 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/mysql -L${withval}/mysql/lib"
6693a1d0 109 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include"
d16cf8a5 110 else
007ae516
VK
111 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}"
112 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 113 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 114 fi
e8636669 115 DYNAMIC_COMPONENTS="yes"
d16cf8a5
AK
116 AC_CHECK_LIB(m, floor)
117 AC_CHECK_LIB(z, gzclose)
118 with_mysql="yes"
119 AC_DEFINE(WITH_MYSQL,,[with mysql])
6693a1d0 120 DB_DRIVERS="$DB_DRIVERS mysql"
d16cf8a5 121 AC_CHECK_LIB(mysqlclient, mysql_init, ,
b11f69d6 122 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
d16cf8a5
AK
123 AC_MSG_CHECKING(whether mysql clients can run)
124 AC_RUN_IFELSE([AC_LANG_SOURCE([[
125 #include <stdio.h>
126 #include <mysql.h>
127 int main(void)
128 {
129 MYSQL *a = mysql_init(NULL);
130 return 0;
131 }
132 ]])],[],[
133 AC_MSG_RESULT(no)
134 AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)
135 ],[])
136 AC_MSG_RESULT(yes)
137 AC_CHECK_FUNCS(mysql_real_escape_string)
6693a1d0 138fi ])
d16cf8a5
AK
139
140AC_ARG_WITH(pgsql,
c4b88c3d 141[AS_HELP_STRING(--with-pgsql,build PostgreSQL database driver)],
d16cf8a5 142[ if test "x$withval" != "xno" ; then
6693a1d0
AK
143 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
144 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
145 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/pgsql -L${withval}/lib/postgresql -L${withval}/pgsql/lib -L${withval}/postgresql/lib"
146 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/pgsql -I${withval}/include/postgresql -I${withval}/pgsql/include -I${withval}/postgresql/include"
147 else
007ae516
VK
148 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}"
149 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
150 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"
151 fi
e8636669 152 DYNAMIC_COMPONENTS="yes"
6693a1d0
AK
153 AC_CHECK_LIB(m, floor)
154 AC_CHECK_LIB(z, gzclose)
155 with_pgsql="yes"
156 DB_DRIVERS="$DB_DRIVERS pgsql"
157 AC_DEFINE(WITH_PGSQL,,[with pgsql])
158 AC_CHECK_LIB(pq, PQconnectdb, ,
b11f69d6 159 [AC_MSG_ERROR(libpq is required for PostgreSQL support)])
6693a1d0
AK
160 AC_MSG_CHECKING(whether postgresql clients can run)
161 AC_RUN_IFELSE([AC_LANG_SOURCE([[
162 #include <stdio.h>
163 #include <libpq-fe.h>
164 int main(void)
165 {
166 PGconn *a = PQconnectdb("");
167 return 0;
168 }
169 ]])],[],[
170 AC_MSG_RESULT(no)
171 AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
172 ],[])
173 AC_MSG_RESULT(yes)
174fi ])
d16cf8a5 175
3a7ce527
AK
176AC_ARG_WITH(server,
177[AS_HELP_STRING(--with-server,build server)],
178[
148f47cf 179 MODULES="$MODULES libnxsnmp server nxmibc"
abc48356
VK
180 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES sql images"
181 CONTRIB_MODULES="$CONTRIB_MODULES mibs"
08ffa53e 182 BUILD_SERVER="yes"
e8636669 183 DYNAMIC_COMPONENTS="yes"
3a7ce527 184])
3a7ce527
AK
185
186
e0760102
VK
187AC_ARG_WITH(client,
188[AS_HELP_STRING(--with-client,build client library and tools)],
189[
1e8eed7a 190 MODULES="$MODULES libnxcl nxevent nxreport console"
e0760102 191 BUILD_CLIENT="yes"
e8636669 192 DYNAMIC_COMPONENTS="yes"
e0760102
VK
193])
194
195
3a7ce527
AK
196SUBAGENT_DIRS=""
197AC_ARG_WITH(agent,
198[AS_HELP_STRING(--with-agent,build agent)],
199[
a7442678 200 BUILD_AGENT=yes
0c3c0c39 201 MODULES="$MODULES agent"
3a7ce527
AK
202 case `uname -s` in
203 Linux)
204 SUBAGENT_DIRS="linux"
205 ;;
206 FreeBSD)
207 SUBAGENT_DIRS="freebsd"
208 ;;
209 SunOS)
210 SUBAGENT_DIRS="sunos"
211 ;;
d0b5a098
VK
212 AIX)
213 SUBAGENT_DIRS="aix"
214 ;;
3a7ce527
AK
215 *)
216 # unknown
217 ;;
218 esac
e8636669
VK
219 DYNAMIC_COMPONENTS="yes"
220])
221
222AC_ARG_WITH(static-agent,
223[AS_HELP_STRING(--with-static-agent,build statically linked agent)],
224[
225 BUILD_STATIC_AGENT="yes"
226 MODULES="$MODULES agent"
227 CFLAGS="$CFLAGS -D_STATIC_AGENT"
228 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT"
229# STATIC_SUBAGENT_LIST="ping portcheck"
230 case `uname -s` in
231 Linux)
232 SUBAGENT_DIRS="linux"
d0b5a098
VK
233 SUBAGENT_LIBS="../subagents/linux/libnsm_linux.la"
234 STATIC_SUBAGENT_LIST="linux $STATIC_SUBAGENT_LIST"
e8636669
VK
235 ;;
236 FreeBSD)
237 SUBAGENT_DIRS="freebsd"
d0b5a098
VK
238 SUBAGENT_LIBS="../subagents/freebsd/libnsm_freebsd.la"
239 STATIC_SUBAGENT_LIST="freebsd $STATIC_SUBAGENT_LIST"
e8636669
VK
240 ;;
241 SunOS)
242 SUBAGENT_DIRS="sunos"
d0b5a098
VK
243 SUBAGENT_LIBS="../subagents/sunos/libnsm_sunos.la"
244 STATIC_SUBAGENT_LIST="sunos $STATIC_SUBAGENT_LIST"
245 ;;
246 AIX)
247 SUBAGENT_DIRS="aix"
248 SUBAGENT_LIBS="../subagents/aix/libnsm_aix.la"
249 STATIC_SUBAGENT_LIST="aix $STATIC_SUBAGENT_LIST"
e8636669
VK
250 ;;
251 *)
252 # unknown
253 ;;
254 esac
3a7ce527 255])
0c3c0c39
AK
256
257AC_ARG_WITH(dist,
258[AS_HELP_STRING(--with-dist,for maintainers only)],
c2eaebc6 259 DB_DRIVERS="mysql pgsql odbc mssql sqlite"
29fa8356 260 MODULES="libnxsnmp server agent libnxcl nxevent nxreport nxmibc console www"
221f5602 261 SUBAGENT_DIRS="linux freebsd sunos aix"
5b0c7d0d 262 NXCONFIG="nxconfig"
abc48356
VK
263 TOP_LEVEL_MODULES="sql images"
264 CONTRIB_MODULES="mibs"
0c3c0c39
AK
265)
266
b97191d2
AK
267AC_ARG_WITH(nxsm,
268[AS_HELP_STRING(--with-nxsm,build session manager for web interface)],
269[
270 MODULES="$MODULES www"
271 BUILD_CLIENT="yes"
e8636669 272 DYNAMIC_COMPONENTS="yes"
b97191d2
AK
273])
274
a7442678
AK
275AC_ARG_WITH(openssl,
276 [AS_HELP_STRING(--with-openssl,specify OpenSSL location)],
277 [
a7442678
AK
278 if test "x$withval" != "xno" ; then
279 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
280 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
281 LDFLAGS="$LDFLAGS -L${withval}/lib"
282 CPPFLAGS="$CPPFLAGS -I${withval}/include"
283 else
284 LD_RUN_PATH="/usr/local/lib:/opt/openssl/lib:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
285 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/opt/openssl/lib"
286 CPPFLAGS="$CPPFLAGS -I/usr/local/include -I/opt/openssl/include"
287 fi
ad6eb83b
AK
288 AC_CHECK_LIB(crypto, RSA_new,
289 [
290 AC_DEFINE(WITH_OPENSSL,,[with openssl])
291 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
292 [], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
293 AC_CHECK_LIB(crypto, EVP_bf_cbc,
294 [], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
295 AC_CHECK_LIB(crypto, EVP_idea_cbc,
296 [], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
297 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
298 [], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
299 ],
a7442678
AK
300 [AC_MSG_ERROR(libcrypto is required for encryption support)])
301 fi
a7442678 302 ],
ad6eb83b
AK
303 [
304 AC_CHECK_LIB(crypto, RSA_new,
305 [
306 AC_DEFINE(WITH_OPENSSL,,[with openssl])
307 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
308 [], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
309 AC_CHECK_LIB(crypto, EVP_bf_cbc,
310 [], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
311 AC_CHECK_LIB(crypto, EVP_idea_cbc,
312 [], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
313 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
314 [], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
315 ],
316 [AC_MSG_RESULT(libcrypto is required for encryption support)])
317 ])
6619a6b0 318
0c3c0c39
AK
319AC_SUBST(DB_DRIVERS)
320AC_SUBST(MODULES)
3a7ce527 321AC_SUBST(SUBAGENT_DIRS)
5b0c7d0d 322AC_SUBST(NXCONFIG)
abc48356
VK
323AC_SUBST(TOP_LEVEL_MODULES)
324AC_SUBST(CONTRIB_MODULES)
e8636669
VK
325AC_SUBST(STATIC_SUBAGENT_LIST)
326AC_SUBST(SUBAGENT_LIBS)
c2eaebc6 327AC_SUBST(BUILD_SERVER)
e8636669
VK
328
329# --------------------------------------------------------------------------
330# If --with-static-agent selected, other components cannot be selected
331# Select shared or static libraries depending on agent build type
332if test "x$BUILD_STATIC_AGENT" = "xyes" ; then
333 if test "x$DYNAMIC_COMPONENTS" = "xyes" ; then
334 AC_MSG_ERROR(Static agent and other components are mutally exclusive.)
335 fi
5669350c 336 ${enable_shared=no}
e8636669 337else
5669350c 338 ${enable_static=no}
e8636669
VK
339fi
340
341AC_LIBTOOL_DLOPEN
342AC_PROG_LIBTOOL
3a7ce527 343
d16cf8a5
AK
344# --------------------------------------------------------------------------
345# checks for libs.
346
347#AC_CHECK_LIB([socket], [socket])
348#AC_CHECK_LIB([nsl], [gethostbyname])
349
521d90e7 350AC_CHECK_LIB(socket, if_nameindex)
87bb64a7 351AC_CHECK_LIB(dl, dlopen)
1b3c0ef0 352AC_CHECK_LIB(kstat, kstat_open)
d16cf8a5 353
e0760102
VK
354if test "x$BUILD_SERVER" = "xyes" ; then
355 AC_CHECK_LIB(termcap, tgetstr, [], [AC_CHECK_LIB(ncurses, tgetstr, [], AC_CHECK_LIB(curses, tgetstr))])
356 AC_CHECK_LIB(readline, readline)
357fi
358
d16cf8a5
AK
359# --------------------------------------------------------------------------
360# checks for headers.
361
362AC_HEADER_STDC
363AC_HEADER_STAT
364AC_HEADER_TIME
521d90e7 365AC_CHECK_HEADERS([sys/int_types.h])
d16cf8a5 366AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h sys/socket.h])
467e30e1 367AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h])
85303064 368AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h])
14ab1131 369AC_CHECK_HEADERS([readline/readline.h])
f52be742 370AC_CHECK_HEADERS([byteswap.h])
eca0b061 371AC_CHECK_HEADERS([sys/mman.h])
31a11006 372AC_CHECK_HEADERS([sys/utsname.h])
d16cf8a5 373
d16cf8a5
AK
374# --------------------------------------------------------------------------
375# types
376AC_CHECK_SIZEOF(short)
377AC_CHECK_SIZEOF(int)
378AC_CHECK_SIZEOF(long)
379AC_CHECK_SIZEOF(long long)
380
381AC_TYPE_PID_T
382AC_TYPE_SIGNAL
383AC_TYPE_SIZE_T
384AC_STRUCT_TIMEZONE
385
521d90e7 386AC_CHECK_TYPES([int64_t, uint64_t, u_int64_t])
eca0b061 387AC_CHECK_TYPES([off_t])
521d90e7 388
d16cf8a5
AK
389# --------------------------------------------------------------------------
390# C/CPP caps
391
392AC_PROG_GCC_TRADITIONAL
393AC_C_CONST
394AC_C_BIGENDIAN
395
f52be742
VK
396# --------------------------------------------------------------------------
397# macros
398
399AC_CHECK_DECLS([__bswap_64],,,[
400#if HAVE_BYTESWAP_H
401#include <byteswap.h>
402#endif
403])
85303064
VK
404AC_CHECK_DECLS([SIOCGIFADDR, SIOCGIFNETMASK, SIOCGIFHWADDR],,,[
405#if HAVE_SYS_IOCTL_H
406#include <sys/ioctl.h>
407#endif
408#if HAVE_SYS_SOCKIO_H
409#include <sys/sockio.h>
410#endif
411])
f52be742 412
d16cf8a5
AK
413# --------------------------------------------------------------------------
414# library functions
415
416AC_FUNC_ERROR_AT_LINE
abc48356
VK
417#AC_FUNC_MALLOC
418#AC_FUNC_REALLOC
d16cf8a5 419AC_FUNC_MEMCMP
d16cf8a5
AK
420AC_FUNC_SELECT_ARGTYPES
421AC_FUNC_STRFTIME
422AC_FUNC_STRTOD
423AC_FUNC_VPRINTF
424
b50f1100
VK
425AC_CHECK_FUNCS([gettimeofday memmove memset strchr strcspn strdup strerror])
426AC_CHECK_FUNCS([strrchr strtol strtoul strtoll strtoull])
467e30e1 427AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
d16cf8a5 428
d16cf8a5
AK
429# sockets/resolver (probably for solaris)
430AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
431AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
432AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
433
434if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
435 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
436fi
437
438if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
439 AC_MSG_CHECKING([if we can include libnsl + libsocket])
440 LIBS="-lnsl -lsocket $LIBS"
441 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
442 if test "$my_ac_link_result" = "no" ; then
443 AC_MSG_RESULT([failure])
444 AC_MSG_ERROR([unable to use gethostbyname()])
445 else
446 AC_MSG_RESULT([success])
447 fi
448fi
449
3d9b275c 450#ALK: CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" PTHREAD_LIBS="-pthread",
d16cf8a5
AK
451# posix threads
452AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
453
454PTHREAD_LIBS=error
455AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
456AC_EGREP_CPP(yes,
a910e139 457 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
d16cf8a5
AK
458 yes
459 #endif
460 ], AC_MSG_RESULT(yes)
6693a1d0 461 CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" PTHREAD_LIBS="-pthread",
d16cf8a5
AK
462 AC_MSG_RESULT(no))
463if test "x$PTHREAD_LIBS" = xerror; then
464 AC_CHECK_LIB(pthread, pthread_attr_init,
6693a1d0 465 PTHREAD_LIBS="-lpthread")
d16cf8a5
AK
466fi
467if test "x$PTHREAD_LIBS" = xerror; then
468 AC_CHECK_LIB(pthreads, pthread_attr_init,
6693a1d0 469 PTHREAD_LIBS="-lpthreads")
d16cf8a5 470fi
d16cf8a5 471if test "x$PTHREAD_LIBS" = xerror; then
6693a1d0
AK
472 AC_CHECK_FUNC(pthread_attr_init,
473 PTHREAD_LIBS="")
d16cf8a5
AK
474fi
475if test "x$PTHREAD_LIBS" = xerror; then
476 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
477fi
478AC_SUBST(PTHREAD_LIBS)
479
696fc54f
VK
480# Extensions to posix threads
481AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
482
82fa7c5d 483# misc
f8a000b8 484CPPFLAGS="$CPPFLAGS -DDATADIR=\\\"\${pkgdatadir}\\\" -DLIBDIR=\\\"\${libdir}\\\""
82fa7c5d 485
d16cf8a5
AK
486# --------------------------------------------------------------------------
487
488# shared libs versions
489#
490# versioning scheme: current:revision:age
491#
492# current
493# The number of the current interface exported by the library. A current
494# value of `0', means that you are calling the interface exported by this
495# library interface 0.
496#
497# revision
498# The implementation number of the most recent interface exported by this
499# library. In this case, a revision value of `0' means that this is the
500# first implementation of the interface.
501# If the next release of this library exports the same interface, but has a
502# different implementation (perhaps some bugs have been fixed), the revision
503# number will be higher, but current number will be the same. In that case,
504# when given a choice, the library with the highest revision will always
505# be used by the runtime loader.
506#
507# age
508# The number of previous additional interfaces supported by this library.
509# If age were `2', then this library can be linked into executables which
510# were built with a release of this library that exported the current
511# interface number, current, or any of the previous two interfaces.
512# By definition age must be less than or equal to current. At the outset,
513# only the first ever interface is implemented, so age can only be `0'.
514#
515#
516#
517
d8f2e39b
VK
518LIBNETXMS_LIBRARY_VERSION=0:2:0
519LIBNXCSCP_LIBRARY_VERSION=0:2:0
520LIBNXSNMP_LIBRARY_VERSION=0:2:0
521LIBNXSRV_LIBRARY_VERSION=0:2:0
522LIBNXCORE_LIBRARY_VERSION=0:2:0
523DBDRV_LIBRARY_VERSION=0:2:0
524SMSDRV_LIBRARY_VERSION=0:2:0
d16cf8a5 525AC_SUBST(LIBNETXMS_LIBRARY_VERSION)
3e7f0791 526AC_SUBST(LIBNXCSCP_LIBRARY_VERSION)
d853cd74 527AC_SUBST(LIBNXSNMP_LIBRARY_VERSION)
aa3b26fd 528AC_SUBST(LIBNXSRV_LIBRARY_VERSION)
17a48052 529AC_SUBST(LIBNXCORE_LIBRARY_VERSION)
b900a78b 530AC_SUBST(DBDRV_LIBRARY_VERSION)
d8f2e39b 531AC_SUBST(SMSDRV_LIBRARY_VERSION)
d16cf8a5
AK
532
533# --------------------------------------------------------------------------
534
535AC_CONFIG_FILES([
d16cf8a5 536 README
0c3c0c39
AK
537 Makefile
538 contrib/Makefile
0c3c0c39
AK
539 contrib/dct/Makefile
540 contrib/startup/Makefile
541 contrib/startup/redhat/Makefile
82fa7c5d 542 contrib/mibs/Makefile
0c3c0c39
AK
543 doc/Makefile
544 images/Makefile
545 include/Makefile
546 m4/Makefile
547 netware/Makefile
548 sql/Makefile
0c3c0c39
AK
549 src/Makefile
550 src/libnetxms/Makefile
551 src/libnxcscp/Makefile
d853cd74 552 src/libnxsnmp/Makefile
0c3c0c39 553 src/libnxcl/Makefile
1b1edd49
VK
554 src/install/Makefile
555 src/install/windows/Makefile
0c3c0c39 556 src/console/Makefile
8c7d057b
VK
557 src/console/nxuilib/Makefile
558 src/console/nxuilib/res/Makefile
f7d8c3b2 559 src/console/nxuilib/sounds/Makefile
0c3c0c39
AK
560 src/console/win32/Makefile
561 src/console/win32/icons/Makefile
562 src/console/win32/res/Makefile
563 src/console/win32starter/Makefile
672441ac 564 src/console/nxav/Makefile
2b463d08 565 src/console/nxav/res/Makefile
672441ac 566 src/console/cmdline/Makefile
2b463d08
VK
567 src/console/PocketPC/Makefile
568 src/console/PocketPC/res/Makefile
0c3c0c39 569 src/nxevent/Makefile
1e8eed7a 570 src/nxreport/Makefile
148f47cf 571 src/nxmibc/Makefile
0c3c0c39
AK
572 src/server/Makefile
573 src/server/core/Makefile
a551fe4d 574 src/server/netxmsd/Makefile
0c3c0c39
AK
575 src/server/dbdrv/Makefile
576 src/server/dbdrv/odbc/Makefile
577 src/server/dbdrv/mssql/Makefile
578 src/server/dbdrv/mysql/Makefile
579 src/server/dbdrv/pgsql/Makefile
9486b324 580 src/server/dbdrv/sqlite/Makefile
d8f2e39b
VK
581 src/server/smsdrv/Makefile
582 src/server/smsdrv/generic/Makefile
0c3c0c39
AK
583 src/server/tools/Makefile
584 src/server/tools/nxget/Makefile
585 src/server/tools/nxaction/Makefile
586 src/server/tools/nxadm/Makefile
5b0c7d0d
VK
587 src/server/tools/nxconfig/Makefile
588 src/server/tools/nxconfig/res/Makefile
f90d7fc5 589 src/server/tools/nxdbmgr/Makefile
d853cd74 590 src/server/tools/nxsnmpget/Makefile
734c670f 591 src/server/tools/nxsnmpwalk/Makefile
665b4ccf 592 src/server/tools/nxsnmpset/Makefile
d24fdaf4 593 src/server/tools/nxupload/Makefile
0c3c0c39
AK
594 src/server/libnxsrv/Makefile
595 src/agent/Makefile
596 src/agent/core/Makefile
5795bf90 597 src/agent/install/Makefile
0c3c0c39
AK
598 src/agent/subagents/Makefile
599 src/agent/subagents/linux/Makefile
600 src/agent/subagents/sunos/Makefile
d0b5a098 601 src/agent/subagents/aix/Makefile
0c3c0c39
AK
602 src/agent/subagents/skeleton/Makefile
603 src/agent/subagents/freebsd/Makefile
604 src/agent/subagents/netware/Makefile
1bc607cc
VK
605 src/agent/subagents/winnt/Makefile
606 src/agent/subagents/win9x/Makefile
0c3c0c39 607 src/agent/subagents/winperf/Makefile
93f15c2a 608 src/agent/subagents/portCheck/Makefile
abc48356 609 src/agent/subagents/ping/Makefile
b97191d2
AK
610 src/www/Makefile
611 src/www/iis/Makefile
612 src/www/nxsm/Makefile
d2a3bf6b 613 src/www/nxsmcl/Makefile
0c3c0c39 614 tools/Makefile
d16cf8a5
AK
615])
616
12249937
VK
617AC_OUTPUT
618
6f926182
AK
619#echo "Updating libtool-1"
620#sed 's/-lc_r/-lc_rXXX/' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
5cecf50e
AK
621
622echo "Updating libtool-2"
623sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
624
6f926182
AK
625#if test ! "x$BUILD_SERVER" = "xyes" ; then
626# echo "Updating libtool-3"
627# $PERL tools/patch_libtool.pl <libtool >libtool.new
628# mv libtool.new libtool
629# chmod 755 libtool
630#fi
a7442678
AK
631
632
633
634###########################
635#
636echo
637echo
638echo
639echo '---------------------------------------------------------------------'
640echo ' Configure results'
641echo '---------------------------------------------------------------------'
642echo
643 echo "Prefix : ${prefix}"
644if test "x${BUILD_SERVER}" = "xyes"; then
645 echo "Build Server : YES"
646else
647 echo "Build Server : NO"
648fi
649if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
650 echo "Encryption enabled : YES"
651else
652 echo "Encryption enabled : NO"
653fi
654if test "x${DB_DRIVERS}" != "x"; then
655 echo "Build DB-Drivers : ${DB_DRIVERS}"
656else
657 echo "Build DB-Drivers : NO"
658fi
659if test "x${BUILD_CLIENT}" = "xyes"; then
660 echo "Build Clients : YES"
661else
662 echo "Build Clients : NO"
663fi
664if test "x${BUILD_AGENT}" = "xyes"; then
665 echo "Build Agent : YES"
666 echo "Subagents list : ${SUBAGENT_DIRS}"
667else
668 echo "Build Agent : NO"
669fi
e8636669
VK
670if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
671 echo "Build Static Agent : YES"
672 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
673else
674 echo "Build Static Agent : NO"
675fi