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