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