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