sqlite: api definition changed
[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
e8e76b4f 7AC_INIT([NetXMS], [1.2.7], [bugs@netxms.org])
ba1d810c 8AC_CONFIG_AUX_DIR(config)
8e7f84bf 9AC_CONFIG_HEADERS(config.h)
d16cf8a5 10AM_INIT_AUTOMAKE
09867021 11m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
d16cf8a5 12
aa24418a 13AC_CONFIG_MACRO_DIR([m4])
5387ff75 14
ef0c727b
VK
15#--------------------------------------------------------------------
16# Functions
17#--------------------------------------------------------------------
5387ff75 18
ef0c727b
VK
19check_substr()
20{
1010cff7 21 for w in $1; do
ef0c727b
VK
22 if test "x$w" = "x$2"; then
23 return 0;
24 fi
25 done
26 return 1
27}
16dff090 28
d3c8926d 29
ef0c727b
VK
30#--------------------------------------------------------------------
31# Initialize variables
32#--------------------------------------------------------------------
d3c8926d 33
ef0c727b
VK
34PLATFORM=`uname -s`
35COMPONENTS=""
36DISABLE_ICONV="no"
37DISABLE_ENCRYPTION="no"
4050bafb 38DISABLE_LMSENSORS="no"
f974a50a 39ENABLE_DEBUG="no"
25ae8377 40ENABLE_WERROR="no"
ef0c727b 41STATIC_BUILD="no"
c1165d33 42ALL_STATIC="no"
ef0c727b
VK
43DBDRIVER_SELECTED="no"
44USE_PTH="no"
45BUILD_SERVER="no"
46BUILD_AGENT="no"
47BUILD_CLIENT="no"
ef0c727b 48BUILD_STATIC_AGENT="no"
447350a9 49BUILD_SDK="no"
ef0c727b 50NEED_ZLIB="no"
f65df2b1 51MODULES="libnetxms tools install"
ef0c727b 52STATIC_SUBAGENT_LIST=""
c1165d33 53PROPOSED_STATIC_SUBAGENTS="default"
ef0c727b
VK
54SUBAGENT_DIRS=""
55SUBAGENT_LIBS=""
7c48e2aa 56SERVER_LIBS=""
ef0c727b 57SERVER_TOOLS=""
7dda4453 58SERVER_INCLUDE=""
ef0c727b
VK
59TOP_LEVEL_MODULES=""
60CONTRIB_MODULES=""
c2612d83 61CLIENT_COMPONENTS=""
8b86c5dc 62BUILD_UNICODE="no"
7d8c91ef 63ORACLE_LIBS=""
6fce76d8
VK
64PGSQL_LIBS=""
65MYSQL_LIBS=""
66ODBC_LIBS=""
467c489f 67FORCE_INTERNAL_EXPAT="no"
17b35ccc
VK
68USE_INTERNAL_LIBTRE="no"
69FORCE_INTERNAL_LIBTRE="no"
1fd41bcd
VK
70USE_INTERNAL_ZLIB="no"
71FORCE_INTERNAL_ZLIB="no"
cc297a70 72FORCE_32BIT_BUILD="no"
df9812a9 73FORCE_INTERNAL_GETOPT="no"
545bda2d
VK
74LDFLAGS_PREFIX=""
75LDFLAGS_SUFFIX=""
1ef5e57a
VK
76LTINIT_CC=""
77LTINIT_CXX=""
d3c8926d 78
16dff090 79
ef0c727b 80#--------------------------------------------------------------------
fecf6a2b
VK
81# Common compilation flags
82#--------------------------------------------------------------------
83
842c22f4 84CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DTRE_WCHAR=1"
fecf6a2b
VK
85
86
87#--------------------------------------------------------------------
ef0c727b
VK
88# Parse command line parameters
89#--------------------------------------------------------------------
7c9c94a7 90
ef0c727b
VK
91AC_ARG_WITH(server,
92[AS_HELP_STRING(--with-server,build server)],
93[
8817f620 94 COMPONENTS="$COMPONENTS sqlite snmp server agent"
c5c0f362
VK
95])
96
97AC_ARG_WITH(snmp,
98[AS_HELP_STRING(--with-snmp,build SNMP library and tools)],
99[
100 COMPONENTS="$COMPONENTS snmp"
ef0c727b 101])
7c9c94a7 102
ef0c727b
VK
103AC_ARG_WITH(client,
104[AS_HELP_STRING(--with-client,build client library and tools)],
105[
106 COMPONENTS="$COMPONENTS client"
107])
d16cf8a5 108
c2612d83 109AC_ARG_WITH(agent,
ef0c727b
VK
110[AS_HELP_STRING(--with-agent,build agent)],
111[
8817f620 112 COMPONENTS="$COMPONENTS sqlite agent"
ef0c727b 113])
d16cf8a5 114
ef0c727b
VK
115AC_ARG_WITH(static-agent,
116[AS_HELP_STRING(--with-static-agent,build statically linked agent)],
117[
8817f620 118 COMPONENTS="$COMPONENTS sqlite static-agent"
ef0c727b 119])
d16cf8a5 120
ef0c727b
VK
121AC_ARG_WITH(ipso-agent,
122[AS_HELP_STRING(--with-ipso-agent,build statically linked IPSO agent)],
123[
971abf4f 124 COMPONENTS="$COMPONENTS ipso-agent"
ef0c727b 125])
521d90e7 126
7dda4453
VK
127AC_ARG_WITH(sdk,
128[AS_HELP_STRING(--with-sdk,build and install files necessary for extension development)],
129[
130 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES include"
131 SERVER_INCLUDE="include"
447350a9 132 BUILD_SDK="yes"
7dda4453
VK
133])
134
ef0c727b
VK
135AC_ARG_WITH(mdebug,
136[AS_HELP_STRING(--with-mdebug,use debug version of memory allocation functions)],
137[
138 CPPFLAGS="$CPPFLAGS -DNETXMS_MEMORY_DEBUG"
139])
d16cf8a5 140
467c489f
VK
141AC_ARG_WITH(internal-libexpat,
142[AS_HELP_STRING(--with-internal-libexpat,force use of bundled libexpat)],
143[
144 FORCE_INTERNAL_EXPAT="yes"
145])
146
17b35ccc
VK
147AC_ARG_WITH(internal-libtre,
148[AS_HELP_STRING(--with-internal-libtre,force use of bundled libtre)],
149[
150 FORCE_INTERNAL_LIBTRE="yes"
151])
152
1fd41bcd
VK
153AC_ARG_WITH(internal-zlib,
154[AS_HELP_STRING(--with-internal-zlib,force use of bundled zlib)],
155[
156 FORCE_INTERNAL_ZLIB="yes"
157])
158
df9812a9
VK
159AC_ARG_WITH(internal-getopt,
160[AS_HELP_STRING(--with-internal-getopt,force use of bundled getopt)],
161[
162 FORCE_INTERNAL_GETOPT="yes"
163])
164
c1165d33
VK
165AC_ARG_WITH(all-static,
166[AS_HELP_STRING(--with-all-static,use -all-static flag for linking executables)],
167[
168 ALL_STATIC="yes"
169])
170
171AC_ARG_WITH(static-subagents,
172[AS_HELP_STRING(--with-static-subagents=list,define list of static subagents (separated by spaces))],
173[
174 PROPOSED_STATIC_SUBAGENTS="$withval"
175])
176
9486b324
VK
177AC_ARG_WITH(sqlite,
178[AS_HELP_STRING(--with-sqlite,build SQLite database driver)],
179[ if test "x$withval" != "xno" ; then
8817f620 180 COMPONENTS="$COMPONENTS sqlite_drv"
ef0c727b 181 DBDRIVER_SELECTED="yes"
9486b324
VK
182fi ])
183
c4b88c3d
VK
184AC_ARG_WITH(odbc,
185[AS_HELP_STRING(--with-odbc,build ODBC database driver)],
186[ if test "x$withval" != "xno" ; then
187 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
188 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
189 LDFLAGS="$LDFLAGS -L${withval}/lib"
190 CPPFLAGS="$CPPFLAGS -I${withval}/include"
ef0c727b
VK
191 fi
192 COMPONENTS="$COMPONENTS odbc"
193 DBDRIVER_SELECTED="yes"
c4b88c3d
VK
194fi ])
195
41b4790d
VK
196AC_ARG_WITH(oracle,
197[AS_HELP_STRING(--with-oracle,build Oracle database driver)],
198[ if test "x$withval" != "xno" ; then
199 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
7d8c91ef
VK
200 if test -x "$withval/lib" ; then
201 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
202 LDFLAGS="$LDFLAGS -L${withval}/lib"
203 else
204 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
205 LDFLAGS="$LDFLAGS -L${withval}"
206 fi
207 if test -x "$withval/include" ; then
208 CPPFLAGS="$CPPFLAGS -I${withval}/include"
209 fi
210 if test -x "$withval/sdk/include" ; then
211 CPPFLAGS="$CPPFLAGS -I${withval}/sdk/include"
212 fi
41b4790d
VK
213 fi
214 COMPONENTS="$COMPONENTS oracle"
215 DBDRIVER_SELECTED="yes"
216fi ])
217
d16cf8a5 218AC_ARG_WITH(mysql,
c4b88c3d 219[AS_HELP_STRING(--with-mysql,build MySQL database driver)],
d16cf8a5
AK
220[ if test "x$withval" != "xno" ; then
221 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
222 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
223 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/mysql -L${withval}/mysql/lib"
6693a1d0 224 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/mysql -I${withval}/mysql/include"
d16cf8a5 225 else
007ae516
VK
226 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}"
227 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 228 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 229 fi
ef0c727b
VK
230 COMPONENTS="$COMPONENTS mysql"
231 DBDRIVER_SELECTED="yes"
6693a1d0 232fi ])
d16cf8a5
AK
233
234AC_ARG_WITH(pgsql,
c4b88c3d 235[AS_HELP_STRING(--with-pgsql,build PostgreSQL database driver)],
d16cf8a5 236[ if test "x$withval" != "xno" ; then
6693a1d0
AK
237 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
238 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
239 LDFLAGS="$LDFLAGS -L${withval}/lib -L${withval}/lib/pgsql -L${withval}/lib/postgresql -L${withval}/pgsql/lib -L${withval}/postgresql/lib"
240 CPPFLAGS="$CPPFLAGS -I${withval}/include -I${withval}/include/pgsql -I${withval}/include/postgresql -I${withval}/pgsql/include -I${withval}/postgresql/include"
241 else
007ae516
VK
242 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}"
243 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
244 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"
245 fi
ef0c727b
VK
246 COMPONENTS="$COMPONENTS pgsql"
247 DBDRIVER_SELECTED="yes"
6693a1d0 248fi ])
d16cf8a5 249
84277a0f
AK
250AC_ARG_WITH(db2,
251[AS_HELP_STRING(--with-db2,build DB2 database driver)],
252[ if test "x$withval" != "xno" ; then
253 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
254 if test `uname -m` = 'i386' || test `uname -m` = 'i686'; then
255 DB2_LIB_DIR=lib32
256 else
257 DB2_LIB_DIR=lib64
258 fi
259 if test -x "$withval/${DB2_LIB_DIR}" ; then
260 LD_RUN_PATH="${withval}/${DB2_LIB_DIR}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
261 LDFLAGS="$LDFLAGS -L${withval}/${DB2_LIB_DIR}"
262 else
263 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
264 LDFLAGS="$LDFLAGS -L${withval}"
265 fi
266 if test -x "$withval/include" ; then
267 CPPFLAGS="$CPPFLAGS -I${withval}/include"
268 fi
269
270 unset DB2_LIB_DIR
271 fi
272 COMPONENTS="$COMPONENTS db2"
273 DBDRIVER_SELECTED="yes"
274fi ])
275
37861c72
VK
276AC_ARG_WITH(informix,
277[AS_HELP_STRING(--with-informix,build Informix database driver)],
278[ if test "x$withval" != "xno" ; then
279 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
280 if test -x "$withval/lib/cli" ; then
281 LD_RUN_PATH="${withval}/lib/cli${LD_RUN_PATH:+:}${LD_RUN_PATH}"
282 LDFLAGS="$LDFLAGS -L${withval}/lib/cli"
283 if test -x "$withval/lib/esql" ; then
284 LD_RUN_PATH="${withval}/lib/esql${LD_RUN_PATH:+:}${LD_RUN_PATH}"
285 LDFLAGS="$LDFLAGS -L${withval}/lib/esql"
286 fi
287 else
288 LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"
289 LDFLAGS="$LDFLAGS -L${withval}"
290 fi
291 if test -x "$withval/incl/cli" ; then
292 CPPFLAGS="$CPPFLAGS -I${withval}/incl/cli"
293 fi
294 fi
295 COMPONENTS="$COMPONENTS informix"
296 DBDRIVER_SELECTED="yes"
297fi ])
298
ef0c727b 299AC_ARG_WITH(openssl,
1010cff7
VK
300[AS_HELP_STRING(--with-openssl,specify OpenSSL location)],
301[
302 if test "x$withval" != "xno" ; then
303 if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
304 LD_RUN_PATH="${withval}/lib${LD_RUN_PATH:+:}${LD_RUN_PATH}"
305 LDFLAGS="$LDFLAGS -L${withval}/lib"
306 CPPFLAGS="$CPPFLAGS -I${withval}/include"
307 else
308 LD_RUN_PATH="/usr/local/lib:/opt/openssl/lib:/usr/local/ssl/lib:${LD_RUN_PATH:+:}${LD_RUN_PATH}"
309 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/opt/openssl/lib"
4d37b0c5 310 CPPFLAGS="$CPPFLAGS -I/opt/openssl/include"
ef0c727b 311 fi
1010cff7
VK
312 fi
313 REQUIRE_ENCRYPTION="yes"
314])
ef0c727b
VK
315
316AC_ARG_ENABLE(iconv,
317[AS_HELP_STRING(--disable-iconv,do not use iconv() for text conversions)],
3a7ce527 318[
ef0c727b 319 DISABLE_ICONV="yes"
3a7ce527 320])
3a7ce527 321
ef0c727b
VK
322AC_ARG_ENABLE(encryption,
323[AS_HELP_STRING(--disable-encryption,disable encryption support)],
e0760102 324[
ef0c727b 325 DISABLE_ENCRYPTION="yes"
e0760102
VK
326])
327
4050bafb
VK
328AC_ARG_ENABLE(lmsensors,
329[AS_HELP_STRING(--disable-lmsensors,disable lmsensors support)],
330[
331 DISABLE_LMSENSORS="yes"
332])
333
a67fa146
VK
334AC_ARG_ENABLE(unicode,
335[AS_HELP_STRING(--enable-unicode,enable UNICODE build)],
336[
337 BUILD_UNICODE="yes"
842c22f4 338 CPPFLAGS="$CPPFLAGS -DUNICODE"
76b1d3d8 339 FORCE_INTERNAL_LIBTRE="yes"
a67fa146
VK
340])
341
f974a50a
VK
342AC_ARG_ENABLE(debug,
343[AS_HELP_STRING(--enable-debug,enable additional debugging functionality)],
344[
345 ENABLE_DEBUG="yes"
346])
347
25ae8377
VK
348AC_ARG_ENABLE(werror,
349[AS_HELP_STRING(--enable-werror,threat all warnings as errors)],
350[
351 ENABLE_WERROR="yes"
352])
353
cc297a70 354AC_ARG_ENABLE(64bit,
e5be5b83 355[AS_HELP_STRING(--disable-64bit,disable 64bit build (force 32bit build on 64bit machine))],
cc297a70
VK
356[
357 FORCE_32BIT_BUILD="yes"
358])
359
ef0c727b
VK
360AC_ARG_WITH(dist,
361[AS_HELP_STRING(--with-dist,for maintainers only)],
87f1fff0 362 DB_DRIVERS=" mysql pgsql odbc mssql sqlite oracle db2 informix"
147cb615 363 MODULES="libexpat libtre zlib libnetxms install sqlite snmp libnxsl libnxlp db server agent libnxmap libnxcl client nxscript tools"
cf52e714 364 SUBAGENT_DIRS="linux freebsd openbsd netbsd sunos aix ipso hpux odbcquery informix oracle lmsensors darwin"
ef0c727b 365 NXCONFIG="nxconfig"
7dda4453
VK
366 TOP_LEVEL_MODULES="include sql images"
367 SERVER_INCLUDE="include"
ef0c727b 368 CONTRIB_MODULES="mibs backgrounds"
9cb6c12f 369 CLIENT_COMPONENTS="nxalarm nxevent nxlexer nxpush nxsms scilexer windows"
ef0c727b
VK
370 SERVER_TOOLS="nxconfig"
371)
372
d8ca9c03 373
ef0c727b
VK
374#--------------------------------------------------------------------
375# Validate command line parameters and set various checking options
376#--------------------------------------------------------------------
377
8817f620
VK
378check_substr "$COMPONENTS" "sqlite"
379if test $? = 0; then
380 MODULES="$MODULES sqlite"
381fi
382
ef0c727b 383check_substr "$COMPONENTS" "static-agent"
1010cff7 384if test $? = 0; then
971abf4f
VK
385 if test "x$COMPONENTS" != "x sqlite static-agent"; then
386 AC_MSG_ERROR(Static agent and other components are mutually exclusive.)
ef0c727b
VK
387 fi
388 STATIC_BUILD="yes"
389 BUILD_STATIC_AGENT="yes"
60a1159a 390 MODULES="$MODULES libnxlp db agent"
3a6979cf 391 DISABLE_ICONV="yes"
ef0c727b 392 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT"
c1165d33
VK
393 if test "x$PROPOSED_STATIC_SUBAGENTS" = "xdefault"; then
394 STATIC_SUBAGENT_LIST="ecs logwatch ping portcheck ups"
395 else
396 STATIC_SUBAGENT_LIST="$PROPOSED_STATIC_SUBAGENTS"
397 fi
60a1159a 398
c1165d33 399 SUBAGENT_LIBS="../subagents/ecs/ecs.la ../subagents/logwatch/logwatch.la ../subagents/ping/ping.la ../subagents/portCheck/portcheck.la ../subagents/ups/ups.la"
e8636669 400
60a1159a
VK
401 check_substr "$STATIC_SUBAGENT_LIST" "odbcquery"
402 if test $? = 0; then
403 COMPONENTS="$COMPONENTS odbc"
404 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/odbcquery/odbcquery.la"
405 fi
406
407 check_substr "$STATIC_SUBAGENT_LIST" "oracle"
408 if test $? = 0; then
409 COMPONENTS="$COMPONENTS oracle"
410 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/oracle/oracle.la"
411 fi
412
413 check_substr "$STATIC_SUBAGENT_LIST" "informix"
414 if test $? = 0; then
415 COMPONENTS="$COMPONENTS informix"
416 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/informix/informix.la"
417 fi
418
ef0c727b 419 case "$PLATFORM" in
e8636669
VK
420 Linux)
421 SUBAGENT_DIRS="linux"
c1165d33 422 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/linux/linux.la"
d0b5a098 423 STATIC_SUBAGENT_LIST="linux $STATIC_SUBAGENT_LIST"
e8636669
VK
424 ;;
425 FreeBSD)
426 SUBAGENT_DIRS="freebsd"
c1165d33 427 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/freebsd/freebsd.la"
d0b5a098 428 STATIC_SUBAGENT_LIST="freebsd $STATIC_SUBAGENT_LIST"
e8636669 429 ;;
992ba479
AK
430 OpenBSD)
431 SUBAGENT_DIRS="openbsd"
c1165d33 432 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/openbsd/openbsd.la"
992ba479
AK
433 STATIC_SUBAGENT_LIST="openbsd $STATIC_SUBAGENT_LIST"
434 ;;
ad0f1ada
VK
435 NetBSD)
436 SUBAGENT_DIRS="netbsd"
c1165d33 437 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/netbsd/netbsd.la"
ad0f1ada
VK
438 STATIC_SUBAGENT_LIST="netbsd $STATIC_SUBAGENT_LIST"
439 ;;
e8636669
VK
440 SunOS)
441 SUBAGENT_DIRS="sunos"
c1165d33 442 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/sunos/sunos.la"
d0b5a098
VK
443 STATIC_SUBAGENT_LIST="sunos $STATIC_SUBAGENT_LIST"
444 ;;
445 AIX)
446 SUBAGENT_DIRS="aix"
c1165d33 447 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/aix/aix.la"
d0b5a098 448 STATIC_SUBAGENT_LIST="aix $STATIC_SUBAGENT_LIST"
e8636669 449 ;;
c29360a9
VK
450 HP-UX)
451 SUBAGENT_DIRS="hpux"
c1165d33 452 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/hpux/hpux.la"
c29360a9
VK
453 STATIC_SUBAGENT_LIST="hpux $STATIC_SUBAGENT_LIST"
454 ;;
cf52e714
AK
455 Darwin)
456 SUBAGENT_DIRS="darwin"
457 SUBAGENT_LIBS="$SUBAGENT_LIBS ../subagents/darwin/darwin.la"
458 STATIC_SUBAGENT_LIST="darwin $STATIC_SUBAGENT_LIST"
459 ;;
e8636669
VK
460 *)
461 # unknown
462 ;;
463 esac
ef0c727b 464fi
2b23dc1e 465
ef0c727b 466check_substr "$COMPONENTS" "ipso-agent"
1010cff7 467if test $? = 0; then
fd5a401b 468 if test "x$COMPONENTS" != "x ipso-agent"; then
971abf4f 469 AC_MSG_ERROR(IPSO agent and other components are mutually exclusive.)
ef0c727b
VK
470 fi
471 STATIC_BUILD="yes"
472 BUILD_STATIC_AGENT="yes"
3a6979cf 473 DISABLE_ICONV="yes"
ef0c727b 474 USE_PTH="yes"
60a1159a 475 MODULES="$MODULES libnxlp db agent"
aa24418a 476 CPPFLAGS="$CPPFLAGS -D_STATIC_AGENT -D_IPSO -D_USE_GNU_PTH -DSQLITE_THREADSAFE=0 -I/usr/local/include"
ef0c727b 477 LDFLAGS="$LDFLAGS -all-static"
971abf4f 478 STATIC_SUBAGENT_LIST="ecs ipso logwatch ping portcheck ups"
ef0c727b 479 SUBAGENT_DIRS="ipso"
c1165d33 480 SUBAGENT_LIBS="../subagents/ecs/ecs.la ../subagents/ipso/ipso.la ../subagents/logwatch/logwatch.la ../subagents/ping/ping.la ../subagents/portCheck/portcheck.la ../subagents/ups/ups.la"
ef0c727b 481fi
c688d2a7 482
c5c0f362
VK
483check_substr "$COMPONENTS" "snmp"
484if test $? = 0; then
485 NEED_ZLIB="yes"
486 MODULES="$MODULES snmp"
487fi
488
ef0c727b 489check_substr "$COMPONENTS" "server"
1010cff7 490if test $? = 0; then
ef0c727b
VK
491 if test "x$DBDRIVER_SELECTED" != "xyes"; then
492 AC_MSG_ERROR(You must select at least one database driver when building server.)
493 fi
494 BUILD_SERVER="yes"
d1834406 495 MODULES="$MODULES libnxmap libnxsl libnxlp db server nxscript"
ef0c727b
VK
496 TOP_LEVEL_MODULES="$TOP_LEVEL_MODULES sql images"
497 CONTRIB_MODULES="$CONTRIB_MODULES mibs backgrounds"
498fi
dff54fed 499
e44986e5
VK
500check_substr "$COMPONENTS" "client"
501if test $? = 0; then
502 BUILD_CLIENT="yes"
503 NEED_ZLIB="yes"
aa24418a 504 MODULES="$MODULES libnxmap libnxcl client"
36ad9f45 505 CLIENT_COMPONENTS="$CLIENT_COMPONENTS nxalarm nxevent nxpush nxsms"
e44986e5
VK
506fi
507
ef0c727b 508check_substr "$COMPONENTS" "agent"
1010cff7 509if test $? = 0; then
ef0c727b 510 BUILD_AGENT="yes"
28ba6824 511 MODULES="$MODULES libnxlp db agent"
1010cff7
VK
512
513 case "$PLATFORM" in
514 Linux)
515 SUBAGENT_DIRS="linux"
516 ;;
517 FreeBSD)
518 SUBAGENT_DIRS="freebsd"
519 ;;
520 OpenBSD)
521 SUBAGENT_DIRS="openbsd"
522 ;;
ad0f1ada
VK
523 NetBSD)
524 SUBAGENT_DIRS="netbsd"
525 ;;
1010cff7
VK
526 SunOS)
527 SUBAGENT_DIRS="sunos"
528 ;;
529 AIX)
530 SUBAGENT_DIRS="aix"
531 ;;
532 HP-UX)
533 SUBAGENT_DIRS="hpux"
cf52e714
AK
534 ;;
535 Darwin)
536 SUBAGENT_DIRS="darwin"
1010cff7
VK
537 ;;
538 *)
539 # unknown
540 ;;
541 esac
ef0c727b 542fi
b97191d2 543
ef0c727b 544check_substr "$COMPONENTS" "mysql"
1010cff7 545if test $? = 0; then
ef0c727b 546 DB_DRIVERS="$DB_DRIVERS mysql"
b67a9e12 547fi
6619a6b0 548
ef0c727b 549check_substr "$COMPONENTS" "pgsql"
1010cff7 550if test $? = 0; then
ef0c727b
VK
551 DB_DRIVERS="$DB_DRIVERS pgsql"
552fi
e8636669 553
8817f620 554check_substr "$COMPONENTS" "sqlite_drv"
1010cff7 555if test $? = 0; then
ef0c727b 556 DB_DRIVERS="$DB_DRIVERS sqlite"
e8636669
VK
557fi
558
ef0c727b 559check_substr "$COMPONENTS" "odbc"
1010cff7 560if test $? = 0; then
ef0c727b 561 DB_DRIVERS="$DB_DRIVERS odbc"
80e96a82 562 SUBAGENT_DIRS="$SUBAGENT_DIRS odbcquery"
ef0c727b
VK
563fi
564
41b4790d
VK
565check_substr "$COMPONENTS" "oracle"
566if test $? = 0; then
567 DB_DRIVERS="$DB_DRIVERS oracle"
4d1753cd 568 SUBAGENT_DIRS="$SUBAGENT_DIRS oracle"
41b4790d
VK
569fi
570
84277a0f
AK
571check_substr "$COMPONENTS" "db2"
572if test $? = 0; then
573 DB_DRIVERS="$DB_DRIVERS db2"
574fi
575
87f1fff0
VK
576check_substr "$COMPONENTS" "informix"
577if test $? = 0; then
578 DB_DRIVERS="$DB_DRIVERS informix"
80e96a82 579 SUBAGENT_DIRS="$SUBAGENT_DIRS informix"
87f1fff0
VK
580fi
581
ef0c727b
VK
582
583#--------------------------------------------------------------------
584# Check for programs
585#--------------------------------------------------------------------
586
587if test "x$PLATFORM" = "xHP-UX"; then
e7d9c4ae 588 AC_CHECK_PROG([CCC], [aCC], [aCC])
ef0c727b 589fi
df9812a9
VK
590if test "x$PLATFORM" = "xAIX"; then
591 AC_CHECK_PROG([CCC], [xlC_r], [xlC_r])
592fi
593AC_PROG_CC(aCC xlC_r gcc cc cl)
ef0c727b
VK
594AC_PROG_CPP
595AC_PROG_CXX
c3cfc039 596if test "x$CXX" = "xg++"; then
753206b5
AK
597 AC_CHECK_PROG([GPLUSPLUS], [g++], [yes], [no])
598 if test "x$GPLUSPLUS" = "xno"; then
c3cfc039
VK
599 AC_MSG_ERROR([*** FATAL: Cannot find any usable C++ compiler])
600 fi
601fi
ef0c727b
VK
602AC_PROG_INSTALL
603AC_PROG_LEX
76154a95 604AC_CHECK_PROGS(YACC,bison byacc,yacc)
ef0c727b
VK
605AC_PROG_LN_S
606
607AC_ARG_VAR(PERL,local path to the perl interpreter)
608perl_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/perl/bin:/opt/perl/usr/bin:/opt/perl/usr/local/bin"
609AC_PATH_PROG(PERL,perl,/usr/bin/env perl,$perl_possible_path)
610
611
612#--------------------------------------------------------------------
ef0c727b
VK
613# C/C++ capabilities
614#--------------------------------------------------------------------
615
616AC_C_CONST
617AC_PROG_GCC_TRADITIONAL
1d9cc60e 618AC_C_BIGENDIAN
ef0c727b
VK
619
620
621#--------------------------------------------------------------------
622# Platform-dependent settings
623#--------------------------------------------------------------------
624
625case "$PLATFORM" in
626 AIX)
545bda2d 627 LDFLAGS_PREFIX="-no-undefined -Wl,-brtl $LDFLAGS"
ef0c727b
VK
628 ;;
629 HP-UX)
53c96e2d 630 CPPFLAGS="$CPPFLAGS -D_HPUX -D_HPUX_SOURCE -D_POSIX_PTHREAD_SEMANTICS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 -D_REENTRANT -D_INCLUDE_LONGLONG"
ef0c727b 631 if test "x$CXX" = "xaCC"; then
53c96e2d 632 CFLAGS="$CFLAGS -AC99"
cfd95c74 633 CXXFLAGS="-mt $CXXFLAGS +W749 +W829"
ef0c727b
VK
634 LDFLAGS="$LDFLAGS -mt"
635 fi
636 ;;
75c30ed4 637 SunOS)
27ed5b1d 638 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
75c30ed4
VK
639 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
640 export LD_LIBRARY_PATH
641 ;;
56b2f755
VK
642 Linux)
643 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
644 ;;
ef0c727b
VK
645 *)
646 ;;
647esac
648
649
650#--------------------------------------------------------------------
c90d3610 651# C++ compiler tuning:
cc297a70 652# * Disable C++ exceptions and RTTI
779ce551 653# * Turn on 64bit mode on HP-UX/Itanium
cc297a70 654# * Turn on 64bit mode on AIX
d358c73f 655# * Turn on 64bit mode on Solaris
ef0c727b
VK
656#--------------------------------------------------------------------
657
658if test "x$CC" = "xgcc" ; then
659
660 AC_LANG_PUSH([C++])
661
662 AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti)
e6b112bc 663 OLD_CXXFLAGS="$CXXFLAGS"
ef0c727b
VK
664 CXXFLAGS="$CXXFLAGS -fno-rtti"
665 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
666 [ AC_MSG_RESULT(yes) ],
667 [
668 CXXFLAGS="$OLD_CXXFLAGS"
669 AC_MSG_RESULT(no)
670 ])
671
672 AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions)
e6b112bc 673 OLD_CXXFLAGS="$CXXFLAGS"
ef0c727b
VK
674 CXXFLAGS="$CXXFLAGS -fno-exceptions"
675 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
676 [ AC_MSG_RESULT(yes) ],
677 [
678 CXXFLAGS="$OLD_CXXFLAGS"
679 AC_MSG_RESULT(no)
680 ])
681
682 AC_LANG_POP([C++])
683
779ce551 684 if test "x$PLATFORM" = "xHP-UX"; then
cc297a70
VK
685 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
686 AC_MSG_CHECKING(whether C compiler accepts -milp32)
687 OLD_CPPFLAGS="$CPPFLAGS"
688 CPPFLAGS="$CPPFLAGS -milp32"
689 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
690 [
691 LDFLAGS="-milp32 $LDFLAGS"
692 AC_MSG_RESULT(yes)
693 ],
694 [
695 CPPFLAGS="$OLD_CPPFLAGS"
696 AC_MSG_RESULT(no)
697 ])
698 else
699 AC_MSG_CHECKING(whether C compiler accepts -mlp64)
700 OLD_CPPFLAGS="$CPPFLAGS"
701 CPPFLAGS="$CPPFLAGS -mlp64"
702 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
703 [
704 LDFLAGS="-mlp64 -L/usr/lib/hpux64 -L/usr/local/lib/hpux64 $LDFLAGS"
705 AC_MSG_RESULT(yes)
706 ],
707 [
708 CPPFLAGS="$OLD_CPPFLAGS"
709 AC_MSG_RESULT(no)
710 ])
711 fi
712 fi
713
714 if test "x$PLATFORM" = "xAIX"; then
715 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
716 AC_MSG_CHECKING(whether C compiler accepts -maix32)
717 OLD_CPPFLAGS="$CPPFLAGS"
718 CPPFLAGS="$CPPFLAGS -maix32"
fecf6a2b 719 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
720 [
721 LDFLAGS="-maix32 $LDFLAGS"
1ef5e57a
VK
722 LTINIT_CC="gcc -maix32"
723 LTINIT_CXX="g++ -maix32"
1c45282c 724 OBJECT_MODE=32
cc297a70
VK
725 AC_MSG_RESULT(yes)
726 ],
727 [
728 CPPFLAGS="$OLD_CPPFLAGS"
729 AC_MSG_RESULT(no)
730 ])
731 else
732 AC_MSG_CHECKING(whether C compiler accepts -maix64)
733 OLD_CPPFLAGS="$CPPFLAGS"
734 CPPFLAGS="$CPPFLAGS -maix64"
fecf6a2b 735 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
736 [
737 LDFLAGS="-maix64 $LDFLAGS"
1ef5e57a
VK
738 LTINIT_CC="gcc -maix64"
739 LTINIT_CXX="g++ -maix64"
1c45282c 740 OBJECT_MODE=64
cc297a70
VK
741 AC_MSG_RESULT(yes)
742 ],
743 [
744 CPPFLAGS="$OLD_CPPFLAGS"
745 AC_MSG_RESULT(no)
746 ])
747 fi
779ce551 748 fi
d358c73f
VK
749
750 if test "x$PLATFORM" = "xSunOS"; then
751 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
752 AC_MSG_CHECKING(whether C compiler accepts -m32)
753 OLD_CPPFLAGS="$CPPFLAGS"
754 CPPFLAGS="$CPPFLAGS -m32"
755 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
756 [
757 LDFLAGS="-m32 $LDFLAGS"
758 AC_MSG_RESULT(yes)
759 ],
760 [
761 CPPFLAGS="$OLD_CPPFLAGS"
762 AC_MSG_RESULT(no)
763 ])
764 else
765 AC_MSG_CHECKING(whether C compiler accepts -m64)
766 OLD_CPPFLAGS="$CPPFLAGS"
767 CPPFLAGS="$CPPFLAGS -m64"
768 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
769 [
770 LDFLAGS="-m64 $LDFLAGS"
771 AC_MSG_RESULT(yes)
772 ],
773 [
774 CPPFLAGS="$OLD_CPPFLAGS"
775 AC_MSG_RESULT(no)
776 ])
777 fi
778 fi
779ce551 779
ce5592b2
VK
780 if test "x$ENABLE_DEBUG" = "xyes"; then
781 CPPFLAGS="$CPPFLAGS -ggdb3"
782 fi
ef0c727b
VK
783fi
784
cfd95c74
VK
785if test "x$CXX" = "xaCC" ; then
786 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
787 AC_MSG_CHECKING(whether C compiler accepts +DD32)
4d37b0c5 788 OLD_CPPFLAGS="$CPPFLAGS"
cfd95c74
VK
789 CPPFLAGS="+DD32 $CPPFLAGS"
790 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
791 [
792 LDFLAGS="+DD32 $LDFLAGS"
793 AC_MSG_RESULT(yes)
794 ],
795 [
4d37b0c5
VK
796 CPPFLAGS="$OLD_CPPFLAGS"
797 AC_MSG_RESULT(no)
cfd95c74 798 ])
4d37b0c5 799 else
cfd95c74
VK
800 AC_MSG_CHECKING(whether C compiler accepts +DD64)
801 OLD_CPPFLAGS="$CPPFLAGS"
802 CPPFLAGS="+DD64 $CPPFLAGS"
803 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
804 [
805 LDFLAGS="+DD64 $LDFLAGS"
806 AC_MSG_RESULT(yes)
807 ],
808 [
809 CPPFLAGS="$OLD_CPPFLAGS"
810 AC_MSG_RESULT(no)
811 ])
4d37b0c5 812 fi
ef0c727b
VK
813fi
814
df9812a9 815if test "x$CXX" = "xxlC_r" ; then
9b99f1c0
VK
816 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
817 AC_MSG_CHECKING(whether C compiler accepts -q32)
818 OLD_CPPFLAGS="$CPPFLAGS"
819 CPPFLAGS="-q32 $CPPFLAGS"
820 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
821 [
822 LDFLAGS="-q32 $LDFLAGS"
df9812a9 823 OBJECT_MODE=32
9b99f1c0
VK
824 AC_MSG_RESULT(yes)
825 ],
826 [
827 CPPFLAGS="$OLD_CPPFLAGS"
828 AC_MSG_RESULT(no)
829 ])
830 else
831 AC_MSG_CHECKING(whether C compiler accepts -q64)
832 OLD_CPPFLAGS="$CPPFLAGS"
833 CPPFLAGS="-q64 $CPPFLAGS"
834 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
835 [
836 LDFLAGS="-q64 $LDFLAGS"
df9812a9 837 OBJECT_MODE=64
9b99f1c0
VK
838 AC_MSG_RESULT(yes)
839 ],
840 [
841 CPPFLAGS="$OLD_CPPFLAGS"
842 AC_MSG_RESULT(no)
843 ])
844 fi
845fi
846
edb018d7
VK
847
848#--------------------------------------------------------------------
849# Initialize libtool
850#--------------------------------------------------------------------
851
852if test "x$STATIC_BUILD" = "xyes"; then
853 enable_shared=no
854 enable_static=yes
855else
856 enable_shared=yes
e99eba92
VK
857 if test "x$BUILD_SDK" = "xyes"; then
858 enable_static=yes
859 else
860 enable_static=no
861 fi
edb018d7 862fi
1ef5e57a
VK
863
864if test "x$LTINIT_CC" != "x"; then
865 SAVED_CC="$CC"
866 CC="$LTINIT_CC"
867fi
868if test "x$LTINIT_CXX" != "x"; then
869 SAVED_CXX="$CXX"
870 CXX="$LTINIT_CXX"
871fi
872
ff12e2f1 873LT_PREREQ([2.2])
1ef5e57a
VK
874LT_INIT([dlopen])
875
876if test "x$SAVED_CC" != "x"; then
877 CC="$SAVED_CC"
878fi
879if test "x$SAVED_CXX" != "x"; then
880 CXX="$SAVED_CXX"
881fi
edb018d7
VK
882
883
cfd95c74
VK
884#--------------------------------------------------------------------
885# Additional include and library directories
886#--------------------------------------------------------------------
ef0c727b 887
cfd95c74
VK
888if test "x$CXX" != "xaCC"; then
889 if test -d /usr/local/include; then
890 if test "x$CC" = "xgcc"; then
891 AC_MSG_CHECKING(whether -I/usr/local/include needed)
892 OLD_CPPFLAGS="$CPPFLAGS"
893 CPPFLAGS="$CPPFLAGS -Werror -I/usr/local/include"
894 AC_TRY_COMPILE([],[],
895 [
896 CPPFLAGS="$OLD_CPPFLAGS -I/usr/local/include"
897 AC_MSG_RESULT(yes)
898 ],
899 [
900 CPPFLAGS="$OLD_CPPFLAGS"
901 AC_MSG_RESULT(no)
902 ]
903 )
904 else
905 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
906 fi
907 fi
908
909 if test -d /usr/kerberos/include; then
910 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
911 fi
ef0c727b 912
cfd95c74
VK
913 if test -d /usr/local/lib; then
914 LDFLAGS="$LDFLAGS -L/usr/local/lib"
915 fi
916fi
ef0c727b
VK
917
918#--------------------------------------------------------------------
919# Check for threads library - either POSIX or GNU
920#--------------------------------------------------------------------
921
922if test "x$USE_PTH" = "xyes"; then
923 AC_CHECK_HEADER(pth.h,,AC_MSG_ERROR([*** GNU Pth thread support not installed - please install first ***]))
924else
925 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
926
927 if test "x$CXX" = "xaCC"; then
928 PTHREAD_LIBS=""
929 else
930 PTHREAD_LIBS="error"
931 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
932 AC_EGREP_CPP(yes,
933 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
934 yes
935 #endif
936 ], AC_MSG_RESULT(yes)
fecf6a2b 937 PTHREAD_LIBS="-pthread",
ef0c727b
VK
938 AC_MSG_RESULT(no))
939 if test "x$PTHREAD_LIBS" = "xerror"; then
940 AC_CHECK_LIB(pthread, pthread_attr_init,
941 PTHREAD_LIBS="-lpthread")
942 fi
f725c1b7 943 # On HP-UX (at least 11.00) pthread library contains
b041c587 944 # __pthread_attr_init_system instead of pthread_attr_init
f725c1b7 945 if test "x$PTHREAD_LIBS" = "xerror"; then
b041c587 946 AC_CHECK_LIB(pthread, __pthread_attr_init_system,
f725c1b7
VK
947 PTHREAD_LIBS="-lpthread")
948 fi
ef0c727b
VK
949 if test "x$PTHREAD_LIBS" = "xerror"; then
950 AC_CHECK_LIB(pthreads, pthread_attr_init,
951 PTHREAD_LIBS="-lpthreads")
952 fi
953 if test "x$PTHREAD_LIBS" = "xerror"; then
954 AC_CHECK_FUNC(pthread_attr_init,
955 PTHREAD_LIBS="")
956 fi
957 fi
958
959 if test "x$PTHREAD_LIBS" = "xerror"; then
960 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
961 fi
8d131dda 962 LIBS="$LIBS $PTHREAD_LIBS"
ef0c727b
VK
963
964 # Extensions to posix threads
965 AC_CHECK_HEADERS([pthread_np.h],,,[
9c29f76e 966#include <pthread.h>
ef0c727b
VK
967 ])
968 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
969
970 # Check for recursive mutexes
39086394
VK
971 AC_CHECK_FUNCS([pthread_mutexattr_settype __pthread_mutexattr_settype pthread_mutexattr_setkind_np])
972 AC_CHECK_DECLS([pthread_mutexattr_settype, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
9c29f76e
VK
973#include <pthread.h>
974#if HAVE_PTHREAD_NP_H
975#include <pthread_np.h>
976#endif
ef0c727b
VK
977 ])
978
979 # Check for read/write locks
980 # On Linux, rwlock functions declared always, but pthread_rwlock_t may need
981 # additional defines
982 AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
983 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
984 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
9c29f76e
VK
985 [AC_TRY_COMPILE([
986#include <sys/types.h>
987#include <pthread.h>
988 ],
ef0c727b
VK
989 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
990 ac_cv_struct_pthread_rw=yes, [
9c29f76e
VK
991 AC_TRY_COMPILE([
992#define _XOPEN_SOURCE 500
993#include <sys/types.h>
994#include <pthread.h>
995 ],
ef0c727b
VK
996 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
997 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
998 if test "$ac_cv_struct_pthread_rw" = "yes"; then
999 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
1000 fi
1001 ])])
1002 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1003 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
1004 fi
1005 fi
1006
1007fi
1008
1009
1010#--------------------------------------------------------------------
1011# Checks for OpenSSL
1012#--------------------------------------------------------------------
1013
1014if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
1015 AC_CHECK_LIB(crypto, RSA_new,
1016 [
1017 AC_DEFINE(WITH_OPENSSL,,[with openssl])
1018 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
1019 [], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
1020 AC_CHECK_LIB(crypto, EVP_bf_cbc,
1021 [], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
1022 AC_CHECK_LIB(crypto, EVP_idea_cbc,
1023 [], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
1024 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
1025 [], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
1026 ],
1027 [
1028 if test "x$REQUIRE_ENCRYPTION" = "xyes"; then
1029 AC_MSG_ERROR(libcrypto is required for encryption support)
1030 else
1031 AC_MSG_RESULT(libcrypto is required for encryption support)
1032 fi
1033 ])
1034fi
1035
1036
1037#--------------------------------------------------------------------
0322eed7
VK
1038# Checks for header files
1039#--------------------------------------------------------------------
1040
1041AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h alloca.h])
2e98cdb4 1042AC_CHECK_HEADERS([sys/int_types.h time.h sys/time.h sys/utsname.h sys/wait.h])
0322eed7
VK
1043AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h net/nh.h sys/socket.h])
1044AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
1045AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
1046AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h])
df9812a9 1047AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h])
f09c2d05 1048AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
0322eed7
VK
1049[[#ifdef HAVE_SYS_TYPES_H
1050# include <sys/types.h>
1051#endif
1052#ifdef HAVE_SYS_TIME_H
1053# include <sys/time.h>
1054#endif
1055#ifdef HAVE_SYS_SOCKET_H
1056# include <sys/socket.h>
1057#endif
1058]])
1059
1060
1061#--------------------------------------------------------------------
ef0c727b
VK
1062# Checks for other libs.
1063#--------------------------------------------------------------------
d16cf8a5 1064
779ce551 1065AC_CHECK_LIB(xnet, accept)
521d90e7 1066AC_CHECK_LIB(socket, if_nameindex)
87bb64a7 1067AC_CHECK_LIB(dl, dlopen)
1b3c0ef0 1068AC_CHECK_LIB(kstat, kstat_open)
d16cf8a5 1069
e0760102 1070if test "x$BUILD_SERVER" = "xyes" ; then
7c48e2aa
VK
1071 AC_CHECK_LIB(termcap, tgetstr, [SERVER_LIBS="$SERVER_LIBS -ltermcap"], [AC_CHECK_LIB(ncurses, tgetstr, [SERVER_LIBS="$SERVER_LIBS -lncurses"], AC_CHECK_LIB(curses, tgetstr, [SERVER_LIBS="$SERVER_LIBS -lcurses"]))])
1072 AC_CHECK_LIB(readline, readline, [SERVER_LIBS="$SERVER_LIBS -lreadline"], [AC_CHECK_LIB(edit, readline, [SERVER_LIBS="$SERVER_LIBS -ledit"])])
1073 SAVED_LDFLAGS="$LDFLAGS"
1074 LDFLAGS="$LDFLAGS $SERVER_LIBS"
1075
0322eed7
VK
1076 AC_CHECK_FUNCS([readline])
1077
1078 # Check if passing rl_insert to rl_bind_key needs cast
1079 if test "$ac_cv_func_readline" = "yes"; then
1080 AC_LANG_PUSH([C++])
1081
1082 AC_MSG_CHECKING(for rl_insert cast)
1083
1084 AC_TRY_COMPILE(
1085 [
1086#include <stdio.h>
1087#include <readline/readline.h>
1088 ],[ rl_bind_key('\t', (Function *)rl_insert); ],
1089 [
1090 AC_MSG_RESULT((Function *))
1091 AC_DEFINE(RL_INSERT_CAST,(Function *),Required cast for rl_insert)
1092 ],[
1093 AC_TRY_COMPILE(
1094 [
1095#include <stdio.h>
1096#include <readline/readline.h>
1097 ],[ rl_bind_key('\t', (rl_command_func_t *)rl_insert); ],
1098 [
1099 AC_MSG_RESULT((rl_command_func_t *))
1100 AC_DEFINE(RL_INSERT_CAST,(rl_command_func_t *),Required cast for rl_insert)
1101 ],[
1102 AC_MSG_RESULT(not needed)
1103 AC_DEFINE(RL_INSERT_CAST,,Required cast for rl_insert)
1104 ]
1105 )
1106 ]
1107 )
1108
1109 AC_LANG_POP([C++])
1110 fi
7c48e2aa 1111 LDFLAGS="$SAVED_LDFLAGS"
e0760102
VK
1112fi
1113
ef0c727b 1114if test "x$NEED_ZLIB" = "xyes"; then
1fd41bcd
VK
1115 if test "x$FORCE_INTERNAL_ZLIB" = "xyes"; then
1116 HAVE_ZLIB=no
1117 else
1118 HAVE_ZLIB=yes
1119 AC_CHECK_HEADER(zlib.h,,HAVE_ZLIB=no)
1120 if test "x$HAVE_ZLIB" = "xyes"; then
1121 AC_CHECK_LIB(z, deflate, [], [ HAVE_ZLIB=no ])
1122 fi
1123 fi
1124 if test "x$HAVE_ZLIB" = "xno"; then
1125 MODULES="zlib $MODULES"
1126 fi
ef0c727b
VK
1127fi
1128
467c489f
VK
1129if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
1130 HAVE_LIBEXPAT=no
1131else
1132 HAVE_LIBEXPAT=yes
1133 AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
1134 AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
1135fi
80ce37ac
VK
1136if test "x$HAVE_LIBEXPAT" = "xno"; then
1137 MODULES="libexpat $MODULES"
1bb6b449 1138fi
ef0c727b 1139
17b35ccc
VK
1140if test "x$FORCE_INTERNAL_LIBTRE" = "xyes"; then
1141 HAVE_LIBTRE=no
1142else
1143 HAVE_LIBTRE=yes
1144 AC_CHECK_HEADER(tre/regex.h,,HAVE_LIBTRE=no)
1145 AC_CHECK_LIB(tre, tre_compile, [], [ HAVE_LIBTRE=no ])
1146fi
1147if test "x$HAVE_LIBTRE" = "xno"; then
1148 MODULES="libtre $MODULES"
1149 AC_DEFINE(USE_BUNDLED_LIBTRE,1,Define to 1 if bundled libtre is used)
a67fa146 1150
720c23d0
VK
1151 tre_version_1='0'
1152 tre_version_2='8'
1153 tre_version_3='0'
a67fa146
VK
1154 tre_version=$tre_version_1.$tre_version_2.$tre_version_3
1155 AC_DEFINE_UNQUOTED(TRE_VERSION, "$tre_version", [ TRE version string. ])
1156 AC_DEFINE_UNQUOTED(TRE_VERSION_1, $tre_version_1, [ TRE version level 1. ])
1157 AC_DEFINE_UNQUOTED(TRE_VERSION_2, $tre_version_2, [ TRE version level 2. ])
1158 AC_DEFINE_UNQUOTED(TRE_VERSION_3, $tre_version_3, [ TRE version level 3. ])
1159 AC_SUBST(TRE_VERSION, $tre_version)
1160
1161 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])
1162 AC_DEFINE(TRE_APPROX, 1, [ Define if you want to enable approximate matching functionality. ])
17b35ccc 1163fi
ef0c727b 1164
4050bafb
VK
1165if test "x$DISABLE_LMSENSORS" = "xno"; then
1166 HAVE_LMSENSORS=yes
1167 AC_CHECK_HEADER(sensors/sensors.h,,HAVE_LMSENSORS=no)
1168 if test "x$HAVE_LMSENSORS" = "xyes"; then
1169 AC_CHECK_LIB(sensors, sensors_init, [ DUMMY="" ], [ HAVE_LMSENSORS=no ])
1170 fi
1171 if test "x$HAVE_LMSENSORS" = "xyes"; then
1172 SUBAGENT_DIRS="$SUBAGENT_DIRS lmsensors"
1173 fi
38bfa5da
AK
1174fi
1175
ef0c727b
VK
1176#--------------------------------------------------------------------
1177# Checks for data types
1178#--------------------------------------------------------------------
1179
d16cf8a5
AK
1180AC_CHECK_SIZEOF(short)
1181AC_CHECK_SIZEOF(int)
1182AC_CHECK_SIZEOF(long)
1183AC_CHECK_SIZEOF(long long)
1184
1185AC_TYPE_PID_T
1186AC_TYPE_SIGNAL
1187AC_TYPE_SIZE_T
1188AC_STRUCT_TIMEZONE
1189
3071f10a 1190AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t])
51128b42 1191AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
4c779d83
VK
1192#if HAVE_SYS_TYPES_H
1193#include <sys/types.h>
1194#endif
1195#if HAVE_SYS_SOCKET_H
1196#include <sys/socket.h>
1197#endif
1198])
e0293f7f
VK
1199AC_CHECK_TYPES([struct stat64],,,[
1200#if HAVE_SYS_STAT_H
1201#include <sys/stat.h>
1202#endif
1203])
521d90e7 1204
e25cadc9 1205
ef0c727b
VK
1206#--------------------------------------------------------------------
1207# Checks for functions
1208#--------------------------------------------------------------------
d16cf8a5
AK
1209
1210AC_FUNC_ERROR_AT_LINE
d16cf8a5 1211AC_FUNC_MEMCMP
d16cf8a5
AK
1212AC_FUNC_SELECT_ARGTYPES
1213AC_FUNC_STRFTIME
1214AC_FUNC_STRTOD
1215AC_FUNC_VPRINTF
1216
80ce37ac 1217AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
55e62b45 1218AC_CHECK_FUNCS([strrchr strlwr strtol strtoul strtoll strtoull])
467e30e1 1219AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
c601fc15 1220AC_CHECK_FUNCS([usleep nanosleep gmtime_r localtime_r stat64 fstat64 lstat64])
aa24418a
VK
1221
1222AC_CHECK_DECLS([nanosleep])
be6467e9 1223
b0823d06
VK
1224# Check if strerror_r is POSIX-compliant
1225if test "$ac_cv_func_strerror_r" = "yes"; then
1226 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
1227 AC_LANG_PUSH([C++])
1228 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7f9423af
VK
1229#if HAVE_STRING_H
1230#include <string.h>
1231#endif
1232#if HAVE_ERRNO_H
1233#include <errno.h>
1234#endif
b0823d06 1235 ]],[[
7f9423af
VK
1236 int e;
1237 char buffer[256];
1238 e = strerror_r(1, buffer, 256);
1239 return e;
b0823d06
VK
1240 ]])
1241 ],[
1242 AC_MSG_RESULT(yes)
1243 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
1244 ],[
1245 AC_MSG_RESULT(no)
1246 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
1247 ])
1248 AC_LANG_POP([C++])
1249fi
1250
be6467e9
VK
1251# Check if timezone is a function
1252AC_MSG_CHECKING(for timezone function)
1253AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1254#if HAVE_TIME_H
1255#include <time.h>
1256#endif
1257#if HAVE_SYS_TIME_H
1258#include <sys/time.h>
1259#endif
1260]],[[
be6467e9 1261 timezone(0, 0);
be6467e9
VK
1262]])
1263],[
1264AC_MSG_RESULT(yes)
1265AC_DEFINE(HAVE_TIMEZONE,1,Define to 1 if timezone function is available)
1266],[
1267AC_MSG_RESULT(no)
445cba33
VK
1268AC_CHECK_DECLS([timezone],,,[
1269#if HAVE_TIME_H
1270#include <time.h>
1271#endif
1272#if HAVE_SYS_TIME_H
1273#include <sys/time.h>
1274#endif
1275])
be6467e9
VK
1276])
1277
1278# Check if struct tm has tm_gmtoff member
1279AC_MSG_CHECKING(for struct tm.tm_gmtoff)
1280AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1281#if HAVE_TIME_H
1282#include <time.h>
1283#endif
1284#if HAVE_SYS_TIME_H
1285#include <sys/time.h>
1286#endif
1287]],[[
be6467e9
VK
1288 struct tm t;
1289 return t.tm_gmtoff;
be6467e9
VK
1290]])
1291],[
1292AC_MSG_RESULT(yes)
1293AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
1294],[
1295AC_MSG_RESULT(no)
1296])
d16cf8a5 1297
f91feddc 1298AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
70fed300
AK
1299AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
1300
d16cf8a5
AK
1301# sockets/resolver (probably for solaris)
1302AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
1303AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
1304AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
1305
1306if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
1307 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
1308fi
1309
1310if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
1311 AC_MSG_CHECKING([if we can include libnsl + libsocket])
1312 LIBS="-lnsl -lsocket $LIBS"
1313 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
1314 if test "$my_ac_link_result" = "no" ; then
1315 AC_MSG_RESULT([failure])
1316 AC_MSG_ERROR([unable to use gethostbyname()])
1317 else
1318 AC_MSG_RESULT([success])
1319 fi
1320fi
1321
c6491611
VK
1322# asprintf, scprintf, etc.
1323AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
1324AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
1325
1326AC_MSG_CHECKING(whether snprintf returns required buffer size)
1327AC_RUN_IFELSE(
1328 [AC_LANG_PROGRAM([
1329#include <stdio.h>
1330#include <string.h>
1331 ], [
1332 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
1333 ])
1334 ],
1335 [ AC_MSG_RESULT(yes)
1336 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
1337 ],
1338 [ AC_MSG_RESULT(no) ],
1339 [ AC_MSG_RESULT(no) ]
1340)
1341
1342
dff54fed 1343
ef0c727b
VK
1344#--------------------------------------------------------------------
1345# Checks for macros and definitions
1346#--------------------------------------------------------------------
dff54fed 1347
ef0c727b
VK
1348AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
1349#ifdef HAVE_SYS_TYPES_H
99e50bb7 1350#include <sys/types.h>
ef0c727b
VK
1351#endif
1352#if HAVE_BYTESWAP_H
1353#include <byteswap.h>
1354#endif
1355#if HAVE_NETINET_IN_H
1356#include <netinet/in.h>
1357#endif
1358#if HAVE_NET_NH_H
1359#include <net/nh.h>
1360#endif
1361])
aa24418a
VK
1362AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
1363#ifdef HAVE_UNISTD_H
1364#include <unistd.h>
1365#endif
1366#ifdef HAVE_DLFCN_H
1367#include <dlfcn.h>
1368#endif
1369])
ce7565e7
VK
1370AC_CHECK_DECLS([va_copy, __va_copy],,,[
1371#ifdef HAVE_UNISTD_H
1372#include <unistd.h>
1373#endif
1374#ifdef HAVE_STDARG_H
1375#include <stdarg.h>
1376#endif
1377#ifdef HAVE_STDLIB_H
1378#include <stdlib.h>
1379#endif
1380])
dff54fed 1381
dff54fed 1382
ef0c727b 1383#--------------------------------------------------------------------
df9812a9
VK
1384# getopt
1385#--------------------------------------------------------------------
1386
1387if test "x$FORCE_INTERNAL_GETOPT" = "xyes"; then
1388 AC_DEFINE([USE_BUNDLED_GETOPT], [1], [Define to 1 if bundled getopt must be used])
1389else
1390 AC_CHECK_HEADERS([getopt.h])
1391 AC_CHECK_LIB(gnugetopt, getopt_long)
1392 AC_CHECK_DECLS([getopt_long],,,[
1393#if HAVE_GETOPT_H
1394#include <getopt.h>
1395#endif
1396 ])
1397fi
1398
1399
1400#--------------------------------------------------------------------
ef0c727b
VK
1401# AIX specific checks
1402#--------------------------------------------------------------------
d16cf8a5 1403
ef0c727b
VK
1404if test "x$PLATFORM" = "xAIX"; then
1405 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
df9812a9
VK
1406 AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64],,,[
1407#if HAVE_PROCINFO_H
1408#include <procinfo.h>
1409#endif
1410 ])
ef0c727b
VK
1411 AC_CHECK_FUNCS([getprocs64],,,[
1412#if HAVE_PROCINFO_H
1413#include <procinfo.h>
6cd41ceb 1414#endif
ef0c727b 1415 ])
7e56bf2e
VK
1416fi
1417
cd4c8ca3 1418
ef0c727b 1419#--------------------------------------------------------------------
ba8db57b
VK
1420# HP-UX specific checks
1421#--------------------------------------------------------------------
1422
1423if test "x$PLATFORM" = "xHP-UX"; then
f09c2d05
VK
1424 AC_CHECK_HEADERS([sys/mib.h],,,[[ ]])
1425 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
1426#if HAVE_NET_IF_H
1427#include <net/if.h>
1428#endif
1429 ])
1430 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
1431#if HAVE_SYS_MIB_H
1432#include <sys/mib.h>
1433#endif
1434 ])
cfd95c74
VK
1435
1436 AC_MSG_CHECKING(if pst_diskinfo has read/write stats fields)
1437 AC_LANG_PUSH([C++])
1438 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1439#include <sys/pstat.h>
1440 ]], [[
1441pst_diskinfo d;
1442int x;
1443x = (int)d.psd_dkread;
1444x = (int)d.psd_dkwrite;
1445 ]])],
1446 [
1447 AC_DEFINE([HAVE_DISKINFO_RWSTATS],[1],[Define to 1 if pst_diskinfo has read/write stats fields])
1448 AC_MSG_RESULT(yes)
1449 ],
1450 [
1451 AC_MSG_RESULT(no)
1452 ])
1453 AC_LANG_POP([C++])
ba8db57b
VK
1454fi
1455
1456
1457#--------------------------------------------------------------------
aa24418a
VK
1458# *BSD specific checks
1459#--------------------------------------------------------------------
1460
1461AC_CHECK_LIB(kvm, kvm_open)
1462AC_CHECK_FUNCS([kvm_getswapinfo])
1463AC_CHECK_TYPES([struct kinfo_proc2],,,[
1464#if HAVE_SYS_SYSCTL_H
1465#include <sys/sysctl.h>
1466#endif
1467])
1468
1469
28ba6824
VK
1470#--------------------------------------------------------------------
1471# FreeBSD specific checks
1472#--------------------------------------------------------------------
1473
1474if test "x$PLATFORM" = "xFreeBSD"; then
61f58c11
VK
1475 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
1476#if HAVE_SYS_TYPES_H
1477#include <sys/types.h>
1478#endif
1479#if HAVE_SYS_SOCKET_H
1480#include <sys/socket.h>
1481#endif
1482#include <net/route.h>
1483 ])
28ba6824
VK
1484fi
1485
1486
aa24418a 1487#--------------------------------------------------------------------
ea6615cf
VK
1488# OpenBSD specific checks
1489#--------------------------------------------------------------------
1490
1491if test "x$PLATFORM" = "xOpenBSD"; then
1492 AC_MSG_CHECKING(if kvm_getprocs requires sizeof kinfo_proc argument)
1493 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1494#include <sys/param.h>
1495#include <sys/proc.h>
1496#include <kvm.h>
1497#include <sys/user.h>
1498 ]],[[
1499 int count;
1500 kvm_getprocs(NULL, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
1501 return 0;
1502 ]])
1503 ],[
1504 AC_MSG_RESULT(yes)
1505 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,1,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1506 ],[
1507 AC_MSG_RESULT(no)
1508 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,0,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1509 ])
1510
1511 AC_MSG_CHECKING(if struct kinfo_proc has member kp_proc)
1512 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1513#include <sys/param.h>
1514#include <sys/proc.h>
1515#include <kvm.h>
1516#include <sys/user.h>
1517 ]],[[
1518 struct kinfo_proc p;
1519 return p.kp_proc.p_pid;
1520 ]])
1521 ],[
1522 AC_MSG_RESULT(yes)
1523 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,1,Define to 1 if struct kinfo_proc has member kp_proc)
1524 ],[
1525 AC_MSG_RESULT(no)
1526 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,0,Define to 1 if struct kinfo_proc has member kp_proc)
1527 ])
1528fi
1529
1530
1531#--------------------------------------------------------------------
ef0c727b
VK
1532# Check for UNICODE stuff
1533#--------------------------------------------------------------------
3e39fcde 1534
8b86c5dc 1535AC_CHECK_HEADERS([wchar.h wctype.h iconv.h])
aa24418a 1536AC_CHECK_TYPES([wchar_t, wint_t],,,[
6b93c954
VK
1537#if HAVE_WCHAR_H
1538#include <wchar.h>
1539#endif
1540])
3e39fcde 1541AC_CHECK_SIZEOF(wchar_t)
aa24418a 1542AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper wcserror wcserror_r])
0186b5da 1543AC_CHECK_FUNCS([wfopen fputws putws wopen wstat waccess wgetenv wrename wunlink wremove])
f3387429 1544AC_CHECK_FUNCS([wchdir wmkdir wrmdir wsystem wmkstemp wpopen wctime wchmod])
dff54fed 1545
3265ba38 1546if test "x$DISABLE_ICONV" != "xyes"; then
75c30ed4 1547 AC_CHECK_LIB(iconv, libiconv_open,
dff54fed 1548 [ ac_found_iconv=yes
8d131dda 1549 LIBS="$LIBS -liconv"
75c30ed4
VK
1550 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
1551 ],
1552 [
1553 AC_CHECK_LIB(iconv, iconv,
1554 [ ac_found_iconv=yes
8d131dda 1555 LIBS="$LIBS -liconv"
75c30ed4
VK
1556 ])
1557 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
1558 ])
dff54fed
VK
1559else
1560 ac_found_iconv=no
ef0c727b 1561 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
dff54fed 1562fi
93571e7f
VK
1563
1564AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
1565AC_RUN_IFELSE(
1566 [AC_LANG_PROGRAM([
1567#if HAVE_ICONV_H
1568#include <iconv.h>
1569#endif
1570 ], [
1571 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
1572 ])
1573 ],
1574 [ AC_MSG_RESULT(yes)
1575 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
1576 valid_ucs2_code="UCS-2-INTERNAL"
1577 ],
1578 [ AC_MSG_RESULT(no) ],
1579 [ AC_MSG_RESULT(no) ]
1580)
1581
1582AC_MSG_CHECKING(whether iconv supports UCS-2)
1583AC_RUN_IFELSE(
1584 [AC_LANG_PROGRAM([
1585#if HAVE_ICONV_H
1586#include <iconv.h>
1587#endif
1588 ], [
1589 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
1590 ])
1591 ],
1592 [ AC_MSG_RESULT(yes)
1593 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
1594 valid_ucs2_code="UCS-2"
1595 ],
1596 [ AC_MSG_RESULT(no) ],
8b86c5dc 1597 [ AC_MSG_RESULT(no) ]
93571e7f
VK
1598)
1599
1600AC_MSG_CHECKING(whether iconv supports UCS2)
1601AC_RUN_IFELSE(
1602 [AC_LANG_PROGRAM([
1603#if HAVE_ICONV_H
1604#include <iconv.h>
1605#endif
1606 ], [
1607 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
1608 ])
1609 ],
1610 [ AC_MSG_RESULT(yes)
1611 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
1612 valid_ucs2_code="UCS2"
1613 ],
1614 [ AC_MSG_RESULT(no) ],
1615 [ AC_MSG_RESULT(no) ]
1616)
1617
44bccbbc
VK
1618AC_MSG_CHECKING(whether iconv supports UCS-2BE)
1619AC_RUN_IFELSE(
1620 [AC_LANG_PROGRAM([
1621#if HAVE_ICONV_H
1622#include <iconv.h>
1623#endif
1624 ], [
1625 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
1626 ])
1627 ],
1628 [ AC_MSG_RESULT(yes)
1629 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
1630 valid_ucs2_code="UCS-2BE"
1631 ],
1632 [ AC_MSG_RESULT(no) ],
1633 [ AC_MSG_RESULT(no) ]
1634)
1635
6e17f325
VK
1636AC_MSG_CHECKING(whether iconv supports UCS-2LE)
1637AC_RUN_IFELSE(
1638 [AC_LANG_PROGRAM([
1639#if HAVE_ICONV_H
1640#include <iconv.h>
1641#endif
1642 ], [
1643 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
1644 ])
1645 ],
1646 [ AC_MSG_RESULT(yes)
1647 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
1648 valid_ucs2_code="UCS-2LE"
1649 ],
1650 [ AC_MSG_RESULT(no) ],
1651 [ AC_MSG_RESULT(no) ]
1652)
1653
4a4e1feb
VK
1654AC_MSG_CHECKING(whether iconv supports UTF-16)
1655AC_RUN_IFELSE(
1656 [AC_LANG_PROGRAM([
1657#if HAVE_ICONV_H
1658#include <iconv.h>
1659#endif
1660 ], [
1661 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
1662 ])
1663 ],
1664 [ AC_MSG_RESULT(yes)
1665 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
1666 valid_ucs2_code="UTF-16"
1667 ],
1668 [ AC_MSG_RESULT(no) ],
1669 [ AC_MSG_RESULT(no) ]
1670)
1671
8b86c5dc
VK
1672AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
1673AC_RUN_IFELSE(
1674 [AC_LANG_PROGRAM([
1675#if HAVE_ICONV_H
1676#include <iconv.h>
1677#endif
1678 ], [
1679 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
1680 ])
1681 ],
1682 [ AC_MSG_RESULT(yes)
1683 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
1684 valid_ucs4_code="UCS-4-INTERNAL"
1685 ],
1686 [ AC_MSG_RESULT(no) ],
1687 [ AC_MSG_RESULT(no) ]
1688)
1689
1690AC_MSG_CHECKING(whether iconv supports UCS-4)
1691AC_RUN_IFELSE(
1692 [AC_LANG_PROGRAM([
1693#if HAVE_ICONV_H
1694#include <iconv.h>
1695#endif
1696 ], [
1697 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
1698 ])
1699 ],
1700 [ AC_MSG_RESULT(yes)
1701 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
1702 valid_ucs4_code="UCS-4"
1703 ],
1704 [ AC_MSG_RESULT(no) ],
1705 [ AC_MSG_RESULT(no) ]
1706)
1707
1708AC_MSG_CHECKING(whether iconv supports UCS4)
1709AC_RUN_IFELSE(
1710 [AC_LANG_PROGRAM([
1711#if HAVE_ICONV_H
1712#include <iconv.h>
1713#endif
1714 ], [
1715 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
1716 ])
1717 ],
1718 [ AC_MSG_RESULT(yes)
1719 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
1720 valid_ucs4_code="UCS4"
1721 ],
1722 [ AC_MSG_RESULT(no) ],
1723 [ AC_MSG_RESULT(no) ]
1724)
1725
1726AC_MSG_CHECKING(whether iconv supports UCS-4BE)
1727AC_RUN_IFELSE(
1728 [AC_LANG_PROGRAM([
1729#if HAVE_ICONV_H
1730#include <iconv.h>
1731#endif
1732 ], [
1733 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
1734 ])
1735 ],
1736 [ AC_MSG_RESULT(yes)
1737 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
1738 valid_ucs4_code="UCS-4BE"
1739 ],
1740 [ AC_MSG_RESULT(no) ],
1741 [ AC_MSG_RESULT(no) ]
1742)
1743
6e17f325
VK
1744AC_MSG_CHECKING(whether iconv supports UCS-4LE)
1745AC_RUN_IFELSE(
1746 [AC_LANG_PROGRAM([
1747#if HAVE_ICONV_H
1748#include <iconv.h>
1749#endif
1750 ], [
1751 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
1752 ])
1753 ],
1754 [ AC_MSG_RESULT(yes)
1755 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
1756 valid_ucs4_code="UCS-4LE"
1757 ],
1758 [ AC_MSG_RESULT(no) ],
1759 [ AC_MSG_RESULT(no) ]
1760)
1761
4a4e1feb
VK
1762AC_MSG_CHECKING(whether iconv supports UTF-32)
1763AC_RUN_IFELSE(
1764 [AC_LANG_PROGRAM([
1765#if HAVE_ICONV_H
1766#include <iconv.h>
1767#endif
1768 ], [
1769 return iconv_open("UTF-8","UTF-32")==(iconv_t)(-1);
1770 ])
1771 ],
1772 [ AC_MSG_RESULT(yes)
1773 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
1774 valid_ucs4_code="UTF-32"
1775 ],
1776 [ AC_MSG_RESULT(no) ],
1777 [ AC_MSG_RESULT(no) ]
1778)
1779
5e40a69e
VK
1780AC_MSG_CHECKING(whether iconv supports ISO8859-1)
1781AC_RUN_IFELSE(
1782 [AC_LANG_PROGRAM([
1783#if HAVE_ICONV_H
1784#include <iconv.h>
1785#endif
1786 ], [
1787 return iconv_open("UTF-8","ISO8859-1")==(iconv_t)(-1);
1788 ])
1789 ],
1790 [ AC_MSG_RESULT(yes)
1791 AC_DEFINE(HAVE_ICONV_ISO8859_1, 1, Define to 1 if iconv supports ISO8859-1)
1792 ],
1793 [ AC_MSG_RESULT(no) ],
1794 [ AC_MSG_RESULT(no) ]
1795)
1796
1797AC_MSG_CHECKING(whether iconv supports ISO-8859-1)
1798AC_RUN_IFELSE(
1799 [AC_LANG_PROGRAM([
1800#if HAVE_ICONV_H
1801#include <iconv.h>
1802#endif
1803 ], [
1804 return iconv_open("UTF-8","ISO-8859-1")==(iconv_t)(-1);
1805 ])
1806 ],
1807 [ AC_MSG_RESULT(yes)
1808 AC_DEFINE(HAVE_ICONV_ISO_8859_1, 1, Define to 1 if iconv supports ISO-8859-1)
1809 ],
1810 [ AC_MSG_RESULT(no) ],
1811 [ AC_MSG_RESULT(no) ]
1812)
1813
1814AC_MSG_CHECKING(whether iconv supports ASCII)
1815AC_RUN_IFELSE(
1816 [AC_LANG_PROGRAM([
1817#if HAVE_ICONV_H
1818#include <iconv.h>
1819#endif
1820 ], [
1821 return iconv_open("UTF-8","ASCII")==(iconv_t)(-1);
1822 ])
1823 ],
1824 [ AC_MSG_RESULT(yes)
1825 AC_DEFINE(HAVE_ICONV_ASCII, 1, Define to 1 if iconv supports ASCII)
1826 ],
1827 [ AC_MSG_RESULT(no) ],
1828 [ AC_MSG_RESULT(no) ]
1829)
1830
93571e7f
VK
1831AC_MSG_CHECKING(whether iconv supports //IGNORE)
1832AC_RUN_IFELSE(
1833 [AC_LANG_PROGRAM([
1834#if HAVE_ICONV_H
1835#include <iconv.h>
1836#endif
1837 ], [
1838 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
1839 ])
1840 ],
1841 [ AC_MSG_RESULT(yes)
1842 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
1843 ],
1844 [ AC_MSG_RESULT(no) ],
1845 [ AC_MSG_RESULT(no) ]
1846)
3e39fcde 1847
19619a35
AK
1848# taken from ZSH's configure
1849# Check if iconv uses const in prototype declaration
24b1570c 1850if test "x$ac_found_iconv" = "xyes"; then
53c96e2d 1851 AC_LANG_PUSH([C++])
19619a35 1852 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
7f9423af
VK
1853 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1854#include <stdlib.h>
f6a2136d 1855#if HAVE_ICONV_H
7f9423af 1856#include <iconv.h>
f6a2136d 1857#endif
f6a2136d
VK
1858 ]],
1859 [[
3e51d371
VK
1860 char **p = NULL;
1861 iconv(0, (const char **)p, 0, 0, 0);
7f9423af 1862 ]])],
3e51d371
VK
1863 [ac_cv_iconv_const=const],
1864 [ac_cv_iconv_const=])])
53c96e2d 1865 AC_LANG_POP([C++])
19619a35
AK
1866 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
1867 [Define as const if the declaration of iconv() needs const.])
1868fi
1869
a67fa146
VK
1870if test "x$ac_cv_type_wchar_t" = "xyes"; then
1871 if test $ac_cv_sizeof_wchar_t -eq 2; then
1872 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
1873 fi
8b86c5dc 1874
a67fa146
VK
1875 if test $ac_cv_sizeof_wchar_t -eq 4; then
1876 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
1877 fi
1878
1879 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
1880 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
1881 fi
1882else
1883 if test "x$BUILD_UNICODE" = "xyes"; then
1884 AC_MSG_ERROR(wchar_t is required for UNICODE build)
1885 fi
8b86c5dc
VK
1886fi
1887
c29360a9 1888
ef0c727b 1889#--------------------------------------------------------------------
ca0f4ea3
VK
1890# MySQL
1891#--------------------------------------------------------------------
1892
1893check_substr "$COMPONENTS" "mysql"
1894if test $? = 0; then
6fce76d8 1895 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
ca0f4ea3 1896 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
aa7794f0 1897
8d131dda
VK
1898 OLD_LIBS="$LIBS"
1899 LIBS="$LIBS $MYSQL_LIBS"
aa7794f0 1900
9c29f76e
VK
1901 AC_MSG_CHECKING(whether mysql clients can run)
1902 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1903#include <stdio.h>
1904#include <mysql.h>
1905int main(void)
1906{
1907 MYSQL *a = mysql_init(NULL);
1908 return 0;
1909}
1910 ]])],[],[
1911 AC_MSG_RESULT(no)
1912 AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)
1913 ],[])
ca0f4ea3 1914 AC_MSG_RESULT(yes)
6fce76d8 1915
ca0f4ea3 1916 AC_CHECK_FUNCS(mysql_real_escape_string)
8d131dda 1917 LIBS="$OLD_LIBS"
ca0f4ea3
VK
1918fi
1919
1920
1921#--------------------------------------------------------------------
58ed4897
VK
1922# PostgreSQL
1923#--------------------------------------------------------------------
1924
203458b7 1925check_substr "$COMPONENTS" "pgsql"
58ed4897
VK
1926if test $? = 0; then
1927 AC_CHECK_LIB(m, floor)
6fce76d8 1928 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"],
58ed4897 1929 [AC_MSG_ERROR(libpq is required for PostgreSQL support)])
6fce76d8
VK
1930
1931 AC_MSG_CHECKING(whether postgresql clients can run)
8d131dda
VK
1932 OLD_LIBS="$LIBS"
1933 LIBS="$LIBS $PGSQL_LIBS"
6fce76d8
VK
1934 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1935 #include <stdio.h>
1936 #include <libpq-fe.h>
1937 int main(void)
1938 {
1939 PGconn *a = PQconnectdb("");
1940 return 0;
1941 }
1942 ]])],[AC_MSG_RESULT(yes)],[
58ed4897
VK
1943 AC_MSG_RESULT(no)
1944 AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
1945 ],[])
8d131dda 1946 LIBS="$OLD_LIBS"
7070538d 1947 AC_CHECK_LIB(pq, PQfformat, [ AC_DEFINE(HAVE_PQFFORMAT, 1, PQfformat not exist in 7.3) ])
58ed4897
VK
1948fi
1949
1950
1951#--------------------------------------------------------------------
9c29f76e
VK
1952# ODBC
1953#--------------------------------------------------------------------
1954
1955check_substr "$COMPONENTS" "odbc"
1956if test $? = 0; then
6fce76d8 1957 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
9c29f76e 1958 [AC_MSG_ERROR(libodbc is required for ODBC support)])
60a1159a
VK
1959 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
1960 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
1961 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
1962 fi
9c29f76e
VK
1963fi
1964
1965
1966#--------------------------------------------------------------------
41b4790d
VK
1967# Oracle
1968#--------------------------------------------------------------------
1969
1970check_substr "$COMPONENTS" "oracle"
1971if test $? = 0; then
1972 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
7d8c91ef
VK
1973 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
1974 [
1975 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
1976 ], [-lclntsh])
1977 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
1978 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
045845e5 1979 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
60a1159a
VK
1980 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
1981 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
1982 fi
41b4790d
VK
1983fi
1984
84277a0f
AK
1985#--------------------------------------------------------------------
1986# DB2
1987#--------------------------------------------------------------------
1988
1989check_substr "$COMPONENTS" "db2"
1990if test $? = 0; then
1991 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
1992 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
1993 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
1994fi
41b4790d
VK
1995
1996#--------------------------------------------------------------------
37861c72
VK
1997# Informix
1998#--------------------------------------------------------------------
1999
2000check_substr "$COMPONENTS" "informix"
2001if test $? = 0; then
2002 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
4f2e8e9b
VK
2003 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
2004 [AC_MSG_ERROR(libthcli is required for Informix support)])
60a1159a
VK
2005 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2006 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
2007 fi
37861c72
VK
2008fi
2009
c3cfc039
VK
2010
2011#--------------------------------------------------------------------
ca0f4ea3
VK
2012# Other settings
2013#--------------------------------------------------------------------
2014
b07c50cc
VK
2015if test "x${BUILD_UNICODE}" = "xyes"; then
2016 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\""
2017else
2018 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\""
2019fi
545bda2d 2020LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $LDFLAGS_SUFFIX"
ca0f4ea3 2021
25ae8377
VK
2022if test "x${ENABLE_WERROR}" = "xyes"; then
2023 CPPFLAGS="$CPPFLAGS -Werror"
2024fi
2025
551ec9ca 2026AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
17b35ccc 2027AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
1fd41bcd 2028AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$NEED_ZLIB/$HAVE_ZLIB" = "yes/no"])
c1165d33
VK
2029AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
2030AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
8b86c5dc 2031
ca0f4ea3
VK
2032
2033#--------------------------------------------------------------------
ef0c727b
VK
2034# Substitute variables
2035#--------------------------------------------------------------------
82fa7c5d 2036
ef0c727b
VK
2037AC_SUBST(DB_DRIVERS)
2038AC_SUBST(MODULES)
2039AC_SUBST(SUBAGENT_DIRS)
7dda4453 2040AC_SUBST(SERVER_INCLUDE)
7c48e2aa 2041AC_SUBST(SERVER_LIBS)
ef0c727b
VK
2042AC_SUBST(SERVER_TOOLS)
2043AC_SUBST(TOP_LEVEL_MODULES)
2044AC_SUBST(CONTRIB_MODULES)
c2612d83 2045AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
2046AC_SUBST(STATIC_SUBAGENT_LIST)
2047AC_SUBST(SUBAGENT_LIBS)
2048AC_SUBST(BUILD_SERVER)
447350a9 2049AC_SUBST(BUILD_SDK)
6fce76d8
VK
2050AC_SUBST(MYSQL_LIBS)
2051AC_SUBST(PGSQL_LIBS)
7d8c91ef 2052AC_SUBST(ORACLE_LIBS)
6fce76d8 2053AC_SUBST(ODBC_LIBS)
84277a0f 2054AC_SUBST(DB2_LIBS)
87f1fff0 2055AC_SUBST(INFORMIX_LIBS)
11ce9a66 2056AC_SUBST(OBJECT_MODE)
d16cf8a5 2057
ef0c727b
VK
2058#--------------------------------------------------------------------
2059# Shared libs versions
d16cf8a5
AK
2060#
2061# versioning scheme: current:revision:age
2062#
2063# current
2064# The number of the current interface exported by the library. A current
2065# value of `0', means that you are calling the interface exported by this
2066# library interface 0.
2067#
2068# revision
2069# The implementation number of the most recent interface exported by this
2070# library. In this case, a revision value of `0' means that this is the
2071# first implementation of the interface.
2072# If the next release of this library exports the same interface, but has a
2073# different implementation (perhaps some bugs have been fixed), the revision
2074# number will be higher, but current number will be the same. In that case,
2075# when given a choice, the library with the highest revision will always
2076# be used by the runtime loader.
2077#
2078# age
2079# The number of previous additional interfaces supported by this library.
2080# If age were `2', then this library can be linked into executables which
2081# were built with a release of this library that exported the current
2082# interface number, current, or any of the previous two interfaces.
2083# By definition age must be less than or equal to current. At the outset,
2084# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 2085#--------------------------------------------------------------------
d16cf8a5 2086
17b35ccc 2087NETXMS_LIBRARY_VERSION=1:0:0
c7d14846 2088AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 2089
ef0c727b
VK
2090
2091#--------------------------------------------------------------------
2092# Generate output files
2093#--------------------------------------------------------------------
d16cf8a5
AK
2094
2095AC_CONFIG_FILES([
ef0c727b 2096 README
0c3c0c39
AK
2097 Makefile
2098 contrib/Makefile
36874eca
VK
2099 contrib/backgrounds/Makefile
2100 contrib/integration/Makefile
2101 contrib/integration/HP_EVA/Makefile
bad6cc0c 2102 contrib/integration/HP_P2000/Makefile
36874eca 2103 contrib/mibs/Makefile
0c3c0c39 2104 contrib/startup/Makefile
fa66d60c 2105 contrib/startup/debian/Makefile
daaefaaf 2106 contrib/startup/gentoo/Makefile
7483d0bf 2107 contrib/startup/hp-ux/Makefile
0c3c0c39 2108 contrib/startup/redhat/Makefile
5de3893d 2109 contrib/startup/suse/Makefile
9993edf4 2110 contrib/startup/ubuntu/Makefile
6adf3219 2111 contrib/startup/solaris/Makefile
0c3c0c39 2112 doc/Makefile
a48203d2
VK
2113 doc/internal/Makefile
2114 doc/manuals/Makefile
2115 doc/misc/Makefile
0c3c0c39
AK
2116 images/Makefile
2117 include/Makefile
2118 m4/Makefile
0c3c0c39 2119 src/Makefile
9191f6ad 2120 src/agent/Makefile
6ac698ed 2121 src/agent/appagent/Makefile
9191f6ad
VK
2122 src/agent/core/Makefile
2123 src/agent/install/Makefile
a2a24e9d 2124 src/agent/libnxsd/Makefile
9191f6ad 2125 src/agent/subagents/Makefile
9191f6ad 2126 src/agent/subagents/aix/Makefile
80e96a82 2127 src/agent/subagents/ecs/Makefile
9191f6ad 2128 src/agent/subagents/freebsd/Makefile
80e96a82
VK
2129 src/agent/subagents/hpux/Makefile
2130 src/agent/subagents/informix/Makefile
9191f6ad 2131 src/agent/subagents/ipso/Makefile
80e96a82
VK
2132 src/agent/subagents/linux/Makefile
2133 src/agent/subagents/logwatch/Makefile
2134 src/agent/subagents/netbsd/Makefile
2135 src/agent/subagents/odbcquery/Makefile
2136 src/agent/subagents/openbsd/Makefile
4d1753cd 2137 src/agent/subagents/oracle/Makefile
9191f6ad 2138 src/agent/subagents/ping/Makefile
80e96a82 2139 src/agent/subagents/portCheck/Makefile
9191f6ad 2140 src/agent/subagents/sms/Makefile
80e96a82 2141 src/agent/subagents/sunos/Makefile
9191f6ad 2142 src/agent/subagents/ups/Makefile
80e96a82
VK
2143 src/agent/subagents/winnt/Makefile
2144 src/agent/subagents/winperf/Makefile
2145 src/agent/subagents/wmi/Makefile
38bfa5da 2146 src/agent/subagents/lmsensors/Makefile
cf52e714 2147 src/agent/subagents/darwin//Makefile
0bd64860 2148 src/agent/tools/Makefile
6ac698ed 2149 src/agent/tools/nxappget/Makefile
0bd64860 2150 src/agent/tools/nxapush/Makefile
c2612d83 2151 src/client/Makefile
551592f4 2152 src/client/install/Makefile
c94fa5c2 2153 src/client/nxalarm/Makefile
e84701c5 2154 src/client/nxevent/Makefile
9cb6c12f 2155 src/client/nxlexer/Makefile
e84701c5 2156 src/client/nxpush/Makefile
59ffa5b7 2157 src/client/nxsms/Makefile
9cb6c12f
VK
2158 src/client/scilexer/Makefile
2159 src/client/windows/Makefile
2160 src/client/windows/nxav/Makefile
2161 src/client/windows/nxav/res/Makefile
23c8c53e
AK
2162 src/client/windows/nxcon/Makefile
2163 src/client/windows/nxcon/icons/Makefile
2164 src/client/windows/nxcon/res/Makefile
23c8c53e
AK
2165 src/client/windows/nxnotify/Makefile
2166 src/client/windows/nxnotify/res/Makefile
9cb6c12f
VK
2167 src/client/windows/nxuilib/Makefile
2168 src/client/windows/nxuilib/res/Makefile
2169 src/client/windows/nxuilib/sounds/Makefile
d1834406
VK
2170 src/db/Makefile
2171 src/db/dbdrv/Makefile
87f1fff0
VK
2172 src/db/dbdrv/db2/Makefile
2173 src/db/dbdrv/informix/Makefile
d1834406
VK
2174 src/db/dbdrv/odbc/Makefile
2175 src/db/dbdrv/mssql/Makefile
2176 src/db/dbdrv/mysql/Makefile
87f1fff0 2177 src/db/dbdrv/oracle/Makefile
d1834406
VK
2178 src/db/dbdrv/pgsql/Makefile
2179 src/db/dbdrv/sqlite/Makefile
d1834406 2180 src/db/libnxdb/Makefile
9191f6ad
VK
2181 src/install/Makefile
2182 src/install/windows/Makefile
2183 src/libexpat/Makefile
2184 src/libexpat/libexpat/Makefile
2185 src/libnetxms/Makefile
2186 src/libnxcl/Makefile
2187 src/libnxlp/Makefile
2188 src/libnxmap/Makefile
2189 src/libnxsl/Makefile
a67fa146
VK
2190 src/libtre/Makefile
2191 src/libtre/win32/Makefile
9191f6ad 2192 src/nxscript/Makefile
0c3c0c39
AK
2193 src/server/Makefile
2194 src/server/core/Makefile
644f97f5
VK
2195 src/server/drivers/Makefile
2196 src/server/drivers/baystack/Makefile
b1bd1fb2 2197 src/server/drivers/cat2900xl/Makefile
910846cc 2198 src/server/drivers/catalyst/Makefile
fce03ab9 2199 src/server/drivers/cisco-esw/Makefile
8bdfaed8 2200 src/server/drivers/dell-pwc/Makefile
a548def4 2201 src/server/drivers/dlink/Makefile
644f97f5 2202 src/server/drivers/ers8000/Makefile
4e592faf
VK
2203 src/server/drivers/lib/Makefile
2204 src/server/drivers/lib/avaya-ers/Makefile
b1bd1fb2 2205 src/server/drivers/lib/cisco/Makefile
81ecaf38 2206 src/server/drivers/netscreen/Makefile
9b13553b 2207 src/server/drivers/procurve/Makefile
217e4d6a 2208 src/server/drivers/symbol-ws/Makefile
d770a97c
VK
2209 src/server/include/Makefile
2210 src/server/libnxsrv/Makefile
2211 src/server/netxmsd/Makefile
d8f2e39b
VK
2212 src/server/smsdrv/Makefile
2213 src/server/smsdrv/generic/Makefile
91369aca 2214 src/server/smsdrv/nxagent/Makefile
aab8a8b6 2215 src/server/smsdrv/portech/Makefile
80a30c53 2216 src/server/smsdrv/dummy/Makefile
0c3c0c39 2217 src/server/tools/Makefile
0c3c0c39
AK
2218 src/server/tools/nxaction/Makefile
2219 src/server/tools/nxadm/Makefile
9191f6ad 2220 src/server/tools/nxap/Makefile
5b0c7d0d
VK
2221 src/server/tools/nxconfig/Makefile
2222 src/server/tools/nxconfig/res/Makefile
f90d7fc5 2223 src/server/tools/nxdbmgr/Makefile
9191f6ad 2224 src/server/tools/nxget/Makefile
d24fdaf4 2225 src/server/tools/nxupload/Makefile
c5c0f362
VK
2226 src/snmp/Makefile
2227 src/snmp/libnxsnmp/Makefile
2228 src/snmp/nxmibc/Makefile
2229 src/snmp/nxsnmpget/Makefile
2230 src/snmp/nxsnmpset/Makefile
2231 src/snmp/nxsnmpwalk/Makefile
9191f6ad 2232 src/sqlite/Makefile
f65df2b1 2233 src/tools/Makefile
f65df2b1 2234 src/tools/nxdevcfg/Makefile
56e13b13 2235 src/tools/nxencpasswd/Makefile
1fd41bcd 2236 src/zlib/Makefile
9191f6ad 2237 sql/Makefile
0c3c0c39 2238 tools/Makefile
d16cf8a5
AK
2239])
2240
12249937
VK
2241AC_OUTPUT
2242
ef0c727b 2243echo "Updating libtool"
5cecf50e
AK
2244sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2245
779ce551
VK
2246# On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
2247if test "x$CC" = "xgcc" && test "x$PLATFORM" = "xHP-UX"; then
2248 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2249fi
2250
b677ef59
VK
2251# On AIX, correct OBJECT_MODE must be set before linking
2252# To avoid manual setting by user, we add this to libtool script
2253if test "x$PLATFORM" = "xAIX"; then
2254 head -n 1 ./libtool > ./libtool.new
2255 echo "export OBJECT_MODE=$OBJECT_MODE" >> ./libtool.new
2256 tail -n +2 ./libtool >> ./libtool.new
2257 mv libtool.new libtool
2258 chmod +x ./libtool
2259fi
2260
ef0c727b
VK
2261#--------------------------------------------------------------------
2262# Print summary
2263#--------------------------------------------------------------------
a7442678 2264
a7442678
AK
2265echo
2266echo
2267echo
2268echo '---------------------------------------------------------------------'
2269echo ' Configure results'
2270echo '---------------------------------------------------------------------'
2271echo
8b86c5dc 2272 echo "Prefix : ${prefix}"
a7442678 2273if test "x${BUILD_SERVER}" = "xyes"; then
8b86c5dc 2274 echo "Build Server : YES"
7c48e2aa 2275 echo "Server libs : ${SERVER_LIBS}"
a7442678 2276else
8b86c5dc 2277 echo "Build Server : NO"
a7442678
AK
2278fi
2279if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
8b86c5dc 2280 echo "Encryption enabled : YES"
a7442678 2281else
8b86c5dc 2282 echo "Encryption enabled : NO"
a7442678
AK
2283fi
2284if test "x${DB_DRIVERS}" != "x"; then
8b86c5dc 2285 echo "Build DB-Drivers :${DB_DRIVERS}"
a7442678 2286else
8b86c5dc 2287 echo "Build DB-Drivers : NO"
a7442678
AK
2288fi
2289if test "x${BUILD_CLIENT}" = "xyes"; then
8b86c5dc 2290 echo "Build Clients : YES"
a7442678 2291else
8b86c5dc 2292 echo "Build Clients : NO"
a7442678
AK
2293fi
2294if test "x${BUILD_AGENT}" = "xyes"; then
8b86c5dc
VK
2295 echo "Build Agent : YES"
2296 echo "Subagents list : ${SUBAGENT_DIRS}"
a7442678 2297else
8b86c5dc 2298 echo "Build Agent : NO"
a7442678 2299fi
e8636669 2300if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
8b86c5dc
VK
2301 echo "Build Static Agent : YES"
2302 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
e8636669 2303else
8b86c5dc 2304 echo "Build Static Agent : NO"
e8636669 2305fi
8b86c5dc 2306if test "x${BUILD_UNICODE}" = "xyes"; then
a67fa146 2307 echo "UNICODE build : YES"
8b86c5dc 2308else
a67fa146 2309 echo "UNICODE build : NO"
8b86c5dc 2310fi
551ec9ca
VK
2311if test "x${HAVE_LIBEXPAT}" = "xno"; then
2312 echo "Use internal libexpat : YES"
1bb6b449 2313else
551ec9ca 2314 echo "Use internal libexpat : NO"
1bb6b449 2315fi
17b35ccc
VK
2316if test "x${HAVE_LIBTRE}" = "xno"; then
2317 echo "Use internal libtre : YES"
2318else
2319 echo "Use internal libtre : NO"
2320fi
1fd41bcd
VK
2321if test "x${NEED_ZLIB}" = "xyes"; then
2322 if test "x${HAVE_ZLIB}" = "xno"; then
2323 echo "Use internal zlib : YES"
2324 else
2325 echo "Use internal zlib : NO"
2326 fi
2327fi
cc297a70
VK
2328if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
2329 echo "Force 32bit build : YES"
2330else
2331 echo "Force 32bit build : NO"
2332fi
7d8c91ef
VK
2333
2334echo "CPPFLAGS : ${CPPFLAGS}"
2335echo "CXXFLAGS : ${CXXFLAGS}"
2336echo "CFLAGS : ${CFLAGS}"
2337echo "LDFLAGS : ${LDFLAGS}"
8d131dda 2338echo "LIBS : ${LIBS}"
7d8c91ef 2339
6fce76d8
VK
2340if test "x${MYSQL_LIBS}" != "x"; then
2341 echo "MySQL libs : ${MYSQL_LIBS}"
2342fi
2343if test "x${PGSQL_LIBS}" != "x"; then
2344 echo "PostgreSQL libs : ${PGSQL_LIBS}"
2345fi
7d8c91ef
VK
2346if test "x${ORACLE_LIBS}" != "x"; then
2347 echo "Oracle libs : ${ORACLE_LIBS}"
2348fi
6fce76d8
VK
2349if test "x${ODBC_LIBS}" != "x"; then
2350 echo "ODBC libs : ${ODBC_LIBS}"
2351fi
84277a0f
AK
2352if test "x${DB2_LIBS}" != "x"; then
2353 echo "DB2 libs : ${DB2_LIBS}"
2354fi
37861c72
VK
2355if test "x${INFORMIX_LIBS}" != "x"; then
2356 echo "Informix libs : ${INFORMIX_LIBS}"
2357fi
ecbed20c
VK
2358
2359FLAGS_CPP="src/tools/nxdevcfg/flags.cpp"
2360echo "/* Automatically generated by configure */" > $FLAGS_CPP
d541b129
VK
2361echo "#include <nms_common.h>" >> $FLAGS_CPP
2362echo "const TCHAR *g_cppFlags = _T(\"${CPPFLAGS}\");" >> $FLAGS_CPP
2363echo "const TCHAR *g_cFlags = _T(\"${CFLAGS}\");" >> $FLAGS_CPP
2364echo "const TCHAR *g_cxxFlags = _T(\"${CXXFLAGS}\");" >> $FLAGS_CPP
2365echo "const TCHAR *g_ldFlags = _T(\"${LDFLAGS}\");" >> $FLAGS_CPP
2366echo "const TCHAR *g_libs = _T(\"${LIBS}\");" >> $FLAGS_CPP
7dda4453
VK
2367echo "const TCHAR *g_cc = _T(\"${CC}\");" >> $FLAGS_CPP
2368echo "const TCHAR *g_cxx = _T(\"${CXX}\");" >> $FLAGS_CPP
2369echo "const TCHAR *g_ld = _T(\"${LD}\");" >> $FLAGS_CPP
2370echo "const TCHAR *g_perl = _T(\"${PERL}\");" >> $FLAGS_CPP