Windows build fixed
[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
ef0c727b 84#--------------------------------------------------------------------
fecf6a2b
VK
85# Common compilation flags
86#--------------------------------------------------------------------
87
842c22f4 88CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DTRE_WCHAR=1"
fecf6a2b
VK
89
90
91#--------------------------------------------------------------------
ef0c727b
VK
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
c2612d83 125AC_ARG_WITH(agent,
ef0c727b
VK
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
673#--------------------------------------------------------------------
ef0c727b
VK
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)
f47bd4ca 703 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -O2"
75c30ed4
VK
704 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
705 export LD_LIBRARY_PATH
706 ;;
56b2f755 707 Linux)
f47bd4ca 708 CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -O2"
56b2f755 709 ;;
d1056954 710 Darwin)
f47bd4ca 711 CPPFLAGS="$CPPFLAGS -Wno-deprecated-declarations -O2"
d1056954 712 ;;
ef0c727b
VK
713 *)
714 ;;
715esac
716
717
718#--------------------------------------------------------------------
c90d3610 719# C++ compiler tuning:
cc297a70 720# * Disable C++ exceptions and RTTI
779ce551 721# * Turn on 64bit mode on HP-UX/Itanium
cc297a70 722# * Turn on 64bit mode on AIX
d358c73f 723# * Turn on 64bit mode on Solaris
ef0c727b
VK
724#--------------------------------------------------------------------
725
5482ef16 726if test "x$ac_compiler_gnu" = "xyes" ; then
9113e749 727 SQLFLAGS="-x c -Wundef"
ef0c727b
VK
728
729 AC_LANG_PUSH([C++])
730
731 AC_MSG_CHECKING(whether C++ compiler accepts -fno-rtti)
e6b112bc 732 OLD_CXXFLAGS="$CXXFLAGS"
ef0c727b
VK
733 CXXFLAGS="$CXXFLAGS -fno-rtti"
734 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
735 [ AC_MSG_RESULT(yes) ],
736 [
737 CXXFLAGS="$OLD_CXXFLAGS"
738 AC_MSG_RESULT(no)
739 ])
740
50e4bc8c
VK
741 check_substr "$COMPONENTS" "java"
742 if test $? != 0; then
743 AC_MSG_CHECKING(whether C++ compiler accepts -fno-exceptions)
744 OLD_CXXFLAGS="$CXXFLAGS"
745 CXXFLAGS="$CXXFLAGS -fno-exceptions"
746 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
747 [ AC_MSG_RESULT(yes) ],
748 [
749 CXXFLAGS="$OLD_CXXFLAGS"
750 AC_MSG_RESULT(no)
751 ])
752 fi
ef0c727b
VK
753
754 AC_LANG_POP([C++])
755
779ce551 756 if test "x$PLATFORM" = "xHP-UX"; then
cc297a70
VK
757 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
758 AC_MSG_CHECKING(whether C compiler accepts -milp32)
759 OLD_CPPFLAGS="$CPPFLAGS"
760 CPPFLAGS="$CPPFLAGS -milp32"
761 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
762 [
763 LDFLAGS="-milp32 $LDFLAGS"
764 AC_MSG_RESULT(yes)
765 ],
766 [
767 CPPFLAGS="$OLD_CPPFLAGS"
768 AC_MSG_RESULT(no)
769 ])
770 else
771 AC_MSG_CHECKING(whether C compiler accepts -mlp64)
772 OLD_CPPFLAGS="$CPPFLAGS"
773 CPPFLAGS="$CPPFLAGS -mlp64"
774 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
775 [
776 LDFLAGS="-mlp64 -L/usr/lib/hpux64 -L/usr/local/lib/hpux64 $LDFLAGS"
777 AC_MSG_RESULT(yes)
778 ],
779 [
780 CPPFLAGS="$OLD_CPPFLAGS"
781 AC_MSG_RESULT(no)
782 ])
783 fi
784 fi
785
786 if test "x$PLATFORM" = "xAIX"; then
787 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
788 AC_MSG_CHECKING(whether C compiler accepts -maix32)
789 OLD_CPPFLAGS="$CPPFLAGS"
790 CPPFLAGS="$CPPFLAGS -maix32"
fecf6a2b 791 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
792 [
793 LDFLAGS="-maix32 $LDFLAGS"
5482ef16
VK
794 LTINIT_CC="$CC -maix32"
795 LTINIT_CXX="$CXX -maix32"
1c45282c 796 OBJECT_MODE=32
cc297a70
VK
797 AC_MSG_RESULT(yes)
798 ],
799 [
800 CPPFLAGS="$OLD_CPPFLAGS"
801 AC_MSG_RESULT(no)
802 ])
803 else
804 AC_MSG_CHECKING(whether C compiler accepts -maix64)
805 OLD_CPPFLAGS="$CPPFLAGS"
806 CPPFLAGS="$CPPFLAGS -maix64"
fecf6a2b 807 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
cc297a70
VK
808 [
809 LDFLAGS="-maix64 $LDFLAGS"
5482ef16
VK
810 LTINIT_CC="$CC -maix64"
811 LTINIT_CXX="$CXX -maix64"
1c45282c 812 OBJECT_MODE=64
cc297a70
VK
813 AC_MSG_RESULT(yes)
814 ],
815 [
816 CPPFLAGS="$OLD_CPPFLAGS"
817 AC_MSG_RESULT(no)
818 ])
819 fi
779ce551 820 fi
d358c73f
VK
821
822 if test "x$PLATFORM" = "xSunOS"; then
823 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
824 AC_MSG_CHECKING(whether C compiler accepts -m32)
825 OLD_CPPFLAGS="$CPPFLAGS"
826 CPPFLAGS="$CPPFLAGS -m32"
827 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
828 [
829 LDFLAGS="-m32 $LDFLAGS"
830 AC_MSG_RESULT(yes)
831 ],
832 [
833 CPPFLAGS="$OLD_CPPFLAGS"
834 AC_MSG_RESULT(no)
835 ])
836 else
837 AC_MSG_CHECKING(whether C compiler accepts -m64)
838 OLD_CPPFLAGS="$CPPFLAGS"
839 CPPFLAGS="$CPPFLAGS -m64"
840 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
841 [
842 LDFLAGS="-m64 $LDFLAGS"
843 AC_MSG_RESULT(yes)
844 ],
845 [
846 CPPFLAGS="$OLD_CPPFLAGS"
847 AC_MSG_RESULT(no)
848 ])
849 fi
850 fi
779ce551 851
ce5592b2
VK
852 if test "x$ENABLE_DEBUG" = "xyes"; then
853 CPPFLAGS="$CPPFLAGS -ggdb3"
854 fi
ef0c727b
VK
855fi
856
cfd95c74
VK
857if test "x$CXX" = "xaCC" ; then
858 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
859 AC_MSG_CHECKING(whether C compiler accepts +DD32)
4d37b0c5 860 OLD_CPPFLAGS="$CPPFLAGS"
cfd95c74
VK
861 CPPFLAGS="+DD32 $CPPFLAGS"
862 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
863 [
864 LDFLAGS="+DD32 $LDFLAGS"
865 AC_MSG_RESULT(yes)
866 ],
867 [
4d37b0c5
VK
868 CPPFLAGS="$OLD_CPPFLAGS"
869 AC_MSG_RESULT(no)
cfd95c74 870 ])
4d37b0c5 871 else
cfd95c74
VK
872 AC_MSG_CHECKING(whether C compiler accepts +DD64)
873 OLD_CPPFLAGS="$CPPFLAGS"
874 CPPFLAGS="+DD64 $CPPFLAGS"
875 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
876 [
877 LDFLAGS="+DD64 $LDFLAGS"
878 AC_MSG_RESULT(yes)
879 ],
880 [
881 CPPFLAGS="$OLD_CPPFLAGS"
882 AC_MSG_RESULT(no)
883 ])
4d37b0c5 884 fi
ef0c727b
VK
885fi
886
df9812a9 887if test "x$CXX" = "xxlC_r" ; then
d1cb61cf 888 SQLFLAGS="-qnoppline"
9b99f1c0
VK
889 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
890 AC_MSG_CHECKING(whether C compiler accepts -q32)
891 OLD_CPPFLAGS="$CPPFLAGS"
892 CPPFLAGS="-q32 $CPPFLAGS"
893 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
894 [
895 LDFLAGS="-q32 $LDFLAGS"
df9812a9 896 OBJECT_MODE=32
9b99f1c0
VK
897 AC_MSG_RESULT(yes)
898 ],
899 [
900 CPPFLAGS="$OLD_CPPFLAGS"
901 AC_MSG_RESULT(no)
902 ])
903 else
904 AC_MSG_CHECKING(whether C compiler accepts -q64)
905 OLD_CPPFLAGS="$CPPFLAGS"
906 CPPFLAGS="-q64 $CPPFLAGS"
907 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
908 [
909 LDFLAGS="-q64 $LDFLAGS"
df9812a9 910 OBJECT_MODE=64
9b99f1c0
VK
911 AC_MSG_RESULT(yes)
912 ],
913 [
914 CPPFLAGS="$OLD_CPPFLAGS"
915 AC_MSG_RESULT(no)
916 ])
917 fi
918fi
919
9113e749
VK
920if test "x$CXX" = "xCC" ; then
921 SQLFLAGS="-Qn"
922 CPPFLAGS="$CPPFLAGS -mt"
923
924 if test "x$FORCE_32BIT_BUILD" = "xyes"; then
925 AC_MSG_CHECKING(whether C compiler accepts -m32)
f5e5296e
VK
926 count=`$CC -flags | grep '^\-m32 ' | wc -l`
927 if test $count -eq 1; then
928 AC_MSG_RESULT(yes)
929 CPPFLAGS="$CPPFLAGS -m32"
930 LDFLAGS="-m32 $LDFLAGS"
931 else
932 AC_MSG_RESULT(no)
933 fi
9113e749 934 else
c3900dbb 935 TEST_XARCH="no"
9113e749 936 AC_MSG_CHECKING(whether C compiler accepts -m64)
f5e5296e
VK
937 count=`$CC -flags | grep '^\-m64 ' | wc -l`
938 if test $count -eq 1; then
939 AC_MSG_RESULT(yes)
940 CPPFLAGS="$CPPFLAGS -m64"
941 LDFLAGS="-m64 $LDFLAGS"
942 else
943 AC_MSG_RESULT(no)
944 TEST_XARCH="yes"
945 fi
c3900dbb
VK
946 if test "x$TEST_XARCH" = "xyes"; then
947 if test "x$CPUTYPE" = "xsparc"; then
948 ARCH="-xarch=v9"
949 else
950 ARCH="-xarch=amd64"
951 fi
952 AC_MSG_CHECKING(whether C compiler accepts $ARCH)
953 OLD_CPPFLAGS="$CPPFLAGS"
954 CPPFLAGS="$CPPFLAGS $ARCH"
955 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ ]], [[ ]])],
956 [
957 LDFLAGS="$ARCH $LDFLAGS"
958 AC_MSG_RESULT(yes)
959 ],
960 [
961 CPPFLAGS="$OLD_CPPFLAGS"
962 AC_MSG_RESULT(no)
963 ])
964 fi
9113e749
VK
965 fi
966fi
967
edb018d7
VK
968
969#--------------------------------------------------------------------
970# Initialize libtool
971#--------------------------------------------------------------------
972
973if test "x$STATIC_BUILD" = "xyes"; then
974 enable_shared=no
975 enable_static=yes
976else
977 enable_shared=yes
e99eba92
VK
978 if test "x$BUILD_SDK" = "xyes"; then
979 enable_static=yes
980 else
981 enable_static=no
982 fi
edb018d7 983fi
1ef5e57a
VK
984
985if test "x$LTINIT_CC" != "x"; then
986 SAVED_CC="$CC"
987 CC="$LTINIT_CC"
988fi
989if test "x$LTINIT_CXX" != "x"; then
990 SAVED_CXX="$CXX"
991 CXX="$LTINIT_CXX"
992fi
993
ff12e2f1 994LT_PREREQ([2.2])
1ef5e57a
VK
995LT_INIT([dlopen])
996
997if test "x$SAVED_CC" != "x"; then
998 CC="$SAVED_CC"
999fi
1000if test "x$SAVED_CXX" != "x"; then
1001 CXX="$SAVED_CXX"
1002fi
edb018d7
VK
1003
1004
cfd95c74
VK
1005#--------------------------------------------------------------------
1006# Additional include and library directories
1007#--------------------------------------------------------------------
ef0c727b 1008
cfd95c74
VK
1009if test "x$CXX" != "xaCC"; then
1010 if test -d /usr/local/include; then
5482ef16 1011 if test "x$ac_compiler_gnu" = "xyes"; then
cfd95c74
VK
1012 AC_MSG_CHECKING(whether -I/usr/local/include needed)
1013 OLD_CPPFLAGS="$CPPFLAGS"
1014 CPPFLAGS="$CPPFLAGS -Werror -I/usr/local/include"
2adc2d49 1015 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
cfd95c74
VK
1016 [
1017 CPPFLAGS="$OLD_CPPFLAGS -I/usr/local/include"
1018 AC_MSG_RESULT(yes)
1019 ],
1020 [
1021 CPPFLAGS="$OLD_CPPFLAGS"
1022 AC_MSG_RESULT(no)
1023 ]
1024 )
1025 else
1026 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
1027 fi
1028 fi
1029
1030 if test -d /usr/kerberos/include; then
1031 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1032 fi
ef0c727b 1033
cfd95c74
VK
1034 if test -d /usr/local/lib; then
1035 LDFLAGS="$LDFLAGS -L/usr/local/lib"
1036 fi
1037fi
ef0c727b
VK
1038
1039#--------------------------------------------------------------------
1040# Check for threads library - either POSIX or GNU
1041#--------------------------------------------------------------------
1042
1043if test "x$USE_PTH" = "xyes"; then
1044 AC_CHECK_HEADER(pth.h,,AC_MSG_ERROR([*** GNU Pth thread support not installed - please install first ***]))
1045else
1046 AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***]))
1047
1048 if test "x$CXX" = "xaCC"; then
1049 PTHREAD_LIBS=""
1050 else
1051 PTHREAD_LIBS="error"
1052 AC_MSG_CHECKING(for old style FreeBSD -pthread flag)
1053 AC_EGREP_CPP(yes,
1054 [#if defined(__FreeBSD_cc_version) || defined(__OpenBSD__)
1055 yes
1056 #endif
1057 ], AC_MSG_RESULT(yes)
fecf6a2b 1058 PTHREAD_LIBS="-pthread",
ef0c727b
VK
1059 AC_MSG_RESULT(no))
1060 if test "x$PTHREAD_LIBS" = "xerror"; then
1061 AC_CHECK_LIB(pthread, pthread_attr_init,
1062 PTHREAD_LIBS="-lpthread")
1063 fi
f725c1b7 1064 # On HP-UX (at least 11.00) pthread library contains
b041c587 1065 # __pthread_attr_init_system instead of pthread_attr_init
f725c1b7 1066 if test "x$PTHREAD_LIBS" = "xerror"; then
b041c587 1067 AC_CHECK_LIB(pthread, __pthread_attr_init_system,
f725c1b7
VK
1068 PTHREAD_LIBS="-lpthread")
1069 fi
ef0c727b
VK
1070 if test "x$PTHREAD_LIBS" = "xerror"; then
1071 AC_CHECK_LIB(pthreads, pthread_attr_init,
1072 PTHREAD_LIBS="-lpthreads")
1073 fi
1074 if test "x$PTHREAD_LIBS" = "xerror"; then
1075 AC_CHECK_FUNC(pthread_attr_init,
1076 PTHREAD_LIBS="")
1077 fi
1078 fi
1079
1080 if test "x$PTHREAD_LIBS" = "xerror"; then
1081 AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
1082 fi
8d131dda 1083 LIBS="$LIBS $PTHREAD_LIBS"
ef0c727b
VK
1084
1085 # Extensions to posix threads
1086 AC_CHECK_HEADERS([pthread_np.h],,,[
9c29f76e 1087#include <pthread.h>
ef0c727b
VK
1088 ])
1089 AC_CHECK_FUNCS([pthread_cond_reltimedwait_np])
1090
1091 # Check for recursive mutexes
39086394
VK
1092 AC_CHECK_FUNCS([pthread_mutexattr_settype __pthread_mutexattr_settype pthread_mutexattr_setkind_np])
1093 AC_CHECK_DECLS([pthread_mutexattr_settype, PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_RECURSIVE_NP, MUTEX_TYPE_COUNTING_FAST],,,[
9c29f76e
VK
1094#include <pthread.h>
1095#if HAVE_PTHREAD_NP_H
1096#include <pthread_np.h>
1097#endif
ef0c727b
VK
1098 ])
1099
1100 # Check for read/write locks
1101 # On Linux, rwlock functions declared always, but pthread_rwlock_t may need
1102 # additional defines
1103 AC_CHECK_FUNCS([pthread_rwlock_init pthread_rwlock_timedrdlock pthread_rwlock_timedwrlock])
1104 if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
1105 AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
afd0c386
VK
1106 [AC_COMPILE_IFELSE([
1107 AC_LANG_PROGRAM([
9c29f76e
VK
1108#include <sys/types.h>
1109#include <pthread.h>
afd0c386
VK
1110 ],
1111 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b 1112 ac_cv_struct_pthread_rw=yes, [
afd0c386
VK
1113 AC_COMPILE_IFELSE([
1114 AC_LANG_PROGRAM([
9c29f76e
VK
1115#define _XOPEN_SOURCE 500
1116#include <sys/types.h>
1117#include <pthread.h>
afd0c386
VK
1118 ],
1119 [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;])],
ef0c727b
VK
1120 ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
1121 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1122 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
1123 fi
1124 ])])
1125 if test "$ac_cv_struct_pthread_rw" = "yes"; then
1126 AC_DEFINE(HAVE_PTHREAD_RWLOCK, 1, Define to 1 if you have working pthread read/write locks)
1127 fi
1128 fi
1129
1130fi
1131
1132
1133#--------------------------------------------------------------------
1134# Checks for OpenSSL
1135#--------------------------------------------------------------------
1136
1137if test "x$DISABLE_ENCRYPTION" != "xyes" ; then
1138 AC_CHECK_LIB(crypto, RSA_new,
1139 [
1140 AC_DEFINE(WITH_OPENSSL,,[with openssl])
1141 AC_CHECK_LIB(crypto, EVP_aes_256_cbc,
e0a77f08 1142 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_AES,,[desc])])
ef0c727b 1143 AC_CHECK_LIB(crypto, EVP_bf_cbc,
e0a77f08 1144 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_BF,,[desc])])
ef0c727b 1145 AC_CHECK_LIB(crypto, EVP_idea_cbc,
e0a77f08 1146 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_IDEA,,[desc])])
ef0c727b 1147 AC_CHECK_LIB(crypto, EVP_des_ede3_cbc,
e0a77f08 1148 [HAVE_LIBCRYPTO="yes"], [AC_DEFINE(NETXMS_NO_DES,,[desc])])
d27e7413 1149 SERVER_LIBS="$SERVER_LIBS -lssl"
e0a77f08
VK
1150 if test "x$HAVE_LIBCRYPTO" = "xyes"; then
1151 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
1152# LIBS="$LIBS -Wl,-Bstatic -lcrypto -Wl,-Bdynamic"
1153 LIBS="$LIBS -lcrypto"
1154 else
1155 LIBS="$LIBS -lcrypto"
1156 fi
1157 else
1158 if test "x$REQUIRE_ENCRYPTION" = "xyes"; then
1159 AC_MSG_ERROR(libcrypto does not provide any suitable encryption algorithm)
1160 else
1161 AC_MSG_RESULT(libcrypto does not provide any suitable encryption algorithm)
1162 fi
1163 fi
ef0c727b
VK
1164 ],
1165 [
1166 if test "x$REQUIRE_ENCRYPTION" = "xyes"; then
1167 AC_MSG_ERROR(libcrypto is required for encryption support)
1168 else
1169 AC_MSG_RESULT(libcrypto is required for encryption support)
1170 fi
1171 ])
1172fi
1173
1174
1175#--------------------------------------------------------------------
0322eed7
VK
1176# Checks for header files
1177#--------------------------------------------------------------------
1178
1179AC_CHECK_HEADERS([sys/types.h sys/stat.h unistd.h stdarg.h fcntl.h alloca.h])
2e98cdb4 1180AC_CHECK_HEADERS([sys/int_types.h time.h sys/time.h sys/utsname.h sys/wait.h])
0322eed7
VK
1181AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h net/nh.h sys/socket.h])
1182AC_CHECK_HEADERS([fcntl.h dirent.h sys/ioctl.h sys/sockio.h poll.h termios.h])
1183AC_CHECK_HEADERS([inttypes.h memory.h stdint.h stdlib.h strings.h string.h])
1184AC_CHECK_HEADERS([readline/readline.h byteswap.h sys/select.h dlfcn.h])
df9812a9 1185AC_CHECK_HEADERS([sys/sysctl.h sys/param.h sys/user.h vm/vm_param.h syslog.h])
f09c2d05 1186AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h],,,
0322eed7
VK
1187[[#ifdef HAVE_SYS_TYPES_H
1188# include <sys/types.h>
1189#endif
1190#ifdef HAVE_SYS_TIME_H
1191# include <sys/time.h>
1192#endif
1193#ifdef HAVE_SYS_SOCKET_H
1194# include <sys/socket.h>
1195#endif
1196]])
1197
1198
1199#--------------------------------------------------------------------
ef0c727b
VK
1200# Checks for other libs.
1201#--------------------------------------------------------------------
d16cf8a5 1202
779ce551 1203AC_CHECK_LIB(xnet, accept)
521d90e7 1204AC_CHECK_LIB(socket, if_nameindex)
87bb64a7 1205AC_CHECK_LIB(dl, dlopen)
1b3c0ef0 1206AC_CHECK_LIB(kstat, kstat_open)
d16cf8a5 1207
e0760102 1208if test "x$BUILD_SERVER" = "xyes" ; then
7c48e2aa
VK
1209 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"]))])
1210 AC_CHECK_LIB(readline, readline, [SERVER_LIBS="$SERVER_LIBS -lreadline"], [AC_CHECK_LIB(edit, readline, [SERVER_LIBS="$SERVER_LIBS -ledit"])])
1211 SAVED_LDFLAGS="$LDFLAGS"
1212 LDFLAGS="$LDFLAGS $SERVER_LIBS"
1213
0322eed7
VK
1214 AC_CHECK_FUNCS([readline])
1215
1216 # Check if passing rl_insert to rl_bind_key needs cast
1217 if test "$ac_cv_func_readline" = "yes"; then
1218 AC_LANG_PUSH([C++])
1219
1220 AC_MSG_CHECKING(for rl_insert cast)
1221
afd0c386 1222 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
0322eed7
VK
1223 [
1224#include <stdio.h>
1225#include <readline/readline.h>
afd0c386 1226 ],[ rl_bind_key('\t', (Function *)rl_insert); ])],
0322eed7
VK
1227 [
1228 AC_MSG_RESULT((Function *))
1229 AC_DEFINE(RL_INSERT_CAST,(Function *),Required cast for rl_insert)
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', (rl_command_func_t *)rl_insert); ])],
0322eed7
VK
1236 [
1237 AC_MSG_RESULT((rl_command_func_t *))
1238 AC_DEFINE(RL_INSERT_CAST,(rl_command_func_t *),Required cast for rl_insert)
1239 ],[
1240 AC_MSG_RESULT(not needed)
1241 AC_DEFINE(RL_INSERT_CAST,,Required cast for rl_insert)
1242 ]
1243 )
1244 ]
1245 )
1246
1247 AC_LANG_POP([C++])
1248 fi
7c48e2aa 1249 LDFLAGS="$SAVED_LDFLAGS"
e0760102
VK
1250fi
1251
ef0c727b 1252if test "x$NEED_ZLIB" = "xyes"; then
1fd41bcd
VK
1253 if test "x$FORCE_INTERNAL_ZLIB" = "xyes"; then
1254 HAVE_ZLIB=no
1255 else
1256 HAVE_ZLIB=yes
1257 AC_CHECK_HEADER(zlib.h,,HAVE_ZLIB=no)
1258 if test "x$HAVE_ZLIB" = "xyes"; then
1259 AC_CHECK_LIB(z, deflate, [], [ HAVE_ZLIB=no ])
1260 fi
1261 fi
1262 if test "x$HAVE_ZLIB" = "xno"; then
1263 MODULES="zlib $MODULES"
1264 fi
ef0c727b
VK
1265fi
1266
467c489f
VK
1267if test "x$FORCE_INTERNAL_EXPAT" = "xyes"; then
1268 HAVE_LIBEXPAT=no
1269else
1270 HAVE_LIBEXPAT=yes
1271 AC_CHECK_HEADER(expat.h,,HAVE_LIBEXPAT=no)
1272 AC_CHECK_LIB(expat, XML_Parse, [], [ HAVE_LIBEXPAT=no ])
1273fi
80ce37ac
VK
1274if test "x$HAVE_LIBEXPAT" = "xno"; then
1275 MODULES="libexpat $MODULES"
1bb6b449 1276fi
ef0c727b 1277
17b35ccc
VK
1278if test "x$FORCE_INTERNAL_LIBTRE" = "xyes"; then
1279 HAVE_LIBTRE=no
1280else
1281 HAVE_LIBTRE=yes
1282 AC_CHECK_HEADER(tre/regex.h,,HAVE_LIBTRE=no)
1283 AC_CHECK_LIB(tre, tre_compile, [], [ HAVE_LIBTRE=no ])
1284fi
1285if test "x$HAVE_LIBTRE" = "xno"; then
1286 MODULES="libtre $MODULES"
1287 AC_DEFINE(USE_BUNDLED_LIBTRE,1,Define to 1 if bundled libtre is used)
a67fa146 1288
720c23d0
VK
1289 tre_version_1='0'
1290 tre_version_2='8'
1291 tre_version_3='0'
a67fa146
VK
1292 tre_version=$tre_version_1.$tre_version_2.$tre_version_3
1293 AC_DEFINE_UNQUOTED(TRE_VERSION, "$tre_version", [ TRE version string. ])
1294 AC_DEFINE_UNQUOTED(TRE_VERSION_1, $tre_version_1, [ TRE version level 1. ])
1295 AC_DEFINE_UNQUOTED(TRE_VERSION_2, $tre_version_2, [ TRE version level 2. ])
1296 AC_DEFINE_UNQUOTED(TRE_VERSION_3, $tre_version_3, [ TRE version level 3. ])
1297 AC_SUBST(TRE_VERSION, $tre_version)
1298
1299 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])
1300 AC_DEFINE(TRE_APPROX, 1, [ Define if you want to enable approximate matching functionality. ])
17b35ccc 1301fi
ef0c727b 1302
4050bafb
VK
1303if test "x$DISABLE_LMSENSORS" = "xno"; then
1304 HAVE_LMSENSORS=yes
1305 AC_CHECK_HEADER(sensors/sensors.h,,HAVE_LMSENSORS=no)
1306 if test "x$HAVE_LMSENSORS" = "xyes"; then
1307 AC_CHECK_LIB(sensors, sensors_init, [ DUMMY="" ], [ HAVE_LMSENSORS=no ])
1308 fi
1309 if test "x$HAVE_LMSENSORS" = "xyes"; then
1310 SUBAGENT_DIRS="$SUBAGENT_DIRS lmsensors"
1311 fi
38bfa5da
AK
1312fi
1313
0a4194c2
AK
1314AC_CHECK_HEADER(curl/curl.h,HAVE_LIBCURL=yes,HAVE_LIBCURL=no)
1315if test "x$HAVE_LIBCURL" = "xyes"; then
2368dc85
VK
1316 AC_CHECK_LIB(curl, curl_global_init, [ HAVE_LIBCURL=yes ], [ HAVE_LIBCURL=no ])
1317 AC_CHECK_DECLS([CURLOPT_NOSIGNAL, curl_version_info],,,[
1318#ifdef HAVE_CURL_CURL_H
1319#include <curl/curl.h>
1320#endif
1321])
0a4194c2
AK
1322fi
1323if test "x$HAVE_LIBCURL" = "xyes"; then
c80c69bd 1324 SUBAGENT_DIRS="$SUBAGENT_DIRS netsvc"
0a4194c2
AK
1325fi
1326
ef0c727b
VK
1327#--------------------------------------------------------------------
1328# Checks for data types
1329#--------------------------------------------------------------------
1330
d16cf8a5
AK
1331AC_CHECK_SIZEOF(short)
1332AC_CHECK_SIZEOF(int)
1333AC_CHECK_SIZEOF(long)
1334AC_CHECK_SIZEOF(long long)
1335
1336AC_TYPE_PID_T
d16cf8a5
AK
1337AC_TYPE_SIZE_T
1338AC_STRUCT_TIMEZONE
1339
3071f10a 1340AC_CHECK_TYPES([long long, unsigned long long, int64_t, uint64_t, u_int64_t, uuid_t])
51128b42 1341AC_CHECK_TYPES([mode_t, off_t, socklen_t],,,[
4c779d83
VK
1342#if HAVE_SYS_TYPES_H
1343#include <sys/types.h>
1344#endif
1345#if HAVE_SYS_SOCKET_H
1346#include <sys/socket.h>
1347#endif
1348])
e0293f7f
VK
1349AC_CHECK_TYPES([struct stat64],,,[
1350#if HAVE_SYS_STAT_H
1351#include <sys/stat.h>
1352#endif
1353])
521d90e7 1354
e25cadc9 1355
ef0c727b
VK
1356#--------------------------------------------------------------------
1357# Checks for functions
1358#--------------------------------------------------------------------
d16cf8a5
AK
1359
1360AC_FUNC_ERROR_AT_LINE
d16cf8a5 1361AC_FUNC_MEMCMP
d16cf8a5
AK
1362AC_FUNC_SELECT_ARGTYPES
1363AC_FUNC_STRFTIME
1364AC_FUNC_STRTOD
1365AC_FUNC_VPRINTF
1366
80ce37ac 1367AC_CHECK_FUNCS([gettimeofday memmove memset bcopy strchr strcspn strdup strerror])
55e62b45 1368AC_CHECK_FUNCS([strrchr strlwr strtol strtoul strtoll strtoull])
467e30e1 1369AC_CHECK_FUNCS([if_nametoindex daemon mmap strerror_r scandir uname poll])
c601fc15 1370AC_CHECK_FUNCS([usleep nanosleep gmtime_r localtime_r stat64 fstat64 lstat64])
aa24418a
VK
1371
1372AC_CHECK_DECLS([nanosleep])
be6467e9 1373
b0823d06
VK
1374# Check if strerror_r is POSIX-compliant
1375if test "$ac_cv_func_strerror_r" = "yes"; then
1376 AC_MSG_CHECKING(if strerror_r is POSIX compliant)
1377 AC_LANG_PUSH([C++])
1378 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7f9423af
VK
1379#if HAVE_STRING_H
1380#include <string.h>
1381#endif
1382#if HAVE_ERRNO_H
1383#include <errno.h>
1384#endif
b0823d06 1385 ]],[[
7f9423af
VK
1386 int e;
1387 char buffer[256];
1388 e = strerror_r(1, buffer, 256);
1389 return e;
b0823d06
VK
1390 ]])
1391 ],[
1392 AC_MSG_RESULT(yes)
1393 AC_DEFINE(HAVE_POSIX_STRERROR_R,1,Define to 1 if strerror_r function is POSIX compliant)
1394 ],[
1395 AC_MSG_RESULT(no)
1396 AC_DEFINE(HAVE_POSIX_STRERROR_R,0,Define to 1 if strerror_r function is POSIX compliant)
1397 ])
1398 AC_LANG_POP([C++])
1399fi
1400
be6467e9
VK
1401# Check if timezone is a function
1402AC_MSG_CHECKING(for timezone function)
1403AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1404#if HAVE_TIME_H
1405#include <time.h>
1406#endif
1407#if HAVE_SYS_TIME_H
1408#include <sys/time.h>
1409#endif
1410]],[[
be6467e9 1411 timezone(0, 0);
be6467e9
VK
1412]])
1413],[
1414AC_MSG_RESULT(yes)
1415AC_DEFINE(HAVE_TIMEZONE,1,Define to 1 if timezone function is available)
1416],[
1417AC_MSG_RESULT(no)
445cba33
VK
1418AC_CHECK_DECLS([timezone],,,[
1419#if HAVE_TIME_H
1420#include <time.h>
1421#endif
1422#if HAVE_SYS_TIME_H
1423#include <sys/time.h>
1424#endif
1425])
be6467e9
VK
1426])
1427
1428# Check if struct tm has tm_gmtoff member
1429AC_MSG_CHECKING(for struct tm.tm_gmtoff)
1430AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1431#if HAVE_TIME_H
1432#include <time.h>
1433#endif
1434#if HAVE_SYS_TIME_H
1435#include <sys/time.h>
1436#endif
1437]],[[
be6467e9
VK
1438 struct tm t;
1439 return t.tm_gmtoff;
be6467e9
VK
1440]])
1441],[
1442AC_MSG_RESULT(yes)
1443AC_DEFINE(HAVE_TM_GMTOFF,1,Define to 1 if struct tm has tm_gmtoff member)
1444],[
1445AC_MSG_RESULT(no)
1446])
d16cf8a5 1447
f91feddc 1448AC_CHECK_FUNCS([sysctlbyname sysctlnametomib])
70fed300
AK
1449AC_CHECK_FUNCS([tcgetattr tcsetattr cfsetospeed cfsetispeed])
1450
d16cf8a5
AK
1451# sockets/resolver (probably for solaris)
1452AC_CHECK_FUNC(connect, , [AC_CHECK_LIB(socket, connect)])
1453AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(resolv, gethostbyname)])
1454AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname)])
1455
1456if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
1457 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
1458fi
1459
1460if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
1461 AC_MSG_CHECKING([if we can include libnsl + libsocket])
1462 LIBS="-lnsl -lsocket $LIBS"
1463 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
1464 if test "$my_ac_link_result" = "no" ; then
1465 AC_MSG_RESULT([failure])
1466 AC_MSG_ERROR([unable to use gethostbyname()])
1467 else
1468 AC_MSG_RESULT([success])
1469 fi
1470fi
1471
c6491611
VK
1472# asprintf, scprintf, etc.
1473AC_CHECK_FUNCS([asprintf aswprintf vasprintf vaswprintf])
1474AC_CHECK_FUNCS([scprintf scwprintf vscprintf vscwprintf])
1475
1476AC_MSG_CHECKING(whether snprintf returns required buffer size)
1477AC_RUN_IFELSE(
1478 [AC_LANG_PROGRAM([
1479#include <stdio.h>
1480#include <string.h>
1481 ], [
1482 return !(snprintf(NULL, 0, "test: %d", 1000) >= 10);
1483 ])
1484 ],
1485 [ AC_MSG_RESULT(yes)
1486 AC_DEFINE(SNPRINTF_RETURNS_REQUIRED_SIZE, 1, Define to 1 if snprintf returns required buffer size in case of truncation)
1487 ],
1488 [ AC_MSG_RESULT(no) ],
1489 [ AC_MSG_RESULT(no) ]
1490)
1491
1492
dff54fed 1493
ef0c727b
VK
1494#--------------------------------------------------------------------
1495# Checks for macros and definitions
1496#--------------------------------------------------------------------
dff54fed 1497
ef0c727b
VK
1498AC_CHECK_DECLS([__bswap_32, __bswap_64, htonll, ntohll],,,[
1499#ifdef HAVE_SYS_TYPES_H
99e50bb7 1500#include <sys/types.h>
ef0c727b
VK
1501#endif
1502#if HAVE_BYTESWAP_H
1503#include <byteswap.h>
1504#endif
1505#if HAVE_NETINET_IN_H
1506#include <netinet/in.h>
1507#endif
1508#if HAVE_NET_NH_H
1509#include <net/nh.h>
1510#endif
1511])
aa24418a
VK
1512AC_CHECK_DECLS([RTLD_NOW, RTLD_GLOBAL],,,[
1513#ifdef HAVE_UNISTD_H
1514#include <unistd.h>
1515#endif
1516#ifdef HAVE_DLFCN_H
1517#include <dlfcn.h>
1518#endif
1519])
ce7565e7
VK
1520AC_CHECK_DECLS([va_copy, __va_copy],,,[
1521#ifdef HAVE_UNISTD_H
1522#include <unistd.h>
1523#endif
1524#ifdef HAVE_STDARG_H
1525#include <stdarg.h>
1526#endif
1527#ifdef HAVE_STDLIB_H
1528#include <stdlib.h>
1529#endif
1530])
dff54fed 1531
dff54fed 1532
ef0c727b 1533#--------------------------------------------------------------------
df9812a9
VK
1534# getopt
1535#--------------------------------------------------------------------
1536
1537if test "x$FORCE_INTERNAL_GETOPT" = "xyes"; then
1538 AC_DEFINE([USE_BUNDLED_GETOPT], [1], [Define to 1 if bundled getopt must be used])
1539else
1540 AC_CHECK_HEADERS([getopt.h])
1541 AC_CHECK_LIB(gnugetopt, getopt_long)
1542 AC_CHECK_DECLS([getopt_long],,,[
1543#if HAVE_GETOPT_H
1544#include <getopt.h>
1545#endif
1546 ])
1547fi
1548
1549
1550#--------------------------------------------------------------------
671651a1
VK
1551# Linux specific checks
1552#--------------------------------------------------------------------
1553
1554if test "x$PLATFORM" = "xLinux"; then
1555 AC_CHECK_HEADERS([sys/reboot.h],,,[[ ]])
1556 AC_CHECK_DECLS([reboot, RB_AUTOBOOT, RB_POWER_OFF, RB_HALT_SYSTEM],,,[
1557#if HAVE_SYS_REBOOT_H
1558#include <sys/reboot.h>
1559#endif
1560 ])
1561 AC_CHECK_FUNCS([reboot],,,[
1562#if HAVE_SYS_REBOOT_H
1563#include <sys/reboot.h>
1564#endif
1565 ])
1566fi
1567
1568
1569#--------------------------------------------------------------------
ef0c727b
VK
1570# AIX specific checks
1571#--------------------------------------------------------------------
d16cf8a5 1572
ef0c727b
VK
1573if test "x$PLATFORM" = "xAIX"; then
1574 AC_CHECK_HEADERS([procinfo.h],,,[[ ]])
efdaffe4 1575 AC_CHECK_DECLS([getkerninfo, getprocs, getprocs64, __sync_add_and_fetch, __sync_sub_and_fetch],,,[
df9812a9
VK
1576#if HAVE_PROCINFO_H
1577#include <procinfo.h>
1578#endif
1579 ])
ef0c727b
VK
1580 AC_CHECK_FUNCS([getprocs64],,,[
1581#if HAVE_PROCINFO_H
1582#include <procinfo.h>
6cd41ceb 1583#endif
ef0c727b 1584 ])
7e56bf2e
VK
1585fi
1586
cd4c8ca3 1587
ef0c727b 1588#--------------------------------------------------------------------
f47bd4ca
VK
1589# Solaris specific checks
1590#--------------------------------------------------------------------
1591
1592if test "x$PLATFORM" = "xSunOS"; then
1593 AC_CHECK_FUNCS([atomic_inc_32_nv atomic_dec_32_nv],,,[
1594#include <sys/atomic.h>
1595 ])
1596fi
1597
1598
1599#--------------------------------------------------------------------
ba8db57b
VK
1600# HP-UX specific checks
1601#--------------------------------------------------------------------
1602
1603if test "x$PLATFORM" = "xHP-UX"; then
3268bb77 1604 AC_CHECK_HEADERS([atomic.h sys/mib.h],,,[[ ]])
f09c2d05
VK
1605 AC_CHECK_DECLS([SIOCGIFNAME, SIOCGIFINDEX],,,[
1606#if HAVE_NET_IF_H
1607#include <net/if.h>
1608#endif
1609 ])
1610 AC_CHECK_DECLS([ID_ifXEntry, open_mib_64],,,[
1611#if HAVE_SYS_MIB_H
1612#include <sys/mib.h>
1613#endif
1614 ])
cfd95c74
VK
1615
1616 AC_MSG_CHECKING(if pst_diskinfo has read/write stats fields)
1617 AC_LANG_PUSH([C++])
1618 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1619#include <sys/pstat.h>
1620 ]], [[
1621pst_diskinfo d;
1622int x;
1623x = (int)d.psd_dkread;
1624x = (int)d.psd_dkwrite;
1625 ]])],
1626 [
1627 AC_DEFINE([HAVE_DISKINFO_RWSTATS],[1],[Define to 1 if pst_diskinfo has read/write stats fields])
1628 AC_MSG_RESULT(yes)
1629 ],
1630 [
1631 AC_MSG_RESULT(no)
1632 ])
1633 AC_LANG_POP([C++])
ba8db57b
VK
1634fi
1635
1636
1637#--------------------------------------------------------------------
aa24418a
VK
1638# *BSD specific checks
1639#--------------------------------------------------------------------
1640
1641AC_CHECK_LIB(kvm, kvm_open)
1642AC_CHECK_FUNCS([kvm_getswapinfo])
1643AC_CHECK_TYPES([struct kinfo_proc2],,,[
1644#if HAVE_SYS_SYSCTL_H
1645#include <sys/sysctl.h>
1646#endif
1647])
1648
1649
28ba6824
VK
1650#--------------------------------------------------------------------
1651# FreeBSD specific checks
1652#--------------------------------------------------------------------
1653
1654if test "x$PLATFORM" = "xFreeBSD"; then
61f58c11
VK
1655 AC_CHECK_DECLS([RTF_WASCLONED],[],[],[
1656#if HAVE_SYS_TYPES_H
1657#include <sys/types.h>
1658#endif
1659#if HAVE_SYS_SOCKET_H
1660#include <sys/socket.h>
1661#endif
1662#include <net/route.h>
1663 ])
28ba6824
VK
1664fi
1665
1666
aa24418a 1667#--------------------------------------------------------------------
ea6615cf
VK
1668# OpenBSD specific checks
1669#--------------------------------------------------------------------
1670
1671if test "x$PLATFORM" = "xOpenBSD"; then
1672 AC_MSG_CHECKING(if kvm_getprocs requires sizeof kinfo_proc argument)
1673 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1674#include <sys/param.h>
1675#include <sys/proc.h>
1676#include <kvm.h>
1677#include <sys/user.h>
1678 ]],[[
1679 int count;
1680 kvm_getprocs(NULL, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
1681 return 0;
1682 ]])
1683 ],[
1684 AC_MSG_RESULT(yes)
1685 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,1,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1686 ],[
1687 AC_MSG_RESULT(no)
1688 AC_DEFINE(KVM_GETPROCS_REQUIRES_SIZEOF,0,Define to 1 if kvm_getprocs requires sizeof kinfo_proc)
1689 ])
1690
1691 AC_MSG_CHECKING(if struct kinfo_proc has member kp_proc)
1692 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1693#include <sys/param.h>
1694#include <sys/proc.h>
1695#include <kvm.h>
1696#include <sys/user.h>
1697 ]],[[
1698 struct kinfo_proc p;
1699 return p.kp_proc.p_pid;
1700 ]])
1701 ],[
1702 AC_MSG_RESULT(yes)
1703 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,1,Define to 1 if struct kinfo_proc has member kp_proc)
1704 ],[
1705 AC_MSG_RESULT(no)
1706 AC_DEFINE(KINFO_PROC_HAS_KP_PROC,0,Define to 1 if struct kinfo_proc has member kp_proc)
1707 ])
1708fi
1709
1710
1711#--------------------------------------------------------------------
ef0c727b
VK
1712# Check for UNICODE stuff
1713#--------------------------------------------------------------------
3e39fcde 1714
8b86c5dc 1715AC_CHECK_HEADERS([wchar.h wctype.h iconv.h])
aa24418a 1716AC_CHECK_TYPES([wchar_t, wint_t],,,[
6b93c954
VK
1717#if HAVE_WCHAR_H
1718#include <wchar.h>
1719#endif
1720])
f172d7b7
VK
1721AC_CHECK_SIZEOF(wchar_t,,[
1722#if HAVE_WCHAR_H
1723#include <wchar.h>
1724#endif
1725])
aa24418a 1726AC_CHECK_FUNCS([wcslen wcsdup wcsncpy wcstoll wcstoull towupper wcserror wcserror_r])
0186b5da 1727AC_CHECK_FUNCS([wfopen fputws putws wopen wstat waccess wgetenv wrename wunlink wremove])
f3387429 1728AC_CHECK_FUNCS([wchdir wmkdir wrmdir wsystem wmkstemp wpopen wctime wchmod])
9d20de29 1729AC_CHECK_FUNCS([vwscanf vswscanf vfwscanf wcscasecmp wcsncasecmp wcstombs wcsrtombs])
dff54fed 1730
3265ba38 1731if test "x$DISABLE_ICONV" != "xyes"; then
75c30ed4 1732 AC_CHECK_LIB(iconv, libiconv_open,
dff54fed 1733 [ ac_found_iconv=yes
8d131dda 1734 LIBS="$LIBS -liconv"
75c30ed4
VK
1735 AC_CHECK_FUNCS(libiconv, ac_found_iconv=yes, ac_found_iconv=no)
1736 ],
1737 [
1738 AC_CHECK_LIB(iconv, iconv,
1739 [ ac_found_iconv=yes
8d131dda 1740 LIBS="$LIBS -liconv"
75c30ed4
VK
1741 ])
1742 AC_CHECK_FUNCS(iconv, ac_found_iconv=yes, ac_found_iconv=no)
1743 ])
dff54fed
VK
1744else
1745 ac_found_iconv=no
ef0c727b 1746 CPPFLAGS="$CPPFLAGS -D__DISABLE_ICONV"
dff54fed 1747fi
93571e7f
VK
1748
1749AC_MSG_CHECKING(whether iconv supports UCS-2-INTERNAL)
1750AC_RUN_IFELSE(
1751 [AC_LANG_PROGRAM([
1752#if HAVE_ICONV_H
1753#include <iconv.h>
1754#endif
1755 ], [
1756 return iconv_open("UTF-8","UCS-2-INTERNAL")==(iconv_t)(-1);
1757 ])
1758 ],
1759 [ AC_MSG_RESULT(yes)
1760 AC_DEFINE(HAVE_ICONV_UCS_2_INTERNAL, 1, Define to 1 if iconv supports UCS-2-INTERNAL)
1761 valid_ucs2_code="UCS-2-INTERNAL"
1762 ],
1763 [ AC_MSG_RESULT(no) ],
1764 [ AC_MSG_RESULT(no) ]
1765)
1766
1767AC_MSG_CHECKING(whether iconv supports UCS-2)
1768AC_RUN_IFELSE(
1769 [AC_LANG_PROGRAM([
1770#if HAVE_ICONV_H
1771#include <iconv.h>
1772#endif
1773 ], [
1774 return iconv_open("UTF-8","UCS-2")==(iconv_t)(-1);
1775 ])
1776 ],
1777 [ AC_MSG_RESULT(yes)
1778 AC_DEFINE(HAVE_ICONV_UCS_2, 1, Define to 1 if iconv supports UCS-2)
1779 valid_ucs2_code="UCS-2"
1780 ],
1781 [ AC_MSG_RESULT(no) ],
8b86c5dc 1782 [ AC_MSG_RESULT(no) ]
93571e7f
VK
1783)
1784
1785AC_MSG_CHECKING(whether iconv supports UCS2)
1786AC_RUN_IFELSE(
1787 [AC_LANG_PROGRAM([
1788#if HAVE_ICONV_H
1789#include <iconv.h>
1790#endif
1791 ], [
1792 return iconv_open("UTF-8","UCS2")==(iconv_t)(-1);
1793 ])
1794 ],
1795 [ AC_MSG_RESULT(yes)
1796 AC_DEFINE(HAVE_ICONV_UCS2, 1, Define to 1 if iconv supports UCS2)
1797 valid_ucs2_code="UCS2"
1798 ],
1799 [ AC_MSG_RESULT(no) ],
1800 [ AC_MSG_RESULT(no) ]
1801)
1802
44bccbbc
VK
1803AC_MSG_CHECKING(whether iconv supports UCS-2BE)
1804AC_RUN_IFELSE(
1805 [AC_LANG_PROGRAM([
1806#if HAVE_ICONV_H
1807#include <iconv.h>
1808#endif
1809 ], [
1810 return iconv_open("UTF-8","UCS-2BE")==(iconv_t)(-1);
1811 ])
1812 ],
1813 [ AC_MSG_RESULT(yes)
1814 AC_DEFINE(HAVE_ICONV_UCS_2BE, 1, Define to 1 if iconv supports UCS-2BE)
1815 valid_ucs2_code="UCS-2BE"
1816 ],
1817 [ AC_MSG_RESULT(no) ],
1818 [ AC_MSG_RESULT(no) ]
1819)
1820
6e17f325
VK
1821AC_MSG_CHECKING(whether iconv supports UCS-2LE)
1822AC_RUN_IFELSE(
1823 [AC_LANG_PROGRAM([
1824#if HAVE_ICONV_H
1825#include <iconv.h>
1826#endif
1827 ], [
1828 return iconv_open("UTF-8","UCS-2LE")==(iconv_t)(-1);
1829 ])
1830 ],
1831 [ AC_MSG_RESULT(yes)
1832 AC_DEFINE(HAVE_ICONV_UCS_2LE, 1, Define to 1 if iconv supports UCS-2LE)
1833 valid_ucs2_code="UCS-2LE"
1834 ],
1835 [ AC_MSG_RESULT(no) ],
1836 [ AC_MSG_RESULT(no) ]
1837)
1838
4a4e1feb
VK
1839AC_MSG_CHECKING(whether iconv supports UTF-16)
1840AC_RUN_IFELSE(
1841 [AC_LANG_PROGRAM([
1842#if HAVE_ICONV_H
1843#include <iconv.h>
1844#endif
1845 ], [
1846 return iconv_open("UTF-8","UTF-16")==(iconv_t)(-1);
1847 ])
1848 ],
1849 [ AC_MSG_RESULT(yes)
1850 AC_DEFINE(HAVE_ICONV_UTF_16, 1, Define to 1 if iconv supports UTF-16)
1851 valid_ucs2_code="UTF-16"
1852 ],
1853 [ AC_MSG_RESULT(no) ],
1854 [ AC_MSG_RESULT(no) ]
1855)
1856
8b86c5dc
VK
1857AC_MSG_CHECKING(whether iconv supports UCS-4-INTERNAL)
1858AC_RUN_IFELSE(
1859 [AC_LANG_PROGRAM([
1860#if HAVE_ICONV_H
1861#include <iconv.h>
1862#endif
1863 ], [
1864 return iconv_open("UTF-8","UCS-4-INTERNAL")==(iconv_t)(-1);
1865 ])
1866 ],
1867 [ AC_MSG_RESULT(yes)
1868 AC_DEFINE(HAVE_ICONV_UCS_4_INTERNAL, 1, Define to 1 if iconv supports UCS-4-INTERNAL)
1869 valid_ucs4_code="UCS-4-INTERNAL"
1870 ],
1871 [ AC_MSG_RESULT(no) ],
1872 [ AC_MSG_RESULT(no) ]
1873)
1874
1875AC_MSG_CHECKING(whether iconv supports UCS-4)
1876AC_RUN_IFELSE(
1877 [AC_LANG_PROGRAM([
1878#if HAVE_ICONV_H
1879#include <iconv.h>
1880#endif
1881 ], [
1882 return iconv_open("UTF-8","UCS-4")==(iconv_t)(-1);
1883 ])
1884 ],
1885 [ AC_MSG_RESULT(yes)
1886 AC_DEFINE(HAVE_ICONV_UCS_4, 1, Define to 1 if iconv supports UCS-4)
1887 valid_ucs4_code="UCS-4"
1888 ],
1889 [ AC_MSG_RESULT(no) ],
1890 [ AC_MSG_RESULT(no) ]
1891)
1892
1893AC_MSG_CHECKING(whether iconv supports UCS4)
1894AC_RUN_IFELSE(
1895 [AC_LANG_PROGRAM([
1896#if HAVE_ICONV_H
1897#include <iconv.h>
1898#endif
1899 ], [
1900 return iconv_open("UTF-8","UCS4")==(iconv_t)(-1);
1901 ])
1902 ],
1903 [ AC_MSG_RESULT(yes)
1904 AC_DEFINE(HAVE_ICONV_UCS4, 1, Define to 1 if iconv supports UCS4)
1905 valid_ucs4_code="UCS4"
1906 ],
1907 [ AC_MSG_RESULT(no) ],
1908 [ AC_MSG_RESULT(no) ]
1909)
1910
1911AC_MSG_CHECKING(whether iconv supports UCS-4BE)
1912AC_RUN_IFELSE(
1913 [AC_LANG_PROGRAM([
1914#if HAVE_ICONV_H
1915#include <iconv.h>
1916#endif
1917 ], [
1918 return iconv_open("UTF-8","UCS-4BE")==(iconv_t)(-1);
1919 ])
1920 ],
1921 [ AC_MSG_RESULT(yes)
1922 AC_DEFINE(HAVE_ICONV_UCS_4BE, 1, Define to 1 if iconv supports UCS-4BE)
1923 valid_ucs4_code="UCS-4BE"
1924 ],
1925 [ AC_MSG_RESULT(no) ],
1926 [ AC_MSG_RESULT(no) ]
1927)
1928
6e17f325
VK
1929AC_MSG_CHECKING(whether iconv supports UCS-4LE)
1930AC_RUN_IFELSE(
1931 [AC_LANG_PROGRAM([
1932#if HAVE_ICONV_H
1933#include <iconv.h>
1934#endif
1935 ], [
1936 return iconv_open("UTF-8","UCS-4LE")==(iconv_t)(-1);
1937 ])
1938 ],
1939 [ AC_MSG_RESULT(yes)
1940 AC_DEFINE(HAVE_ICONV_UCS_4LE, 1, Define to 1 if iconv supports UCS-4LE)
1941 valid_ucs4_code="UCS-4LE"
1942 ],
1943 [ AC_MSG_RESULT(no) ],
1944 [ AC_MSG_RESULT(no) ]
1945)
1946
4a4e1feb
VK
1947AC_MSG_CHECKING(whether iconv supports UTF-32)
1948AC_RUN_IFELSE(
1949 [AC_LANG_PROGRAM([
1950#if HAVE_ICONV_H
1951#include <iconv.h>
1952#endif
1953 ], [
1954 return iconv_open("UTF-8","UTF-32")==(iconv_t)(-1);
1955 ])
1956 ],
1957 [ AC_MSG_RESULT(yes)
1958 AC_DEFINE(HAVE_ICONV_UTF_32, 1, Define to 1 if iconv supports UTF-32)
1959 valid_ucs4_code="UTF-32"
1960 ],
1961 [ AC_MSG_RESULT(no) ],
1962 [ AC_MSG_RESULT(no) ]
1963)
1964
93571e7f
VK
1965AC_MSG_CHECKING(whether iconv supports //IGNORE)
1966AC_RUN_IFELSE(
1967 [AC_LANG_PROGRAM([
1968#if HAVE_ICONV_H
1969#include <iconv.h>
1970#endif
1971 ], [
1972 return iconv_open("UTF-8//IGNORE","$valid_ucs2_code")==(iconv_t)(-1);
1973 ])
1974 ],
1975 [ AC_MSG_RESULT(yes)
1976 AC_DEFINE(HAVE_ICONV_IGNORE, 1, Define to 1 if iconv supports //IGNORE option)
1977 ],
1978 [ AC_MSG_RESULT(no) ],
1979 [ AC_MSG_RESULT(no) ]
1980)
3e39fcde 1981
19619a35
AK
1982# taken from ZSH's configure
1983# Check if iconv uses const in prototype declaration
24b1570c 1984if test "x$ac_found_iconv" = "xyes"; then
53c96e2d 1985 AC_LANG_PUSH([C++])
19619a35 1986 AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const,
7f9423af
VK
1987 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1988#include <stdlib.h>
f6a2136d 1989#if HAVE_ICONV_H
7f9423af 1990#include <iconv.h>
f6a2136d 1991#endif
f6a2136d
VK
1992 ]],
1993 [[
3e51d371
VK
1994 char **p = NULL;
1995 iconv(0, (const char **)p, 0, 0, 0);
7f9423af 1996 ]])],
3e51d371
VK
1997 [ac_cv_iconv_const=const],
1998 [ac_cv_iconv_const=])])
53c96e2d 1999 AC_LANG_POP([C++])
19619a35
AK
2000 AC_DEFINE_UNQUOTED([ICONV_CONST], $ac_cv_iconv_const,
2001 [Define as const if the declaration of iconv() needs const.])
2002fi
2003
a67fa146
VK
2004if test "x$ac_cv_type_wchar_t" = "xyes"; then
2005 if test $ac_cv_sizeof_wchar_t -eq 2; then
2006 AC_DEFINE(UNICODE_UCS2, 1, Define to 1 if you have 2-byte wchar_t)
2007 fi
8b86c5dc 2008
a67fa146
VK
2009 if test $ac_cv_sizeof_wchar_t -eq 4; then
2010 AC_DEFINE(UNICODE_UCS4, 1, Define to 1 if you have 4-byte wchar_t)
2011 fi
2012
2013 if test "x$USE_INTERNAL_LIBTRE" = "xyes"; then
2014 AC_DEFINE(TRE_WCHAR, 1, [ Define to enable wide character support in libtre.])
2015 fi
2016else
2017 if test "x$BUILD_UNICODE" = "xyes"; then
2018 AC_MSG_ERROR(wchar_t is required for UNICODE build)
2019 fi
8b86c5dc
VK
2020fi
2021
c29360a9 2022
ef0c727b 2023#--------------------------------------------------------------------
ca0f4ea3
VK
2024# MySQL
2025#--------------------------------------------------------------------
2026
2027check_substr "$COMPONENTS" "mysql"
2028if test $? = 0; then
6fce76d8 2029 AC_CHECK_LIB(mysqlclient, mysql_init, [MYSQL_LIBS="-lmysqlclient"],
ca0f4ea3 2030 [AC_MSG_ERROR(libmysqlclient is requred for MySQL support)])
aa7794f0 2031
8d131dda
VK
2032 OLD_LIBS="$LIBS"
2033 LIBS="$LIBS $MYSQL_LIBS"
aa7794f0 2034
9c29f76e
VK
2035 AC_MSG_CHECKING(whether mysql clients can run)
2036 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2037#include <stdio.h>
2038#include <mysql.h>
2039int main(void)
2040{
2041 MYSQL *a = mysql_init(NULL);
2042 return 0;
2043}
2044 ]])],[],[
2045 AC_MSG_RESULT(no)
2046 AC_MSG_ERROR(Your MySQL client libraries aren't properly installed)
2047 ],[])
ca0f4ea3 2048 AC_MSG_RESULT(yes)
6fce76d8 2049
ca0f4ea3 2050 AC_CHECK_FUNCS(mysql_real_escape_string)
8d131dda 2051 LIBS="$OLD_LIBS"
ca0f4ea3
VK
2052fi
2053
2054
2055#--------------------------------------------------------------------
58ed4897
VK
2056# PostgreSQL
2057#--------------------------------------------------------------------
2058
203458b7 2059check_substr "$COMPONENTS" "pgsql"
58ed4897
VK
2060if test $? = 0; then
2061 AC_CHECK_LIB(m, floor)
6fce76d8 2062 AC_CHECK_LIB(pq, PQconnectdb, [PGSQL_LIBS="-lpq"],
58ed4897 2063 [AC_MSG_ERROR(libpq is required for PostgreSQL support)])
6fce76d8
VK
2064
2065 AC_MSG_CHECKING(whether postgresql clients can run)
8d131dda
VK
2066 OLD_LIBS="$LIBS"
2067 LIBS="$LIBS $PGSQL_LIBS"
6fce76d8
VK
2068 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2069 #include <stdio.h>
2070 #include <libpq-fe.h>
2071 int main(void)
2072 {
2073 PGconn *a = PQconnectdb("");
2074 return 0;
2075 }
2076 ]])],[AC_MSG_RESULT(yes)],[
58ed4897
VK
2077 AC_MSG_RESULT(no)
2078 AC_MSG_ERROR(Your PostgreSQL client libraries aren't properly installed)
2079 ],[])
8d131dda 2080 LIBS="$OLD_LIBS"
7070538d 2081 AC_CHECK_LIB(pq, PQfformat, [ AC_DEFINE(HAVE_PQFFORMAT, 1, PQfformat not exist in 7.3) ])
58ed4897
VK
2082fi
2083
2084
2085#--------------------------------------------------------------------
9c29f76e
VK
2086# ODBC
2087#--------------------------------------------------------------------
2088
2089check_substr "$COMPONENTS" "odbc"
2090if test $? = 0; then
6fce76d8 2091 AC_CHECK_LIB(odbc, SQLAllocHandle, [ODBC_LIBS="-lodbc"],
9c29f76e 2092 [AC_MSG_ERROR(libodbc is required for ODBC support)])
60a1159a
VK
2093 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2094 SUBAGENT_LIBS="$SUBAGENT_LIBS $ODBC_LIBS"
2095 AC_CHECK_LIB(ltdl, lt_dlopen, [SUBAGENT_LIBS="$SUBAGENT_LIBS -lltdl"], [])
2096 fi
9c29f76e
VK
2097fi
2098
2099
2100#--------------------------------------------------------------------
41b4790d
VK
2101# Oracle
2102#--------------------------------------------------------------------
2103
2104check_substr "$COMPONENTS" "oracle"
2105if test $? = 0; then
2106 AC_CHECK_HEADER(oci.h,,AC_MSG_ERROR([*** Cannot find oci.h - check your Oracle client installation ***]))
7d8c91ef
VK
2107 AC_CHECK_LIB(nnz11, nzstrcpy, [NNZ_LIB=-lnnz11],
2108 [
2109 AC_CHECK_LIB(nnz10, nzstrcpy, [NNZ_LIB=-lnnz10], [], [-lclntsh])
2110 ], [-lclntsh])
2111 AC_CHECK_LIB(clntsh, OCIHandleAlloc, [ORACLE_LIBS="-lclntsh $NNZ_LIB"],
2112 [AC_MSG_ERROR(libclntsh is required for Oracle support)], [$NNZ_LIB])
045845e5 2113 AC_CHECK_LIB(rt, sem_destroy, [ORACLE_LIBS="$ORACLE_LIBS -lrt"], [])
60a1159a
VK
2114 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2115 SUBAGENT_LIBS="$SUBAGENT_LIBS $ORACLE_LIBS"
2116 fi
41b4790d
VK
2117fi
2118
84277a0f
AK
2119#--------------------------------------------------------------------
2120# DB2
2121#--------------------------------------------------------------------
2122
2123check_substr "$COMPONENTS" "db2"
2124if test $? = 0; then
2125 AC_CHECK_HEADER(sql.h,,AC_MSG_ERROR([*** Cannot find sql.h - check your DB2 client installation ***]))
2126 AC_CHECK_LIB(db2, SQLAllocHandle, [DB2_LIBS="-ldb2"],
2127 [AC_MSG_ERROR(libdb2 is required for DB2 support)])
6afe141e 2128 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2129 SUBAGENT_LIBS="$SUBAGENT_LIBS $DB2_LIBS"
2130 fi
84277a0f 2131fi
41b4790d
VK
2132
2133#--------------------------------------------------------------------
37861c72
VK
2134# Informix
2135#--------------------------------------------------------------------
2136
2137check_substr "$COMPONENTS" "informix"
2138if test $? = 0; then
2139 AC_CHECK_HEADER(infxcli.h,,AC_MSG_ERROR([*** Cannot find infxcli.h - check your Informix client installation ***]))
4f2e8e9b
VK
2140 AC_CHECK_LIB(thcli, SQLAllocHandle, [INFORMIX_LIBS="-lthcli"],
2141 [AC_MSG_ERROR(libthcli is required for Informix support)])
60a1159a
VK
2142 if test "x$BUILD_STATIC_AGENT" = "xyes"; then
2143 SUBAGENT_LIBS="$SUBAGENT_LIBS $INFORMIX_LIBS"
2144 fi
37861c72
VK
2145fi
2146
c3cfc039
VK
2147
2148#--------------------------------------------------------------------
50e4bc8c
VK
2149# Java
2150#--------------------------------------------------------------------
2151
2152check_substr "$COMPONENTS" "java"
2153if test $? = 0; then
2154 AC_CHECK_HEADER(jni.h,,AC_MSG_ERROR([*** Cannot find jni.h - check your JDK installation ***]))
2155# AC_CHECK_LIB(jvm, SQLAllocHandle, [JAVA_LIBS="-ljvm"],
2156# [AC_MSG_ERROR(libjvm is required for Java support)])
2157fi
2158
2159
2160#--------------------------------------------------------------------
ca0f4ea3
VK
2161# Other settings
2162#--------------------------------------------------------------------
2163
a5a95ac8
VK
2164if test "x$RUNTIME_PREFIX" = "x"; then
2165 if test "x${BUILD_UNICODE}" = "xyes"; then
2166 CPPFLAGS="$CPPFLAGS -DPREFIX=L\\\"\${prefix}\\\" -DDATADIR=L\\\"\${pkgdatadir}\\\" -DBINDIR=L\\\"\${bindir}\\\" -DLIBDIR=L\\\"\${libdir}\\\" -DPKGLIBDIR=L\\\"\${pkglibdir}\\\""
2167 else
2168 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"\${prefix}\\\" -DDATADIR=\\\"\${pkgdatadir}\\\" -DBINDIR=\\\"\${bindir}\\\" -DLIBDIR=\\\"\${libdir}\\\" -DPKGLIBDIR=\\\"\${pkglibdir}\\\""
2169 fi
b07c50cc 2170else
a5a95ac8
VK
2171 if test "x${BUILD_UNICODE}" = "xyes"; then
2172 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\\\""
2173 else
2174 CPPFLAGS="$CPPFLAGS -DPREFIX=\\\"$RUNTIME_PREFIX\\\" -DDATADIR=\\\"$RUNTIME_PREFIX/share/netxms\\\" -DBINDIR=\\\"$RUNTIME_PREFIX/bin\\\" -DLIBDIR=\\\"$RUNTIME_PREFIX/lib\\\" -DPKGLIBDIR=\\\"$RUNTIME_PREFIX/lib/netxms\\\""
2175 fi
b07c50cc 2176fi
545bda2d 2177LDFLAGS="$LDFLAGS_PREFIX $LDFLAGS $LDFLAGS_SUFFIX"
ca0f4ea3 2178
25ae8377
VK
2179if test "x${ENABLE_WERROR}" = "xyes"; then
2180 CPPFLAGS="$CPPFLAGS -Werror"
2181fi
2182
2b479c92
VK
2183if test "x$shrext_cmds" != "x"; then
2184 AC_DEFINE_UNQUOTED([SHLIB_SUFFIX], _T("$shrext_cmds"), [Define to platform's shared library suffix])
2185fi
2186
551ec9ca 2187AM_CONDITIONAL([USE_INTERNAL_EXPAT], [test "x$HAVE_LIBEXPAT" = "xno"])
17b35ccc 2188AM_CONDITIONAL([USE_INTERNAL_LIBTRE], [test "x$HAVE_LIBTRE" = "xno"])
1fd41bcd 2189AM_CONDITIONAL([USE_INTERNAL_ZLIB], [test "$NEED_ZLIB/$HAVE_ZLIB" = "yes/no"])
c1165d33
VK
2190AM_CONDITIONAL([STATIC_BUILD], [test "x$STATIC_BUILD" = "xyes"])
2191AM_CONDITIONAL([ALL_STATIC], [test "x$ALL_STATIC" = "xyes"])
eca43970 2192AM_CONDITIONAL([USE_ENCRYPTION], [test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"])
6dde8627 2193AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
8b86c5dc 2194
ca0f4ea3
VK
2195
2196#--------------------------------------------------------------------
ef0c727b
VK
2197# Substitute variables
2198#--------------------------------------------------------------------
82fa7c5d 2199
ef0c727b
VK
2200AC_SUBST(DB_DRIVERS)
2201AC_SUBST(MODULES)
2202AC_SUBST(SUBAGENT_DIRS)
7dda4453 2203AC_SUBST(SERVER_INCLUDE)
7c48e2aa 2204AC_SUBST(SERVER_LIBS)
ef0c727b
VK
2205AC_SUBST(SERVER_TOOLS)
2206AC_SUBST(TOP_LEVEL_MODULES)
2207AC_SUBST(CONTRIB_MODULES)
c2612d83 2208AC_SUBST(CLIENT_COMPONENTS)
ef0c727b
VK
2209AC_SUBST(STATIC_SUBAGENT_LIST)
2210AC_SUBST(SUBAGENT_LIBS)
2211AC_SUBST(BUILD_SERVER)
447350a9 2212AC_SUBST(BUILD_SDK)
6fce76d8
VK
2213AC_SUBST(MYSQL_LIBS)
2214AC_SUBST(PGSQL_LIBS)
7d8c91ef 2215AC_SUBST(ORACLE_LIBS)
6fce76d8 2216AC_SUBST(ODBC_LIBS)
84277a0f 2217AC_SUBST(DB2_LIBS)
87f1fff0 2218AC_SUBST(INFORMIX_LIBS)
11ce9a66 2219AC_SUBST(OBJECT_MODE)
9113e749 2220AC_SUBST(SQLFLAGS)
2b479c92 2221AC_SUBST(SHLIB_SUFFIX, $shrext_cmds)
d16cf8a5 2222
ef0c727b
VK
2223#--------------------------------------------------------------------
2224# Shared libs versions
d16cf8a5
AK
2225#
2226# versioning scheme: current:revision:age
2227#
2228# current
2229# The number of the current interface exported by the library. A current
2230# value of `0', means that you are calling the interface exported by this
2231# library interface 0.
2232#
2233# revision
2234# The implementation number of the most recent interface exported by this
2235# library. In this case, a revision value of `0' means that this is the
2236# first implementation of the interface.
2237# If the next release of this library exports the same interface, but has a
2238# different implementation (perhaps some bugs have been fixed), the revision
2239# number will be higher, but current number will be the same. In that case,
2240# when given a choice, the library with the highest revision will always
2241# be used by the runtime loader.
2242#
2243# age
2244# The number of previous additional interfaces supported by this library.
2245# If age were `2', then this library can be linked into executables which
2246# were built with a release of this library that exported the current
2247# interface number, current, or any of the previous two interfaces.
2248# By definition age must be less than or equal to current. At the outset,
2249# only the first ever interface is implemented, so age can only be `0'.
ef0c727b 2250#--------------------------------------------------------------------
d16cf8a5 2251
17b35ccc 2252NETXMS_LIBRARY_VERSION=1:0:0
c7d14846 2253AC_SUBST(NETXMS_LIBRARY_VERSION)
d16cf8a5 2254
ef0c727b
VK
2255#--------------------------------------------------------------------
2256# Generate output files
2257#--------------------------------------------------------------------
d16cf8a5
AK
2258
2259AC_CONFIG_FILES([
0c3c0c39
AK
2260 Makefile
2261 contrib/Makefile
36874eca
VK
2262 contrib/backgrounds/Makefile
2263 contrib/integration/Makefile
2264 contrib/integration/HP_EVA/Makefile
bad6cc0c 2265 contrib/integration/HP_P2000/Makefile
36874eca 2266 contrib/mibs/Makefile
0c3c0c39 2267 contrib/startup/Makefile
fa66d60c 2268 contrib/startup/debian/Makefile
daaefaaf 2269 contrib/startup/gentoo/Makefile
7483d0bf 2270 contrib/startup/hp-ux/Makefile
0c3c0c39 2271 contrib/startup/redhat/Makefile
5de3893d 2272 contrib/startup/suse/Makefile
9993edf4 2273 contrib/startup/ubuntu/Makefile
6adf3219 2274 contrib/startup/solaris/Makefile
0c3c0c39 2275 doc/Makefile
a48203d2
VK
2276 doc/internal/Makefile
2277 doc/manuals/Makefile
2278 doc/misc/Makefile
0c3c0c39
AK
2279 images/Makefile
2280 include/Makefile
2281 m4/Makefile
0c3c0c39 2282 src/Makefile
9191f6ad 2283 src/agent/Makefile
6ac698ed 2284 src/agent/appagent/Makefile
9191f6ad
VK
2285 src/agent/core/Makefile
2286 src/agent/install/Makefile
a2a24e9d 2287 src/agent/libnxsd/Makefile
9191f6ad 2288 src/agent/subagents/Makefile
9191f6ad 2289 src/agent/subagents/aix/Makefile
df8b3df7 2290 src/agent/subagents/darwin/Makefile
80e96a82 2291 src/agent/subagents/ecs/Makefile
9191f6ad 2292 src/agent/subagents/freebsd/Makefile
80e96a82
VK
2293 src/agent/subagents/hpux/Makefile
2294 src/agent/subagents/informix/Makefile
9191f6ad 2295 src/agent/subagents/ipso/Makefile
50e4bc8c
VK
2296 src/agent/subagents/java/Makefile
2297 src/agent/subagents/java/java/Makefile
2298 src/agent/subagents/java/java/src/Makefile
2299 src/agent/subagents/java/java/src/main/Makefile
2300 src/agent/subagents/java/java/src/main/java/Makefile
2301 src/agent/subagents/java/java/src/main/java/org/Makefile
2302 src/agent/subagents/java/java/src/main/java/org/netxms/Makefile
2303 src/agent/subagents/java/java/src/main/java/org/netxms/agent/Makefile
80e96a82 2304 src/agent/subagents/linux/Makefile
df8b3df7 2305 src/agent/subagents/lmsensors/Makefile
80e96a82
VK
2306 src/agent/subagents/logwatch/Makefile
2307 src/agent/subagents/netbsd/Makefile
df8b3df7 2308 src/agent/subagents/netsvc/Makefile
80e96a82
VK
2309 src/agent/subagents/odbcquery/Makefile
2310 src/agent/subagents/openbsd/Makefile
4d1753cd 2311 src/agent/subagents/oracle/Makefile
9191f6ad 2312 src/agent/subagents/ping/Makefile
80e96a82 2313 src/agent/subagents/portCheck/Makefile
df8b3df7 2314 src/agent/subagents/rpi/Makefile
9191f6ad 2315 src/agent/subagents/sms/Makefile
80e96a82 2316 src/agent/subagents/sunos/Makefile
9191f6ad 2317 src/agent/subagents/ups/Makefile
80e96a82
VK
2318 src/agent/subagents/winnt/Makefile
2319 src/agent/subagents/winperf/Makefile
a7a03ffd
VK
2320 src/agent/subagents/wmi/Makefile
2321 src/agent/subagents/db2/Makefile
0bd64860 2322 src/agent/tools/Makefile
6ac698ed 2323 src/agent/tools/nxappget/Makefile
0bd64860 2324 src/agent/tools/nxapush/Makefile
c2612d83 2325 src/client/Makefile
551592f4 2326 src/client/install/Makefile
c94fa5c2 2327 src/client/nxalarm/Makefile
e84701c5 2328 src/client/nxevent/Makefile
9cb6c12f 2329 src/client/nxlexer/Makefile
e84701c5 2330 src/client/nxpush/Makefile
59ffa5b7 2331 src/client/nxsms/Makefile
9cb6c12f
VK
2332 src/client/scilexer/Makefile
2333 src/client/windows/Makefile
2334 src/client/windows/nxav/Makefile
2335 src/client/windows/nxav/res/Makefile
23c8c53e
AK
2336 src/client/windows/nxcon/Makefile
2337 src/client/windows/nxcon/icons/Makefile
2338 src/client/windows/nxcon/res/Makefile
23c8c53e
AK
2339 src/client/windows/nxnotify/Makefile
2340 src/client/windows/nxnotify/res/Makefile
9cb6c12f
VK
2341 src/client/windows/nxuilib/Makefile
2342 src/client/windows/nxuilib/res/Makefile
2343 src/client/windows/nxuilib/sounds/Makefile
d1834406
VK
2344 src/db/Makefile
2345 src/db/dbdrv/Makefile
87f1fff0
VK
2346 src/db/dbdrv/db2/Makefile
2347 src/db/dbdrv/informix/Makefile
d1834406
VK
2348 src/db/dbdrv/odbc/Makefile
2349 src/db/dbdrv/mssql/Makefile
2350 src/db/dbdrv/mysql/Makefile
87f1fff0 2351 src/db/dbdrv/oracle/Makefile
d1834406
VK
2352 src/db/dbdrv/pgsql/Makefile
2353 src/db/dbdrv/sqlite/Makefile
d1834406 2354 src/db/libnxdb/Makefile
9191f6ad
VK
2355 src/install/Makefile
2356 src/install/windows/Makefile
2357 src/libexpat/Makefile
2358 src/libexpat/libexpat/Makefile
2359 src/libnetxms/Makefile
2360 src/libnxcl/Makefile
2361 src/libnxlp/Makefile
2362 src/libnxmap/Makefile
2363 src/libnxsl/Makefile
a67fa146
VK
2364 src/libtre/Makefile
2365 src/libtre/win32/Makefile
a7a03ffd 2366 src/nxcproxy/Makefile
9191f6ad 2367 src/nxscript/Makefile
0c3c0c39
AK
2368 src/server/Makefile
2369 src/server/core/Makefile
644f97f5 2370 src/server/drivers/Makefile
0239cfea 2371 src/server/drivers/at/Makefile
644f97f5 2372 src/server/drivers/baystack/Makefile
b1bd1fb2 2373 src/server/drivers/cat2900xl/Makefile
910846cc 2374 src/server/drivers/catalyst/Makefile
fce03ab9 2375 src/server/drivers/cisco-esw/Makefile
8bdfaed8 2376 src/server/drivers/dell-pwc/Makefile
a548def4 2377 src/server/drivers/dlink/Makefile
644f97f5 2378 src/server/drivers/ers8000/Makefile
4e592faf
VK
2379 src/server/drivers/lib/Makefile
2380 src/server/drivers/lib/avaya-ers/Makefile
b1bd1fb2 2381 src/server/drivers/lib/cisco/Makefile
81ecaf38 2382 src/server/drivers/netscreen/Makefile
e10e890e 2383 src/server/drivers/ntws/Makefile
c183a9f9 2384 src/server/drivers/ping3/Makefile
9b13553b 2385 src/server/drivers/procurve/Makefile
217e4d6a 2386 src/server/drivers/symbol-ws/Makefile
d770a97c
VK
2387 src/server/include/Makefile
2388 src/server/libnxsrv/Makefile
2389 src/server/netxmsd/Makefile
d8f2e39b
VK
2390 src/server/smsdrv/Makefile
2391 src/server/smsdrv/generic/Makefile
91369aca 2392 src/server/smsdrv/nxagent/Makefile
aab8a8b6 2393 src/server/smsdrv/portech/Makefile
80a30c53 2394 src/server/smsdrv/dummy/Makefile
0c3c0c39 2395 src/server/tools/Makefile
0c3c0c39
AK
2396 src/server/tools/nxaction/Makefile
2397 src/server/tools/nxadm/Makefile
9191f6ad 2398 src/server/tools/nxap/Makefile
5b0c7d0d
VK
2399 src/server/tools/nxconfig/Makefile
2400 src/server/tools/nxconfig/res/Makefile
f90d7fc5 2401 src/server/tools/nxdbmgr/Makefile
9191f6ad 2402 src/server/tools/nxget/Makefile
d24fdaf4 2403 src/server/tools/nxupload/Makefile
c5c0f362
VK
2404 src/snmp/Makefile
2405 src/snmp/libnxsnmp/Makefile
2406 src/snmp/nxmibc/Makefile
2407 src/snmp/nxsnmpget/Makefile
2408 src/snmp/nxsnmpset/Makefile
2409 src/snmp/nxsnmpwalk/Makefile
9191f6ad 2410 src/sqlite/Makefile
f65df2b1 2411 src/tools/Makefile
f65df2b1 2412 src/tools/nxdevcfg/Makefile
56e13b13 2413 src/tools/nxencpasswd/Makefile
1fd41bcd 2414 src/zlib/Makefile
9191f6ad 2415 sql/Makefile
0c3c0c39 2416 tools/Makefile
d16cf8a5
AK
2417])
2418
12249937
VK
2419AC_OUTPUT
2420
ef0c727b 2421echo "Updating libtool"
5cecf50e
AK
2422sed 's,$SED -e "/${host}-//g",$SED -e "s/${host}-//g",g' < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2423
779ce551 2424# On HP-UX, libtool passes +b instead of -Wl,+b even if gcc/g++ used as linker
5482ef16 2425if test "x$ac_compiler_gnu" = "xyes" && test "x$PLATFORM" = "xHP-UX"; then
779ce551
VK
2426 sed "s,hardcode_libdir_flag_spec_ld=,#hardcode_libdir_flag_spec_ld=,g" < ./libtool > libtool.new && mv libtool.new libtool && chmod +x ./libtool
2427fi
2428
b677ef59
VK
2429# On AIX, correct OBJECT_MODE must be set before linking
2430# To avoid manual setting by user, we add this to libtool script
2431if test "x$PLATFORM" = "xAIX"; then
2432 head -n 1 ./libtool > ./libtool.new
2433 echo "export OBJECT_MODE=$OBJECT_MODE" >> ./libtool.new
2434 tail -n +2 ./libtool >> ./libtool.new
2435 mv libtool.new libtool
2436 chmod +x ./libtool
2437fi
2438
ef0c727b
VK
2439#--------------------------------------------------------------------
2440# Print summary
2441#--------------------------------------------------------------------
a7442678 2442
a7442678
AK
2443echo
2444echo
2445echo
2446echo '---------------------------------------------------------------------'
2447echo ' Configure results'
2448echo '---------------------------------------------------------------------'
2449echo
8b86c5dc 2450 echo "Prefix : ${prefix}"
a7442678 2451if test "x${BUILD_SERVER}" = "xyes"; then
8b86c5dc 2452 echo "Build Server : YES"
7c48e2aa 2453 echo "Server libs : ${SERVER_LIBS}"
a7442678 2454else
8b86c5dc 2455 echo "Build Server : NO"
a7442678
AK
2456fi
2457if test "x${ac_cv_lib_crypto_RSA_new}" = "xyes"; then
8b86c5dc 2458 echo "Encryption enabled : YES"
a7442678 2459else
8b86c5dc 2460 echo "Encryption enabled : NO"
a7442678
AK
2461fi
2462if test "x${DB_DRIVERS}" != "x"; then
8b86c5dc 2463 echo "Build DB-Drivers :${DB_DRIVERS}"
a7442678 2464else
8b86c5dc 2465 echo "Build DB-Drivers : NO"
a7442678
AK
2466fi
2467if test "x${BUILD_CLIENT}" = "xyes"; then
8b86c5dc 2468 echo "Build Clients : YES"
a7442678 2469else
8b86c5dc 2470 echo "Build Clients : NO"
a7442678
AK
2471fi
2472if test "x${BUILD_AGENT}" = "xyes"; then
8b86c5dc
VK
2473 echo "Build Agent : YES"
2474 echo "Subagents list : ${SUBAGENT_DIRS}"
a7442678 2475else
8b86c5dc 2476 echo "Build Agent : NO"
a7442678 2477fi
e8636669 2478if test "x${BUILD_STATIC_AGENT}" = "xyes"; then
8b86c5dc
VK
2479 echo "Build Static Agent : YES"
2480 echo "Subagents list : ${STATIC_SUBAGENT_LIST}"
e8636669 2481else
8b86c5dc 2482 echo "Build Static Agent : NO"
e8636669 2483fi
8b86c5dc 2484if test "x${BUILD_UNICODE}" = "xyes"; then
a67fa146 2485 echo "UNICODE build : YES"
8b86c5dc 2486else
a67fa146 2487 echo "UNICODE build : NO"
8b86c5dc 2488fi
551ec9ca
VK
2489if test "x${HAVE_LIBEXPAT}" = "xno"; then
2490 echo "Use internal libexpat : YES"
1bb6b449 2491else
551ec9ca 2492 echo "Use internal libexpat : NO"
1bb6b449 2493fi
17b35ccc
VK
2494if test "x${HAVE_LIBTRE}" = "xno"; then
2495 echo "Use internal libtre : YES"
2496else
2497 echo "Use internal libtre : NO"
2498fi
1fd41bcd
VK
2499if test "x${NEED_ZLIB}" = "xyes"; then
2500 if test "x${HAVE_ZLIB}" = "xno"; then
2501 echo "Use internal zlib : YES"
2502 else
2503 echo "Use internal zlib : NO"
2504 fi
2505fi
cc297a70
VK
2506if test "x${FORCE_32BIT_BUILD}" = "xyes"; then
2507 echo "Force 32bit build : YES"
2508else
2509 echo "Force 32bit build : NO"
2510fi
7d8c91ef 2511
9113e749
VK
2512echo "C compiler : ${CC}"
2513echo "C++ compiler : ${CXX}"
7d8c91ef
VK
2514echo "CPPFLAGS : ${CPPFLAGS}"
2515echo "CXXFLAGS : ${CXXFLAGS}"
2516echo "CFLAGS : ${CFLAGS}"
2517echo "LDFLAGS : ${LDFLAGS}"
8d131dda 2518echo "LIBS : ${LIBS}"
7d8c91ef 2519
6fce76d8
VK
2520if test "x${MYSQL_LIBS}" != "x"; then
2521 echo "MySQL libs : ${MYSQL_LIBS}"
2522fi
2523if test "x${PGSQL_LIBS}" != "x"; then
2524 echo "PostgreSQL libs : ${PGSQL_LIBS}"
2525fi
7d8c91ef
VK
2526if test "x${ORACLE_LIBS}" != "x"; then
2527 echo "Oracle libs : ${ORACLE_LIBS}"
2528fi
6fce76d8
VK
2529if test "x${ODBC_LIBS}" != "x"; then
2530 echo "ODBC libs : ${ODBC_LIBS}"
2531fi
84277a0f
AK
2532if test "x${DB2_LIBS}" != "x"; then
2533 echo "DB2 libs : ${DB2_LIBS}"
2534fi
37861c72
VK
2535if test "x${INFORMIX_LIBS}" != "x"; then
2536 echo "Informix libs : ${INFORMIX_LIBS}"
2537fi
ecbed20c
VK
2538
2539FLAGS_CPP="src/tools/nxdevcfg/flags.cpp"
2540echo "/* Automatically generated by configure */" > $FLAGS_CPP
d541b129
VK
2541echo "#include <nms_common.h>" >> $FLAGS_CPP
2542echo "const TCHAR *g_cppFlags = _T(\"${CPPFLAGS}\");" >> $FLAGS_CPP
2543echo "const TCHAR *g_cFlags = _T(\"${CFLAGS}\");" >> $FLAGS_CPP
2544echo "const TCHAR *g_cxxFlags = _T(\"${CXXFLAGS}\");" >> $FLAGS_CPP
2545echo "const TCHAR *g_ldFlags = _T(\"${LDFLAGS}\");" >> $FLAGS_CPP
2546echo "const TCHAR *g_libs = _T(\"${LIBS}\");" >> $FLAGS_CPP
7dda4453
VK
2547echo "const TCHAR *g_cc = _T(\"${CC}\");" >> $FLAGS_CPP
2548echo "const TCHAR *g_cxx = _T(\"${CXX}\");" >> $FLAGS_CPP
2549echo "const TCHAR *g_ld = _T(\"${LD}\");" >> $FLAGS_CPP
2550echo "const TCHAR *g_perl = _T(\"${PERL}\");" >> $FLAGS_CPP