implemented agent policy inventory
[public/netxms.git] / configure.ac
CommitLineData
8e76f8aa 1# $Id$
d16cf8a5 2#
ef0c727b
VK
3# NetXMS - Network Management System
4# Configure script
d16cf8a5
AK
5#
6
467c489f 7AC_INIT([NetXMS], [1.1.0], [NetXMS Team <bugs@netxms.org>])
ba1d810c
AK
8AC_CONFIG_AUX_DIR(config)
9AM_CONFIG_HEADER(config.h)
d16cf8a5
AK
10AM_INIT_AUTOMAKE
11
aa24418a 12AC_CONFIG_MACRO_DIR([m4])
5387ff75 13
ef0c727b
VK
14#--------------------------------------------------------------------
15# Functions
16#--------------------------------------------------------------------
5387ff75 17
ef0c727b
VK
18check_substr()
19{
1010cff7 20 for w in $1; do
ef0c727b
VK
21 if test "x$w" = "x$2"; then
22 return 0;
23 fi
24 done
25 return 1
26}
16dff090 27
d3c8926d 28
ef0c727b
VK
29#--------------------------------------------------------------------
30# Initialize variables
31#--------------------------------------------------------------------
d3c8926d 32
ef0c727b
VK
33PLATFORM=`uname -s`
34COMPONENTS=""
35DISABLE_ICONV="no"
36DISABLE_ENCRYPTION="no"
37ENABLE_UNSTABLE="no"
f974a50a 38ENABLE_DEBUG="no"
ef0c727b
VK
39STATIC_BUILD="no"
40DBDRIVER_SELECTED="no"
41USE_PTH="no"
42BUILD_SERVER="no"
43BUILD_AGENT="no"
44BUILD_CLIENT="no"
45BUILD_NXHTTPD="no"
46BUILD_STATIC_AGENT="no"
47NEED_ZLIB="no"
d99ee887 48NEED_WXWIDGETS="no"
f65df2b1 49MODULES="libnetxms tools install"
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"
7d8c91ef 60ORACLE_LIBS=""
6fce76d8
VK
61PGSQL_LIBS=""
62MYSQL_LIBS=""
63ODBC_LIBS=""
467c489f 64FORCE_INTERNAL_EXPAT="no"
cc297a70 65FORCE_32BIT_BUILD="no"
d3c8926d 66
16dff090 67
ef0c727b 68#--------------------------------------------------------------------
fecf6a2b
VK
69# Common compilation flags
70#--------------------------------------------------------------------
71
72CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
73
74
75#--------------------------------------------------------------------
ef0c727b
VK
76# Parse command line parameters
77#--------------------------------------------------------------------
7c9c94a7 78
ef0c727b
VK
79AC_ARG_WITH(server,
80[AS_HELP_STRING(--with-server,build server)],
81[
8817f620 82 COMPONENTS="$COMPONENTS sqlite snmp server agent"
c5c0f362
VK
83])
84
85AC_ARG_WITH(snmp,
86[AS_HELP_STRING(--with-snmp,build SNMP library and tools)],
87[
88 COMPONENTS="$COMPONENTS snmp"
ef0c727b 89])
7c9c94a7 90
ef0c727b
VK
91AC_ARG_WITH(client,
92[AS_HELP_STRING(--with-client,build client library and tools)],
93[
94 COMPONENTS="$COMPONENTS client"
95])
d16cf8a5 96
c2612d83 97AC_ARG_WITH(agent,
ef0c727b
VK
98[AS_HELP_STRING(--with-agent,build agent)],
99[
8817f620 100 COMPONENTS="$COMPONENTS sqlite agent"
ef0c727b 101])
d16cf8a5 102
ef0c727b
VK
103AC_ARG_WITH(static-agent,
104[AS_HELP_STRING(--with-static-agent,build statically linked agent)],
105[
8817f620 106 COMPONENTS="$COMPONENTS sqlite static-agent"
ef0c727b 107])
d16cf8a5 108
ef0c727b
VK
109AC_ARG_WITH(ipso-agent,
110[AS_HELP_STRING(--with-ipso-agent,build statically linked IPSO agent)],
111[
8817f620 112 COMPONENTS="$COMPONENTS sqlite ipso-agent"
ef0c727b 113])
521d90e7 114
e02b69b9
VK
115AC_ARG_WITH(webui,
116[AS_HELP_STRING(--with-webui,build web interface)],
ef0c727b 117[
e02b69b9 118 COMPONENTS="$COMPONENTS webui"
ef0c727b 119])
d16cf8a5 120
ef0c727b
VK
121AC_ARG_WITH(mdebug,
122[AS_HELP_STRING(--with-mdebug,use debug version of memory allocation functions)],
123[
124 CPPFLAGS="$CPPFLAGS -DNETXMS_MEMORY_DEBUG"
125])
d16cf8a5 126
467c489f
VK
127AC_ARG_WITH(internal-libexpat,
128[AS_HELP_STRING(--with-internal-libexpat,force use of bundled libexpat)],
129[
130 FORCE_INTERNAL_EXPAT="yes"
131])
132
9486b324
VK
133AC_ARG_WITH(sqlite,
134[AS_HELP_STRING(--with-sqlite,build SQLite database driver)],
135[ if test "x$withval" != "xno" ; then
8817f620 136 COMPONENTS="$COMPONENTS sqlite_drv"
ef0c727b 137 DBDRIVER_SELECTED="yes"
9486b324
VK
138fi ])
139
c4b88c3d
VK
140AC_ARG_WITH(odbc,
141[AS_HELP_STRING(--with-odbc,build ODBC database driver)],
142[ if test "x$withval" != "xno" ; then
143 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
144 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
145 LDFLAGS="$LDFLAGS -L${withval}/lib"
146 CPPFLAGS="$CPPFLAGS -I${withval}/include"
ef0c727b
VK
147 fi
148 COMPONENTS="$COMPONENTS odbc"
149 DBDRIVER_SELECTED="yes"
c4b88c3d
VK
150fi ])
151
41b4790d
VK
152AC_ARG_WITH(oracle,
153[AS_HELP_STRING(--with-oracle,build Oracle database driver)],
154[ if test "x$withval" != "xno" ; then
155 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
7d8c91ef
VK
156 if test -x "$withval/lib" ; then
157 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
158 LDFLAGS="$LDFLAGS -L${withval}/lib"
159 else
160 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
161 LDFLAGS="$LDFLAGS -L${withval}"
162 fi
163 if test -x "$withval/include" ; then
164 CPPFLAGS="$CPPFLAGS -I${withval}/include"
165 fi
166 if test -x "$withval/sdk/include" ; then
167 CPPFLAGS="$CPPFLAGS -I${withval}/sdk/include"
168 fi
41b4790d
VK
169 fi
170 COMPONENTS="$COMPONENTS oracle"
171 DBDRIVER_SELECTED="yes"
172fi ])
173
d16cf8a5 174AC_ARG_WITH(mysql,
c4b88c3d 175[AS_HELP_STRING(--with-mysql,build MySQL database driver)],
d16cf8a5
AK
176[ if test "x$withval" != "xno" ; then
177 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
178 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
179 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/mysql -L${withval}/mysql/lib"
6693a1d0 180 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include"
d16cf8a5 181 else
007ae516
VK
182 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}"
183 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 184 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 185 fi
ef0c727b
VK
186 COMPONENTS="$COMPONENTS mysql"
187 DBDRIVER_SELECTED="yes"
6693a1d0 188fi ])
d16cf8a5
AK
189
190AC_ARG_WITH(pgsql,
c4b88c3d 191[AS_HELP_STRING(--with-pgsql,build PostgreSQL database driver)],
d16cf8a5 192[ if test "x$withval" != "xno" ; then
6693a1d0
AK
193 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
194 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
195 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/pgsql -L${withval}/lib/postgresql -L${withval}/pgsql/lib -L${withval}/postgresql/lib"
196 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/pgsql -I${withval}/include/postgresql -I${withval}/pgsql/include -I${withval}/postgresql/include"
197 else
007ae516
VK
198 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}"
199 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
200 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"
201 fi
ef0c727b
VK
202 COMPONENTS="$COMPONENTS pgsql"
203 DBDRIVER_SELECTED="yes"
6693a1d0 204fi ])
d16cf8a5 205
84277a0f
AK
206AC_ARG_WITH(db2,
207[AS_HELP_STRING(--with-db2,build DB2 database driver)],
208[ if test "x$withval" != "xno" ; then
209 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
210 if test `uname -m` = 'i386' || test `uname -m` = 'i686'; then
211 DB2_LIB_DIR=lib32
212 else
213 DB2_LIB_DIR=lib64
214 fi
215 if test -x "$withval/${DB2_LIB_DIR}" ; then
216 LD_RUN_PATH="${withval}/${DB2_LIB_DIR}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
217 LDFLAGS="$LDFLAGS -L${withval}/${DB2_LIB_DIR}"
218 else
219 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
220 LDFLAGS="$LDFLAGS -L${withval}"
221 fi
222 if test -x "$withval/include" ; then
223 CPPFLAGS="$CPPFLAGS -I${withval}/include"
224 fi
225
226 unset DB2_LIB_DIR
227 fi
228 COMPONENTS="$COMPONENTS db2"
229 DBDRIVER_SELECTED="yes"
230fi ])
231
ef0c727b 232AC_ARG_WITH(openssl,
1010cff7
VK
233[AS_HELP_STRING(--with-openssl,specify OpenSSL location)],
234[
235 if test "x$withval" != "xno" ; then
236 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
237 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
238 LDFLAGS="$LDFLAGS -L${withval}/lib"
239 CPPFLAGS="$CPPFLAGS -I${withval}/include"
240 else
241 LD_RUN_PATH="/usr/local/lib:/opt/openssl/lib:/usr/local/ssl/lib:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
242 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/opt/openssl/lib"
4d37b0c5 243 CPPFLAGS="$CPPFLAGS -I/opt/openssl/include"
ef0c727b 244 fi
1010cff7
VK
245 fi
246 REQUIRE_ENCRYPTION="yes"
247])
ef0c727b 248
c3cfc039
VK
249AC_ARG_WITH(gd,
250[AS_HELP_STRING(--with-gd,specify GD location)],
251[
252 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
253 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
254 LDFLAGS="$LDFLAGS -L${withval}/lib"
255 CPPFLAGS="$CPPFLAGS -I${withval}/include"
256 fi
257])
258
ef0c727b
VK
259AC_ARG_ENABLE(iconv,
260[AS_HELP_STRING(--disable-iconv,do not use iconv() for text conversions)],
3a7ce527 261[
ef0c727b 262 DISABLE_ICONV="yes"
3a7ce527 263])
3a7ce527 264
ef0c727b
VK
265AC_ARG_ENABLE(encryption,
266[AS_HELP_STRING(--disable-encryption,disable encryption support)],
e0760102 267[
ef0c727b 268 DISABLE_ENCRYPTION="yes"
e0760102
VK
269])
270
ef0c727b
VK
271AC_ARG_ENABLE(unstable,
272[AS_HELP_STRING(--enable-unstable,build experimental/unstable components)],
d8ca9c03 273[
ef0c727b 274 ENABLE_UNSTABLE="yes"
d8ca9c03
VK
275])
276
f974a50a
VK
277AC_ARG_ENABLE(debug,
278[AS_HELP_STRING(--enable-debug,enable additional debugging functionality)],
279[
280 ENABLE_DEBUG="yes"
281])
282
cc297a70
VK
283AC_ARG_ENABLE(64bit,
284[AS_HELP_STRING(--disable-64bit,disable 64bit build (force 32bit build event on 64bit machine))],
285[
286 FORCE_32BIT_BUILD="yes"
287])
288
ef0c727b
VK
289AC_ARG_WITH(dist,
290[AS_HELP_STRING(--with-dist,for maintainers only)],
84277a0f 291 DB_DRIVERS=" mysql pgsql odbc mssql sqlite oracle db2"
f65df2b1 292 MODULES="libexpat libnetxms install sqlite snmp libnxsl libnxlp db server agent libnxmap libnxcl client nxscript tools webui"
ad0f1ada 293 SUBAGENT_DIRS="linux freebsd openbsd netbsd sunos aix ipso hpux"
ef0c727b
VK
294 NXCONFIG="nxconfig"
295 TOP_LEVEL_MODULES="sql images"
296 CONTRIB_MODULES="mibs backgrounds"
aa24418a 297 CLIENT_COMPONENTS="nxalarm nxevent nxpush nxsms"
24f89c3a 298 UNSTABLE_SUBAGENT_DIRS="odbcquery"
ef0c727b
VK
299 SERVER_TOOLS="nxconfig"
300)
301
d8ca9c03 302
ef0c727b
VK
303#--------------------------------------------------------------------
304# Validate command line parameters and set various checking options
305#--------------------------------------------------------------------
306
8817f620
VK
307check_substr "$COMPONENTS" "sqlite"
308if test $? = 0; then
309 MODULES="$MODULES sqlite"
310fi
311
ef0c727b 312check_substr "$COMPONENTS" "static-agent"
1010cff7 313if test $? = 0; then
ef0c727b
VK
314 if test "x$COMPONENTS" != "x static-agent"; then
315 AC_MSG_ERROR(Static agent and other components are mutally exclusive.)
316 fi
317 STATIC_BUILD="yes"
318 BUILD_STATIC_AGENT="yes"
aa8d6795 319 MODULES="$MODULES libnxlp agent"
3a6979cf 320 DISABLE_ICONV="yes"
ef0c727b 321 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT"
e8636669 322
ef0c727b 323 case "$PLATFORM" in
e8636669
VK
324 Linux)
325 SUBAGENT_DIRS="linux"
d0b5a098
VK
326 SUBAGENT_LIBS="../subagents/linux/libnsm_linux.la"
327 STATIC_SUBAGENT_LIST="linux $STATIC_SUBAGENT_LIST"
e8636669
VK
328 ;;
329 FreeBSD)
330 SUBAGENT_DIRS="freebsd"
d0b5a098
VK
331 SUBAGENT_LIBS="../subagents/freebsd/libnsm_freebsd.la"
332 STATIC_SUBAGENT_LIST="freebsd $STATIC_SUBAGENT_LIST"
e8636669 333 ;;
992ba479
AK
334 OpenBSD)
335 SUBAGENT_DIRS="openbsd"
336 SUBAGENT_LIBS="../subagents/openbsd/libnsm_openbsd.la"
337 STATIC_SUBAGENT_LIST="openbsd $STATIC_SUBAGENT_LIST"
338 ;;
ad0f1ada
VK
339 NetBSD)
340 SUBAGENT_DIRS="netbsd"
341 SUBAGENT_LIBS="../subagents/netbsd/libnsm_netbsd.la"
342 STATIC_SUBAGENT_LIST="netbsd $STATIC_SUBAGENT_LIST"
343 ;;
e8636669
VK
344 SunOS)
345 SUBAGENT_DIRS="sunos"
d0b5a098
VK
346 SUBAGENT_LIBS="../subagents/sunos/libnsm_sunos.la"
347 STATIC_SUBAGENT_LIST="sunos $STATIC_SUBAGENT_LIST"
348 ;;
349 AIX)
350 SUBAGENT_DIRS="aix"
351 SUBAGENT_LIBS="../subagents/aix/libnsm_aix.la"
352 STATIC_SUBAGENT_LIST="aix $STATIC_SUBAGENT_LIST"
e8636669 353 ;;
c29360a9
VK
354 HP-UX)
355 SUBAGENT_DIRS="hpux"
356 SUBAGENT_LIBS="../subagents/hpux/libnsm_hpux.la"
357 STATIC_SUBAGENT_LIST="hpux $STATIC_SUBAGENT_LIST"
358 ;;
e8636669
VK
359 *)
360 # unknown
361 ;;
362 esac
ef0c727b 363fi
2b23dc1e 364
ef0c727b 365check_substr "$COMPONENTS" "ipso-agent"
1010cff7 366if test $? = 0; then
fd5a401b 367 if test "x$COMPONENTS" != "x ipso-agent"; then
ef0c727b
VK
368 AC_MSG_ERROR(IPSO agent and other components are mutally exclusive.)
369 fi
370 STATIC_BUILD="yes"
371 BUILD_STATIC_AGENT="yes"
3a6979cf 372 DISABLE_ICONV="yes"
ef0c727b 373 USE_PTH="yes"
aa8d6795 374 MODULES="$MODULES libnxlp agent"
aa24418a 375 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT -D_IPSO -D_USE_GNU_PTH -DSQLITE_THREADSAFE=0 -I/usr/local/include"
ef0c727b
VK
376 LDFLAGS="$LDFLAGS -all-static"
377 STATIC_SUBAGENT_LIST="ipso ping portcheck ups"
378 SUBAGENT_DIRS="ipso"
379 SUBAGENT_LIBS="../subagents/ipso/libnsm_ipso.la ../subagents/ping/libnsm_ping.la ../subagents/portCheck/libnsm_portCheck.la ../subagents/ups/libnsm_ups.la"
380fi
c688d2a7 381
c5c0f362
VK
382check_substr "$COMPONENTS" "snmp"
383if test $? = 0; then
384 NEED_ZLIB="yes"
385 MODULES="$MODULES snmp"
386fi
387
ef0c727b 388check_substr "$COMPONENTS" "server"
1010cff7 389if test $? = 0; then
ef0c727b
VK
390 if test "x$DBDRIVER_SELECTED" != "xyes"; then
391 AC_MSG_ERROR(You must select at least one database driver when building server.)
392 fi
393 BUILD_SERVER="yes"
d1834406 394 MODULES="$MODULES libnxmap libnxsl libnxlp db server nxscript"
ef0c727b
VK
395 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES sql images"
396 CONTRIB_MODULES="$CONTRIB_MODULES mibs backgrounds"
397fi
dff54fed 398
e44986e5
VK
399check_substr "$COMPONENTS" "client"
400if test $? = 0; then
401 BUILD_CLIENT="yes"
402 NEED_ZLIB="yes"
aa24418a 403 MODULES="$MODULES libnxmap libnxcl client"
36ad9f45 404 CLIENT_COMPONENTS="$CLIENT_COMPONENTS nxalarm nxevent nxpush nxsms"
e44986e5
VK
405fi
406
ef0c727b 407check_substr "$COMPONENTS" "agent"
1010cff7 408if test $? = 0; then
ef0c727b 409 BUILD_AGENT="yes"
28ba6824 410 MODULES="$MODULES libnxlp db agent"
ef0c727b 411 if test "x$ENABLE_UNSTABLE" = "xyes"; then
24f89c3a 412 UNSTABLE_SUBAGENT_DIRS="odbcquery"
987b646a 413 fi
1010cff7
VK
414
415 case "$PLATFORM" in
416 Linux)
417 SUBAGENT_DIRS="linux"
418 ;;
419 FreeBSD)
420 SUBAGENT_DIRS="freebsd"
421 ;;
422 OpenBSD)
423 SUBAGENT_DIRS="openbsd"
424 ;;
ad0f1ada
VK
425 NetBSD)
426 SUBAGENT_DIRS="netbsd"
427 ;;
1010cff7
VK
428 SunOS)
429 SUBAGENT_DIRS="sunos"
430 ;;
431 AIX)
432 SUBAGENT_DIRS="aix"
433 ;;
434 HP-UX)
435 SUBAGENT_DIRS="hpux"
436 ;;
437 *)
438 # unknown
439 ;;
440 esac
ef0c727b 441fi
b97191d2 442
e02b69b9 443check_substr "$COMPONENTS" "webui"
1010cff7 444if test $? = 0; then
ef0c727b 445 BUILD_NXHTTPD="yes"
e02b69b9 446 MODULES="$MODULES libnxmap libnxcl webui"
ef0c727b 447fi
b67a9e12 448
ef0c727b 449check_substr "$COMPONENTS" "mysql"
1010cff7 450if test $? = 0; then
ef0c727b 451 DB_DRIVERS="$DB_DRIVERS mysql"
b67a9e12 452fi
6619a6b0 453
ef0c727b 454check_substr "$COMPONENTS" "pgsql"
1010cff7 455if test $? = 0; then
ef0c727b
VK
456 DB_DRIVERS="$DB_DRIVERS pgsql"
457fi
e8636669 458
8817f620 459check_substr "$COMPONENTS" "sqlite_drv"
1010cff7 460if test $? = 0; then
ef0c727b 461 DB_DRIVERS="$DB_DRIVERS sqlite"
e8636669
VK
462fi
463
ef0c727b 464check_substr "$COMPONENTS" "odbc"
1010cff7 465if test $? = 0; then
ef0c727b
VK
466 DB_DRIVERS="$DB_DRIVERS odbc"
467fi
468
41b4790d
VK
469check_substr "$COMPONENTS" "oracle"
470if test $? = 0; then
471 DB_DRIVERS="$DB_DRIVERS oracle"
472fi
473
84277a0f
AK
474check_substr "$COMPONENTS" "db2"
475if test $? = 0; then
476 DB_DRIVERS="$DB_DRIVERS db2"
477fi
478
ef0c727b
VK
479
480#--------------------------------------------------------------------
481# Check for programs
482#--------------------------------------------------------------------
483
484if test "x$PLATFORM" = "xHP-UX"; then
e7d9c4ae 485 AC_CHECK_PROG([CCC], [aCC], [aCC])
ef0c727b
VK
486fi
487AC_PROG_CC(aCC gcc cc cl)
488AC_PROG_CPP
489AC_PROG_CXX
c3cfc039 490if test "x$CXX" = "xg++"; then
753206b5
AK
491 AC_CHECK_PROG([GPLUSPLUS], [g++], [yes], [no])
492 if test "x$GPLUSPLUS" = "xno"; then
c3cfc039
VK
493 AC_MSG_ERROR([*** FATAL: Cannot find any usable C++ compiler])
494 fi
495fi
ef0c727b
VK
496AC_PROG_INSTALL
497AC_PROG_LEX
76154a95 498AC_CHECK_PROGS(YACC,bison byacc,yacc)
ef0c727b
VK
499AC_PROG_LN_S
500
501AC_ARG_VAR(PERL,local path to the perl interpreter)
502perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin"
503AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path)
504
505
506#--------------------------------------------------------------------
507# Initialize libtool
508#--------------------------------------------------------------------
509
510if test "x$STATIC_BUILD" = "xyes"; then
511 enable_shared=no
512 enable_static=yes
513else
514 enable_shared=yes
515 enable_static=no
516fi
e8636669
VK
517AC_LIBTOOL_DLOPEN
518AC_PROG_LIBTOOL
3a7ce527 519
d16cf8a5 520
ef0c727b
VK
521#--------------------------------------------------------------------
522# C/C++ capabilities
523#--------------------------------------------------------------------
524
525AC_C_CONST
526AC_PROG_GCC_TRADITIONAL
1d9cc60e 527AC_C_BIGENDIAN
ef0c727b
VK
528
529
530#--------------------------------------------------------------------
531# Platform-dependent settings
532#--------------------------------------------------------------------
533
534case "$PLATFORM" in
535 AIX)
9fedef8b 536 LDFLAGS="-no-undefined -Wl,-brtl $LDFLAGS"
ef0c727b
VK
537 ;;
538 HP-UX)
5a5957b2 539 CPPFLAGS="$CPPFLAGS -D_HPUX -D_HPUX_SOURCE -D_POSIX_PTHREAD_SEMANTICS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 -D_REENTRANT"
ef0c727b
VK
540 if test "x$CXX" = "xaCC"; then
541 CXXFLAGS="-mt $CXXFLAGS +W749 +W829"
542 LDFLAGS="$LDFLAGS -mt"
543 fi
544 ;;
75c30ed4 545 SunOS)
27ed5b1d 546 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
75c30ed4
VK
547 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
548 export LD_LIBRARY_PATH
549 ;;
56b2f755
VK
550 Linux)
551 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
552 ;;
ef0c727b
VK
553 *)
554 ;;
555esac
556
557
558#--------------------------------------------------------------------
c90d3610 559# C++ compiler tuning:
cc297a70 560# * Disable C++ exceptions and RTTI
779ce551 561# * Turn on 64bit mode on HP-UX/Itanium
cc297a70 562# * Turn on 64bit mode on AIX
ef0c727b
VK
563#--------------------------------------------------------------------
564
565if test "x$CC" = "xgcc" ; then
566
567 AC_LANG_PUSH([C++])
568
569 AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti)
570 OLD_CXXFLGAS="$CXXFLAGS"
571 CXXFLAGS="$CXXFLAGS -fno-rtti"
572 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
573 [ AC_MSG_RESULT(yes) ],
574 [
575 CXXFLAGS="$OLD_CXXFLAGS"
576 AC_MSG_RESULT(no)
577 ])
578
579 AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions)
580 OLD_CXXFLGAS="$CXXFLAGS"
581 CXXFLAGS="$CXXFLAGS -fno-exceptions"
582 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
583 [ AC_MSG_RESULT(yes) ],
584 [
585 CXXFLAGS="$OLD_CXXFLAGS"
586 AC_MSG_RESULT(no)
587 ])
588
589 AC_LANG_POP([C++])
590
779ce551 591 if test "x$PLATFORM" = "xHP-UX"; then
cc297a70
VK
592 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
593 AC_MSG_CHECKING(whether C compiler accepts -milp32)
594 OLD_CPPFLAGS="$CPPFLAGS"
595 CPPFLAGS="$CPPFLAGS -milp32"
596 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
597 [
598 LDFLAGS="-milp32 $LDFLAGS"
599 AC_MSG_RESULT(yes)
600 ],
601 [
602 CPPFLAGS="$OLD_CPPFLAGS"
603 AC_MSG_RESULT(no)
604 ])
605 else
606 AC_MSG_CHECKING(whether C compiler accepts -mlp64)
607 OLD_CPPFLAGS="$CPPFLAGS"
608 CPPFLAGS="$CPPFLAGS -mlp64"
609 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
610 [
611 LDFLAGS="-mlp64 -L/usr/lib/hpux64 -L/usr/local/lib/hpux64 $LDFLAGS"
612 AC_MSG_RESULT(yes)
613 ],
614 [
615 CPPFLAGS="$OLD_CPPFLAGS"
616 AC_MSG_RESULT(no)
617 ])
618 fi
619 fi
620
621 if test "x$PLATFORM" = "xAIX"; then
622 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
623 AC_MSG_CHECKING(whether C compiler accepts -maix32)
624 OLD_CPPFLAGS="$CPPFLAGS"
625 CPPFLAGS="$CPPFLAGS -maix32"
fecf6a2b 626 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
627 [
628 LDFLAGS="-maix32 $LDFLAGS"
1c45282c
VK
629 OBJECT_MODE=32
630 AC_SUBST(OBJECT_MODE)
cc297a70
VK
631 AC_MSG_RESULT(yes)
632 ],
633 [
634 CPPFLAGS="$OLD_CPPFLAGS"
635 AC_MSG_RESULT(no)
636 ])
637 else
638 AC_MSG_CHECKING(whether C compiler accepts -maix64)
639 OLD_CPPFLAGS="$CPPFLAGS"
640 CPPFLAGS="$CPPFLAGS -maix64"
fecf6a2b 641 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
642 [
643 LDFLAGS="-maix64 $LDFLAGS"
1c45282c
VK
644 OBJECT_MODE=64
645 AC_SUBST(OBJECT_MODE)
cc297a70
VK
646 AC_MSG_RESULT(yes)
647 ],
648 [
649 CPPFLAGS="$OLD_CPPFLAGS"
650 AC_MSG_RESULT(no)
651 ])
652 fi
779ce551
VK
653 fi
654
ce5592b2
VK
655 if test "x$ENABLE_DEBUG" = "xyes"; then
656 CPPFLAGS="$CPPFLAGS -ggdb3"
657 fi
ef0c727b
VK
658fi
659
660
661#--------------------------------------------------------------------
662# Additional include and library directories
663#--------------------------------------------------------------------
664
665if test -d /usr/local/include; then
4d37b0c5
VK
666 if test "x$CC" = "xgcc"; then
667 AC_MSG_CHECKING(whether -I/usr/local/include needed)
668 OLD_CPPFLAGS="$CPPFLAGS"
669 CPPFLAGS="$CPPFLAGS -Werror -I/usr/local/include"
670 AC_TRY_COMPILE([],[],
671 [
672 CPPFLAGS="$OLD_CPPFLAGS -I/usr/local/include"
673 AC_MSG_RESULT(yes)
674 ],
675 [
676 CPPFLAGS="$OLD_CPPFLAGS"
677 AC_MSG_RESULT(no)
678 ]
679 )
680 else
681 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
682 fi
ef0c727b
VK
683fi
684
685if test -d /usr/kerberos/include; then
686 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
687fi
688
689if test -d /usr/local/lib; then
690 LDFLAGS="$LDFLAGS -L/usr/local/lib"
691fi
692
693
694#--------------------------------------------------------------------
695# Check for threads library - either POSIX or GNU
696#--------------------------------------------------------------------
697
698if test "x$USE_PTH" = "xyes"; then
699 AC_CHECK_HEADER(pth.h,,AC_MSG_ERROR([*** GNU Pth thread support not installed - please install first ***]))
700else
701 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
702
703 if test "x$CXX" = "xaCC"; then
704 PTHREAD_LIBS=""
705 else
706 PTHREAD_LIBS="error"
707 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
708 AC_EGREP_CPP(yes,
709 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
710 yes
711 #endif
712 ], AC_MSG_RESULT(yes)
fecf6a2b 713 PTHREAD_LIBS="-pthread",
ef0c727b
VK
714 AC_MSG_RESULT(no))
715 if test "x$PTHREAD_LIBS" = "xerror"; then
716 AC_CHECK_LIB(pthread, pthread_attr_init,
717 PTHREAD_LIBS="-lpthread")
718 fi
f725c1b7 719 # On HP-UX (at least 11.00) pthread library contains
b041c587 720 # __pthread_attr_init_system instead of pthread_attr_init
f725c1b7 721 if test "x$PTHREAD_LIBS" = "xerror"; then
b041c587 722 AC_CHECK_LIB(pthread, __pthread_attr_init_system,
f725c1b7
VK
723 PTHREAD_LIBS="-lpthread")
724 fi
ef0c727b
VK
725 if test "x$PTHREAD_LIBS" = "xerror"; then
726 AC_CHECK_LIB(pthreads, pthread_attr_init,
727 PTHREAD_LIBS="-lpthreads")
728 fi
729 if test "x$PTHREAD_LIBS" = "xerror"; then
730 AC_CHECK_FUNC(pthread_attr_init,
731 PTHREAD_LIBS="")
732 fi
733 fi
734
735 if test "x$PTHREAD_LIBS" = "xerror"; then
736 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
737 fi
8d131dda 738 LIBS="$LIBS $PTHREAD_LIBS"
ef0c727b
VK
739
740 # Extensions to posix threads
741 AC_CHECK_HEADERS([pthread_np.h],,,[
9c29f76e 742#include <pthread.h>
ef0c727b
VK
743 ])
744 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
745
746 # Check for recursive mutexes
39086394
VK
747 AC_CHECK_FUNCS([pthread_mutexattr_settype __pthread_mutexattr_settype pthread_mutexattr_setkind_np])
748 AC_CHECK_DECLS([pthread_mutexattr_settype, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
9c29f76e
VK
749#include <pthread.h>
750#if HAVE_PTHREAD_NP_H
751#include <pthread_np.h>
752#endif
ef0c727b
VK
753 ])
754
755 # Check for read/write locks
756 # On Linux, rwlock functions declared always, but pthread_rwlock_t may need
757 # additional defines
758 AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
759 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
760 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
9c29f76e
VK
761 [AC_TRY_COMPILE([
762#include <sys/types.h>
763#include <pthread.h>
764 ],
ef0c727b
VK
765 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
766 ac_cv_struct_pthread_rw=yes, [
9c29f76e
VK
767 AC_TRY_COMPILE([
768#define _XOPEN_SOURCE 500
769#include <sys/types.h>
770#include <pthread.h>
771 ],
ef0c727b
VK
772 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
773 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
774 if test "$ac_cv_struct_pthread_rw" = "yes"; then
775 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
776 fi
777 ])])
778 if test "$ac_cv_struct_pthread_rw" = "yes"; then
779 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
780 fi
781 fi
782
783fi
784
785
786#--------------------------------------------------------------------
787# Checks for OpenSSL
788#--------------------------------------------------------------------
789
790if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
791 AC_CHECK_LIB(crypto, RSA_new,
792 [
793 AC_DEFINE(WITH_OPENSSL,,[with openssl])
794 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
795 [], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
796 AC_CHECK_LIB(crypto, EVP_bf_cbc,
797 [], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
798 AC_CHECK_LIB(crypto, EVP_idea_cbc,
799 [], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
800 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
801 [], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
802 ],
803 [
804 if test "x$REQUIRE_ENCRYPTION" = "xyes"; then
805 AC_MSG_ERROR(libcrypto is required for encryption support)
806 else
807 AC_MSG_RESULT(libcrypto is required for encryption support)
808 fi
809 ])
810fi
811
812
813#--------------------------------------------------------------------
0322eed7
VK
814# Checks for header files
815#--------------------------------------------------------------------
816
817AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h alloca.h])
818AC_CHECK_HEADERS([sys/int_types.h time.h sys/time.h sys/utsname.h])
819AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h net/nh.h sys/socket.h])
820AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
821AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
822AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h])
823AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h getopt.h])
f09c2d05 824AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
0322eed7
VK
825[[#ifdef HAVE_SYS_TYPES_H
826# include <sys/types.h>
827#endif
828#ifdef HAVE_SYS_TIME_H
829# include <sys/time.h>
830#endif
831#ifdef HAVE_SYS_SOCKET_H
832# include <sys/socket.h>
833#endif
834]])
835
836
837#--------------------------------------------------------------------
ef0c727b
VK
838# Checks for other libs.
839#--------------------------------------------------------------------
d16cf8a5 840
779ce551 841AC_CHECK_LIB(xnet, accept)
521d90e7 842AC_CHECK_LIB(socket, if_nameindex)
87bb64a7 843AC_CHECK_LIB(dl, dlopen)
1b3c0ef0 844AC_CHECK_LIB(kstat, kstat_open)
b821526a 845AC_CHECK_LIB(gnugetopt, getopt_long)
d16cf8a5 846
e0760102
VK
847if test "x$BUILD_SERVER" = "xyes" ; then
848 AC_CHECK_LIB(termcap, tgetstr, [], [AC_CHECK_LIB(ncurses, tgetstr, [], AC_CHECK_LIB(curses, tgetstr))])
0322eed7
VK
849 AC_CHECK_LIB(readline, readline, [], [AC_CHECK_LIB(edit, readline)])
850 AC_CHECK_FUNCS([readline])
851
852 # Check if passing rl_insert to rl_bind_key needs cast
853 if test "$ac_cv_func_readline" = "yes"; then
854 AC_LANG_PUSH([C++])
855
856 AC_MSG_CHECKING(for rl_insert cast)
857
858 AC_TRY_COMPILE(
859 [
860#include <stdio.h>
861#include <readline/readline.h>
862 ],[ rl_bind_key('\t', (Function *)rl_insert); ],
863 [
864 AC_MSG_RESULT((Function *))
865 AC_DEFINE(RL_INSERT_CAST,(Function *),Required cast for rl_insert)
866 ],[
867 AC_TRY_COMPILE(
868 [
869#include <stdio.h>
870#include <readline/readline.h>
871 ],[ rl_bind_key('\t', (rl_command_func_t *)rl_insert); ],
872 [
873 AC_MSG_RESULT((rl_command_func_t *))
874 AC_DEFINE(RL_INSERT_CAST,(rl_command_func_t *),Required cast for rl_insert)
875 ],[
876 AC_MSG_RESULT(not needed)
877 AC_DEFINE(RL_INSERT_CAST,,Required cast for rl_insert)
878 ]
879 )
880 ]
881 )
882
883 AC_LANG_POP([C++])
884 fi
e0760102
VK
885fi
886
ef0c727b
VK
887if test "x$NEED_ZLIB" = "xyes"; then
888 AC_CHECK_HEADER(zlib.h,,AC_MSG_ERROR([*** ZLib development package not installed - please install first ***]))
889 AC_CHECK_LIB(z, deflate)
890fi
891
467c489f
VK
892if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
893 HAVE_LIBEXPAT=no
894else
895 HAVE_LIBEXPAT=yes
896 AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
897 AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
898fi
80ce37ac
VK
899if test "x$HAVE_LIBEXPAT" = "xno"; then
900 MODULES="libexpat $MODULES"
901 CPPFLAGS="$CPPFLAGS "
1bb6b449 902fi
ef0c727b 903
ef0c727b
VK
904
905#--------------------------------------------------------------------
906# Checks for data types
907#--------------------------------------------------------------------
908
d16cf8a5
AK
909AC_CHECK_SIZEOF(short)
910AC_CHECK_SIZEOF(int)
911AC_CHECK_SIZEOF(long)
912AC_CHECK_SIZEOF(long long)
913
914AC_TYPE_PID_T
915AC_TYPE_SIGNAL
916AC_TYPE_SIZE_T
917AC_STRUCT_TIMEZONE
918
51128b42
VK
919AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t])
920AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
4c779d83
VK
921#if HAVE_SYS_TYPES_H
922#include <sys/types.h>
923#endif
924#if HAVE_SYS_SOCKET_H
925#include <sys/socket.h>
926#endif
927])
e0293f7f
VK
928AC_CHECK_TYPES([struct stat64],,,[
929#if HAVE_SYS_STAT_H
930#include <sys/stat.h>
931#endif
932])
521d90e7 933
e25cadc9 934
ef0c727b
VK
935#--------------------------------------------------------------------
936# Checks for functions
937#--------------------------------------------------------------------
d16cf8a5
AK
938
939AC_FUNC_ERROR_AT_LINE
d16cf8a5 940AC_FUNC_MEMCMP
d16cf8a5
AK
941AC_FUNC_SELECT_ARGTYPES
942AC_FUNC_STRFTIME
943AC_FUNC_STRTOD
944AC_FUNC_VPRINTF
945
80ce37ac 946AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
b50f1100 947AC_CHECK_FUNCS([strrchr strtol strtoul strtoll strtoull])
467e30e1 948AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
aa24418a
VK
949AC_CHECK_FUNCS([usleep nanosleep getopt_long gmtime_r localtime_r lstat64])
950
951AC_CHECK_DECLS([nanosleep])
be6467e9 952
b0823d06
VK
953# Check if strerror_r is POSIX-compliant
954if test "$ac_cv_func_strerror_r" = "yes"; then
955 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
956 AC_LANG_PUSH([C++])
957 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7f9423af
VK
958#if HAVE_STRING_H
959#include <string.h>
960#endif
961#if HAVE_ERRNO_H
962#include <errno.h>
963#endif
b0823d06 964 ]],[[
7f9423af
VK
965 int e;
966 char buffer[256];
967 e = strerror_r(1, buffer, 256);
968 return e;
b0823d06
VK
969 ]])
970 ],[
971 AC_MSG_RESULT(yes)
972 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
973 ],[
974 AC_MSG_RESULT(no)
975 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
976 ])
977 AC_LANG_POP([C++])
978fi
979
be6467e9
VK
980# Check if timezone is a function
981AC_MSG_CHECKING(for timezone function)
982AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
983#if HAVE_TIME_H
984#include <time.h>
985#endif
986#if HAVE_SYS_TIME_H
987#include <sys/time.h>
988#endif
989]],[[
be6467e9 990 timezone(0, 0);
be6467e9
VK
991]])
992],[
993AC_MSG_RESULT(yes)
994AC_DEFINE(HAVE_TIMEZONE,1,Define to 1 if timezone function is available)
995],[
996AC_MSG_RESULT(no)
445cba33
VK
997AC_CHECK_DECLS([timezone],,,[
998#if HAVE_TIME_H
999#include <time.h>
1000#endif
1001#if HAVE_SYS_TIME_H
1002#include <sys/time.h>
1003#endif
1004])
be6467e9
VK
1005])
1006
1007# Check if struct tm has tm_gmtoff member
1008AC_MSG_CHECKING(for struct tm.tm_gmtoff)
1009AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1010#if HAVE_TIME_H
1011#include <time.h>
1012#endif
1013#if HAVE_SYS_TIME_H
1014#include <sys/time.h>
1015#endif
1016]],[[
be6467e9
VK
1017 struct tm t;
1018 return t.tm_gmtoff;
be6467e9
VK
1019]])
1020],[
1021AC_MSG_RESULT(yes)
1022AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
1023],[
1024AC_MSG_RESULT(no)
1025])
d16cf8a5 1026
99e50bb7
VK
1027AC_CHECK_DECLS([getopt_long],,,[
1028#if HAVE_GETOPT_H
1029#include <getopt.h>
1030#endif
1031])
73d7fbdb 1032
f91feddc 1033AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
70fed300
AK
1034AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
1035
d16cf8a5
AK
1036# sockets/resolver (probably for solaris)
1037AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
1038AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
1039AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
1040
1041if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
1042 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
1043fi
1044
1045if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
1046 AC_MSG_CHECKING([if we can include libnsl + libsocket])
1047 LIBS="-lnsl -lsocket $LIBS"
1048 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
1049 if test "$my_ac_link_result" = "no" ; then
1050 AC_MSG_RESULT([failure])
1051 AC_MSG_ERROR([unable to use gethostbyname()])
1052 else
1053 AC_MSG_RESULT([success])
1054 fi
1055fi
1056
c6491611
VK
1057# asprintf, scprintf, etc.
1058AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
1059AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
1060
1061AC_MSG_CHECKING(whether snprintf returns required buffer size)
1062AC_RUN_IFELSE(
1063 [AC_LANG_PROGRAM([
1064#include <stdio.h>
1065#include <string.h>
1066 ], [
1067 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
1068 ])
1069 ],
1070 [ AC_MSG_RESULT(yes)
1071 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
1072 ],
1073 [ AC_MSG_RESULT(no) ],
1074 [ AC_MSG_RESULT(no) ]
1075)
1076
1077
dff54fed 1078
ef0c727b
VK
1079#--------------------------------------------------------------------
1080# Checks for macros and definitions
1081#--------------------------------------------------------------------
dff54fed 1082
ef0c727b
VK
1083AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
1084#ifdef HAVE_SYS_TYPES_H
99e50bb7 1085#include <sys/types.h>
ef0c727b
VK
1086#endif
1087#if HAVE_BYTESWAP_H
1088#include <byteswap.h>
1089#endif
1090#if HAVE_NETINET_IN_H
1091#include <netinet/in.h>
1092#endif
1093#if HAVE_NET_NH_H
1094#include <net/nh.h>
1095#endif
1096])
aa24418a
VK
1097AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
1098#ifdef HAVE_UNISTD_H
1099#include <unistd.h>
1100#endif
1101#ifdef HAVE_DLFCN_H
1102#include <dlfcn.h>
1103#endif
1104])
ce7565e7
VK
1105AC_CHECK_DECLS([va_copy, __va_copy],,,[
1106#ifdef HAVE_UNISTD_H
1107#include <unistd.h>
1108#endif
1109#ifdef HAVE_STDARG_H
1110#include <stdarg.h>
1111#endif
1112#ifdef HAVE_STDLIB_H
1113#include <stdlib.h>
1114#endif
1115])
dff54fed 1116
dff54fed 1117
ef0c727b
VK
1118#--------------------------------------------------------------------
1119# AIX specific checks
1120#--------------------------------------------------------------------
d16cf8a5 1121
ef0c727b
VK
1122if test "x$PLATFORM" = "xAIX"; then
1123 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
1124 AC_CHECK_DECLS([getkerninfo])
1125 AC_CHECK_FUNCS([getprocs64],,,[
1126#if HAVE_PROCINFO_H
1127#include <procinfo.h>
6cd41ceb 1128#endif
ef0c727b 1129 ])
7e56bf2e
VK
1130fi
1131
cd4c8ca3 1132
ef0c727b 1133#--------------------------------------------------------------------
ba8db57b
VK
1134# HP-UX specific checks
1135#--------------------------------------------------------------------
1136
1137if test "x$PLATFORM" = "xHP-UX"; then
f09c2d05
VK
1138 AC_CHECK_HEADERS([sys/mib.h],,,[[ ]])
1139 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
1140#if HAVE_NET_IF_H
1141#include <net/if.h>
1142#endif
1143 ])
1144 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
1145#if HAVE_SYS_MIB_H
1146#include <sys/mib.h>
1147#endif
1148 ])
ba8db57b
VK
1149fi
1150
1151
1152#--------------------------------------------------------------------
aa24418a
VK
1153# *BSD specific checks
1154#--------------------------------------------------------------------
1155
1156AC_CHECK_LIB(kvm, kvm_open)
1157AC_CHECK_FUNCS([kvm_getswapinfo])
1158AC_CHECK_TYPES([struct kinfo_proc2],,,[
1159#if HAVE_SYS_SYSCTL_H
1160#include <sys/sysctl.h>
1161#endif
1162])
1163
1164
28ba6824
VK
1165
1166#--------------------------------------------------------------------
1167# FreeBSD specific checks
1168#--------------------------------------------------------------------
1169
1170if test "x$PLATFORM" = "xFreeBSD"; then
61f58c11
VK
1171 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
1172#if HAVE_SYS_TYPES_H
1173#include <sys/types.h>
1174#endif
1175#if HAVE_SYS_SOCKET_H
1176#include <sys/socket.h>
1177#endif
1178#include <net/route.h>
1179 ])
28ba6824
VK
1180fi
1181
1182
aa24418a 1183#--------------------------------------------------------------------
8b86c5dc
VK
1184# Check for wxWidgets
1185#--------------------------------------------------------------------
1186
1187if test "x$NEED_WXWIDGETS" = "xyes"; then
1188 AC_PATH_PROGS([WXCONF], [wx-config wxgtk2-2.8-config], [no], [$PATH:/usr/local/bin])
1189 if test "x$WXCONF" = "xno"; then
1190 AC_MSG_ERROR([*** wxWidgets not installed - unable to build GUI components ***])
1191 else
1192 AC_PATH_PROGS([WXRC], [wxrc wxrc-gtk2-2.8], [no], [$PATH:/usr/local/bin])
1193 if test "x$WXRC" = "xno"; then
1194 AC_MSG_ERROR([*** wxWidgets resource compiler not found - unable to build GUI components ***])
1195 else
1196 NEED_UNICODE=`$WXCONF --selected-config | grep unicode | wc -l`
1197 if test $NEED_UNICODE -eq 1; then
1198 BUILD_UNICODE="yes"
273da39a 1199 WX_UNICODE="yes"
8b86c5dc
VK
1200 fi
1201 CXXFLAGS="$CXXFLAGS `$WXCONF --cxxflags --debug=$ENABLE_DEBUG`"
1202 LDFLAGS="$LDFLAGS `$WXCONF --libs --debug=$ENABLE_DEBUG`"
1203 fi
1204 fi
bfc410a1
VK
1205 $WXCONF --cxxflags | grep error >/dev/null
1206 if test $? = 0; then
1207 echo "wx-config output:"
1208 echo "*** BEGIN ***"
1209 $WXCONF --cxxflags
1210 echo "*** END ***"
1211 AC_MSG_ERROR([*** wxWidgets is not configured properly - see wx-config output above ***])
1212 fi
8b86c5dc
VK
1213fi
1214
1215
1216#--------------------------------------------------------------------
ef0c727b
VK
1217# Check for UNICODE stuff
1218#--------------------------------------------------------------------
3e39fcde 1219
8b86c5dc 1220AC_CHECK_HEADERS([wchar.h wctype.h iconv.h])
aa24418a 1221AC_CHECK_TYPES([wchar_t, wint_t],,,[
6b93c954
VK
1222#if HAVE_WCHAR_H
1223#include <wchar.h>
1224#endif
1225])
3e39fcde 1226AC_CHECK_SIZEOF(wchar_t)
aa24418a
VK
1227AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper wcserror wcserror_r])
1228AC_CHECK_FUNCS([wfopen wopen wstat wgetenv wrename wunlink])
ba8db57b 1229AC_CHECK_FUNCS([wfopen wopen wstat wgetenv wrename wunlink])
dff54fed 1230
3265ba38 1231if test "x$DISABLE_ICONV" != "xyes"; then
75c30ed4 1232 AC_CHECK_LIB(iconv, libiconv_open,
dff54fed 1233 [ ac_found_iconv=yes
8d131dda 1234 LIBS="$LIBS -liconv"
75c30ed4
VK
1235 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
1236 ],
1237 [
1238 AC_CHECK_LIB(iconv, iconv,
1239 [ ac_found_iconv=yes
8d131dda 1240 LIBS="$LIBS -liconv"
75c30ed4
VK
1241 ])
1242 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
1243 ])
dff54fed
VK
1244else
1245 ac_found_iconv=no
ef0c727b 1246 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
dff54fed 1247fi
93571e7f
VK
1248
1249AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
1250AC_RUN_IFELSE(
1251 [AC_LANG_PROGRAM([
1252#if HAVE_ICONV_H
1253#include <iconv.h>
1254#endif
1255 ], [
1256 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
1257 ])
1258 ],
1259 [ AC_MSG_RESULT(yes)
1260 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
1261 valid_ucs2_code="UCS-2-INTERNAL"
1262 ],
1263 [ AC_MSG_RESULT(no) ],
1264 [ AC_MSG_RESULT(no) ]
1265)
1266
1267AC_MSG_CHECKING(whether iconv supports UCS-2)
1268AC_RUN_IFELSE(
1269 [AC_LANG_PROGRAM([
1270#if HAVE_ICONV_H
1271#include <iconv.h>
1272#endif
1273 ], [
1274 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
1275 ])
1276 ],
1277 [ AC_MSG_RESULT(yes)
1278 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
1279 valid_ucs2_code="UCS-2"
1280 ],
1281 [ AC_MSG_RESULT(no) ],
8b86c5dc 1282 [ AC_MSG_RESULT(no) ]
93571e7f
VK
1283)
1284
1285AC_MSG_CHECKING(whether iconv supports UCS2)
1286AC_RUN_IFELSE(
1287 [AC_LANG_PROGRAM([
1288#if HAVE_ICONV_H
1289#include <iconv.h>
1290#endif
1291 ], [
1292 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
1293 ])
1294 ],
1295 [ AC_MSG_RESULT(yes)
1296 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
1297 valid_ucs2_code="UCS2"
1298 ],
1299 [ AC_MSG_RESULT(no) ],
1300 [ AC_MSG_RESULT(no) ]
1301)
1302
44bccbbc
VK
1303AC_MSG_CHECKING(whether iconv supports UCS-2BE)
1304AC_RUN_IFELSE(
1305 [AC_LANG_PROGRAM([
1306#if HAVE_ICONV_H
1307#include <iconv.h>
1308#endif
1309 ], [
1310 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
1311 ])
1312 ],
1313 [ AC_MSG_RESULT(yes)
1314 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
1315 valid_ucs2_code="UCS-2BE"
1316 ],
1317 [ AC_MSG_RESULT(no) ],
1318 [ AC_MSG_RESULT(no) ]
1319)
1320
6e17f325
VK
1321AC_MSG_CHECKING(whether iconv supports UCS-2LE)
1322AC_RUN_IFELSE(
1323 [AC_LANG_PROGRAM([
1324#if HAVE_ICONV_H
1325#include <iconv.h>
1326#endif
1327 ], [
1328 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
1329 ])
1330 ],
1331 [ AC_MSG_RESULT(yes)
1332 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
1333 valid_ucs2_code="UCS-2LE"
1334 ],
1335 [ AC_MSG_RESULT(no) ],
1336 [ AC_MSG_RESULT(no) ]
1337)
1338
8b86c5dc
VK
1339AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
1340AC_RUN_IFELSE(
1341 [AC_LANG_PROGRAM([
1342#if HAVE_ICONV_H
1343#include <iconv.h>
1344#endif
1345 ], [
1346 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
1347 ])
1348 ],
1349 [ AC_MSG_RESULT(yes)
1350 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
1351 valid_ucs4_code="UCS-4-INTERNAL"
1352 ],
1353 [ AC_MSG_RESULT(no) ],
1354 [ AC_MSG_RESULT(no) ]
1355)
1356
1357AC_MSG_CHECKING(whether iconv supports UCS-4)
1358AC_RUN_IFELSE(
1359 [AC_LANG_PROGRAM([
1360#if HAVE_ICONV_H
1361#include <iconv.h>
1362#endif
1363 ], [
1364 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
1365 ])
1366 ],
1367 [ AC_MSG_RESULT(yes)
1368 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
1369 valid_ucs4_code="UCS-4"
1370 ],
1371 [ AC_MSG_RESULT(no) ],
1372 [ AC_MSG_RESULT(no) ]
1373)
1374
1375AC_MSG_CHECKING(whether iconv supports UCS4)
1376AC_RUN_IFELSE(
1377 [AC_LANG_PROGRAM([
1378#if HAVE_ICONV_H
1379#include <iconv.h>
1380#endif
1381 ], [
1382 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
1383 ])
1384 ],
1385 [ AC_MSG_RESULT(yes)
1386 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
1387 valid_ucs4_code="UCS4"
1388 ],
1389 [ AC_MSG_RESULT(no) ],
1390 [ AC_MSG_RESULT(no) ]
1391)
1392
1393AC_MSG_CHECKING(whether iconv supports UCS-4BE)
1394AC_RUN_IFELSE(
1395 [AC_LANG_PROGRAM([
1396#if HAVE_ICONV_H
1397#include <iconv.h>
1398#endif
1399 ], [
1400 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
1401 ])
1402 ],
1403 [ AC_MSG_RESULT(yes)
1404 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
1405 valid_ucs4_code="UCS-4BE"
1406 ],
1407 [ AC_MSG_RESULT(no) ],
1408 [ AC_MSG_RESULT(no) ]
1409)
1410
6e17f325
VK
1411AC_MSG_CHECKING(whether iconv supports UCS-4LE)
1412AC_RUN_IFELSE(
1413 [AC_LANG_PROGRAM([
1414#if HAVE_ICONV_H
1415#include <iconv.h>
1416#endif
1417 ], [
1418 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
1419 ])
1420 ],
1421 [ AC_MSG_RESULT(yes)
1422 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
1423 valid_ucs4_code="UCS-4LE"
1424 ],
1425 [ AC_MSG_RESULT(no) ],
1426 [ AC_MSG_RESULT(no) ]
1427)
1428
5e40a69e
VK
1429AC_MSG_CHECKING(whether iconv supports ISO8859-1)
1430AC_RUN_IFELSE(
1431 [AC_LANG_PROGRAM([
1432#if HAVE_ICONV_H
1433#include <iconv.h>
1434#endif
1435 ], [
1436 return iconv_open("UTF-8","ISO8859-1")==(iconv_t)(-1);
1437 ])
1438 ],
1439 [ AC_MSG_RESULT(yes)
1440 AC_DEFINE(HAVE_ICONV_ISO8859_1, 1, Define to 1 if iconv supports ISO8859-1)
1441 ],
1442 [ AC_MSG_RESULT(no) ],
1443 [ AC_MSG_RESULT(no) ]
1444)
1445
1446AC_MSG_CHECKING(whether iconv supports ISO-8859-1)
1447AC_RUN_IFELSE(
1448 [AC_LANG_PROGRAM([
1449#if HAVE_ICONV_H
1450#include <iconv.h>
1451#endif
1452 ], [
1453 return iconv_open("UTF-8","ISO-8859-1")==(iconv_t)(-1);
1454 ])
1455 ],
1456 [ AC_MSG_RESULT(yes)
1457 AC_DEFINE(HAVE_ICONV_ISO_8859_1, 1, Define to 1 if iconv supports ISO-8859-1)
1458 ],
1459 [ AC_MSG_RESULT(no) ],
1460 [ AC_MSG_RESULT(no) ]
1461)
1462
1463AC_MSG_CHECKING(whether iconv supports ASCII)
1464AC_RUN_IFELSE(
1465 [AC_LANG_PROGRAM([
1466#if HAVE_ICONV_H
1467#include <iconv.h>
1468#endif
1469 ], [
1470 return iconv_open("UTF-8","ASCII")==(iconv_t)(-1);
1471 ])
1472 ],
1473 [ AC_MSG_RESULT(yes)
1474 AC_DEFINE(HAVE_ICONV_ASCII, 1, Define to 1 if iconv supports ASCII)
1475 ],
1476 [ AC_MSG_RESULT(no) ],
1477 [ AC_MSG_RESULT(no) ]
1478)
1479
93571e7f
VK
1480AC_MSG_CHECKING(whether iconv supports //IGNORE)
1481AC_RUN_IFELSE(
1482 [AC_LANG_PROGRAM([
1483#if HAVE_ICONV_H
1484#include <iconv.h>
1485#endif
1486 ], [
1487 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
1488 ])
1489 ],
1490 [ AC_MSG_RESULT(yes)
1491 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
1492 ],
1493 [ AC_MSG_RESULT(no) ],
1494 [ AC_MSG_RESULT(no) ]
1495)
3e39fcde 1496
19619a35
AK
1497# taken from ZSH's configure
1498# Check if iconv uses const in prototype declaration
24b1570c 1499if test "x$ac_found_iconv" = "xyes"; then
19619a35 1500 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
7f9423af
VK
1501 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1502#include <stdlib.h>
1503#include <iconv.h>
1504 ]],
1505 [[
1506#ifdef __cplusplus
1507"C"
1508#endif
1509#if defined(__STDC__) || defined(__cplusplus)
1510 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1511#else
1512 size_t iconv();
1513#endif
1514 ]])],
19619a35
AK
1515 [ac_cv_iconv_const=],
1516 [ac_cv_iconv_const=const])])
1517 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
1518 [Define as const if the declaration of iconv() needs const.])
1519fi
1520
93571e7f 1521if test $ac_cv_sizeof_wchar_t -eq 2; then
8b86c5dc
VK
1522 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
1523fi
1524
1525if test $ac_cv_sizeof_wchar_t -eq 4; then
1526 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
1527fi
1528
c29360a9 1529
ef0c727b 1530#--------------------------------------------------------------------
ca0f4ea3
VK
1531# MySQL
1532#--------------------------------------------------------------------
1533
1534check_substr "$COMPONENTS" "mysql"
1535if test $? = 0; then
6fce76d8 1536 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
ca0f4ea3 1537 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
aa7794f0 1538
8d131dda
VK
1539 OLD_LIBS="$LIBS"
1540 LIBS="$LIBS $MYSQL_LIBS"
aa7794f0 1541
9c29f76e
VK
1542 AC_MSG_CHECKING(whether mysql clients can run)
1543 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1544#include <stdio.h>
1545#include <mysql.h>
1546int main(void)
1547{
1548 MYSQL *a = mysql_init(NULL);
1549 return 0;
1550}
1551 ]])],[],[
1552 AC_MSG_RESULT(no)
1553 AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)
1554 ],[])
ca0f4ea3 1555 AC_MSG_RESULT(yes)
6fce76d8 1556
ca0f4ea3 1557 AC_CHECK_FUNCS(mysql_real_escape_string)
8d131dda 1558 LIBS="$OLD_LIBS"
ca0f4ea3
VK
1559fi
1560
1561
1562#--------------------------------------------------------------------
58ed4897
VK
1563# PostgreSQL
1564#--------------------------------------------------------------------
1565
203458b7 1566check_substr "$COMPONENTS" "pgsql"
58ed4897
VK
1567if test $? = 0; then
1568 AC_CHECK_LIB(m, floor)
6fce76d8 1569 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"],
58ed4897 1570 [AC_MSG_ERROR(libpq is required for PostgreSQL support)])
6fce76d8
VK
1571
1572 AC_MSG_CHECKING(whether postgresql clients can run)
8d131dda
VK
1573 OLD_LIBS="$LIBS"
1574 LIBS="$LIBS $PGSQL_LIBS"
6fce76d8
VK
1575 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1576 #include <stdio.h>
1577 #include <libpq-fe.h>
1578 int main(void)
1579 {
1580 PGconn *a = PQconnectdb("");
1581 return 0;
1582 }
1583 ]])],[AC_MSG_RESULT(yes)],[
58ed4897
VK
1584 AC_MSG_RESULT(no)
1585 AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
1586 ],[])
8d131dda 1587 LIBS="$OLD_LIBS"
7070538d 1588 AC_CHECK_LIB(pq, PQfformat, [ AC_DEFINE(HAVE_PQFFORMAT, 1, PQfformat not exist in 7.3) ])
58ed4897
VK
1589fi
1590
1591
1592#--------------------------------------------------------------------
9c29f76e
VK
1593# ODBC
1594#--------------------------------------------------------------------
1595
1596check_substr "$COMPONENTS" "odbc"
1597if test $? = 0; then
6fce76d8 1598 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
9c29f76e
VK
1599 [AC_MSG_ERROR(libodbc is required for ODBC support)])
1600fi
1601
1602
1603#--------------------------------------------------------------------
41b4790d
VK
1604# Oracle
1605#--------------------------------------------------------------------
1606
1607check_substr "$COMPONENTS" "oracle"
1608if test $? = 0; then
1609 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
7d8c91ef
VK
1610 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
1611 [
1612 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
1613 ], [-lclntsh])
1614 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
1615 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
41b4790d
VK
1616fi
1617
84277a0f
AK
1618#--------------------------------------------------------------------
1619# DB2
1620#--------------------------------------------------------------------
1621
1622check_substr "$COMPONENTS" "db2"
1623if test $? = 0; then
1624 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
1625 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
1626 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
1627fi
41b4790d
VK
1628
1629#--------------------------------------------------------------------
c3cfc039
VK
1630# nxhttpd
1631#--------------------------------------------------------------------
1632
e02b69b9 1633check_substr "$COMPONENTS" "webui"
c3cfc039
VK
1634if test $? = 0; then
1635 AC_CHECK_HEADER(gd.h,,AC_MSG_ERROR([*** GD support not installed - please install first ***]))
1636 AC_CHECK_LIB(gd, gdImageCreate, [], [
1637 AC_MSG_ERROR(libgd is required for web interface)
1638 ])
1639
1640fi
1641
1642
1643#--------------------------------------------------------------------
ca0f4ea3
VK
1644# Other settings
1645#--------------------------------------------------------------------
1646
fecf6a2b 1647CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DPREFIXW=L\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\""
ca0f4ea3 1648
8b86c5dc 1649AM_CONDITIONAL([BUILD_UNICODE_LIBS], [test "x$BUILD_UNICODE" = "xyes"])
551ec9ca 1650AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
8b86c5dc 1651
ca0f4ea3
VK
1652
1653#--------------------------------------------------------------------
ef0c727b
VK
1654# Substitute variables
1655#--------------------------------------------------------------------
82fa7c5d 1656
ef0c727b
VK
1657AC_SUBST(DB_DRIVERS)
1658AC_SUBST(MODULES)
1659AC_SUBST(SUBAGENT_DIRS)
1660AC_SUBST(SERVER_TOOLS)
1661AC_SUBST(TOP_LEVEL_MODULES)
1662AC_SUBST(CONTRIB_MODULES)
c2612d83 1663AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
1664AC_SUBST(STATIC_SUBAGENT_LIST)
1665AC_SUBST(SUBAGENT_LIBS)
1666AC_SUBST(BUILD_SERVER)
1667AC_SUBST(UNSTABLE_SUBAGENT_DIRS)
db91456f 1668AC_SUBST(WXRC)
6fce76d8
VK
1669AC_SUBST(MYSQL_LIBS)
1670AC_SUBST(PGSQL_LIBS)
7d8c91ef 1671AC_SUBST(ORACLE_LIBS)
6fce76d8 1672AC_SUBST(ODBC_LIBS)
84277a0f 1673AC_SUBST(DB2_LIBS)
d16cf8a5 1674
ef0c727b
VK
1675#--------------------------------------------------------------------
1676# Shared libs versions
d16cf8a5
AK
1677#
1678# versioning scheme: current:revision:age
1679#
1680# current
1681# The number of the current interface exported by the library. A current
1682# value of `0', means that you are calling the interface exported by this
1683# library interface 0.
1684#
1685# revision
1686# The implementation number of the most recent interface exported by this
1687# library. In this case, a revision value of `0' means that this is the
1688# first implementation of the interface.
1689# If the next release of this library exports the same interface, but has a
1690# different implementation (perhaps some bugs have been fixed), the revision
1691# number will be higher, but current number will be the same. In that case,
1692# when given a choice, the library with the highest revision will always
1693# be used by the runtime loader.
1694#
1695# age
1696# The number of previous additional interfaces supported by this library.
1697# If age were `2', then this library can be linked into executables which
1698# were built with a release of this library that exported the current
1699# interface number, current, or any of the previous two interfaces.
1700# By definition age must be less than or equal to current. At the outset,
1701# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 1702#--------------------------------------------------------------------
d16cf8a5 1703
8c5adf3a 1704NETXMS_LIBRARY_VERSION=0:2:0
c7d14846 1705AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 1706
ef0c727b
VK
1707
1708#--------------------------------------------------------------------
1709# Generate output files
1710#--------------------------------------------------------------------
d16cf8a5
AK
1711
1712AC_CONFIG_FILES([
ef0c727b 1713 README
0c3c0c39
AK
1714 Makefile
1715 contrib/Makefile
0c3c0c39 1716 contrib/startup/Makefile
fa66d60c 1717 contrib/startup/debian/Makefile
daaefaaf 1718 contrib/startup/gentoo/Makefile
0c3c0c39 1719 contrib/startup/redhat/Makefile
5de3893d 1720 contrib/startup/suse/Makefile
9993edf4 1721 contrib/startup/ubuntu/Makefile
82fa7c5d 1722 contrib/mibs/Makefile
3f2f9f2b 1723 contrib/backgrounds/Makefile
0c3c0c39 1724 doc/Makefile
a48203d2
VK
1725 doc/internal/Makefile
1726 doc/manuals/Makefile
1727 doc/misc/Makefile
0c3c0c39
AK
1728 images/Makefile
1729 include/Makefile
1730 m4/Makefile
1731 netware/Makefile
1732 sql/Makefile
0c3c0c39 1733 src/Makefile
8817f620 1734 src/sqlite/Makefile
80ce37ac
VK
1735 src/libexpat/Makefile
1736 src/libexpat/libexpat/Makefile
0c3c0c39 1737 src/libnetxms/Makefile
0c3c0c39 1738 src/libnxcl/Makefile
aa8d6795 1739 src/libnxlp/Makefile
c002b04a 1740 src/libnxsl/Makefile
1d410d50 1741 src/libnxmap/Makefile
1b1edd49
VK
1742 src/install/Makefile
1743 src/install/windows/Makefile
c2612d83 1744 src/client/Makefile
551592f4 1745 src/client/install/Makefile
c94fa5c2 1746 src/client/nxalarm/Makefile
e84701c5
VK
1747 src/client/nxevent/Makefile
1748 src/client/nxpush/Makefile
59ffa5b7 1749 src/client/nxsms/Makefile
23c8c53e
AK
1750 src/client/windows/nxuilib/Makefile
1751 src/client/windows/nxuilib/res/Makefile
1752 src/client/windows/nxuilib/sounds/Makefile
d9db1c72 1753 src/client/nxlexer/Makefile
23c8c53e
AK
1754 src/client/windows/nxcon/Makefile
1755 src/client/windows/nxcon/icons/Makefile
1756 src/client/windows/nxcon/res/Makefile
23c8c53e
AK
1757 src/client/windows/nxav/Makefile
1758 src/client/windows/nxav/res/Makefile
1759 src/client/windows/nxnotify/Makefile
1760 src/client/windows/nxnotify/res/Makefile
f519aa3e 1761 src/nxscript/Makefile
d1834406
VK
1762 src/db/Makefile
1763 src/db/dbdrv/Makefile
1764 src/db/dbdrv/odbc/Makefile
1765 src/db/dbdrv/mssql/Makefile
1766 src/db/dbdrv/mysql/Makefile
1767 src/db/dbdrv/pgsql/Makefile
1768 src/db/dbdrv/sqlite/Makefile
1769 src/db/dbdrv/oracle/Makefile
84277a0f 1770 src/db/dbdrv/db2/Makefile
d1834406 1771 src/db/libnxdb/Makefile
0c3c0c39
AK
1772 src/server/Makefile
1773 src/server/core/Makefile
d770a97c
VK
1774 src/server/include/Makefile
1775 src/server/libnxsrv/Makefile
1776 src/server/netxmsd/Makefile
d8f2e39b
VK
1777 src/server/smsdrv/Makefile
1778 src/server/smsdrv/generic/Makefile
91369aca 1779 src/server/smsdrv/nxagent/Makefile
0c3c0c39
AK
1780 src/server/tools/Makefile
1781 src/server/tools/nxget/Makefile
1782 src/server/tools/nxaction/Makefile
1783 src/server/tools/nxadm/Makefile
5b0c7d0d
VK
1784 src/server/tools/nxconfig/Makefile
1785 src/server/tools/nxconfig/res/Makefile
f90d7fc5 1786 src/server/tools/nxdbmgr/Makefile
4e2debcc 1787 src/server/tools/nxencpasswd/Makefile
d24fdaf4 1788 src/server/tools/nxupload/Makefile
c5c0f362
VK
1789 src/snmp/Makefile
1790 src/snmp/libnxsnmp/Makefile
1791 src/snmp/nxmibc/Makefile
1792 src/snmp/nxsnmpget/Makefile
1793 src/snmp/nxsnmpset/Makefile
1794 src/snmp/nxsnmpwalk/Makefile
f65df2b1
VK
1795 src/tools/Makefile
1796 src/tools/nxcptest/Makefile
1797 src/tools/nxdevcfg/Makefile
0c3c0c39
AK
1798 src/agent/Makefile
1799 src/agent/core/Makefile
5795bf90 1800 src/agent/install/Makefile
0c3c0c39
AK
1801 src/agent/subagents/Makefile
1802 src/agent/subagents/linux/Makefile
1803 src/agent/subagents/sunos/Makefile
d0b5a098 1804 src/agent/subagents/aix/Makefile
9bdf494f 1805 src/agent/subagents/hpux/Makefile
0c3c0c39
AK
1806 src/agent/subagents/skeleton/Makefile
1807 src/agent/subagents/freebsd/Makefile
992ba479 1808 src/agent/subagents/openbsd/Makefile
ad0f1ada 1809 src/agent/subagents/netbsd/Makefile
2b23dc1e 1810 src/agent/subagents/ipso/Makefile
0c3c0c39 1811 src/agent/subagents/netware/Makefile
1bc607cc
VK
1812 src/agent/subagents/winnt/Makefile
1813 src/agent/subagents/win9x/Makefile
0c3c0c39 1814 src/agent/subagents/winperf/Makefile
3737b4b9 1815 src/agent/subagents/wmi/Makefile
93f15c2a 1816 src/agent/subagents/portCheck/Makefile
abc48356 1817 src/agent/subagents/ping/Makefile
dbca7ed1 1818 src/agent/subagents/sms/Makefile
2f06a66e 1819 src/agent/subagents/ups/Makefile
539ab0c3
AK
1820 src/agent/subagents/ecs/Makefile
1821 src/agent/subagents/odbcquery/Makefile
0d362f93 1822 src/agent/subagents/logwatch/Makefile
e02b69b9 1823 src/webui/Makefile
420d9ecf
AK
1824 src/webui/nxhttpd/Makefile
1825 src/webui/nxhttpd/static/Makefile
1826 src/webui/nxhttpd/static/images/Makefile
1827 src/webui/nxhttpd/static/images/buttons/Makefile
1828 src/webui/nxhttpd/static/images/buttons/normal/Makefile
1829 src/webui/nxhttpd/static/images/buttons/pressed/Makefile
1830 src/webui/nxhttpd/static/images/ctrlpanel/Makefile
1831 src/webui/nxhttpd/static/images/objects/Makefile
1832 src/webui/nxhttpd/static/images/status/Makefile
0c3c0c39 1833 tools/Makefile
d16cf8a5
AK
1834])
1835
12249937
VK
1836AC_OUTPUT
1837
ef0c727b 1838echo "Updating libtool"
5cecf50e
AK
1839sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
1840
779ce551
VK
1841# On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
1842if test "x$CC" = "xgcc" && test "x$PLATFORM" = "xHP-UX"; then
1843 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
1844fi
1845
ef0c727b
VK
1846#--------------------------------------------------------------------
1847# Print summary
1848#--------------------------------------------------------------------
a7442678 1849
a7442678
AK
1850echo
1851echo
1852echo
1853echo '---------------------------------------------------------------------'
1854echo ' Configure results'
1855echo '---------------------------------------------------------------------'
1856echo
8b86c5dc 1857 echo "Prefix : ${prefix}"
a7442678 1858if test "x${BUILD_SERVER}" = "xyes"; then
8b86c5dc 1859 echo "Build Server : YES"
a7442678 1860else
8b86c5dc 1861 echo "Build Server : NO"
a7442678
AK
1862fi
1863if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
8b86c5dc 1864 echo "Encryption enabled : YES"
a7442678 1865else
8b86c5dc 1866 echo "Encryption enabled : NO"
a7442678
AK
1867fi
1868if test "x${DB_DRIVERS}" != "x"; then
8b86c5dc 1869 echo "Build DB-Drivers :${DB_DRIVERS}"
a7442678 1870else
8b86c5dc 1871 echo "Build DB-Drivers : NO"
a7442678
AK
1872fi
1873if test "x${BUILD_CLIENT}" = "xyes"; then
8b86c5dc 1874 echo "Build Clients : YES"
a7442678 1875else
8b86c5dc 1876 echo "Build Clients : NO"
a7442678 1877fi
ef0c727b 1878if test "x${BUILD_NXHTTPD}" = "xyes"; then
8b86c5dc 1879 echo "Build Web Interface : YES"
2654e540 1880else
8b86c5dc 1881 echo "Build Web Interface : NO"
2654e540 1882fi
a7442678 1883if test "x${BUILD_AGENT}" = "xyes"; then
8b86c5dc
VK
1884 echo "Build Agent : YES"
1885 echo "Subagents list : ${SUBAGENT_DIRS}"
a7442678 1886else
8b86c5dc 1887 echo "Build Agent : NO"
a7442678 1888fi
e8636669 1889if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
8b86c5dc
VK
1890 echo "Build Static Agent : YES"
1891 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
e8636669 1892else
8b86c5dc 1893 echo "Build Static Agent : NO"
e8636669 1894fi
8b86c5dc
VK
1895if test "x${BUILD_UNICODE}" = "xyes"; then
1896 echo "Build UNICODE libraries : YES"
1897else
1898 echo "Build UNICODE libraries : NO"
1899fi
551ec9ca
VK
1900if test "x${HAVE_LIBEXPAT}" = "xno"; then
1901 echo "Use internal libexpat : YES"
1bb6b449 1902else
551ec9ca 1903 echo "Use internal libexpat : NO"
1bb6b449 1904fi
cc297a70
VK
1905if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
1906 echo "Force 32bit build : YES"
1907else
1908 echo "Force 32bit build : NO"
1909fi
7d8c91ef
VK
1910
1911echo "CPPFLAGS : ${CPPFLAGS}"
1912echo "CXXFLAGS : ${CXXFLAGS}"
1913echo "CFLAGS : ${CFLAGS}"
1914echo "LDFLAGS : ${LDFLAGS}"
8d131dda 1915echo "LIBS : ${LIBS}"
7d8c91ef 1916
6fce76d8
VK
1917if test "x${MYSQL_LIBS}" != "x"; then
1918 echo "MySQL libs : ${MYSQL_LIBS}"
1919fi
1920if test "x${PGSQL_LIBS}" != "x"; then
1921 echo "PostgreSQL libs : ${PGSQL_LIBS}"
1922fi
7d8c91ef
VK
1923if test "x${ORACLE_LIBS}" != "x"; then
1924 echo "Oracle libs : ${ORACLE_LIBS}"
1925fi
6fce76d8
VK
1926if test "x${ODBC_LIBS}" != "x"; then
1927 echo "ODBC libs : ${ODBC_LIBS}"
1928fi
84277a0f
AK
1929if test "x${DB2_LIBS}" != "x"; then
1930 echo "DB2 libs : ${DB2_LIBS}"
1931fi