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