Commit | Line | Data |
---|---|---|
6db3b20b | 1 | # $Id: configure.ac,v 1.248 2007-06-13 22:18:35 victor Exp $ |
d16cf8a5 | 2 | # |
ef0c727b VK |
3 | # NetXMS - Network Management System |
4 | # Configure script | |
d16cf8a5 AK |
5 | # |
6 | ||
6db3b20b | 7 | AC_INIT([NetXMS], [0.2.18-rc1], [NetXMS Team <bugs@netxms.org>]) |
ba1d810c AK |
8 | AC_CONFIG_AUX_DIR(config) |
9 | AM_CONFIG_HEADER(config.h) | |
d16cf8a5 AK |
10 | AM_INIT_AUTOMAKE |
11 | ||
5387ff75 | 12 | |
ef0c727b VK |
13 | #-------------------------------------------------------------------- |
14 | # Functions | |
15 | #-------------------------------------------------------------------- | |
5387ff75 | 16 | |
ef0c727b VK |
17 | check_substr() |
18 | { | |
1010cff7 | 19 | for w in $1; do |
ef0c727b VK |
20 | if test "x$w" = "x$2"; then |
21 | return 0; | |
22 | fi | |
23 | done | |
24 | return 1 | |
25 | } | |
16dff090 | 26 | |
d3c8926d | 27 | |
ef0c727b VK |
28 | #-------------------------------------------------------------------- |
29 | # Initialize variables | |
30 | #-------------------------------------------------------------------- | |
d3c8926d | 31 | |
ef0c727b VK |
32 | PLATFORM=`uname -s` |
33 | COMPONENTS="" | |
34 | DISABLE_ICONV="no" | |
35 | DISABLE_ENCRYPTION="no" | |
36 | ENABLE_UNSTABLE="no" | |
37 | STATIC_BUILD="no" | |
38 | DBDRIVER_SELECTED="no" | |
39 | USE_PTH="no" | |
40 | BUILD_SERVER="no" | |
41 | BUILD_AGENT="no" | |
42 | BUILD_CLIENT="no" | |
43 | BUILD_NXHTTPD="no" | |
44 | BUILD_STATIC_AGENT="no" | |
45 | NEED_ZLIB="no" | |
46 | MODULES="" | |
ef0c727b VK |
47 | STATIC_SUBAGENT_LIST="" |
48 | SUBAGENT_DIRS="" | |
49 | SUBAGENT_LIBS="" | |
50 | UNSTABLE_SUBAGENT_DIRS="" | |
51 | SERVER_TOOLS="" | |
52 | TOP_LEVEL_MODULES="" | |
53 | CONTRIB_MODULES="" | |
d3c8926d | 54 | |
16dff090 | 55 | |
ef0c727b VK |
56 | #-------------------------------------------------------------------- |
57 | # Parse command line parameters | |
58 | #-------------------------------------------------------------------- | |
7c9c94a7 | 59 | |
ef0c727b VK |
60 | AC_ARG_WITH(server, |
61 | [AS_HELP_STRING(--with-server,build server)], | |
62 | [ | |
63 | COMPONENTS="$COMPONENTS server agent" | |
64 | ]) | |
7c9c94a7 | 65 | |
ef0c727b VK |
66 | AC_ARG_WITH(client, |
67 | [AS_HELP_STRING(--with-client,build client library and tools)], | |
68 | [ | |
69 | COMPONENTS="$COMPONENTS client" | |
70 | ]) | |
d16cf8a5 | 71 | |
ef0c727b VK |
72 | AC_ARG_WITH(agent, |
73 | [AS_HELP_STRING(--with-agent,build agent)], | |
74 | [ | |
75 | COMPONENTS="$COMPONENTS agent" | |
76 | ]) | |
d16cf8a5 | 77 | |
ef0c727b VK |
78 | AC_ARG_WITH(static-agent, |
79 | [AS_HELP_STRING(--with-static-agent,build statically linked agent)], | |
80 | [ | |
81 | COMPONENTS="$COMPONENTS static-agent" | |
82 | ]) | |
d16cf8a5 | 83 | |
ef0c727b VK |
84 | AC_ARG_WITH(ipso-agent, |
85 | [AS_HELP_STRING(--with-ipso-agent,build statically linked IPSO agent)], | |
86 | [ | |
87 | COMPONENTS="$COMPONENTS ipso-agent" | |
88 | ]) | |
521d90e7 | 89 | |
ef0c727b VK |
90 | AC_ARG_WITH(nxhttpd, |
91 | [AS_HELP_STRING(--with-nxhttpd,build web interface)], | |
92 | [ | |
93 | COMPONENTS="$COMPONENTS nxhttpd" | |
9adfeefb AK |
94 | |
95 | AC_CHECK_HEADER(gd.h,,AC_MSG_ERROR([*** GD support not installed - please install first ***])) | |
96 | AC_CHECK_LIB(gd, gdImageCreate, [], [ | |
97 | AC_MSG_ERROR(libgd is required for web interface) | |
98 | ]) | |
ef0c727b | 99 | ]) |
d16cf8a5 | 100 | |
ef0c727b VK |
101 | AC_ARG_WITH(mdebug, |
102 | [AS_HELP_STRING(--with-mdebug,use debug version of memory allocation functions)], | |
103 | [ | |
104 | CPPFLAGS="$CPPFLAGS -DNETXMS_MEMORY_DEBUG" | |
105 | ]) | |
d16cf8a5 | 106 | |
9486b324 VK |
107 | AC_ARG_WITH(sqlite, |
108 | [AS_HELP_STRING(--with-sqlite,build SQLite database driver)], | |
109 | [ if test "x$withval" != "xno" ; then | |
110 | if test "x$withval" != "x" && test "x$withval" != "xyes" ; then | |
111 | LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}" | |
112 | LDFLAGS="$LDFLAGS -L${withval}/lib" | |
113 | CPPFLAGS="$CPPFLAGS -I${withval}/include" | |
ef0c727b VK |
114 | fi |
115 | COMPONENTS="$COMPONENTS sqlite" | |
116 | DBDRIVER_SELECTED="yes" | |
9486b324 VK |
117 | fi ]) |
118 | ||
c4b88c3d VK |
119 | AC_ARG_WITH(odbc, |
120 | [AS_HELP_STRING(--with-odbc,build ODBC database driver)], | |
121 | [ if test "x$withval" != "xno" ; then | |
122 | if test "x$withval" != "x" && test "x$withval" != "xyes" ; then | |
123 | LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}" | |
124 | LDFLAGS="$LDFLAGS -L${withval}/lib" | |
125 | CPPFLAGS="$CPPFLAGS -I${withval}/include" | |
ef0c727b VK |
126 | fi |
127 | COMPONENTS="$COMPONENTS odbc" | |
128 | DBDRIVER_SELECTED="yes" | |
c4b88c3d VK |
129 | fi ]) |
130 | ||
d16cf8a5 | 131 | AC_ARG_WITH(mysql, |
c4b88c3d | 132 | [AS_HELP_STRING(--with-mysql,build MySQL database driver)], |
d16cf8a5 AK |
133 | [ if test "x$withval" != "xno" ; then |
134 | if test "x$withval" != "x" && test "x$withval" != "xyes" ; then | |
135 | LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}" | |
136 | LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/mysql -L${withval}/mysql/lib" | |
6693a1d0 | 137 | CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include" |
d16cf8a5 | 138 | else |
007ae516 VK |
139 | 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}" |
140 | 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 | 141 | 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 | 142 | fi |
ef0c727b VK |
143 | COMPONENTS="$COMPONENTS mysql" |
144 | DBDRIVER_SELECTED="yes" | |
6693a1d0 | 145 | fi ]) |
d16cf8a5 AK |
146 | |
147 | AC_ARG_WITH(pgsql, | |
c4b88c3d | 148 | [AS_HELP_STRING(--with-pgsql,build PostgreSQL database driver)], |
d16cf8a5 | 149 | [ if test "x$withval" != "xno" ; then |
6693a1d0 AK |
150 | if test "x$withval" != "x" && test "x$withval" != "xyes" ; then |
151 | LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}" | |
152 | LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/pgsql -L${withval}/lib/postgresql -L${withval}/pgsql/lib -L${withval}/postgresql/lib" | |
153 | CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/pgsql -I${withval}/include/postgresql -I${withval}/pgsql/include -I${withval}/postgresql/include" | |
154 | else | |
007ae516 VK |
155 | 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}" |
156 | 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 |
157 | 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" |
158 | fi | |
ef0c727b VK |
159 | COMPONENTS="$COMPONENTS pgsql" |
160 | DBDRIVER_SELECTED="yes" | |
6693a1d0 | 161 | fi ]) |
d16cf8a5 | 162 | |
ef0c727b | 163 | AC_ARG_WITH(openssl, |
1010cff7 VK |
164 | [AS_HELP_STRING(--with-openssl,specify OpenSSL location)], |
165 | [ | |
166 | if test "x$withval" != "xno" ; then | |
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" | |
170 | CPPFLAGS="$CPPFLAGS -I${withval}/include" | |
171 | else | |
172 | LD_RUN_PATH="/usr/local/lib:/opt/openssl/lib:/usr/local/ssl/lib:${LD_RUN_PATH:+:}${LD_RUN_PATH}" | |
173 | LDFLAGS="$LDFLAGS -L/usr/local/lib -L/opt/openssl/lib" | |
174 | CPPFLAGS="$CPPFLAGS -I/usr/local/include -I/opt/openssl/include" | |
ef0c727b | 175 | fi |
1010cff7 VK |
176 | fi |
177 | REQUIRE_ENCRYPTION="yes" | |
178 | ]) | |
ef0c727b VK |
179 | |
180 | AC_ARG_ENABLE(iconv, | |
181 | [AS_HELP_STRING(--disable-iconv,do not use iconv() for text conversions)], | |
3a7ce527 | 182 | [ |
ef0c727b | 183 | DISABLE_ICONV="yes" |
3a7ce527 | 184 | ]) |
3a7ce527 | 185 | |
ef0c727b VK |
186 | AC_ARG_ENABLE(encryption, |
187 | [AS_HELP_STRING(--disable-encryption,disable encryption support)], | |
e0760102 | 188 | [ |
ef0c727b | 189 | DISABLE_ENCRYPTION="yes" |
e0760102 VK |
190 | ]) |
191 | ||
ef0c727b VK |
192 | AC_ARG_ENABLE(unstable, |
193 | [AS_HELP_STRING(--enable-unstable,build experimental/unstable components)], | |
d8ca9c03 | 194 | [ |
ef0c727b | 195 | ENABLE_UNSTABLE="yes" |
d8ca9c03 VK |
196 | ]) |
197 | ||
ef0c727b VK |
198 | AC_ARG_WITH(dist, |
199 | [AS_HELP_STRING(--with-dist,for maintainers only)], | |
68e4e62d | 200 | DB_DRIVERS=" mysql pgsql odbc mssql sqlite oracle" |
ef0c727b VK |
201 | MODULES="libnxsnmp libnxsl server agent libnxmap libnxcl nxevent nxpush nxreport nxmibc console nxhttpd nxscript" |
202 | SUBAGENT_DIRS="linux freebsd openbsd sunos aix ipso hpux" | |
203 | NXCONFIG="nxconfig" | |
204 | TOP_LEVEL_MODULES="sql images" | |
205 | CONTRIB_MODULES="mibs backgrounds" | |
539ab0c3 | 206 | UNSTABLE_SUBAGENT_DIRS="logscan odbcquery" |
ef0c727b VK |
207 | SERVER_TOOLS="nxconfig" |
208 | ) | |
209 | ||
d8ca9c03 | 210 | |
ef0c727b VK |
211 | #-------------------------------------------------------------------- |
212 | # Validate command line parameters and set various checking options | |
213 | #-------------------------------------------------------------------- | |
214 | ||
215 | check_substr "$COMPONENTS" "static-agent" | |
1010cff7 | 216 | if test $? = 0; then |
ef0c727b VK |
217 | if test "x$COMPONENTS" != "x static-agent"; then |
218 | AC_MSG_ERROR(Static agent and other components are mutally exclusive.) | |
219 | fi | |
220 | STATIC_BUILD="yes" | |
221 | BUILD_STATIC_AGENT="yes" | |
0c3c0c39 | 222 | MODULES="$MODULES agent" |
3a6979cf | 223 | DISABLE_ICONV="yes" |
ef0c727b | 224 | CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT" |
e8636669 | 225 | |
ef0c727b | 226 | case "$PLATFORM" in |
e8636669 VK |
227 | Linux) |
228 | SUBAGENT_DIRS="linux" | |
d0b5a098 VK |
229 | SUBAGENT_LIBS="../subagents/linux/libnsm_linux.la" |
230 | STATIC_SUBAGENT_LIST="linux $STATIC_SUBAGENT_LIST" | |
e8636669 VK |
231 | ;; |
232 | FreeBSD) | |
233 | SUBAGENT_DIRS="freebsd" | |
d0b5a098 VK |
234 | SUBAGENT_LIBS="../subagents/freebsd/libnsm_freebsd.la" |
235 | STATIC_SUBAGENT_LIST="freebsd $STATIC_SUBAGENT_LIST" | |
e8636669 | 236 | ;; |
992ba479 AK |
237 | OpenBSD) |
238 | SUBAGENT_DIRS="openbsd" | |
239 | SUBAGENT_LIBS="../subagents/openbsd/libnsm_openbsd.la" | |
240 | STATIC_SUBAGENT_LIST="openbsd $STATIC_SUBAGENT_LIST" | |
241 | ;; | |
e8636669 VK |
242 | SunOS) |
243 | SUBAGENT_DIRS="sunos" | |
d0b5a098 VK |
244 | SUBAGENT_LIBS="../subagents/sunos/libnsm_sunos.la" |
245 | STATIC_SUBAGENT_LIST="sunos $STATIC_SUBAGENT_LIST" | |
246 | ;; | |
247 | AIX) | |
248 | SUBAGENT_DIRS="aix" | |
249 | SUBAGENT_LIBS="../subagents/aix/libnsm_aix.la" | |
250 | STATIC_SUBAGENT_LIST="aix $STATIC_SUBAGENT_LIST" | |
e8636669 | 251 | ;; |
c29360a9 VK |
252 | HP-UX) |
253 | SUBAGENT_DIRS="hpux" | |
254 | SUBAGENT_LIBS="../subagents/hpux/libnsm_hpux.la" | |
255 | STATIC_SUBAGENT_LIST="hpux $STATIC_SUBAGENT_LIST" | |
256 | ;; | |
e8636669 VK |
257 | *) |
258 | # unknown | |
259 | ;; | |
260 | esac | |
ef0c727b | 261 | fi |
2b23dc1e | 262 | |
ef0c727b | 263 | check_substr "$COMPONENTS" "ipso-agent" |
1010cff7 | 264 | if test $? = 0; then |
ef0c727b VK |
265 | if test "x$COMPONENTS" != "x static-agent"; then |
266 | AC_MSG_ERROR(IPSO agent and other components are mutally exclusive.) | |
267 | fi | |
268 | STATIC_BUILD="yes" | |
269 | BUILD_STATIC_AGENT="yes" | |
3a6979cf | 270 | DISABLE_ICONV="yes" |
ef0c727b VK |
271 | USE_PTH="yes" |
272 | MODULES="$MODULES agent" | |
273 | CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT -D_IPSO -D_USE_GNU_PTH -I/usr/local/include" | |
274 | LDFLAGS="$LDFLAGS -all-static" | |
275 | STATIC_SUBAGENT_LIST="ipso ping portcheck ups" | |
276 | SUBAGENT_DIRS="ipso" | |
277 | SUBAGENT_LIBS="../subagents/ipso/libnsm_ipso.la ../subagents/ping/libnsm_ping.la ../subagents/portCheck/libnsm_portCheck.la ../subagents/ups/libnsm_ups.la" | |
278 | fi | |
c688d2a7 | 279 | |
ef0c727b | 280 | check_substr "$COMPONENTS" "server" |
1010cff7 | 281 | if test $? = 0; then |
ef0c727b VK |
282 | if test "x$DBDRIVER_SELECTED" != "xyes"; then |
283 | AC_MSG_ERROR(You must select at least one database driver when building server.) | |
284 | fi | |
285 | BUILD_SERVER="yes" | |
286 | NEED_ZLIB="yes" | |
287 | MODULES="$MODULES libnxmap libnxsnmp libnxsl server nxmibc nxscript" | |
288 | TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES sql images" | |
289 | CONTRIB_MODULES="$CONTRIB_MODULES mibs backgrounds" | |
290 | fi | |
dff54fed | 291 | |
ef0c727b | 292 | check_substr "$COMPONENTS" "client" |
1010cff7 | 293 | if test $? = 0; then |
ef0c727b VK |
294 | BUILD_CLIENT="yes" |
295 | NEED_ZLIB="yes" | |
296 | MODULES="$MODULES libnxmap libnxcl nxevent nxpush nxreport console" | |
297 | fi | |
0c3c0c39 | 298 | |
ef0c727b | 299 | check_substr "$COMPONENTS" "agent" |
1010cff7 | 300 | if test $? = 0; then |
ef0c727b VK |
301 | BUILD_AGENT="yes" |
302 | MODULES="$MODULES agent" | |
303 | if test "x$ENABLE_UNSTABLE" = "xyes"; then | |
539ab0c3 | 304 | UNSTABLE_SUBAGENT_DIRS="logscan odbcquery" |
987b646a | 305 | fi |
1010cff7 VK |
306 | |
307 | case "$PLATFORM" in | |
308 | Linux) | |
309 | SUBAGENT_DIRS="linux" | |
310 | ;; | |
311 | FreeBSD) | |
312 | SUBAGENT_DIRS="freebsd" | |
313 | ;; | |
314 | OpenBSD) | |
315 | SUBAGENT_DIRS="openbsd" | |
316 | ;; | |
317 | SunOS) | |
318 | SUBAGENT_DIRS="sunos" | |
319 | ;; | |
320 | AIX) | |
321 | SUBAGENT_DIRS="aix" | |
322 | ;; | |
323 | HP-UX) | |
324 | SUBAGENT_DIRS="hpux" | |
325 | ;; | |
326 | *) | |
327 | # unknown | |
328 | ;; | |
329 | esac | |
ef0c727b | 330 | fi |
b97191d2 | 331 | |
ef0c727b | 332 | check_substr "$COMPONENTS" "nxhttpd" |
1010cff7 | 333 | if test $? = 0; then |
ef0c727b VK |
334 | BUILD_NXHTTPD="yes" |
335 | MODULES="$MODULES libnxmap libnxcl nxhttpd" | |
336 | fi | |
b67a9e12 | 337 | |
ef0c727b | 338 | check_substr "$COMPONENTS" "mysql" |
1010cff7 | 339 | if test $? = 0; then |
ef0c727b | 340 | DB_DRIVERS="$DB_DRIVERS mysql" |
b67a9e12 | 341 | fi |
6619a6b0 | 342 | |
ef0c727b | 343 | check_substr "$COMPONENTS" "pgsql" |
1010cff7 | 344 | if test $? = 0; then |
ef0c727b VK |
345 | DB_DRIVERS="$DB_DRIVERS pgsql" |
346 | fi | |
e8636669 | 347 | |
ef0c727b | 348 | check_substr "$COMPONENTS" "sqlite" |
1010cff7 | 349 | if test $? = 0; then |
ef0c727b | 350 | DB_DRIVERS="$DB_DRIVERS sqlite" |
e8636669 VK |
351 | fi |
352 | ||
ef0c727b | 353 | check_substr "$COMPONENTS" "odbc" |
1010cff7 | 354 | if test $? = 0; then |
ef0c727b VK |
355 | DB_DRIVERS="$DB_DRIVERS odbc" |
356 | fi | |
357 | ||
358 | ||
359 | #-------------------------------------------------------------------- | |
360 | # Check for programs | |
361 | #-------------------------------------------------------------------- | |
362 | ||
363 | if test "x$PLATFORM" = "xHP-UX"; then | |
e7d9c4ae | 364 | AC_CHECK_PROG([CCC], [aCC], [aCC]) |
ef0c727b VK |
365 | fi |
366 | AC_PROG_CC(aCC gcc cc cl) | |
367 | AC_PROG_CPP | |
368 | AC_PROG_CXX | |
369 | AC_PROG_INSTALL | |
370 | AC_PROG_LEX | |
371 | AC_PROG_YACC | |
372 | AC_PROG_LN_S | |
373 | ||
374 | AC_ARG_VAR(PERL,local path to the perl interpreter) | |
375 | perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin" | |
376 | AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path) | |
377 | ||
378 | ||
379 | #-------------------------------------------------------------------- | |
380 | # Initialize libtool | |
381 | #-------------------------------------------------------------------- | |
382 | ||
383 | if test "x$STATIC_BUILD" = "xyes"; then | |
384 | enable_shared=no | |
385 | enable_static=yes | |
386 | else | |
387 | enable_shared=yes | |
388 | enable_static=no | |
389 | fi | |
e8636669 VK |
390 | AC_LIBTOOL_DLOPEN |
391 | AC_PROG_LIBTOOL | |
3a7ce527 | 392 | |
d16cf8a5 | 393 | |
ef0c727b VK |
394 | #-------------------------------------------------------------------- |
395 | # C/C++ capabilities | |
396 | #-------------------------------------------------------------------- | |
397 | ||
398 | AC_C_CONST | |
399 | AC_PROG_GCC_TRADITIONAL | |
1d9cc60e | 400 | AC_C_BIGENDIAN |
ef0c727b VK |
401 | |
402 | ||
403 | #-------------------------------------------------------------------- | |
404 | # Platform-dependent settings | |
405 | #-------------------------------------------------------------------- | |
406 | ||
407 | case "$PLATFORM" in | |
408 | AIX) | |
409 | LDFLAGS="-no-undefined $LDFLAGS" | |
410 | ;; | |
411 | HP-UX) | |
412 | CPPFLAGS="$CPPFLAGS -D_HPUX -D_HPUX_SOURCE -D_POSIX_PTHREAD_SEMANTICS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1" | |
413 | if test "x$CXX" = "xaCC"; then | |
414 | CXXFLAGS="-mt $CXXFLAGS +W749 +W829" | |
415 | LDFLAGS="$LDFLAGS -mt" | |
416 | fi | |
417 | ;; | |
418 | *) | |
419 | ;; | |
420 | esac | |
421 | ||
422 | ||
423 | #-------------------------------------------------------------------- | |
424 | # Disable C++ exceptions | |
425 | #-------------------------------------------------------------------- | |
426 | ||
427 | if test "x$CC" = "xgcc" ; then | |
428 | ||
429 | AC_LANG_PUSH([C++]) | |
430 | ||
431 | AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti) | |
432 | OLD_CXXFLGAS="$CXXFLAGS" | |
433 | CXXFLAGS="$CXXFLAGS -fno-rtti" | |
434 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])], | |
435 | [ AC_MSG_RESULT(yes) ], | |
436 | [ | |
437 | CXXFLAGS="$OLD_CXXFLAGS" | |
438 | AC_MSG_RESULT(no) | |
439 | ]) | |
440 | ||
441 | AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions) | |
442 | OLD_CXXFLGAS="$CXXFLAGS" | |
443 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
444 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])], | |
445 | [ AC_MSG_RESULT(yes) ], | |
446 | [ | |
447 | CXXFLAGS="$OLD_CXXFLAGS" | |
448 | AC_MSG_RESULT(no) | |
449 | ]) | |
450 | ||
451 | AC_LANG_POP([C++]) | |
452 | ||
453 | fi | |
454 | ||
455 | ||
456 | #-------------------------------------------------------------------- | |
457 | # Additional include and library directories | |
458 | #-------------------------------------------------------------------- | |
459 | ||
460 | if test -d /usr/local/include; then | |
461 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" | |
462 | fi | |
463 | ||
464 | if test -d /usr/kerberos/include; then | |
465 | CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include" | |
466 | fi | |
467 | ||
468 | if test -d /usr/local/lib; then | |
469 | LDFLAGS="$LDFLAGS -L/usr/local/lib" | |
470 | fi | |
471 | ||
472 | ||
473 | #-------------------------------------------------------------------- | |
474 | # Check for threads library - either POSIX or GNU | |
475 | #-------------------------------------------------------------------- | |
476 | ||
477 | if test "x$USE_PTH" = "xyes"; then | |
478 | AC_CHECK_HEADER(pth.h,,AC_MSG_ERROR([*** GNU Pth thread support not installed - please install first ***])) | |
479 | else | |
480 | AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***])) | |
481 | ||
482 | if test "x$CXX" = "xaCC"; then | |
483 | PTHREAD_LIBS="" | |
484 | else | |
485 | PTHREAD_LIBS="error" | |
486 | AC_MSG_CHECKING(for old style FreeBSD -pthread flag) | |
487 | AC_EGREP_CPP(yes, | |
488 | [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__) | |
489 | yes | |
490 | #endif | |
491 | ], AC_MSG_RESULT(yes) | |
492 | CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" PTHREAD_LIBS="-pthread", | |
493 | AC_MSG_RESULT(no)) | |
494 | if test "x$PTHREAD_LIBS" = "xerror"; then | |
495 | AC_CHECK_LIB(pthread, pthread_attr_init, | |
496 | PTHREAD_LIBS="-lpthread") | |
497 | fi | |
498 | if test "x$PTHREAD_LIBS" = "xerror"; then | |
499 | AC_CHECK_LIB(pthreads, pthread_attr_init, | |
500 | PTHREAD_LIBS="-lpthreads") | |
501 | fi | |
502 | if test "x$PTHREAD_LIBS" = "xerror"; then | |
503 | AC_CHECK_FUNC(pthread_attr_init, | |
504 | PTHREAD_LIBS="") | |
505 | fi | |
506 | fi | |
507 | ||
508 | if test "x$PTHREAD_LIBS" = "xerror"; then | |
509 | AC_MSG_ERROR(*** Unable to locate working posix thread library ***) | |
510 | fi | |
511 | LDFLAGS="$LDFLAGS $PTHREAD_LIBS" | |
512 | ||
513 | # Extensions to posix threads | |
514 | AC_CHECK_HEADERS([pthread_np.h],,,[ | |
9c29f76e | 515 | #include <pthread.h> |
ef0c727b VK |
516 | ]) |
517 | AC_CHECK_FUNCS([pthread_cond_reltimedwait_np]) | |
518 | ||
519 | # Check for recursive mutexes | |
520 | AC_CHECK_FUNCS([pthread_mutexattr_settype pthread_mutexattr_setkind_np]) | |
521 | AC_CHECK_DECLS([PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[ | |
9c29f76e VK |
522 | #include <pthread.h> |
523 | #if HAVE_PTHREAD_NP_H | |
524 | #include <pthread_np.h> | |
525 | #endif | |
ef0c727b VK |
526 | ]) |
527 | ||
528 | # Check for read/write locks | |
529 | # On Linux, rwlock functions declared always, but pthread_rwlock_t may need | |
530 | # additional defines | |
531 | AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock]) | |
532 | if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then | |
533 | AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw, | |
9c29f76e VK |
534 | [AC_TRY_COMPILE([ |
535 | #include <sys/types.h> | |
536 | #include <pthread.h> | |
537 | ], | |
ef0c727b VK |
538 | [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;], |
539 | ac_cv_struct_pthread_rw=yes, [ | |
9c29f76e VK |
540 | AC_TRY_COMPILE([ |
541 | #define _XOPEN_SOURCE 500 | |
542 | #include <sys/types.h> | |
543 | #include <pthread.h> | |
544 | ], | |
ef0c727b VK |
545 | [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;], |
546 | ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no) | |
547 | if test "$ac_cv_struct_pthread_rw" = "yes"; then | |
548 | CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500" | |
549 | fi | |
550 | ])]) | |
551 | if test "$ac_cv_struct_pthread_rw" = "yes"; then | |
552 | AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks) | |
553 | fi | |
554 | fi | |
555 | ||
556 | fi | |
557 | ||
558 | ||
559 | #-------------------------------------------------------------------- | |
560 | # Checks for OpenSSL | |
561 | #-------------------------------------------------------------------- | |
562 | ||
563 | if test "x$DISABLE_ENCRYPTION" != "xyes" ; then | |
564 | AC_CHECK_LIB(crypto, RSA_new, | |
565 | [ | |
566 | AC_DEFINE(WITH_OPENSSL,,[with openssl]) | |
567 | AC_CHECK_LIB(crypto, EVP_aes_256_cbc, | |
568 | [], [AC_DEFINE(NETXMS_NO_AES,,[desc])]) | |
569 | AC_CHECK_LIB(crypto, EVP_bf_cbc, | |
570 | [], [AC_DEFINE(NETXMS_NO_BF,,[desc])]) | |
571 | AC_CHECK_LIB(crypto, EVP_idea_cbc, | |
572 | [], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])]) | |
573 | AC_CHECK_LIB(crypto, EVP_des_ede3_cbc, | |
574 | [], [AC_DEFINE(NETXMS_NO_DES,,[desc])]) | |
575 | ], | |
576 | [ | |
577 | if test "x$REQUIRE_ENCRYPTION" = "xyes"; then | |
578 | AC_MSG_ERROR(libcrypto is required for encryption support) | |
579 | else | |
580 | AC_MSG_RESULT(libcrypto is required for encryption support) | |
581 | fi | |
582 | ]) | |
583 | fi | |
584 | ||
585 | ||
586 | #-------------------------------------------------------------------- | |
587 | # Checks for other libs. | |
588 | #-------------------------------------------------------------------- | |
d16cf8a5 | 589 | |
521d90e7 | 590 | AC_CHECK_LIB(socket, if_nameindex) |
87bb64a7 | 591 | AC_CHECK_LIB(dl, dlopen) |
1b3c0ef0 | 592 | AC_CHECK_LIB(kstat, kstat_open) |
d16cf8a5 | 593 | |
e0760102 VK |
594 | if test "x$BUILD_SERVER" = "xyes" ; then |
595 | AC_CHECK_LIB(termcap, tgetstr, [], [AC_CHECK_LIB(ncurses, tgetstr, [], AC_CHECK_LIB(curses, tgetstr))]) | |
596 | AC_CHECK_LIB(readline, readline) | |
597 | fi | |
598 | ||
ef0c727b VK |
599 | if test "x$NEED_ZLIB" = "xyes"; then |
600 | AC_CHECK_HEADER(zlib.h,,AC_MSG_ERROR([*** ZLib development package not installed - please install first ***])) | |
601 | AC_CHECK_LIB(z, deflate) | |
602 | fi | |
603 | ||
604 | ||
605 | #-------------------------------------------------------------------- | |
606 | # Checks for header files | |
607 | #-------------------------------------------------------------------- | |
d16cf8a5 | 608 | |
ef0c727b VK |
609 | AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h]) |
610 | AC_CHECK_HEADERS([sys/int_types.h sys/time.h sys/utsname.h]) | |
ca6ad6bb | 611 | AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h net/nh.h sys/socket.h]) |
70fed300 | 612 | AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h]) |
ef0c727b VK |
613 | AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h]) |
614 | AC_CHECK_HEADERS([sys/sysctl.h vm/vm_param.h]) | |
ade50e8b AK |
615 | AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h],,, |
616 | [[#ifdef HAVE_SYS_TYPES_H | |
617 | # include <sys/types.h> | |
618 | #endif | |
619 | #ifdef HAVE_SYS_TIME_H | |
620 | # include <sys/time.h> | |
621 | #endif | |
622 | #ifdef HAVE_SYS_SOCKET_H | |
623 | # include <sys/socket.h> | |
624 | #endif | |
625 | ]]) | |
d16cf8a5 | 626 | |
ef0c727b VK |
627 | |
628 | #-------------------------------------------------------------------- | |
629 | # Checks for data types | |
630 | #-------------------------------------------------------------------- | |
631 | ||
d16cf8a5 AK |
632 | AC_CHECK_SIZEOF(short) |
633 | AC_CHECK_SIZEOF(int) | |
634 | AC_CHECK_SIZEOF(long) | |
635 | AC_CHECK_SIZEOF(long long) | |
636 | ||
637 | AC_TYPE_PID_T | |
638 | AC_TYPE_SIGNAL | |
639 | AC_TYPE_SIZE_T | |
640 | AC_STRUCT_TIMEZONE | |
641 | ||
521d90e7 | 642 | AC_CHECK_TYPES([int64_t, uint64_t, u_int64_t]) |
4c779d83 VK |
643 | AC_CHECK_TYPES([off_t, socklen_t],,,[ |
644 | #if HAVE_SYS_TYPES_H | |
645 | #include <sys/types.h> | |
646 | #endif | |
647 | #if HAVE_SYS_SOCKET_H | |
648 | #include <sys/socket.h> | |
649 | #endif | |
650 | ]) | |
521d90e7 | 651 | |
e25cadc9 | 652 | |
ef0c727b VK |
653 | #-------------------------------------------------------------------- |
654 | # Checks for functions | |
655 | #-------------------------------------------------------------------- | |
d16cf8a5 AK |
656 | |
657 | AC_FUNC_ERROR_AT_LINE | |
d16cf8a5 | 658 | AC_FUNC_MEMCMP |
d16cf8a5 AK |
659 | AC_FUNC_SELECT_ARGTYPES |
660 | AC_FUNC_STRFTIME | |
661 | AC_FUNC_STRTOD | |
662 | AC_FUNC_VPRINTF | |
663 | ||
b50f1100 VK |
664 | AC_CHECK_FUNCS([gettimeofday memmove memset strchr strcspn strdup strerror]) |
665 | AC_CHECK_FUNCS([strrchr strtol strtoul strtoll strtoull]) | |
467e30e1 | 666 | AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll]) |
8aa1f557 | 667 | AC_CHECK_FUNCS([nanosleep getopt_long gmtime_r]) |
d16cf8a5 | 668 | |
73d7fbdb VK |
669 | AC_CHECK_DECLS([getopt_long]) |
670 | ||
f91feddc | 671 | AC_CHECK_FUNCS([sysctlbyname sysctlnametomib]) |
70fed300 AK |
672 | AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed]) |
673 | ||
d16cf8a5 AK |
674 | # sockets/resolver (probably for solaris) |
675 | AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)]) | |
676 | AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)]) | |
677 | AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)]) | |
678 | ||
679 | if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then | |
680 | AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)]) | |
681 | fi | |
682 | ||
683 | if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then | |
684 | AC_MSG_CHECKING([if we can include libnsl + libsocket]) | |
685 | LIBS="-lnsl -lsocket $LIBS" | |
686 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ]) | |
687 | if test "$my_ac_link_result" = "no" ; then | |
688 | AC_MSG_RESULT([failure]) | |
689 | AC_MSG_ERROR([unable to use gethostbyname()]) | |
690 | else | |
691 | AC_MSG_RESULT([success]) | |
692 | fi | |
693 | fi | |
694 | ||
dff54fed | 695 | |
ef0c727b VK |
696 | #-------------------------------------------------------------------- |
697 | # Checks for macros and definitions | |
698 | #-------------------------------------------------------------------- | |
dff54fed | 699 | |
ef0c727b VK |
700 | AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[ |
701 | #ifdef HAVE_SYS_TYPES_H | |
702 | # include <sys/types.h> | |
703 | #endif | |
704 | #if HAVE_BYTESWAP_H | |
705 | #include <byteswap.h> | |
706 | #endif | |
707 | #if HAVE_NETINET_IN_H | |
708 | #include <netinet/in.h> | |
709 | #endif | |
710 | #if HAVE_NET_NH_H | |
711 | #include <net/nh.h> | |
712 | #endif | |
713 | ]) | |
dff54fed | 714 | |
dff54fed | 715 | |
ef0c727b VK |
716 | #-------------------------------------------------------------------- |
717 | # AIX specific checks | |
718 | #-------------------------------------------------------------------- | |
d16cf8a5 | 719 | |
ef0c727b VK |
720 | if test "x$PLATFORM" = "xAIX"; then |
721 | AC_CHECK_HEADERS([procinfo.h],,,[[ ]]) | |
722 | AC_CHECK_DECLS([getkerninfo]) | |
723 | AC_CHECK_FUNCS([getprocs64],,,[ | |
724 | #if HAVE_PROCINFO_H | |
725 | #include <procinfo.h> | |
6cd41ceb | 726 | #endif |
ef0c727b | 727 | ]) |
7e56bf2e VK |
728 | fi |
729 | ||
cd4c8ca3 | 730 | |
ef0c727b VK |
731 | #-------------------------------------------------------------------- |
732 | # Check for UNICODE stuff | |
733 | #-------------------------------------------------------------------- | |
3e39fcde | 734 | |
93571e7f | 735 | AC_CHECK_HEADERS([wchar.h iconv.h]) |
3e39fcde | 736 | AC_CHECK_SIZEOF(wchar_t) |
dff54fed | 737 | |
3265ba38 | 738 | if test "x$DISABLE_ICONV" != "xyes"; then |
dff54fed VK |
739 | AC_CHECK_LIB(iconv, iconv, |
740 | [ ac_found_iconv=yes | |
741 | LDFLAGS="$LDFLAGS -liconv" | |
742 | ]) | |
743 | AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no) | |
744 | else | |
745 | ac_found_iconv=no | |
ef0c727b | 746 | CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV" |
dff54fed | 747 | fi |
93571e7f VK |
748 | |
749 | AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL) | |
750 | AC_RUN_IFELSE( | |
751 | [AC_LANG_PROGRAM([ | |
752 | #if HAVE_ICONV_H | |
753 | #include <iconv.h> | |
754 | #endif | |
755 | ], [ | |
756 | return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1); | |
757 | ]) | |
758 | ], | |
759 | [ AC_MSG_RESULT(yes) | |
760 | AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL) | |
761 | valid_ucs2_code="UCS-2-INTERNAL" | |
762 | ], | |
763 | [ AC_MSG_RESULT(no) ], | |
764 | [ AC_MSG_RESULT(no) ] | |
765 | ) | |
766 | ||
767 | AC_MSG_CHECKING(whether iconv supports UCS-2) | |
768 | AC_RUN_IFELSE( | |
769 | [AC_LANG_PROGRAM([ | |
770 | #if HAVE_ICONV_H | |
771 | #include <iconv.h> | |
772 | #endif | |
773 | ], [ | |
774 | return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1); | |
775 | ]) | |
776 | ], | |
777 | [ AC_MSG_RESULT(yes) | |
778 | AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2) | |
779 | valid_ucs2_code="UCS-2" | |
780 | ], | |
781 | [ AC_MSG_RESULT(no) ], | |
782 | [ AC_MSG_RESULT(yes) | |
783 | AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2) | |
784 | ] | |
785 | ) | |
786 | ||
787 | AC_MSG_CHECKING(whether iconv supports UCS2) | |
788 | AC_RUN_IFELSE( | |
789 | [AC_LANG_PROGRAM([ | |
790 | #if HAVE_ICONV_H | |
791 | #include <iconv.h> | |
792 | #endif | |
793 | ], [ | |
794 | return iconv_open("UTF-8","UCS2")==(iconv_t)(-1); | |
795 | ]) | |
796 | ], | |
797 | [ AC_MSG_RESULT(yes) | |
798 | AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2) | |
799 | valid_ucs2_code="UCS2" | |
800 | ], | |
801 | [ AC_MSG_RESULT(no) ], | |
802 | [ AC_MSG_RESULT(no) ] | |
803 | ) | |
804 | ||
44bccbbc VK |
805 | AC_MSG_CHECKING(whether iconv supports UCS-2BE) |
806 | AC_RUN_IFELSE( | |
807 | [AC_LANG_PROGRAM([ | |
808 | #if HAVE_ICONV_H | |
809 | #include <iconv.h> | |
810 | #endif | |
811 | ], [ | |
812 | return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1); | |
813 | ]) | |
814 | ], | |
815 | [ AC_MSG_RESULT(yes) | |
816 | AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE) | |
817 | valid_ucs2_code="UCS-2BE" | |
818 | ], | |
819 | [ AC_MSG_RESULT(no) ], | |
820 | [ AC_MSG_RESULT(no) ] | |
821 | ) | |
822 | ||
5e40a69e VK |
823 | AC_MSG_CHECKING(whether iconv supports ISO8859-1) |
824 | AC_RUN_IFELSE( | |
825 | [AC_LANG_PROGRAM([ | |
826 | #if HAVE_ICONV_H | |
827 | #include <iconv.h> | |
828 | #endif | |
829 | ], [ | |
830 | return iconv_open("UTF-8","ISO8859-1")==(iconv_t)(-1); | |
831 | ]) | |
832 | ], | |
833 | [ AC_MSG_RESULT(yes) | |
834 | AC_DEFINE(HAVE_ICONV_ISO8859_1, 1, Define to 1 if iconv supports ISO8859-1) | |
835 | ], | |
836 | [ AC_MSG_RESULT(no) ], | |
837 | [ AC_MSG_RESULT(no) ] | |
838 | ) | |
839 | ||
840 | AC_MSG_CHECKING(whether iconv supports ISO-8859-1) | |
841 | AC_RUN_IFELSE( | |
842 | [AC_LANG_PROGRAM([ | |
843 | #if HAVE_ICONV_H | |
844 | #include <iconv.h> | |
845 | #endif | |
846 | ], [ | |
847 | return iconv_open("UTF-8","ISO-8859-1")==(iconv_t)(-1); | |
848 | ]) | |
849 | ], | |
850 | [ AC_MSG_RESULT(yes) | |
851 | AC_DEFINE(HAVE_ICONV_ISO_8859_1, 1, Define to 1 if iconv supports ISO-8859-1) | |
852 | ], | |
853 | [ AC_MSG_RESULT(no) ], | |
854 | [ AC_MSG_RESULT(no) ] | |
855 | ) | |
856 | ||
857 | AC_MSG_CHECKING(whether iconv supports ASCII) | |
858 | AC_RUN_IFELSE( | |
859 | [AC_LANG_PROGRAM([ | |
860 | #if HAVE_ICONV_H | |
861 | #include <iconv.h> | |
862 | #endif | |
863 | ], [ | |
864 | return iconv_open("UTF-8","ASCII")==(iconv_t)(-1); | |
865 | ]) | |
866 | ], | |
867 | [ AC_MSG_RESULT(yes) | |
868 | AC_DEFINE(HAVE_ICONV_ASCII, 1, Define to 1 if iconv supports ASCII) | |
869 | ], | |
870 | [ AC_MSG_RESULT(no) ], | |
871 | [ AC_MSG_RESULT(no) ] | |
872 | ) | |
873 | ||
93571e7f VK |
874 | AC_MSG_CHECKING(whether iconv supports //IGNORE) |
875 | AC_RUN_IFELSE( | |
876 | [AC_LANG_PROGRAM([ | |
877 | #if HAVE_ICONV_H | |
878 | #include <iconv.h> | |
879 | #endif | |
880 | ], [ | |
881 | return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1); | |
882 | ]) | |
883 | ], | |
884 | [ AC_MSG_RESULT(yes) | |
885 | AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option) | |
886 | ], | |
887 | [ AC_MSG_RESULT(no) ], | |
888 | [ AC_MSG_RESULT(no) ] | |
889 | ) | |
3e39fcde | 890 | |
19619a35 AK |
891 | # taken from ZSH's configure |
892 | # Check if iconv uses const in prototype declaration | |
24b1570c | 893 | if test "x$ac_found_iconv" = "xyes"; then |
19619a35 AK |
894 | AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const, |
895 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> | |
896 | #include <iconv.h>]], | |
897 | [[#ifdef __cplusplus | |
898 | "C" | |
899 | #endif | |
900 | #if defined(__STDC__) || defined(__cplusplus) | |
901 | size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); | |
902 | #else | |
903 | size_t iconv(); | |
904 | #endif]])], | |
905 | [ac_cv_iconv_const=], | |
906 | [ac_cv_iconv_const=const])]) | |
907 | AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const, | |
908 | [Define as const if the declaration of iconv() needs const.]) | |
909 | fi | |
910 | ||
93571e7f | 911 | if test $ac_cv_sizeof_wchar_t -eq 2; then |
3e39fcde VK |
912 | AC_DEFINE(HAVE_USEABLE_WCHAR_T, 1, Define to 1 if you have useable wchar_t) |
913 | fi | |
914 | ||
c29360a9 | 915 | |
ca0f4ea3 VK |
916 | #-------------------------------------------------------------------- |
917 | # MySQL | |
918 | #-------------------------------------------------------------------- | |
919 | ||
920 | check_substr "$COMPONENTS" "mysql" | |
921 | if test $? = 0; then | |
9c29f76e | 922 | AC_CHECK_LIB(mysqlclient, mysql_init, [], |
ca0f4ea3 | 923 | [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)]) |
9c29f76e VK |
924 | AC_MSG_CHECKING(whether mysql clients can run) |
925 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |
926 | #include <stdio.h> | |
927 | #include <mysql.h> | |
928 | int main(void) | |
929 | { | |
930 | MYSQL *a = mysql_init(NULL); | |
931 | return 0; | |
932 | } | |
933 | ]])],[],[ | |
934 | AC_MSG_RESULT(no) | |
935 | AC_MSG_ERROR(Your MySQL client libraries aren't properly installed) | |
936 | ],[]) | |
ca0f4ea3 VK |
937 | AC_MSG_RESULT(yes) |
938 | AC_CHECK_FUNCS(mysql_real_escape_string) | |
939 | fi | |
940 | ||
941 | ||
58ed4897 VK |
942 | #-------------------------------------------------------------------- |
943 | # PostgreSQL | |
944 | #-------------------------------------------------------------------- | |
945 | ||
203458b7 | 946 | check_substr "$COMPONENTS" "pgsql" |
58ed4897 VK |
947 | if test $? = 0; then |
948 | AC_CHECK_LIB(m, floor) | |
949 | AC_CHECK_LIB(pq, PQconnectdb, , | |
950 | [AC_MSG_ERROR(libpq is required for PostgreSQL support)]) | |
951 | AC_MSG_CHECKING(whether postgresql clients can run) | |
952 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |
953 | #include <stdio.h> | |
954 | #include <libpq-fe.h> | |
955 | int main(void) | |
956 | { | |
957 | PGconn *a = PQconnectdb(""); | |
958 | return 0; | |
959 | } | |
960 | ]])],[],[ | |
961 | AC_MSG_RESULT(no) | |
962 | AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed) | |
963 | ],[]) | |
964 | AC_MSG_RESULT(yes) | |
965 | fi | |
966 | ||
967 | ||
9c29f76e VK |
968 | #-------------------------------------------------------------------- |
969 | # ODBC | |
970 | #-------------------------------------------------------------------- | |
971 | ||
972 | check_substr "$COMPONENTS" "odbc" | |
973 | if test $? = 0; then | |
974 | AC_CHECK_LIB(odbc, SQLAllocHandle, [], | |
975 | [AC_MSG_ERROR(libodbc is required for ODBC support)]) | |
976 | fi | |
977 | ||
978 | ||
979 | #-------------------------------------------------------------------- | |
980 | # SQLite | |
981 | #-------------------------------------------------------------------- | |
982 | ||
983 | check_substr "$COMPONENTS" "sqlite" | |
984 | if test $? = 0; then | |
985 | AC_CHECK_LIB(sqlite3, sqlite3_open, [], | |
986 | [AC_MSG_ERROR(libsqlite3 is required for SQLite support)]) | |
987 | fi | |
988 | ||
989 | ||
ca0f4ea3 VK |
990 | #-------------------------------------------------------------------- |
991 | # Other settings | |
992 | #-------------------------------------------------------------------- | |
993 | ||
994 | CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DDATADIR=\\\"\${pkgdatadir}\\\" -DLIBDIR=\\\"\${libdir}\\\"" | |
995 | ||
996 | ||
ef0c727b VK |
997 | #-------------------------------------------------------------------- |
998 | # Substitute variables | |
999 | #-------------------------------------------------------------------- | |
82fa7c5d | 1000 | |
ef0c727b VK |
1001 | AC_SUBST(DB_DRIVERS) |
1002 | AC_SUBST(MODULES) | |
1003 | AC_SUBST(SUBAGENT_DIRS) | |
1004 | AC_SUBST(SERVER_TOOLS) | |
1005 | AC_SUBST(TOP_LEVEL_MODULES) | |
1006 | AC_SUBST(CONTRIB_MODULES) | |
1007 | AC_SUBST(STATIC_SUBAGENT_LIST) | |
1008 | AC_SUBST(SUBAGENT_LIBS) | |
1009 | AC_SUBST(BUILD_SERVER) | |
1010 | AC_SUBST(UNSTABLE_SUBAGENT_DIRS) | |
d16cf8a5 | 1011 | |
ef0c727b VK |
1012 | #-------------------------------------------------------------------- |
1013 | # Shared libs versions | |
d16cf8a5 AK |
1014 | # |
1015 | # versioning scheme: current:revision:age | |
1016 | # | |
1017 | # current | |
1018 | # The number of the current interface exported by the library. A current | |
1019 | # value of `0', means that you are calling the interface exported by this | |
1020 | # library interface 0. | |
1021 | # | |
1022 | # revision | |
1023 | # The implementation number of the most recent interface exported by this | |
1024 | # library. In this case, a revision value of `0' means that this is the | |
1025 | # first implementation of the interface. | |
1026 | # If the next release of this library exports the same interface, but has a | |
1027 | # different implementation (perhaps some bugs have been fixed), the revision | |
1028 | # number will be higher, but current number will be the same. In that case, | |
1029 | # when given a choice, the library with the highest revision will always | |
1030 | # be used by the runtime loader. | |
1031 | # | |
1032 | # age | |
1033 | # The number of previous additional interfaces supported by this library. | |
1034 | # If age were `2', then this library can be linked into executables which | |
1035 | # were built with a release of this library that exported the current | |
1036 | # interface number, current, or any of the previous two interfaces. | |
1037 | # By definition age must be less than or equal to current. At the outset, | |
1038 | # only the first ever interface is implemented, so age can only be `0'. | |
ef0c727b | 1039 | #-------------------------------------------------------------------- |
d16cf8a5 | 1040 | |
c7d14846 VK |
1041 | NETXMS_LIBRARY_VERSION=0:2:0 |
1042 | AC_SUBST(NETXMS_LIBRARY_VERSION) | |
d16cf8a5 | 1043 | |
ef0c727b VK |
1044 | |
1045 | #-------------------------------------------------------------------- | |
1046 | # Generate output files | |
1047 | #-------------------------------------------------------------------- | |
d16cf8a5 AK |
1048 | |
1049 | AC_CONFIG_FILES([ | |
ef0c727b | 1050 | README |
0c3c0c39 AK |
1051 | Makefile |
1052 | contrib/Makefile | |
0c3c0c39 AK |
1053 | contrib/dct/Makefile |
1054 | contrib/startup/Makefile | |
daaefaaf | 1055 | contrib/startup/gentoo/Makefile |
0c3c0c39 | 1056 | contrib/startup/redhat/Makefile |
5de3893d | 1057 | contrib/startup/suse/Makefile |
82fa7c5d | 1058 | contrib/mibs/Makefile |
3f2f9f2b | 1059 | contrib/backgrounds/Makefile |
0c3c0c39 | 1060 | doc/Makefile |
a48203d2 VK |
1061 | doc/internal/Makefile |
1062 | doc/manuals/Makefile | |
1063 | doc/misc/Makefile | |
0c3c0c39 AK |
1064 | images/Makefile |
1065 | include/Makefile | |
1066 | m4/Makefile | |
1067 | netware/Makefile | |
1068 | sql/Makefile | |
0c3c0c39 AK |
1069 | src/Makefile |
1070 | src/libnetxms/Makefile | |
d853cd74 | 1071 | src/libnxsnmp/Makefile |
0c3c0c39 | 1072 | src/libnxcl/Makefile |
c002b04a | 1073 | src/libnxsl/Makefile |
1d410d50 | 1074 | src/libnxmap/Makefile |
1b1edd49 VK |
1075 | src/install/Makefile |
1076 | src/install/windows/Makefile | |
0c3c0c39 | 1077 | src/console/Makefile |
8c7d057b VK |
1078 | src/console/nxuilib/Makefile |
1079 | src/console/nxuilib/res/Makefile | |
f7d8c3b2 | 1080 | src/console/nxuilib/sounds/Makefile |
e4d08190 | 1081 | src/console/nxlexer/Makefile |
0c3c0c39 AK |
1082 | src/console/win32/Makefile |
1083 | src/console/win32/icons/Makefile | |
1084 | src/console/win32/res/Makefile | |
1085 | src/console/win32starter/Makefile | |
672441ac | 1086 | src/console/nxav/Makefile |
2b463d08 | 1087 | src/console/nxav/res/Makefile |
52996299 VK |
1088 | src/console/nxnotify/Makefile |
1089 | src/console/nxnotify/res/Makefile | |
672441ac | 1090 | src/console/cmdline/Makefile |
2b463d08 VK |
1091 | src/console/PocketPC/Makefile |
1092 | src/console/PocketPC/res/Makefile | |
0c3c0c39 | 1093 | src/nxevent/Makefile |
09c70d92 | 1094 | src/nxpush/Makefile |
1e8eed7a | 1095 | src/nxreport/Makefile |
148f47cf | 1096 | src/nxmibc/Makefile |
f519aa3e | 1097 | src/nxscript/Makefile |
0c3c0c39 AK |
1098 | src/server/Makefile |
1099 | src/server/core/Makefile | |
a551fe4d | 1100 | src/server/netxmsd/Makefile |
0c3c0c39 AK |
1101 | src/server/dbdrv/Makefile |
1102 | src/server/dbdrv/odbc/Makefile | |
1103 | src/server/dbdrv/mssql/Makefile | |
1104 | src/server/dbdrv/mysql/Makefile | |
1105 | src/server/dbdrv/pgsql/Makefile | |
9486b324 | 1106 | src/server/dbdrv/sqlite/Makefile |
5de3893d | 1107 | src/server/dbdrv/oracle/Makefile |
d8f2e39b VK |
1108 | src/server/smsdrv/Makefile |
1109 | src/server/smsdrv/generic/Makefile | |
0c3c0c39 AK |
1110 | src/server/tools/Makefile |
1111 | src/server/tools/nxget/Makefile | |
1112 | src/server/tools/nxaction/Makefile | |
1113 | src/server/tools/nxadm/Makefile | |
5b0c7d0d VK |
1114 | src/server/tools/nxconfig/Makefile |
1115 | src/server/tools/nxconfig/res/Makefile | |
f90d7fc5 | 1116 | src/server/tools/nxdbmgr/Makefile |
d853cd74 | 1117 | src/server/tools/nxsnmpget/Makefile |
734c670f | 1118 | src/server/tools/nxsnmpwalk/Makefile |
665b4ccf | 1119 | src/server/tools/nxsnmpset/Makefile |
d24fdaf4 | 1120 | src/server/tools/nxupload/Makefile |
0c3c0c39 AK |
1121 | src/server/libnxsrv/Makefile |
1122 | src/agent/Makefile | |
1123 | src/agent/core/Makefile | |
5795bf90 | 1124 | src/agent/install/Makefile |
0c3c0c39 AK |
1125 | src/agent/subagents/Makefile |
1126 | src/agent/subagents/linux/Makefile | |
1127 | src/agent/subagents/sunos/Makefile | |
d0b5a098 | 1128 | src/agent/subagents/aix/Makefile |
9bdf494f | 1129 | src/agent/subagents/hpux/Makefile |
0c3c0c39 AK |
1130 | src/agent/subagents/skeleton/Makefile |
1131 | src/agent/subagents/freebsd/Makefile | |
992ba479 | 1132 | src/agent/subagents/openbsd/Makefile |
2b23dc1e | 1133 | src/agent/subagents/ipso/Makefile |
0c3c0c39 | 1134 | src/agent/subagents/netware/Makefile |
1bc607cc VK |
1135 | src/agent/subagents/winnt/Makefile |
1136 | src/agent/subagents/win9x/Makefile | |
0c3c0c39 | 1137 | src/agent/subagents/winperf/Makefile |
93f15c2a | 1138 | src/agent/subagents/portCheck/Makefile |
b36a6eb9 | 1139 | src/agent/subagents/logscan/Makefile |
abc48356 | 1140 | src/agent/subagents/ping/Makefile |
2f06a66e | 1141 | src/agent/subagents/ups/Makefile |
539ab0c3 AK |
1142 | src/agent/subagents/ecs/Makefile |
1143 | src/agent/subagents/odbcquery/Makefile | |
5de3893d | 1144 | src/nxhttpd/Makefile |
066afcd4 VK |
1145 | src/nxhttpd/static/Makefile |
1146 | src/nxhttpd/static/images/Makefile | |
4351a82a VK |
1147 | src/nxhttpd/static/images/buttons/Makefile |
1148 | src/nxhttpd/static/images/buttons/normal/Makefile | |
1149 | src/nxhttpd/static/images/buttons/pressed/Makefile | |
6db3b20b | 1150 | src/nxhttpd/static/images/ctrlpanel/Makefile |
18928f80 | 1151 | src/nxhttpd/static/images/objects/Makefile |
fb7ce4b9 | 1152 | src/nxhttpd/static/images/status/Makefile |
0c3c0c39 | 1153 | tools/Makefile |
d16cf8a5 AK |
1154 | ]) |
1155 | ||
12249937 VK |
1156 | AC_OUTPUT |
1157 | ||
ef0c727b | 1158 | echo "Updating libtool" |
5cecf50e AK |
1159 | sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool |
1160 | ||
a7442678 | 1161 | |
ef0c727b VK |
1162 | #-------------------------------------------------------------------- |
1163 | # Print summary | |
1164 | #-------------------------------------------------------------------- | |
a7442678 | 1165 | |
a7442678 AK |
1166 | echo |
1167 | echo | |
1168 | echo | |
1169 | echo '---------------------------------------------------------------------' | |
1170 | echo ' Configure results' | |
1171 | echo '---------------------------------------------------------------------' | |
1172 | echo | |
1173 | echo "Prefix : ${prefix}" | |
1174 | if test "x${BUILD_SERVER}" = "xyes"; then | |
1175 | echo "Build Server : YES" | |
1176 | else | |
1177 | echo "Build Server : NO" | |
1178 | fi | |
1179 | if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then | |
1180 | echo "Encryption enabled : YES" | |
1181 | else | |
1182 | echo "Encryption enabled : NO" | |
1183 | fi | |
1184 | if test "x${DB_DRIVERS}" != "x"; then | |
1010cff7 | 1185 | echo "Build DB-Drivers :${DB_DRIVERS}" |
a7442678 AK |
1186 | else |
1187 | echo "Build DB-Drivers : NO" | |
1188 | fi | |
1189 | if test "x${BUILD_CLIENT}" = "xyes"; then | |
1190 | echo "Build Clients : YES" | |
1191 | else | |
1192 | echo "Build Clients : NO" | |
1193 | fi | |
ef0c727b | 1194 | if test "x${BUILD_NXHTTPD}" = "xyes"; then |
2654e540 AK |
1195 | echo "Build Web Interface : YES" |
1196 | else | |
c2503081 | 1197 | echo "Build Web Interface : NO" |
2654e540 | 1198 | fi |
a7442678 AK |
1199 | if test "x${BUILD_AGENT}" = "xyes"; then |
1200 | echo "Build Agent : YES" | |
1201 | echo "Subagents list : ${SUBAGENT_DIRS}" | |
1202 | else | |
1203 | echo "Build Agent : NO" | |
1204 | fi | |
e8636669 VK |
1205 | if test "x${BUILD_STATIC_AGENT}" = "xyes"; then |
1206 | echo "Build Static Agent : YES" | |
1207 | echo "Subagents list : ${STATIC_SUBAGENT_LIST}" | |
1208 | else | |
1209 | echo "Build Static Agent : NO" | |
1210 | fi |