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