]> gcc.gnu.org Git - gcc.git/blob - libjava/aclocal.m4
2004-02-05 Michael Koch <konqueror@gmx.de>
[gcc.git] / libjava / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4-p6
2
3 dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 sinclude(../config/accross.m4)
14
15 AC_DEFUN(LIBGCJ_CONFIGURE,
16 [
17 dnl Default to --enable-multilib
18 AC_ARG_ENABLE(multilib,
19 [ --enable-multilib build many library versions (default)],
20 [case "${enableval}" in
21 yes) multilib=yes ;;
22 no) multilib=no ;;
23 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
24 esac], [multilib=yes])dnl
25
26 dnl We may get other options which we don't document:
27 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
28
29 # When building with srcdir == objdir, links to the source files will
30 # be created in directories within the target_subdir. We have to
31 # adjust toplevel_srcdir accordingly, so that configure finds
32 # install-sh and other auxiliary files that live in the top-level
33 # source directory.
34 if test "${srcdir}" = "."; then
35 if test -z "${with_target_subdir}"; then
36 toprel=".."
37 else
38 if test "${with_target_subdir}" != "."; then
39 toprel="${with_multisrctop}../.."
40 else
41 toprel="${with_multisrctop}.."
42 fi
43 fi
44 else
45 toprel=".."
46 fi
47
48 libgcj_basedir=$srcdir/$toprel/$1/libjava
49 AC_SUBST(libgcj_basedir)
50
51 AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
52 if :; then :; else
53 # This overrides the previous occurrence for automake, but not for
54 # autoconf, which is exactly what we want.
55 AC_CONFIG_AUX_DIR(..)
56 fi
57
58 # This works around an automake problem.
59 mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
60 AC_SUBST(mkinstalldirs)
61
62 AC_CANONICAL_SYSTEM
63
64 dnl This shouldn't be needed, as long as top-level dependencies are
65 dnl defined correctly and shared-library paths are set up so that
66 dnl execution tests succeed. FIXME.
67 define([AC_PROG_CC_WORKS],[])
68 define([AC_PROG_CXX_WORKS],[])
69
70 AC_PROG_CC
71
72 # We use the libstdc++-v3 version of LIB_AC_PROG_CXX, but use
73 # glibjava_CXX instead of glibcpp_CXX. That's because we're passed a
74 # different definition of CXX than other directories, since we don't
75 # depend on libstdc++-v3 having already been built.
76 AC_DEFUN(LIB_AC_PROG_CXX,
77 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
78 dnl Fool anybody using AC_PROG_CXX.
79 AC_PROVIDE([AC_PROG_CXX])
80 # Use glibjava_CXX so that we do not cause CXX to be cached with the
81 # flags that come in CXX while configuring libjava. They're different
82 # from those used for all other target libraries. If CXX is set in
83 # the environment, respect that here.
84 glibjava_CXX=$CXX
85 AC_CHECK_PROGS(glibjava_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
86 AC_SUBST(CXX)
87 CXX=$glibjava_CXX
88 test -z "$glibjava_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
89
90 AC_PROG_CXX_GNU
91
92 if test $ac_cv_prog_gxx = yes; then
93 GXX=yes
94 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
95 dnl plays around with CXXFLAGS (such as to build both debugging and
96 dnl normal versions of a library), tasteless as that idea is.
97 ac_test_CXXFLAGS="${CXXFLAGS+set}"
98 ac_save_CXXFLAGS="$CXXFLAGS"
99 CXXFLAGS=
100 AC_PROG_CXX_G
101 if test "$ac_test_CXXFLAGS" = set; then
102 CXXFLAGS="$ac_save_CXXFLAGS"
103 elif test $ac_cv_prog_cxx_g = yes; then
104 CXXFLAGS="-g -O2"
105 else
106 CXXFLAGS="-O2"
107 fi
108 else
109 GXX=
110 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
111 fi
112 ])
113
114 LIB_AC_PROG_CXX
115
116 dnl version is pulled out to make it a bit easier to change using sed.
117 version=0.0.7
118 dnl Still use "libjava" here to placate dejagnu.
119 AM_INIT_AUTOMAKE(libjava, $version)
120
121 AC_CHECK_TOOL(AS, as)
122 AC_CHECK_TOOL(AR, ar)
123 AC_CHECK_TOOL(RANLIB, ranlib, :)
124
125 AC_PROG_INSTALL
126
127 AM_MAINTAINER_MODE
128
129 AC_EXEEXT
130
131 # configure.host sets the following important variables
132 # libgcj_cflags - host specific C compiler flags
133 # libgcj_cxxflags - host specific C++ compiler flags
134 # libgcj_javaflags - host specific Java compiler flags
135
136 libgcj_cflags=
137 libgcj_cxxflags=
138 libgcj_javaflags=
139
140 . [$]{srcdir}/configure.host
141
142 LIBGCJ_CFLAGS="[$]{libgcj_cflags}"
143 LIBGCJ_CXXFLAGS="[$]{libgcj_cxxflags}"
144 LIBGCJ_JAVAFLAGS="[$]{libgcj_javaflags}"
145 AC_SUBST(LIBGCJ_CFLAGS)
146 AC_SUBST(LIBGCJ_CXXFLAGS)
147 AC_SUBST(LIBGCJ_JAVAFLAGS)
148 ])dnl
149
150 sinclude(../libtool.m4)
151 dnl The lines below arrange for aclocal not to bring libtool.m4
152 dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
153 dnl to add a definition of LIBTOOL to Makefile.in.
154 ifelse(yes,no,[
155 AC_DEFUN([AM_PROG_LIBTOOL],)
156 AC_DEFUN([AC_LIBTOOL_DLOPEN],)
157 AC_DEFUN([AC_LIBLTDL_CONVENIENCE],)
158 AC_DEFUN([LT_AC_PROG_GCJ],)
159 AC_SUBST(GCJ)
160 AC_SUBST(LIBTOOL)
161 ])
162
163 #serial AM2
164
165 dnl From Bruno Haible.
166
167 AC_DEFUN([AM_ICONV],
168 [
169 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
170 dnl those with the standalone portable GNU libiconv installed).
171
172 am_cv_lib_iconv_ldpath=
173 AC_ARG_WITH([libiconv-prefix],
174 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
175 for dir in `echo "$withval" | tr : ' '`; do
176 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
177 if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
178 done
179 ])
180
181 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
182 am_cv_func_iconv="no, consider installing GNU libiconv"
183 am_cv_lib_iconv=no
184 AC_TRY_LINK([#include <stdlib.h>
185 #include <iconv.h>],
186 [iconv_t cd = iconv_open("","");
187 iconv(cd,NULL,NULL,NULL,NULL);
188 iconv_close(cd);],
189 am_cv_func_iconv=yes)
190 if test "$am_cv_func_iconv" != yes; then
191 am_save_LIBS="$LIBS"
192 LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
193 AC_TRY_LINK([#include <stdlib.h>
194 #include <iconv.h>],
195 [iconv_t cd = iconv_open("","");
196 iconv(cd,NULL,NULL,NULL,NULL);
197 iconv_close(cd);],
198 am_cv_lib_iconv=yes
199 am_cv_func_iconv=yes)
200 LIBS="$am_save_LIBS"
201 fi
202 ])
203 if test "$am_cv_func_iconv" = yes; then
204 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
205 AC_MSG_CHECKING([for iconv declaration])
206 AC_CACHE_VAL(am_cv_proto_iconv, [
207 AC_TRY_COMPILE([
208 #include <stdlib.h>
209 #include <iconv.h>
210 extern
211 #ifdef __cplusplus
212 "C"
213 #endif
214 #if defined(__STDC__) || defined(__cplusplus)
215 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
216 #else
217 size_t iconv();
218 #endif
219 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
220 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
221 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
222 AC_MSG_RESULT([$]{ac_t:-
223 }[$]am_cv_proto_iconv)
224 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
225 [Define as const if the declaration of iconv() needs const.])
226 fi
227 LIBICONV=
228 if test "$am_cv_lib_iconv" = yes; then
229 LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
230 fi
231 AC_SUBST(LIBICONV)
232 ])
233
234 # Check whether LC_MESSAGES is available in <locale.h>.
235 # Ulrich Drepper <drepper@cygnus.com>, 1995.
236 #
237 # This file can be copied and used freely without restrictions. It can
238 # be used in projects which are not available under the GNU General Public
239 # License or the GNU Library General Public License but which still want
240 # to provide support for the GNU gettext functionality.
241 # Please note that the actual code of the GNU gettext library is covered
242 # by the GNU Library General Public License, and the rest of the GNU
243 # gettext package package is covered by the GNU General Public License.
244 # They are *not* in the public domain.
245
246 # serial 2
247
248 AC_DEFUN([AM_LC_MESSAGES],
249 [AC_CHECK_HEADERS(locale.h)
250 if test $ac_cv_header_locale_h = yes; then
251 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
252 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
253 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
254 if test $am_cv_val_LC_MESSAGES = yes; then
255 AC_DEFINE(HAVE_LC_MESSAGES, 1,
256 [Define if your <locale.h> file defines LC_MESSAGES.])
257 fi
258 fi])
259
260 AC_DEFUN([CHECK_FOR_BROKEN_MINGW_LD],
261 [
262 AC_MSG_CHECKING(whether 'ld' is at least 2.13)
263 LD_PROG=`$CC --print-prog-name=ld`
264 LD_VERSION=`$LD_PROG --version`
265 LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
266 LD_VERSION_MINOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 2`
267 if expr "$LD_VERSION_MAJOR" \> 2 > /dev/null; then
268 LD_OK="ok"
269 else
270 if expr "$LD_VERSION_MAJOR" = 2 && expr "$LD_VERSION_MINOR" \>= 13 > /dev/null; then
271 LD_OK="ok"
272 fi
273 fi
274 if test "x$LD_OK" != x; then
275 AC_MSG_RESULT([yes; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR])
276 else
277 AC_MSG_RESULT([no; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR])
278 AC_MSG_WARN([ld <2.13 detected; enabling JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS hack...])
279 AC_DEFINE(JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS, 1,
280 [Indicate that linker is not able to 8-byte align static data])
281 fi[]dnl
282 ])# CHECK_FOR_BROKEN_MINGW_LD
283
284 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
285 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
286 dnl also defines GSTUFF_PKG_ERRORS on error
287 AC_DEFUN(PKG_CHECK_MODULES, [
288 succeeded=no
289
290 if test -z "$PKG_CONFIG"; then
291 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
292 fi
293
294 if test "$PKG_CONFIG" = "no" ; then
295 echo "*** The pkg-config script could not be found. Make sure it is"
296 echo "*** in your path, or set the PKG_CONFIG environment variable"
297 echo "*** to the full path to pkg-config."
298 echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
299 else
300 PKG_CONFIG_MIN_VERSION=0.9.0
301 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
302 AC_MSG_CHECKING(for $2)
303
304 if $PKG_CONFIG --exists "$2" ; then
305 AC_MSG_RESULT(yes)
306 succeeded=yes
307
308 AC_MSG_CHECKING($1_CFLAGS)
309 $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
310 AC_MSG_RESULT($$1_CFLAGS)
311
312 AC_MSG_CHECKING($1_LIBS)
313 $1_LIBS=`$PKG_CONFIG --libs "$2"`
314 AC_MSG_RESULT($$1_LIBS)
315 else
316 $1_CFLAGS=""
317 $1_LIBS=""
318 ## If we have a custom action on failure, don't print errors, but
319 ## do set a variable so people can do so.
320 $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
321 ifelse([$4], ,echo $$1_PKG_ERRORS,)
322 fi
323
324 AC_SUBST($1_CFLAGS)
325 AC_SUBST($1_LIBS)
326 else
327 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
328 echo "*** See http://www.freedesktop.org/software/pkgconfig"
329 fi
330 fi
331
332 if test $succeeded = yes; then
333 ifelse([$3], , :, [$3])
334 else
335 ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
336 fi
337 ])
338
339
340
341 # lib-prefix.m4 serial 3 (gettext-0.12.2)
342 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
343 dnl This file is free software, distributed under the terms of the GNU
344 dnl General Public License. As a special exception to the GNU General
345 dnl Public License, this file may be distributed as part of a program
346 dnl that contains a configuration script generated by Autoconf, under
347 dnl the same distribution terms as the rest of that program.
348
349 dnl From Bruno Haible.
350
351 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
352 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
353 dnl require excessive bracketing.
354 ifdef([AC_HELP_STRING],
355 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
356 [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
357
358 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
359 dnl to access previously installed libraries. The basic assumption is that
360 dnl a user will want packages to use other packages he previously installed
361 dnl with the same --prefix option.
362 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
363 dnl libraries, but is otherwise very convenient.
364 AC_DEFUN([AC_LIB_PREFIX],
365 [
366 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
367 AC_REQUIRE([AC_PROG_CC])
368 AC_REQUIRE([AC_CANONICAL_HOST])
369 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
370 dnl By default, look in $includedir and $libdir.
371 use_additional=yes
372 AC_LIB_WITH_FINAL_PREFIX([
373 eval additional_includedir=\"$includedir\"
374 eval additional_libdir=\"$libdir\"
375 ])
376 AC_LIB_ARG_WITH([lib-prefix],
377 [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
378 --without-lib-prefix don't search for libraries in includedir and libdir],
379 [
380 if test "X$withval" = "Xno"; then
381 use_additional=no
382 else
383 if test "X$withval" = "X"; then
384 AC_LIB_WITH_FINAL_PREFIX([
385 eval additional_includedir=\"$includedir\"
386 eval additional_libdir=\"$libdir\"
387 ])
388 else
389 additional_includedir="$withval/include"
390 additional_libdir="$withval/lib"
391 fi
392 fi
393 ])
394 if test $use_additional = yes; then
395 dnl Potentially add $additional_includedir to $CPPFLAGS.
396 dnl But don't add it
397 dnl 1. if it's the standard /usr/include,
398 dnl 2. if it's already present in $CPPFLAGS,
399 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
400 dnl 4. if it doesn't exist as a directory.
401 if test "X$additional_includedir" != "X/usr/include"; then
402 haveit=
403 for x in $CPPFLAGS; do
404 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
405 if test "X$x" = "X-I$additional_includedir"; then
406 haveit=yes
407 break
408 fi
409 done
410 if test -z "$haveit"; then
411 if test "X$additional_includedir" = "X/usr/local/include"; then
412 if test -n "$GCC"; then
413 case $host_os in
414 linux*) haveit=yes;;
415 esac
416 fi
417 fi
418 if test -z "$haveit"; then
419 if test -d "$additional_includedir"; then
420 dnl Really add $additional_includedir to $CPPFLAGS.
421 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
422 fi
423 fi
424 fi
425 fi
426 dnl Potentially add $additional_libdir to $LDFLAGS.
427 dnl But don't add it
428 dnl 1. if it's the standard /usr/lib,
429 dnl 2. if it's already present in $LDFLAGS,
430 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
431 dnl 4. if it doesn't exist as a directory.
432 if test "X$additional_libdir" != "X/usr/lib"; then
433 haveit=
434 for x in $LDFLAGS; do
435 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
436 if test "X$x" = "X-L$additional_libdir"; then
437 haveit=yes
438 break
439 fi
440 done
441 if test -z "$haveit"; then
442 if test "X$additional_libdir" = "X/usr/local/lib"; then
443 if test -n "$GCC"; then
444 case $host_os in
445 linux*) haveit=yes;;
446 esac
447 fi
448 fi
449 if test -z "$haveit"; then
450 if test -d "$additional_libdir"; then
451 dnl Really add $additional_libdir to $LDFLAGS.
452 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
453 fi
454 fi
455 fi
456 fi
457 fi
458 ])
459
460 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
461 dnl acl_final_exec_prefix, containing the values to which $prefix and
462 dnl $exec_prefix will expand at the end of the configure script.
463 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
464 [
465 dnl Unfortunately, prefix and exec_prefix get only finally determined
466 dnl at the end of configure.
467 if test "X$prefix" = "XNONE"; then
468 acl_final_prefix="$ac_default_prefix"
469 else
470 acl_final_prefix="$prefix"
471 fi
472 if test "X$exec_prefix" = "XNONE"; then
473 acl_final_exec_prefix='${prefix}'
474 else
475 acl_final_exec_prefix="$exec_prefix"
476 fi
477 acl_save_prefix="$prefix"
478 prefix="$acl_final_prefix"
479 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
480 prefix="$acl_save_prefix"
481 ])
482
483 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
484 dnl variables prefix and exec_prefix bound to the values they will have
485 dnl at the end of the configure script.
486 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
487 [
488 acl_save_prefix="$prefix"
489 prefix="$acl_final_prefix"
490 acl_save_exec_prefix="$exec_prefix"
491 exec_prefix="$acl_final_exec_prefix"
492 $1
493 exec_prefix="$acl_save_exec_prefix"
494 prefix="$acl_save_prefix"
495 ])
496
497 # lib-link.m4 serial 4 (gettext-0.12)
498 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
499 dnl This file is free software, distributed under the terms of the GNU
500 dnl General Public License. As a special exception to the GNU General
501 dnl Public License, this file may be distributed as part of a program
502 dnl that contains a configuration script generated by Autoconf, under
503 dnl the same distribution terms as the rest of that program.
504
505 dnl From Bruno Haible.
506
507 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
508 dnl the libraries corresponding to explicit and implicit dependencies.
509 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
510 dnl augments the CPPFLAGS variable.
511 AC_DEFUN([AC_LIB_LINKFLAGS],
512 [
513 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
514 AC_REQUIRE([AC_LIB_RPATH])
515 define([Name],[translit([$1],[./-], [___])])
516 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
517 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
518 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
519 AC_LIB_LINKFLAGS_BODY([$1], [$2])
520 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
521 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
522 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
523 ])
524 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
525 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
526 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
527 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
528 AC_SUBST([LIB]NAME)
529 AC_SUBST([LTLIB]NAME)
530 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
531 dnl results of this search when this library appears as a dependency.
532 HAVE_LIB[]NAME=yes
533 undefine([Name])
534 undefine([NAME])
535 ])
536
537 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
538 dnl searches for libname and the libraries corresponding to explicit and
539 dnl implicit dependencies, together with the specified include files and
540 dnl the ability to compile and link the specified testcode. If found, it
541 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
542 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
543 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
544 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
545 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
546 [
547 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
548 AC_REQUIRE([AC_LIB_RPATH])
549 define([Name],[translit([$1],[./-], [___])])
550 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
551 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
552
553 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
554 dnl accordingly.
555 AC_LIB_LINKFLAGS_BODY([$1], [$2])
556
557 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
558 dnl because if the user has installed lib[]Name and not disabled its use
559 dnl via --without-lib[]Name-prefix, he wants to use it.
560 ac_save_CPPFLAGS="$CPPFLAGS"
561 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
562
563 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
564 ac_save_LIBS="$LIBS"
565 LIBS="$LIBS $LIB[]NAME"
566 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
567 LIBS="$ac_save_LIBS"
568 ])
569 if test "$ac_cv_lib[]Name" = yes; then
570 HAVE_LIB[]NAME=yes
571 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
572 AC_MSG_CHECKING([how to link with lib[]$1])
573 AC_MSG_RESULT([$LIB[]NAME])
574 else
575 HAVE_LIB[]NAME=no
576 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
577 dnl $INC[]NAME either.
578 CPPFLAGS="$ac_save_CPPFLAGS"
579 LIB[]NAME=
580 LTLIB[]NAME=
581 fi
582 AC_SUBST([HAVE_LIB]NAME)
583 AC_SUBST([LIB]NAME)
584 AC_SUBST([LTLIB]NAME)
585 undefine([Name])
586 undefine([NAME])
587 ])
588
589 dnl Determine the platform dependent parameters needed to use rpath:
590 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
591 dnl hardcode_direct, hardcode_minus_L.
592 AC_DEFUN([AC_LIB_RPATH],
593 [
594 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
595 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
596 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
597 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
598 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
599 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
600 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
601 . ./conftest.sh
602 rm -f ./conftest.sh
603 acl_cv_rpath=done
604 ])
605 wl="$acl_cv_wl"
606 libext="$acl_cv_libext"
607 shlibext="$acl_cv_shlibext"
608 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
609 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
610 hardcode_direct="$acl_cv_hardcode_direct"
611 hardcode_minus_L="$acl_cv_hardcode_minus_L"
612 dnl Determine whether the user wants rpath handling at all.
613 AC_ARG_ENABLE(rpath,
614 [ --disable-rpath do not hardcode runtime library paths],
615 :, enable_rpath=yes)
616 ])
617
618 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
619 dnl the libraries corresponding to explicit and implicit dependencies.
620 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
621 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
622 [
623 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
624 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
625 dnl By default, look in $includedir and $libdir.
626 use_additional=yes
627 AC_LIB_WITH_FINAL_PREFIX([
628 eval additional_includedir=\"$includedir\"
629 eval additional_libdir=\"$libdir\"
630 ])
631 AC_LIB_ARG_WITH([lib$1-prefix],
632 [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
633 --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
634 [
635 if test "X$withval" = "Xno"; then
636 use_additional=no
637 else
638 if test "X$withval" = "X"; then
639 AC_LIB_WITH_FINAL_PREFIX([
640 eval additional_includedir=\"$includedir\"
641 eval additional_libdir=\"$libdir\"
642 ])
643 else
644 additional_includedir="$withval/include"
645 additional_libdir="$withval/lib"
646 fi
647 fi
648 ])
649 dnl Search the library and its dependencies in $additional_libdir and
650 dnl $LDFLAGS. Using breadth-first-seach.
651 LIB[]NAME=
652 LTLIB[]NAME=
653 INC[]NAME=
654 rpathdirs=
655 ltrpathdirs=
656 names_already_handled=
657 names_next_round='$1 $2'
658 while test -n "$names_next_round"; do
659 names_this_round="$names_next_round"
660 names_next_round=
661 for name in $names_this_round; do
662 already_handled=
663 for n in $names_already_handled; do
664 if test "$n" = "$name"; then
665 already_handled=yes
666 break
667 fi
668 done
669 if test -z "$already_handled"; then
670 names_already_handled="$names_already_handled $name"
671 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
672 dnl or AC_LIB_HAVE_LINKFLAGS call.
673 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
674 eval value=\"\$HAVE_LIB$uppername\"
675 if test -n "$value"; then
676 if test "$value" = yes; then
677 eval value=\"\$LIB$uppername\"
678 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
679 eval value=\"\$LTLIB$uppername\"
680 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
681 else
682 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
683 dnl that this library doesn't exist. So just drop it.
684 :
685 fi
686 else
687 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
688 dnl and the already constructed $LIBNAME/$LTLIBNAME.
689 found_dir=
690 found_la=
691 found_so=
692 found_a=
693 if test $use_additional = yes; then
694 if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
695 found_dir="$additional_libdir"
696 found_so="$additional_libdir/lib$name.$shlibext"
697 if test -f "$additional_libdir/lib$name.la"; then
698 found_la="$additional_libdir/lib$name.la"
699 fi
700 else
701 if test -f "$additional_libdir/lib$name.$libext"; then
702 found_dir="$additional_libdir"
703 found_a="$additional_libdir/lib$name.$libext"
704 if test -f "$additional_libdir/lib$name.la"; then
705 found_la="$additional_libdir/lib$name.la"
706 fi
707 fi
708 fi
709 fi
710 if test "X$found_dir" = "X"; then
711 for x in $LDFLAGS $LTLIB[]NAME; do
712 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
713 case "$x" in
714 -L*)
715 dir=`echo "X$x" | sed -e 's/^X-L//'`
716 if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
717 found_dir="$dir"
718 found_so="$dir/lib$name.$shlibext"
719 if test -f "$dir/lib$name.la"; then
720 found_la="$dir/lib$name.la"
721 fi
722 else
723 if test -f "$dir/lib$name.$libext"; then
724 found_dir="$dir"
725 found_a="$dir/lib$name.$libext"
726 if test -f "$dir/lib$name.la"; then
727 found_la="$dir/lib$name.la"
728 fi
729 fi
730 fi
731 ;;
732 esac
733 if test "X$found_dir" != "X"; then
734 break
735 fi
736 done
737 fi
738 if test "X$found_dir" != "X"; then
739 dnl Found the library.
740 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
741 if test "X$found_so" != "X"; then
742 dnl Linking with a shared library. We attempt to hardcode its
743 dnl directory into the executable's runpath, unless it's the
744 dnl standard /usr/lib.
745 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
746 dnl No hardcoding is needed.
747 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
748 else
749 dnl Use an explicit option to hardcode DIR into the resulting
750 dnl binary.
751 dnl Potentially add DIR to ltrpathdirs.
752 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
753 haveit=
754 for x in $ltrpathdirs; do
755 if test "X$x" = "X$found_dir"; then
756 haveit=yes
757 break
758 fi
759 done
760 if test -z "$haveit"; then
761 ltrpathdirs="$ltrpathdirs $found_dir"
762 fi
763 dnl The hardcoding into $LIBNAME is system dependent.
764 if test "$hardcode_direct" = yes; then
765 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
766 dnl resulting binary.
767 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
768 else
769 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
770 dnl Use an explicit option to hardcode DIR into the resulting
771 dnl binary.
772 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
773 dnl Potentially add DIR to rpathdirs.
774 dnl The rpathdirs will be appended to $LIBNAME at the end.
775 haveit=
776 for x in $rpathdirs; do
777 if test "X$x" = "X$found_dir"; then
778 haveit=yes
779 break
780 fi
781 done
782 if test -z "$haveit"; then
783 rpathdirs="$rpathdirs $found_dir"
784 fi
785 else
786 dnl Rely on "-L$found_dir".
787 dnl But don't add it if it's already contained in the LDFLAGS
788 dnl or the already constructed $LIBNAME
789 haveit=
790 for x in $LDFLAGS $LIB[]NAME; do
791 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
792 if test "X$x" = "X-L$found_dir"; then
793 haveit=yes
794 break
795 fi
796 done
797 if test -z "$haveit"; then
798 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
799 fi
800 if test "$hardcode_minus_L" != no; then
801 dnl FIXME: Not sure whether we should use
802 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
803 dnl here.
804 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
805 else
806 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
807 dnl here, because this doesn't fit in flags passed to the
808 dnl compiler. So give up. No hardcoding. This affects only
809 dnl very old systems.
810 dnl FIXME: Not sure whether we should use
811 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
812 dnl here.
813 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
814 fi
815 fi
816 fi
817 fi
818 else
819 if test "X$found_a" != "X"; then
820 dnl Linking with a static library.
821 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
822 else
823 dnl We shouldn't come here, but anyway it's good to have a
824 dnl fallback.
825 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
826 fi
827 fi
828 dnl Assume the include files are nearby.
829 additional_includedir=
830 case "$found_dir" in
831 */lib | */lib/)
832 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
833 additional_includedir="$basedir/include"
834 ;;
835 esac
836 if test "X$additional_includedir" != "X"; then
837 dnl Potentially add $additional_includedir to $INCNAME.
838 dnl But don't add it
839 dnl 1. if it's the standard /usr/include,
840 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
841 dnl 3. if it's already present in $CPPFLAGS or the already
842 dnl constructed $INCNAME,
843 dnl 4. if it doesn't exist as a directory.
844 if test "X$additional_includedir" != "X/usr/include"; then
845 haveit=
846 if test "X$additional_includedir" = "X/usr/local/include"; then
847 if test -n "$GCC"; then
848 case $host_os in
849 linux*) haveit=yes;;
850 esac
851 fi
852 fi
853 if test -z "$haveit"; then
854 for x in $CPPFLAGS $INC[]NAME; do
855 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
856 if test "X$x" = "X-I$additional_includedir"; then
857 haveit=yes
858 break
859 fi
860 done
861 if test -z "$haveit"; then
862 if test -d "$additional_includedir"; then
863 dnl Really add $additional_includedir to $INCNAME.
864 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
865 fi
866 fi
867 fi
868 fi
869 fi
870 dnl Look for dependencies.
871 if test -n "$found_la"; then
872 dnl Read the .la file. It defines the variables
873 dnl dlname, library_names, old_library, dependency_libs, current,
874 dnl age, revision, installed, dlopen, dlpreopen, libdir.
875 save_libdir="$libdir"
876 case "$found_la" in
877 */* | *\\*) . "$found_la" ;;
878 *) . "./$found_la" ;;
879 esac
880 libdir="$save_libdir"
881 dnl We use only dependency_libs.
882 for dep in $dependency_libs; do
883 case "$dep" in
884 -L*)
885 additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
886 dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
887 dnl But don't add it
888 dnl 1. if it's the standard /usr/lib,
889 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
890 dnl 3. if it's already present in $LDFLAGS or the already
891 dnl constructed $LIBNAME,
892 dnl 4. if it doesn't exist as a directory.
893 if test "X$additional_libdir" != "X/usr/lib"; then
894 haveit=
895 if test "X$additional_libdir" = "X/usr/local/lib"; then
896 if test -n "$GCC"; then
897 case $host_os in
898 linux*) haveit=yes;;
899 esac
900 fi
901 fi
902 if test -z "$haveit"; then
903 haveit=
904 for x in $LDFLAGS $LIB[]NAME; do
905 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
906 if test "X$x" = "X-L$additional_libdir"; then
907 haveit=yes
908 break
909 fi
910 done
911 if test -z "$haveit"; then
912 if test -d "$additional_libdir"; then
913 dnl Really add $additional_libdir to $LIBNAME.
914 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
915 fi
916 fi
917 haveit=
918 for x in $LDFLAGS $LTLIB[]NAME; do
919 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
920 if test "X$x" = "X-L$additional_libdir"; then
921 haveit=yes
922 break
923 fi
924 done
925 if test -z "$haveit"; then
926 if test -d "$additional_libdir"; then
927 dnl Really add $additional_libdir to $LTLIBNAME.
928 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
929 fi
930 fi
931 fi
932 fi
933 ;;
934 -R*)
935 dir=`echo "X$dep" | sed -e 's/^X-R//'`
936 if test "$enable_rpath" != no; then
937 dnl Potentially add DIR to rpathdirs.
938 dnl The rpathdirs will be appended to $LIBNAME at the end.
939 haveit=
940 for x in $rpathdirs; do
941 if test "X$x" = "X$dir"; then
942 haveit=yes
943 break
944 fi
945 done
946 if test -z "$haveit"; then
947 rpathdirs="$rpathdirs $dir"
948 fi
949 dnl Potentially add DIR to ltrpathdirs.
950 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
951 haveit=
952 for x in $ltrpathdirs; do
953 if test "X$x" = "X$dir"; then
954 haveit=yes
955 break
956 fi
957 done
958 if test -z "$haveit"; then
959 ltrpathdirs="$ltrpathdirs $dir"
960 fi
961 fi
962 ;;
963 -l*)
964 dnl Handle this in the next round.
965 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
966 ;;
967 *.la)
968 dnl Handle this in the next round. Throw away the .la's
969 dnl directory; it is already contained in a preceding -L
970 dnl option.
971 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
972 ;;
973 *)
974 dnl Most likely an immediate library name.
975 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
976 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
977 ;;
978 esac
979 done
980 fi
981 else
982 dnl Didn't find the library; assume it is in the system directories
983 dnl known to the linker and runtime loader. (All the system
984 dnl directories known to the linker should also be known to the
985 dnl runtime loader, otherwise the system is severely misconfigured.)
986 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
987 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
988 fi
989 fi
990 fi
991 done
992 done
993 if test "X$rpathdirs" != "X"; then
994 if test -n "$hardcode_libdir_separator"; then
995 dnl Weird platform: only the last -rpath option counts, the user must
996 dnl pass all path elements in one option. We can arrange that for a
997 dnl single library, but not when more than one $LIBNAMEs are used.
998 alldirs=
999 for found_dir in $rpathdirs; do
1000 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
1001 done
1002 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
1003 acl_save_libdir="$libdir"
1004 libdir="$alldirs"
1005 eval flag=\"$hardcode_libdir_flag_spec\"
1006 libdir="$acl_save_libdir"
1007 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1008 else
1009 dnl The -rpath options are cumulative.
1010 for found_dir in $rpathdirs; do
1011 acl_save_libdir="$libdir"
1012 libdir="$found_dir"
1013 eval flag=\"$hardcode_libdir_flag_spec\"
1014 libdir="$acl_save_libdir"
1015 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
1016 done
1017 fi
1018 fi
1019 if test "X$ltrpathdirs" != "X"; then
1020 dnl When using libtool, the option that works for both libraries and
1021 dnl executables is -R. The -R options are cumulative.
1022 for found_dir in $ltrpathdirs; do
1023 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
1024 done
1025 fi
1026 ])
1027
1028 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
1029 dnl unless already present in VAR.
1030 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
1031 dnl contains two or three consecutive elements that belong together.
1032 AC_DEFUN([AC_LIB_APPENDTOVAR],
1033 [
1034 for element in [$2]; do
1035 haveit=
1036 for x in $[$1]; do
1037 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1038 if test "X$x" = "X$element"; then
1039 haveit=yes
1040 break
1041 fi
1042 done
1043 if test -z "$haveit"; then
1044 [$1]="${[$1]}${[$1]:+ }$element"
1045 fi
1046 done
1047 ])
1048
1049 # lib-ld.m4 serial 2 (gettext-0.12)
1050 dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
1051 dnl This file is free software, distributed under the terms of the GNU
1052 dnl General Public License. As a special exception to the GNU General
1053 dnl Public License, this file may be distributed as part of a program
1054 dnl that contains a configuration script generated by Autoconf, under
1055 dnl the same distribution terms as the rest of that program.
1056
1057 dnl Subroutines of libtool.m4,
1058 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
1059 dnl with libtool.m4.
1060
1061 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
1062 AC_DEFUN([AC_LIB_PROG_LD_GNU],
1063 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
1064 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
1065 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
1066 acl_cv_prog_gnu_ld=yes
1067 else
1068 acl_cv_prog_gnu_ld=no
1069 fi])
1070 with_gnu_ld=$acl_cv_prog_gnu_ld
1071 ])
1072
1073 dnl From libtool-1.4. Sets the variable LD.
1074 AC_DEFUN([AC_LIB_PROG_LD],
1075 [AC_ARG_WITH(gnu-ld,
1076 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
1077 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
1078 AC_REQUIRE([AC_PROG_CC])dnl
1079 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1080 # Prepare PATH_SEPARATOR.
1081 # The user is always right.
1082 if test "${PATH_SEPARATOR+set}" != set; then
1083 echo "#! /bin/sh" >conf$$.sh
1084 echo "exit 0" >>conf$$.sh
1085 chmod +x conf$$.sh
1086 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
1087 PATH_SEPARATOR=';'
1088 else
1089 PATH_SEPARATOR=:
1090 fi
1091 rm -f conf$$.sh
1092 fi
1093 ac_prog=ld
1094 if test "$GCC" = yes; then
1095 # Check if gcc -print-prog-name=ld gives a path.
1096 AC_MSG_CHECKING([for ld used by GCC])
1097 case $host in
1098 *-*-mingw*)
1099 # gcc leaves a trailing carriage return which upsets mingw
1100 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
1101 *)
1102 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
1103 esac
1104 case $ac_prog in
1105 # Accept absolute paths.
1106 [[\\/]* | [A-Za-z]:[\\/]*)]
1107 [re_direlt='/[^/][^/]*/\.\./']
1108 # Canonicalize the path of ld
1109 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
1110 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
1111 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1112 done
1113 test -z "$LD" && LD="$ac_prog"
1114 ;;
1115 "")
1116 # If it fails, then pretend we aren't using GCC.
1117 ac_prog=ld
1118 ;;
1119 *)
1120 # If it is relative, then search for the first ld in PATH.
1121 with_gnu_ld=unknown
1122 ;;
1123 esac
1124 elif test "$with_gnu_ld" = yes; then
1125 AC_MSG_CHECKING([for GNU ld])
1126 else
1127 AC_MSG_CHECKING([for non-GNU ld])
1128 fi
1129 AC_CACHE_VAL(acl_cv_path_LD,
1130 [if test -z "$LD"; then
1131 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1132 for ac_dir in $PATH; do
1133 test -z "$ac_dir" && ac_dir=.
1134 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
1135 acl_cv_path_LD="$ac_dir/$ac_prog"
1136 # Check to see if the program is GNU ld. I'd rather use --version,
1137 # but apparently some GNU ld's only accept -v.
1138 # Break only if it was the GNU/non-GNU ld that we prefer.
1139 if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
1140 test "$with_gnu_ld" != no && break
1141 else
1142 test "$with_gnu_ld" != yes && break
1143 fi
1144 fi
1145 done
1146 IFS="$ac_save_ifs"
1147 else
1148 acl_cv_path_LD="$LD" # Let the user override the test with a path.
1149 fi])
1150 LD="$acl_cv_path_LD"
1151 if test -n "$LD"; then
1152 AC_MSG_RESULT($LD)
1153 else
1154 AC_MSG_RESULT(no)
1155 fi
1156 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
1157 AC_LIB_PROG_LD_GNU
1158 ])
1159
1160 # Do all the work for Automake. This macro actually does too much --
1161 # some checks are only needed if your package does certain things.
1162 # But this isn't really a big deal.
1163
1164 # serial 1
1165
1166 dnl Usage:
1167 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
1168
1169 AC_DEFUN([AM_INIT_AUTOMAKE],
1170 [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
1171 AC_REQUIRE([AC_PROG_INSTALL])
1172 PACKAGE=[$1]
1173 AC_SUBST(PACKAGE)
1174 VERSION=[$2]
1175 AC_SUBST(VERSION)
1176 dnl test to see if srcdir already configured
1177 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
1178 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1179 fi
1180 ifelse([$3],,
1181 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
1182 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
1183 AC_REQUIRE([AM_SANITY_CHECK])
1184 AC_REQUIRE([AC_ARG_PROGRAM])
1185 dnl FIXME This is truly gross.
1186 missing_dir=`cd $ac_aux_dir && pwd`
1187 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
1188 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
1189 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
1190 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
1191 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
1192 AC_REQUIRE([AC_PROG_MAKE_SET])])
1193
1194 # Copyright 2002 Free Software Foundation, Inc.
1195
1196 # This program is free software; you can redistribute it and/or modify
1197 # it under the terms of the GNU General Public License as published by
1198 # the Free Software Foundation; either version 2, or (at your option)
1199 # any later version.
1200
1201 # This program is distributed in the hope that it will be useful,
1202 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1203 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1204 # GNU General Public License for more details.
1205
1206 # You should have received a copy of the GNU General Public License
1207 # along with this program; if not, write to the Free Software
1208 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1209
1210 # AM_AUTOMAKE_VERSION(VERSION)
1211 # ----------------------------
1212 # Automake X.Y traces this macro to ensure aclocal.m4 has been
1213 # generated from the m4 files accompanying Automake X.Y.
1214 AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
1215
1216 # AM_SET_CURRENT_AUTOMAKE_VERSION
1217 # -------------------------------
1218 # Call AM_AUTOMAKE_VERSION so it can be traced.
1219 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
1220 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
1221 [AM_AUTOMAKE_VERSION([1.4-p6])])
1222
1223 #
1224 # Check to make sure that the build environment is sane.
1225 #
1226
1227 AC_DEFUN([AM_SANITY_CHECK],
1228 [AC_MSG_CHECKING([whether build environment is sane])
1229 # Just in case
1230 sleep 1
1231 echo timestamp > conftestfile
1232 # Do `set' in a subshell so we don't clobber the current shell's
1233 # arguments. Must try -L first in case configure is actually a
1234 # symlink; some systems play weird games with the mod time of symlinks
1235 # (eg FreeBSD returns the mod time of the symlink's containing
1236 # directory).
1237 if (
1238 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
1239 if test "[$]*" = "X"; then
1240 # -L didn't work.
1241 set X `ls -t $srcdir/configure conftestfile`
1242 fi
1243 if test "[$]*" != "X $srcdir/configure conftestfile" \
1244 && test "[$]*" != "X conftestfile $srcdir/configure"; then
1245
1246 # If neither matched, then we have a broken ls. This can happen
1247 # if, for instance, CONFIG_SHELL is bash and it inherits a
1248 # broken ls alias from the environment. This has actually
1249 # happened. Such a system could not be considered "sane".
1250 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
1251 alias in your environment])
1252 fi
1253
1254 test "[$]2" = conftestfile
1255 )
1256 then
1257 # Ok.
1258 :
1259 else
1260 AC_MSG_ERROR([newly created file is older than distributed files!
1261 Check your system clock])
1262 fi
1263 rm -f conftest*
1264 AC_MSG_RESULT(yes)])
1265
1266 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
1267 dnl The program must properly implement --version.
1268 AC_DEFUN([AM_MISSING_PROG],
1269 [AC_MSG_CHECKING(for working $2)
1270 # Run test in a subshell; some versions of sh will print an error if
1271 # an executable is not found, even if stderr is redirected.
1272 # Redirect stdin to placate older versions of autoconf. Sigh.
1273 if ($2 --version) < /dev/null > /dev/null 2>&1; then
1274 $1=$2
1275 AC_MSG_RESULT(found)
1276 else
1277 $1="$3/missing $2"
1278 AC_MSG_RESULT(missing)
1279 fi
1280 AC_SUBST($1)])
1281
1282 # Add --enable-maintainer-mode option to configure.
1283 # From Jim Meyering
1284
1285 # serial 1
1286
1287 AC_DEFUN([AM_MAINTAINER_MODE],
1288 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1289 dnl maintainer-mode is disabled by default
1290 AC_ARG_ENABLE(maintainer-mode,
1291 [ --enable-maintainer-mode enable make rules and dependencies not useful
1292 (and sometimes confusing) to the casual installer],
1293 USE_MAINTAINER_MODE=$enableval,
1294 USE_MAINTAINER_MODE=no)
1295 AC_MSG_RESULT($USE_MAINTAINER_MODE)
1296 AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
1297 MAINT=$MAINTAINER_MODE_TRUE
1298 AC_SUBST(MAINT)dnl
1299 ]
1300 )
1301
1302 # Define a conditional.
1303
1304 AC_DEFUN([AM_CONDITIONAL],
1305 [AC_SUBST($1_TRUE)
1306 AC_SUBST($1_FALSE)
1307 if $2; then
1308 $1_TRUE=
1309 $1_FALSE='#'
1310 else
1311 $1_TRUE='#'
1312 $1_FALSE=
1313 fi])
1314
1315 # Like AC_CONFIG_HEADER, but automatically create stamp file.
1316
1317 AC_DEFUN([AM_CONFIG_HEADER],
1318 [AC_PREREQ([2.12])
1319 AC_CONFIG_HEADER([$1])
1320 dnl When config.status generates a header, we must update the stamp-h file.
1321 dnl This file resides in the same directory as the config header
1322 dnl that is generated. We must strip everything past the first ":",
1323 dnl and everything past the last "/".
1324 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
1325 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
1326 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
1327 <<am_indx=1
1328 for am_file in <<$1>>; do
1329 case " <<$>>CONFIG_HEADERS " in
1330 *" <<$>>am_file "*<<)>>
1331 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
1332 ;;
1333 esac
1334 am_indx=`expr "<<$>>am_indx" + 1`
1335 done<<>>dnl>>)
1336 changequote([,]))])
1337
1338 # Configure paths for GTK+
1339 # Owen Taylor 1997-2001
1340
1341 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
1342 dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
1343 dnl pass to pkg-config
1344 dnl
1345 AC_DEFUN(AM_PATH_GTK_2_0,
1346 [dnl
1347 dnl Get the cflags and libraries from pkg-config
1348 dnl
1349 AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program],
1350 , enable_gtktest=yes)
1351
1352 pkg_config_args=gtk+-2.0
1353 for module in . $4
1354 do
1355 case "$module" in
1356 gthread)
1357 pkg_config_args="$pkg_config_args gthread-2.0"
1358 ;;
1359 esac
1360 done
1361
1362 no_gtk=""
1363
1364 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1365
1366 if test x$PKG_CONFIG != xno ; then
1367 if pkg-config --atleast-pkgconfig-version 0.7 ; then
1368 :
1369 else
1370 echo *** pkg-config too old; version 0.7 or better required.
1371 no_gtk=yes
1372 PKG_CONFIG=no
1373 fi
1374 else
1375 no_gtk=yes
1376 fi
1377
1378 min_gtk_version=ifelse([$1], ,2.0.0,$1)
1379 AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
1380
1381 if test x$PKG_CONFIG != xno ; then
1382 ## don't try to run the test against uninstalled libtool libs
1383 if $PKG_CONFIG --uninstalled $pkg_config_args; then
1384 echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
1385 enable_gtktest=no
1386 fi
1387
1388 if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
1389 :
1390 else
1391 no_gtk=yes
1392 fi
1393 fi
1394
1395 if test x"$no_gtk" = x ; then
1396 GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
1397 GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
1398 gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1399 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1400 gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1401 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1402 gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
1403 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1404 if test "x$enable_gtktest" = "xyes" ; then
1405 ac_save_CFLAGS="$CFLAGS"
1406 ac_save_LIBS="$LIBS"
1407 CFLAGS="$CFLAGS $GTK_CFLAGS"
1408 LIBS="$GTK_LIBS $LIBS"
1409 dnl
1410 dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
1411 dnl checks the results of pkg-config to some extent)
1412 dnl
1413 rm -f conf.gtktest
1414 AC_TRY_RUN([
1415 #include <gtk/gtk.h>
1416 #include <stdio.h>
1417 #include <stdlib.h>
1418
1419 int
1420 main ()
1421 {
1422 int major, minor, micro;
1423 char *tmp_version;
1424
1425 system ("touch conf.gtktest");
1426
1427 /* HP/UX 9 (%@#!) writes to sscanf strings */
1428 tmp_version = g_strdup("$min_gtk_version");
1429 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1430 printf("%s, bad version string\n", "$min_gtk_version");
1431 exit(1);
1432 }
1433
1434 if ((gtk_major_version != $gtk_config_major_version) ||
1435 (gtk_minor_version != $gtk_config_minor_version) ||
1436 (gtk_micro_version != $gtk_config_micro_version))
1437 {
1438 printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
1439 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
1440 gtk_major_version, gtk_minor_version, gtk_micro_version);
1441 printf ("*** was found! If pkg-config was correct, then it is best\n");
1442 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
1443 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
1444 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
1445 printf("*** required on your system.\n");
1446 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
1447 printf("*** to point to the correct configuration files\n");
1448 }
1449 else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
1450 (gtk_minor_version != GTK_MINOR_VERSION) ||
1451 (gtk_micro_version != GTK_MICRO_VERSION))
1452 {
1453 printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
1454 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
1455 printf("*** library (version %d.%d.%d)\n",
1456 gtk_major_version, gtk_minor_version, gtk_micro_version);
1457 }
1458 else
1459 {
1460 if ((gtk_major_version > major) ||
1461 ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1462 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
1463 {
1464 return 0;
1465 }
1466 else
1467 {
1468 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
1469 gtk_major_version, gtk_minor_version, gtk_micro_version);
1470 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
1471 major, minor, micro);
1472 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
1473 printf("***\n");
1474 printf("*** If you have already installed a sufficiently new version, this error\n");
1475 printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
1476 printf("*** being found. The easiest way to fix this is to remove the old version\n");
1477 printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
1478 printf("*** correct copy of pkg-config. (In this case, you will have to\n");
1479 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1480 printf("*** so that the correct libraries are found at run-time))\n");
1481 }
1482 }
1483 return 1;
1484 }
1485 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1486 CFLAGS="$ac_save_CFLAGS"
1487 LIBS="$ac_save_LIBS"
1488 fi
1489 fi
1490 if test "x$no_gtk" = x ; then
1491 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
1492 ifelse([$2], , :, [$2])
1493 else
1494 AC_MSG_RESULT(no)
1495 if test "$PKG_CONFIG" = "no" ; then
1496 echo "*** A new enough version of pkg-config was not found."
1497 echo "*** See http://pkgconfig.sourceforge.net"
1498 else
1499 if test -f conf.gtktest ; then
1500 :
1501 else
1502 echo "*** Could not run GTK+ test program, checking why..."
1503 ac_save_CFLAGS="$CFLAGS"
1504 ac_save_LIBS="$LIBS"
1505 CFLAGS="$CFLAGS $GTK_CFLAGS"
1506 LIBS="$LIBS $GTK_LIBS"
1507 AC_TRY_LINK([
1508 #include <gtk/gtk.h>
1509 #include <stdio.h>
1510 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
1511 [ echo "*** The test program compiled, but did not run. This usually means"
1512 echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
1513 echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
1514 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1515 echo "*** to the installed location Also, make sure you have run ldconfig if that"
1516 echo "*** is required on your system"
1517 echo "***"
1518 echo "*** If you have an old version installed, it is best to remove it, although"
1519 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
1520 [ echo "*** The test program failed to compile or link. See the file config.log for the"
1521 echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
1522 CFLAGS="$ac_save_CFLAGS"
1523 LIBS="$ac_save_LIBS"
1524 fi
1525 fi
1526 GTK_CFLAGS=""
1527 GTK_LIBS=""
1528 ifelse([$3], , :, [$3])
1529 fi
1530 AC_SUBST(GTK_CFLAGS)
1531 AC_SUBST(GTK_LIBS)
1532 rm -f conf.gtktest
1533 ])
1534
1535 # Configure paths for GLIB
1536 # Owen Taylor 1997-2001
1537
1538 dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
1539 dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or
1540 dnl gthread is specified in MODULES, pass to pkg-config
1541 dnl
1542 AC_DEFUN(AM_PATH_GLIB_2_0,
1543 [dnl
1544 dnl Get the cflags and libraries from pkg-config
1545 dnl
1546 AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program],
1547 , enable_glibtest=yes)
1548
1549 pkg_config_args=glib-2.0
1550 for module in . $4
1551 do
1552 case "$module" in
1553 gmodule)
1554 pkg_config_args="$pkg_config_args gmodule-2.0"
1555 ;;
1556 gobject)
1557 pkg_config_args="$pkg_config_args gobject-2.0"
1558 ;;
1559 gthread)
1560 pkg_config_args="$pkg_config_args gthread-2.0"
1561 ;;
1562 esac
1563 done
1564
1565 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
1566
1567 no_glib=""
1568
1569 if test x$PKG_CONFIG != xno ; then
1570 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
1571 :
1572 else
1573 echo *** pkg-config too old; version 0.7 or better required.
1574 no_glib=yes
1575 PKG_CONFIG=no
1576 fi
1577 else
1578 no_glib=yes
1579 fi
1580
1581 min_glib_version=ifelse([$1], ,2.0.0,$1)
1582 AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
1583
1584 if test x$PKG_CONFIG != xno ; then
1585 ## don't try to run the test against uninstalled libtool libs
1586 if $PKG_CONFIG --uninstalled $pkg_config_args; then
1587 echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
1588 enable_glibtest=no
1589 fi
1590
1591 if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
1592 :
1593 else
1594 no_glib=yes
1595 fi
1596 fi
1597
1598 if test x"$no_glib" = x ; then
1599 GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
1600 GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
1601 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
1602
1603 GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
1604 GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
1605 glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
1606 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1607 glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
1608 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1609 glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
1610 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1611 if test "x$enable_glibtest" = "xyes" ; then
1612 ac_save_CFLAGS="$CFLAGS"
1613 ac_save_LIBS="$LIBS"
1614 CFLAGS="$CFLAGS $GLIB_CFLAGS"
1615 LIBS="$GLIB_LIBS $LIBS"
1616 dnl
1617 dnl Now check if the installed GLIB is sufficiently new. (Also sanity
1618 dnl checks the results of pkg-config to some extent)
1619 dnl
1620 rm -f conf.glibtest
1621 AC_TRY_RUN([
1622 #include <glib.h>
1623 #include <stdio.h>
1624 #include <stdlib.h>
1625
1626 int
1627 main ()
1628 {
1629 int major, minor, micro;
1630 char *tmp_version;
1631
1632 system ("touch conf.glibtest");
1633
1634 /* HP/UX 9 (%@#!) writes to sscanf strings */
1635 tmp_version = g_strdup("$min_glib_version");
1636 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1637 printf("%s, bad version string\n", "$min_glib_version");
1638 exit(1);
1639 }
1640
1641 if ((glib_major_version != $glib_config_major_version) ||
1642 (glib_minor_version != $glib_config_minor_version) ||
1643 (glib_micro_version != $glib_config_micro_version))
1644 {
1645 printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
1646 $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
1647 glib_major_version, glib_minor_version, glib_micro_version);
1648 printf ("*** was found! If pkg-config was correct, then it is best\n");
1649 printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
1650 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
1651 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
1652 printf("*** required on your system.\n");
1653 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
1654 printf("*** to point to the correct configuration files\n");
1655 }
1656 else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
1657 (glib_minor_version != GLIB_MINOR_VERSION) ||
1658 (glib_micro_version != GLIB_MICRO_VERSION))
1659 {
1660 printf("*** GLIB header files (version %d.%d.%d) do not match\n",
1661 GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
1662 printf("*** library (version %d.%d.%d)\n",
1663 glib_major_version, glib_minor_version, glib_micro_version);
1664 }
1665 else
1666 {
1667 if ((glib_major_version > major) ||
1668 ((glib_major_version == major) && (glib_minor_version > minor)) ||
1669 ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
1670 {
1671 return 0;
1672 }
1673 else
1674 {
1675 printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
1676 glib_major_version, glib_minor_version, glib_micro_version);
1677 printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
1678 major, minor, micro);
1679 printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
1680 printf("***\n");
1681 printf("*** If you have already installed a sufficiently new version, this error\n");
1682 printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
1683 printf("*** being found. The easiest way to fix this is to remove the old version\n");
1684 printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
1685 printf("*** correct copy of pkg-config. (In this case, you will have to\n");
1686 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1687 printf("*** so that the correct libraries are found at run-time))\n");
1688 }
1689 }
1690 return 1;
1691 }
1692 ],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1693 CFLAGS="$ac_save_CFLAGS"
1694 LIBS="$ac_save_LIBS"
1695 fi
1696 fi
1697 if test "x$no_glib" = x ; then
1698 AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
1699 ifelse([$2], , :, [$2])
1700 else
1701 AC_MSG_RESULT(no)
1702 if test "$PKG_CONFIG" = "no" ; then
1703 echo "*** A new enough version of pkg-config was not found."
1704 echo "*** See http://www.freedesktop.org/software/pkgconfig/"
1705 else
1706 if test -f conf.glibtest ; then
1707 :
1708 else
1709 echo "*** Could not run GLIB test program, checking why..."
1710 ac_save_CFLAGS="$CFLAGS"
1711 ac_save_LIBS="$LIBS"
1712 CFLAGS="$CFLAGS $GLIB_CFLAGS"
1713 LIBS="$LIBS $GLIB_LIBS"
1714 AC_TRY_LINK([
1715 #include <glib.h>
1716 #include <stdio.h>
1717 ], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
1718 [ echo "*** The test program compiled, but did not run. This usually means"
1719 echo "*** that the run-time linker is not finding GLIB or finding the wrong"
1720 echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
1721 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1722 echo "*** to the installed location Also, make sure you have run ldconfig if that"
1723 echo "*** is required on your system"
1724 echo "***"
1725 echo "*** If you have an old version installed, it is best to remove it, although"
1726 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
1727 [ echo "*** The test program failed to compile or link. See the file config.log for the"
1728 echo "*** exact error that occured. This usually means GLIB is incorrectly installed."])
1729 CFLAGS="$ac_save_CFLAGS"
1730 LIBS="$ac_save_LIBS"
1731 fi
1732 fi
1733 GLIB_CFLAGS=""
1734 GLIB_LIBS=""
1735 GLIB_GENMARSHAL=""
1736 GOBJECT_QUERY=""
1737 GLIB_MKENUMS=""
1738 ifelse([$3], , :, [$3])
1739 fi
1740 AC_SUBST(GLIB_CFLAGS)
1741 AC_SUBST(GLIB_LIBS)
1742 AC_SUBST(GLIB_GENMARSHAL)
1743 AC_SUBST(GOBJECT_QUERY)
1744 AC_SUBST(GLIB_MKENUMS)
1745 rm -f conf.glibtest
1746 ])
1747
1748 # Configure paths for LIBART
1749 # Raph Levien 98-11-18
1750 # stolen from Manish Singh 98-9-30
1751 # stolen back from Frank Belew
1752 # stolen from Manish Singh
1753 # Shamelessly stolen from Owen Taylor
1754
1755 dnl AM_PATH_LIBART([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1756 dnl Test for LIBART, and define LIBART_CFLAGS and LIBART_LIBS
1757 dnl
1758 AC_DEFUN(AM_PATH_LIBART,
1759 [dnl
1760 dnl Get the cflags and libraries from the libart-config script
1761 dnl
1762 AC_ARG_WITH(libart-prefix,[ --with-libart-prefix=PFX Prefix where LIBART is installed (optional)],
1763 libart_prefix="$withval", libart_prefix="")
1764 AC_ARG_WITH(libart-exec-prefix,[ --with-libart-exec-prefix=PFX Exec prefix where LIBART is installed (optional)],
1765 libart_exec_prefix="$withval", libart_exec_prefix="")
1766 AC_ARG_ENABLE(libarttest, [ --disable-libarttest Do not try to compile and run a test LIBART program],
1767 , enable_libarttest=yes)
1768
1769 if test x$libart_exec_prefix != x ; then
1770 libart_args="$libart_args --exec-prefix=$libart_exec_prefix"
1771 if test x${LIBART_CONFIG+set} != xset ; then
1772 LIBART_CONFIG=$libart_exec_prefix/bin/libart-config
1773 fi
1774 fi
1775 if test x$libart_prefix != x ; then
1776 libart_args="$libart_args --prefix=$libart_prefix"
1777 if test x${LIBART_CONFIG+set} != xset ; then
1778 LIBART_CONFIG=$libart_prefix/bin/libart-config
1779 fi
1780 fi
1781
1782 AC_PATH_PROG(LIBART_CONFIG, libart2-config, no)
1783 if test "$LIBART_CONFIG" = "no" ; then
1784 AC_PATH_PROG(LIBART_CONFIG, libart-config, no)
1785 fi
1786 min_libart_version=ifelse([$1], ,0.2.5,$1)
1787 AC_MSG_CHECKING(for LIBART - version >= $min_libart_version)
1788 no_libart=""
1789 if test "$LIBART_CONFIG" = "no" ; then
1790 no_libart=yes
1791 else
1792 LIBART_CFLAGS=`$LIBART_CONFIG $libartconf_args --cflags`
1793 LIBART_LIBS=`$LIBART_CONFIG $libartconf_args --libs`
1794
1795 libart_major_version=`$LIBART_CONFIG $libart_args --version | \
1796 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1797 libart_minor_version=`$LIBART_CONFIG $libart_args --version | \
1798 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1799 libart_micro_version=`$LIBART_CONFIG $libart_config_args --version | \
1800 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1801 if test "x$enable_libarttest" = "xyes" ; then
1802 ac_save_CFLAGS="$CFLAGS"
1803 ac_save_LIBS="$LIBS"
1804 CFLAGS="$CFLAGS $LIBART_CFLAGS"
1805 LIBS="$LIBS $LIBART_LIBS"
1806 dnl
1807 dnl Now check if the installed LIBART is sufficiently new. (Also sanity
1808 dnl checks the results of libart-config to some extent
1809 dnl
1810 rm -f conf.libarttest
1811 AC_TRY_RUN([
1812 #include <stdio.h>
1813 #include <stdlib.h>
1814 #include <string.h>
1815 #include <libart_lgpl/libart.h>
1816
1817 char*
1818 my_strdup (char *str)
1819 {
1820 char *new_str;
1821
1822 if (str)
1823 {
1824 new_str = malloc ((strlen (str) + 1) * sizeof(char));
1825 strcpy (new_str, str);
1826 }
1827 else
1828 new_str = NULL;
1829
1830 return new_str;
1831 }
1832
1833 int main ()
1834 {
1835 int major, minor, micro;
1836 char *tmp_version;
1837
1838 system ("touch conf.libarttest");
1839
1840 /* HP/UX 9 (%@#!) writes to sscanf strings */
1841 tmp_version = my_strdup("$min_libart_version");
1842 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1843 printf("%s, bad version string\n", "$min_libart_version");
1844 exit(1);
1845 }
1846
1847 if (($libart_major_version > major) ||
1848 (($libart_major_version == major) && ($libart_minor_version > minor)) ||
1849 (($libart_major_version == major) && ($libart_minor_version == minor) && ($libart_micro_version >= micro)))
1850 {
1851 return 0;
1852 }
1853 else
1854 {
1855 printf("\n*** 'libart-config --version' returned %d.%d.%d, but the minimum version\n", $libart_major_version, $libart_minor_version, $libart_micro_version);
1856 printf("*** of LIBART required is %d.%d.%d. If libart-config is correct, then it is\n", major, minor, micro);
1857 printf("*** best to upgrade to the required version.\n");
1858 printf("*** If libart-config was wrong, set the environment variable LIBART_CONFIG\n");
1859 printf("*** to point to the correct copy of libart-config, and remove the file\n");
1860 printf("*** config.cache before re-running configure\n");
1861 return 1;
1862 }
1863 }
1864
1865 ],, no_libart=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1866 CFLAGS="$ac_save_CFLAGS"
1867 LIBS="$ac_save_LIBS"
1868 fi
1869 fi
1870 if test "x$no_libart" = x ; then
1871 AC_MSG_RESULT(yes)
1872 ifelse([$2], , :, [$2])
1873 else
1874 AC_MSG_RESULT(no)
1875 if test "$LIBART_CONFIG" = "no" ; then
1876 echo "*** The libart-config script installed by LIBART could not be found"
1877 echo "*** If LIBART was installed in PREFIX, make sure PREFIX/bin is in"
1878 echo "*** your path, or set the LIBART_CONFIG environment variable to the"
1879 echo "*** full path to libart-config."
1880 else
1881 if test -f conf.libarttest ; then
1882 :
1883 else
1884 echo "*** Could not run LIBART test program, checking why..."
1885 CFLAGS="$CFLAGS $LIBART_CFLAGS"
1886 LIBS="$LIBS $LIBART_LIBS"
1887 AC_TRY_LINK([
1888 #include <stdio.h>
1889 #include <libart_lgpl/libart.h>
1890 ], [ return 0; ],
1891 [ echo "*** The test program compiled, but did not run. This usually means"
1892 echo "*** that the run-time linker is not finding LIBART or finding the wrong"
1893 echo "*** version of LIBART. If it is not finding LIBART, you'll need to set your"
1894 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1895 echo "*** to the installed location Also, make sure you have run ldconfig if that"
1896 echo "*** is required on your system"
1897 echo "***"
1898 echo "*** If you have an old version installed, it is best to remove it, although"
1899 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1900 [ echo "*** The test program failed to compile or link. See the file config.log for the"
1901 echo "*** exact error that occured. This usually means LIBART was incorrectly installed"
1902 echo "*** or that you have moved LIBART since it was installed. In the latter case, you"
1903 echo "*** may want to edit the libart-config script: $LIBART_CONFIG" ])
1904 CFLAGS="$ac_save_CFLAGS"
1905 LIBS="$ac_save_LIBS"
1906 fi
1907 fi
1908 LIBART_CFLAGS=""
1909 LIBART_LIBS=""
1910 ifelse([$3], , :, [$3])
1911 fi
1912 AC_SUBST(LIBART_CFLAGS)
1913 AC_SUBST(LIBART_LIBS)
1914 rm -f conf.libarttest
1915 ])
1916
This page took 0.124756 seconds and 5 git commands to generate.