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