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