| 1 | dnl aclocal.m4 generated automatically by aclocal 1.4 |
| 2 | |
| 3 | dnl Copyright (C) 1994, 1995-8, 1999 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 | dnl See whether we need to use fopen-bin.h rather than fopen-same.h. |
| 14 | AC_DEFUN(BFD_BINARY_FOPEN, |
| 15 | [AC_REQUIRE([AC_CANONICAL_SYSTEM]) |
| 16 | case "${host}" in |
| 17 | changequote(,)dnl |
| 18 | *-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*) |
| 19 | changequote([,])dnl |
| 20 | AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;; |
| 21 | esac])dnl |
| 22 | |
| 23 | dnl Get a default for CC_FOR_BUILD to put into Makefile. |
| 24 | AC_DEFUN(BFD_CC_FOR_BUILD, |
| 25 | [# Put a plausible default for CC_FOR_BUILD in Makefile. |
| 26 | if test -z "$CC_FOR_BUILD"; then |
| 27 | if test "x$cross_compiling" = "xno"; then |
| 28 | CC_FOR_BUILD='$(CC)' |
| 29 | else |
| 30 | CC_FOR_BUILD=gcc |
| 31 | fi |
| 32 | fi |
| 33 | AC_SUBST(CC_FOR_BUILD) |
| 34 | # Also set EXEEXT_FOR_BUILD. |
| 35 | if test "x$cross_compiling" = "xno"; then |
| 36 | EXEEXT_FOR_BUILD='$(EXEEXT)' |
| 37 | else |
| 38 | AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext, |
| 39 | [rm -f conftest* |
| 40 | echo 'int main () { return 0; }' > conftest.c |
| 41 | bfd_cv_build_exeext= |
| 42 | ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 |
| 43 | for file in conftest.*; do |
| 44 | case $file in |
| 45 | *.c | *.o | *.obj | *.ilk | *.pdb) ;; |
| 46 | *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; |
| 47 | esac |
| 48 | done |
| 49 | rm -f conftest* |
| 50 | test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no]) |
| 51 | EXEEXT_FOR_BUILD="" |
| 52 | test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} |
| 53 | fi |
| 54 | AC_SUBST(EXEEXT_FOR_BUILD)])dnl |
| 55 | |
| 56 | dnl See whether we need a declaration for a function. |
| 57 | AC_DEFUN(BFD_NEED_DECLARATION, |
| 58 | [AC_MSG_CHECKING([whether $1 must be declared]) |
| 59 | AC_CACHE_VAL(bfd_cv_decl_needed_$1, |
| 60 | [AC_TRY_COMPILE([ |
| 61 | #include <stdio.h> |
| 62 | #ifdef HAVE_STRING_H |
| 63 | #include <string.h> |
| 64 | #else |
| 65 | #ifdef HAVE_STRINGS_H |
| 66 | #include <strings.h> |
| 67 | #endif |
| 68 | #endif |
| 69 | #ifdef HAVE_STDLIB_H |
| 70 | #include <stdlib.h> |
| 71 | #endif |
| 72 | #ifdef HAVE_UNISTD_H |
| 73 | #include <unistd.h> |
| 74 | #endif], |
| 75 | [char *(*pfn) = (char *(*)) $1], |
| 76 | bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)]) |
| 77 | AC_MSG_RESULT($bfd_cv_decl_needed_$1) |
| 78 | if test $bfd_cv_decl_needed_$1 = yes; then |
| 79 | AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1, |
| 80 | [Define if $1 is not declared in system header files.]) |
| 81 | fi |
| 82 | ])dnl |
| 83 | |
| 84 | dnl Check for existence of a type $1 in sys/procfs.h |
| 85 | |
| 86 | AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE, |
| 87 | [AC_MSG_CHECKING([for $1 in sys/procfs.h]) |
| 88 | AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1, |
| 89 | [AC_TRY_COMPILE([#include <sys/procfs.h>], |
| 90 | [$1 avar], |
| 91 | bfd_cv_have_sys_procfs_type_$1=yes, |
| 92 | bfd_cv_have_sys_procfs_type_$1=no |
| 93 | )]) |
| 94 | if test $bfd_cv_have_sys_procfs_type_$1 = yes; then |
| 95 | AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1, |
| 96 | [Define if <sys/procfs.h> has $1.]) |
| 97 | fi |
| 98 | AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1) |
| 99 | ]) |
| 100 | |
| 101 | |
| 102 | dnl Check for existence of member $2 in type $1 in sys/procfs.h |
| 103 | |
| 104 | AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER, |
| 105 | [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h]) |
| 106 | AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2, |
| 107 | [AC_TRY_COMPILE([#include <sys/procfs.h>], |
| 108 | [$1 avar; void* aref = (void*) &avar.$2], |
| 109 | bfd_cv_have_sys_procfs_type_member_$1_$2=yes, |
| 110 | bfd_cv_have_sys_procfs_type_member_$1_$2=no |
| 111 | )]) |
| 112 | if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then |
| 113 | AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1, |
| 114 | [Define if <sys/procfs.h> has $1.$2.]) |
| 115 | fi |
| 116 | AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2) |
| 117 | ]) |
| 118 | |
| 119 | |
| 120 | |
| 121 | # Do all the work for Automake. This macro actually does too much -- |
| 122 | # some checks are only needed if your package does certain things. |
| 123 | # But this isn't really a big deal. |
| 124 | |
| 125 | # serial 1 |
| 126 | |
| 127 | dnl Usage: |
| 128 | dnl AM_INIT_AUTOMAKE(package,version, [no-define]) |
| 129 | |
| 130 | AC_DEFUN(AM_INIT_AUTOMAKE, |
| 131 | [AC_REQUIRE([AC_PROG_INSTALL]) |
| 132 | PACKAGE=[$1] |
| 133 | AC_SUBST(PACKAGE) |
| 134 | VERSION=[$2] |
| 135 | AC_SUBST(VERSION) |
| 136 | dnl test to see if srcdir already configured |
| 137 | if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then |
| 138 | AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) |
| 139 | fi |
| 140 | ifelse([$3],, |
| 141 | AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) |
| 142 | AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) |
| 143 | AC_REQUIRE([AM_SANITY_CHECK]) |
| 144 | AC_REQUIRE([AC_ARG_PROGRAM]) |
| 145 | dnl FIXME This is truly gross. |
| 146 | missing_dir=`cd $ac_aux_dir && pwd` |
| 147 | AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) |
| 148 | AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) |
| 149 | AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) |
| 150 | AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) |
| 151 | AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) |
| 152 | AC_REQUIRE([AC_PROG_MAKE_SET])]) |
| 153 | |
| 154 | # |
| 155 | # Check to make sure that the build environment is sane. |
| 156 | # |
| 157 | |
| 158 | AC_DEFUN(AM_SANITY_CHECK, |
| 159 | [AC_MSG_CHECKING([whether build environment is sane]) |
| 160 | # Just in case |
| 161 | sleep 1 |
| 162 | echo timestamp > conftestfile |
| 163 | # Do `set' in a subshell so we don't clobber the current shell's |
| 164 | # arguments. Must try -L first in case configure is actually a |
| 165 | # symlink; some systems play weird games with the mod time of symlinks |
| 166 | # (eg FreeBSD returns the mod time of the symlink's containing |
| 167 | # directory). |
| 168 | if ( |
| 169 | set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` |
| 170 | if test "[$]*" = "X"; then |
| 171 | # -L didn't work. |
| 172 | set X `ls -t $srcdir/configure conftestfile` |
| 173 | fi |
| 174 | if test "[$]*" != "X $srcdir/configure conftestfile" \ |
| 175 | && test "[$]*" != "X conftestfile $srcdir/configure"; then |
| 176 | |
| 177 | # If neither matched, then we have a broken ls. This can happen |
| 178 | # if, for instance, CONFIG_SHELL is bash and it inherits a |
| 179 | # broken ls alias from the environment. This has actually |
| 180 | # happened. Such a system could not be considered "sane". |
| 181 | AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken |
| 182 | alias in your environment]) |
| 183 | fi |
| 184 | |
| 185 | test "[$]2" = conftestfile |
| 186 | ) |
| 187 | then |
| 188 | # Ok. |
| 189 | : |
| 190 | else |
| 191 | AC_MSG_ERROR([newly created file is older than distributed files! |
| 192 | Check your system clock]) |
| 193 | fi |
| 194 | rm -f conftest* |
| 195 | AC_MSG_RESULT(yes)]) |
| 196 | |
| 197 | dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) |
| 198 | dnl The program must properly implement --version. |
| 199 | AC_DEFUN(AM_MISSING_PROG, |
| 200 | [AC_MSG_CHECKING(for working $2) |
| 201 | # Run test in a subshell; some versions of sh will print an error if |
| 202 | # an executable is not found, even if stderr is redirected. |
| 203 | # Redirect stdin to placate older versions of autoconf. Sigh. |
| 204 | if ($2 --version) < /dev/null > /dev/null 2>&1; then |
| 205 | $1=$2 |
| 206 | AC_MSG_RESULT(found) |
| 207 | else |
| 208 | $1="$3/missing $2" |
| 209 | AC_MSG_RESULT(missing) |
| 210 | fi |
| 211 | AC_SUBST($1)]) |
| 212 | |
| 213 | |
| 214 | # serial 35 AC_PROG_LIBTOOL |
| 215 | AC_DEFUN(AC_PROG_LIBTOOL, |
| 216 | [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl |
| 217 | |
| 218 | # Save cache, so that ltconfig can load it |
| 219 | AC_CACHE_SAVE |
| 220 | |
| 221 | # Actually configure libtool. ac_aux_dir is where install-sh is found. |
| 222 | CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ |
| 223 | LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \ |
| 224 | DLLTOOL="$DLLTOOL" AS="$AS" \ |
| 225 | ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ |
| 226 | $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ |
| 227 | || AC_MSG_ERROR([libtool configure failed]) |
| 228 | |
| 229 | # Reload cache, that may have been modified by ltconfig |
| 230 | AC_CACHE_LOAD |
| 231 | |
| 232 | # This can be used to rebuild libtool when needed |
| 233 | LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" |
| 234 | |
| 235 | # Always use our own libtool. |
| 236 | LIBTOOL='$(SHELL) $(top_builddir)/libtool' |
| 237 | AC_SUBST(LIBTOOL)dnl |
| 238 | |
| 239 | # Redirect the config.log output again, so that the ltconfig log is not |
| 240 | # clobbered by the next message. |
| 241 | exec 5>>./config.log |
| 242 | ]) |
| 243 | |
| 244 | AC_DEFUN(AC_LIBTOOL_SETUP, |
| 245 | [AC_PREREQ(2.13)dnl |
| 246 | AC_REQUIRE([AC_ENABLE_SHARED])dnl |
| 247 | AC_REQUIRE([AC_ENABLE_STATIC])dnl |
| 248 | AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl |
| 249 | AC_REQUIRE([AC_CANONICAL_HOST])dnl |
| 250 | AC_REQUIRE([AC_CANONICAL_BUILD])dnl |
| 251 | AC_REQUIRE([AC_PROG_RANLIB])dnl |
| 252 | AC_REQUIRE([AC_PROG_CC])dnl |
| 253 | AC_REQUIRE([AC_PROG_LD])dnl |
| 254 | AC_REQUIRE([AC_PROG_NM])dnl |
| 255 | AC_REQUIRE([AC_SYS_NM_PARSE])dnl |
| 256 | AC_REQUIRE([AC_SYS_SYMBOL_UNDERSCORE])dnl |
| 257 | AC_REQUIRE([AC_PROG_LN_S])dnl |
| 258 | dnl |
| 259 | |
| 260 | # Check for any special flags to pass to ltconfig. |
| 261 | libtool_flags="--cache-file=$cache_file" |
| 262 | test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" |
| 263 | test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" |
| 264 | test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" |
| 265 | test "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen" |
| 266 | test "$silent" = yes && libtool_flags="$libtool_flags --silent" |
| 267 | test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" |
| 268 | test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" |
| 269 | |
| 270 | # Some flags need to be propagated to the compiler or linker for good |
| 271 | # libtool support. |
| 272 | case "$host" in |
| 273 | *-*-irix6*) |
| 274 | # Find out which ABI we are using. |
| 275 | echo '[#]line __oline__ "configure"' > conftest.$ac_ext |
| 276 | if AC_TRY_EVAL(ac_compile); then |
| 277 | case "`/usr/bin/file conftest.o`" in |
| 278 | *32-bit*) |
| 279 | LD="${LD-ld} -32" |
| 280 | ;; |
| 281 | *N32*) |
| 282 | LD="${LD-ld} -n32" |
| 283 | ;; |
| 284 | *64-bit*) |
| 285 | LD="${LD-ld} -64" |
| 286 | ;; |
| 287 | esac |
| 288 | fi |
| 289 | rm -rf conftest* |
| 290 | ;; |
| 291 | |
| 292 | *-*-sco3.2v5*) |
| 293 | # On SCO OpenServer 5, we need -belf to get full-featured binaries. |
| 294 | SAVE_CFLAGS="$CFLAGS" |
| 295 | CFLAGS="$CFLAGS -belf" |
| 296 | AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, |
| 297 | [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) |
| 298 | if test x"$lt_cv_cc_needs_belf" != x"yes"; then |
| 299 | # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf |
| 300 | CFLAGS="$SAVE_CFLAGS" |
| 301 | fi |
| 302 | ;; |
| 303 | |
| 304 | *-*-cygwin*) |
| 305 | AC_SYS_LIBTOOL_CYGWIN |
| 306 | ;; |
| 307 | |
| 308 | esac |
| 309 | |
| 310 | # enable the --disable-libtool-lock switch |
| 311 | |
| 312 | AC_ARG_ENABLE(libtool-lock, |
| 313 | [ --disable-libtool-lock force libtool not to do file locking], |
| 314 | need_locks=$enableval, |
| 315 | need_locks=yes) |
| 316 | |
| 317 | if test x"$need_locks" = xno; then |
| 318 | libtool_flags="$libtool_flags --disable-lock" |
| 319 | fi |
| 320 | ]) |
| 321 | |
| 322 | # AC_LIBTOOL_DLOPEN - check for dlopen support |
| 323 | AC_DEFUN(AC_LIBTOOL_DLOPEN, [lt_dlopen=yes]) |
| 324 | |
| 325 | # AC_ENABLE_SHARED - implement the --enable-shared flag |
| 326 | # Usage: AC_ENABLE_SHARED[(DEFAULT)] |
| 327 | # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to |
| 328 | # `yes'. |
| 329 | AC_DEFUN(AC_ENABLE_SHARED, |
| 330 | [define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl |
| 331 | AC_ARG_ENABLE(shared, |
| 332 | changequote(<<, >>)dnl |
| 333 | << --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], |
| 334 | changequote([, ])dnl |
| 335 | [p=${PACKAGE-default} |
| 336 | case "$enableval" in |
| 337 | yes) enable_shared=yes ;; |
| 338 | no) enable_shared=no ;; |
| 339 | *) |
| 340 | enable_shared=no |
| 341 | # Look at the argument we got. We use all the common list separators. |
| 342 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," |
| 343 | for pkg in $enableval; do |
| 344 | if test "X$pkg" = "X$p"; then |
| 345 | enable_shared=yes |
| 346 | fi |
| 347 | done |
| 348 | IFS="$ac_save_ifs" |
| 349 | ;; |
| 350 | esac], |
| 351 | enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl |
| 352 | ]) |
| 353 | |
| 354 | # AC_DISABLE_SHARED - set the default shared flag to --disable-shared |
| 355 | AC_DEFUN(AC_DISABLE_SHARED, |
| 356 | [AC_ENABLE_SHARED(no)]) |
| 357 | |
| 358 | # AC_ENABLE_STATIC - implement the --enable-static flag |
| 359 | # Usage: AC_ENABLE_STATIC[(DEFAULT)] |
| 360 | # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to |
| 361 | # `yes'. |
| 362 | AC_DEFUN(AC_ENABLE_STATIC, |
| 363 | [define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl |
| 364 | AC_ARG_ENABLE(static, |
| 365 | changequote(<<, >>)dnl |
| 366 | << --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], |
| 367 | changequote([, ])dnl |
| 368 | [p=${PACKAGE-default} |
| 369 | case "$enableval" in |
| 370 | yes) enable_static=yes ;; |
| 371 | no) enable_static=no ;; |
| 372 | *) |
| 373 | enable_static=no |
| 374 | # Look at the argument we got. We use all the common list separators. |
| 375 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," |
| 376 | for pkg in $enableval; do |
| 377 | if test "X$pkg" = "X$p"; then |
| 378 | enable_static=yes |
| 379 | fi |
| 380 | done |
| 381 | IFS="$ac_save_ifs" |
| 382 | ;; |
| 383 | esac], |
| 384 | enable_static=AC_ENABLE_STATIC_DEFAULT)dnl |
| 385 | ]) |
| 386 | |
| 387 | # AC_DISABLE_STATIC - set the default static flag to --disable-static |
| 388 | AC_DEFUN(AC_DISABLE_STATIC, |
| 389 | [AC_ENABLE_STATIC(no)]) |
| 390 | |
| 391 | |
| 392 | # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag |
| 393 | # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] |
| 394 | # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to |
| 395 | # `yes'. |
| 396 | AC_DEFUN(AC_ENABLE_FAST_INSTALL, |
| 397 | [define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl |
| 398 | AC_ARG_ENABLE(fast-install, |
| 399 | changequote(<<, >>)dnl |
| 400 | << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], |
| 401 | changequote([, ])dnl |
| 402 | [p=${PACKAGE-default} |
| 403 | case "$enableval" in |
| 404 | yes) enable_fast_install=yes ;; |
| 405 | no) enable_fast_install=no ;; |
| 406 | *) |
| 407 | enable_fast_install=no |
| 408 | # Look at the argument we got. We use all the common list separators. |
| 409 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," |
| 410 | for pkg in $enableval; do |
| 411 | if test "X$pkg" = "X$p"; then |
| 412 | enable_fast_install=yes |
| 413 | fi |
| 414 | done |
| 415 | IFS="$ac_save_ifs" |
| 416 | ;; |
| 417 | esac], |
| 418 | enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl |
| 419 | ]) |
| 420 | |
| 421 | # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install |
| 422 | AC_DEFUN(AC_DISABLE_FAST_INSTALL, |
| 423 | [AC_ENABLE_FAST_INSTALL(no)]) |
| 424 | |
| 425 | |
| 426 | # AC_PROG_LD - find the path to the GNU or non-GNU linker |
| 427 | AC_DEFUN(AC_PROG_LD, |
| 428 | [AC_ARG_WITH(gnu-ld, |
| 429 | [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], |
| 430 | test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) |
| 431 | AC_REQUIRE([AC_PROG_CC])dnl |
| 432 | AC_REQUIRE([AC_CANONICAL_HOST])dnl |
| 433 | AC_REQUIRE([AC_CANONICAL_BUILD])dnl |
| 434 | ac_prog=ld |
| 435 | if test "$ac_cv_prog_gcc" = yes; then |
| 436 | # Check if gcc -print-prog-name=ld gives a path. |
| 437 | AC_MSG_CHECKING([for ld used by GCC]) |
| 438 | ac_prog=`($CC -print-prog-name=ld) 2>&5` |
| 439 | case "$ac_prog" in |
| 440 | # Accept absolute paths. |
| 441 | changequote(,)dnl |
| 442 | /* | [A-Za-z]:[\\/]*) |
| 443 | re_direlt='/[^/][^/]*/\.\./' |
| 444 | changequote([,])dnl |
| 445 | # Canonicalize the path of ld |
| 446 | ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` |
| 447 | while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do |
| 448 | ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` |
| 449 | done |
| 450 | test -z "$LD" && LD="$ac_prog" |
| 451 | ;; |
| 452 | "") |
| 453 | # If it fails, then pretend we aren't using GCC. |
| 454 | ac_prog=ld |
| 455 | ;; |
| 456 | *) |
| 457 | # If it is relative, then search for the first ld in PATH. |
| 458 | with_gnu_ld=unknown |
| 459 | ;; |
| 460 | esac |
| 461 | elif test "$with_gnu_ld" = yes; then |
| 462 | AC_MSG_CHECKING([for GNU ld]) |
| 463 | else |
| 464 | AC_MSG_CHECKING([for non-GNU ld]) |
| 465 | fi |
| 466 | AC_CACHE_VAL(ac_cv_path_LD, |
| 467 | [if test -z "$LD"; then |
| 468 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" |
| 469 | for ac_dir in $PATH; do |
| 470 | test -z "$ac_dir" && ac_dir=. |
| 471 | if test -f "$ac_dir/$ac_prog"; then |
| 472 | ac_cv_path_LD="$ac_dir/$ac_prog" |
| 473 | # Check to see if the program is GNU ld. I'd rather use --version, |
| 474 | # but apparently some GNU ld's only accept -v. |
| 475 | # Break only if it was the GNU/non-GNU ld that we prefer. |
| 476 | if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then |
| 477 | test "$with_gnu_ld" != no && break |
| 478 | else |
| 479 | test "$with_gnu_ld" != yes && break |
| 480 | fi |
| 481 | fi |
| 482 | done |
| 483 | IFS="$ac_save_ifs" |
| 484 | else |
| 485 | ac_cv_path_LD="$LD" # Let the user override the test with a path. |
| 486 | fi]) |
| 487 | LD="$ac_cv_path_LD" |
| 488 | if test -n "$LD"; then |
| 489 | AC_MSG_RESULT($LD) |
| 490 | else |
| 491 | AC_MSG_RESULT(no) |
| 492 | fi |
| 493 | test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) |
| 494 | AC_SUBST(LD) |
| 495 | AC_PROG_LD_GNU |
| 496 | ]) |
| 497 | |
| 498 | AC_DEFUN(AC_PROG_LD_GNU, |
| 499 | [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, |
| 500 | [# I'd rather use --version here, but apparently some GNU ld's only accept -v. |
| 501 | if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then |
| 502 | ac_cv_prog_gnu_ld=yes |
| 503 | else |
| 504 | ac_cv_prog_gnu_ld=no |
| 505 | fi]) |
| 506 | ]) |
| 507 | |
| 508 | # AC_PROG_NM - find the path to a BSD-compatible name lister |
| 509 | AC_DEFUN(AC_PROG_NM, |
| 510 | [AC_MSG_CHECKING([for BSD-compatible nm]) |
| 511 | AC_CACHE_VAL(ac_cv_path_NM, |
| 512 | [if test -n "$NM"; then |
| 513 | # Let the user override the test. |
| 514 | ac_cv_path_NM="$NM" |
| 515 | else |
| 516 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" |
| 517 | for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do |
| 518 | test -z "$ac_dir" && ac_dir=. |
| 519 | if test -f $ac_dir/nm; then |
| 520 | # Check to see if the nm accepts a BSD-compat flag. |
| 521 | # Adding the `sed 1q' prevents false positives on HP-UX, which says: |
| 522 | # nm: unknown option "B" ignored |
| 523 | if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then |
| 524 | ac_cv_path_NM="$ac_dir/nm -B" |
| 525 | break |
| 526 | elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then |
| 527 | ac_cv_path_NM="$ac_dir/nm -p" |
| 528 | break |
| 529 | else |
| 530 | ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but |
| 531 | continue # so that we can try to find one that supports BSD flags |
| 532 | fi |
| 533 | fi |
| 534 | done |
| 535 | IFS="$ac_save_ifs" |
| 536 | test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm |
| 537 | fi]) |
| 538 | NM="$ac_cv_path_NM" |
| 539 | AC_MSG_RESULT([$NM]) |
| 540 | AC_SUBST(NM) |
| 541 | ]) |
| 542 | |
| 543 | # AC_SYS_NM_PARSE - Check for command to grab the raw symbol name followed |
| 544 | # by C symbol name from nm. |
| 545 | AC_DEFUN(AC_SYS_NM_PARSE, |
| 546 | [AC_REQUIRE([AC_CANONICAL_HOST])dnl |
| 547 | AC_REQUIRE([AC_PROG_NM])dnl |
| 548 | # Check for command to grab the raw symbol name followed by C symbol from nm. |
| 549 | AC_MSG_CHECKING([command to parse $NM output]) |
| 550 | AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe, |
| 551 | [# These are sane defaults that work on at least a few old systems. |
| 552 | # {They come from Ultrix. What could be older than Ultrix?!! ;)} |
| 553 | |
| 554 | changequote(,)dnl |
| 555 | # Character class describing NM global symbol codes. |
| 556 | ac_symcode='[BCDEGRST]' |
| 557 | |
| 558 | # Regexp to match symbols that can be accessed directly from C. |
| 559 | ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)' |
| 560 | |
| 561 | # Transform the above into a raw symbol and a C symbol. |
| 562 | ac_symxfrm='\1 \2\3 \3' |
| 563 | |
| 564 | # Transform an extracted symbol line into a proper C declaration |
| 565 | ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" |
| 566 | |
| 567 | # Define system-specific variables. |
| 568 | case "$host_os" in |
| 569 | aix*) |
| 570 | ac_symcode='[BCDT]' |
| 571 | ;; |
| 572 | cygwin* | mingw*) |
| 573 | ac_symcode='[ABCDGISTW]' |
| 574 | ;; |
| 575 | hpux*) |
| 576 | ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" |
| 577 | ;; |
| 578 | irix*) |
| 579 | ac_symcode='[BCDEGRST]' |
| 580 | ;; |
| 581 | solaris*) |
| 582 | ac_symcode='[BDT]' |
| 583 | ;; |
| 584 | esac |
| 585 | |
| 586 | # If we're using GNU nm, then use its standard symbol codes. |
| 587 | if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then |
| 588 | ac_symcode='[ABCDGISTW]' |
| 589 | fi |
| 590 | changequote([,])dnl |
| 591 | |
| 592 | # Try without a prefix undercore, then with it. |
| 593 | for ac_symprfx in "" "_"; do |
| 594 | |
| 595 | ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($ac_symcode\)[ ][ ]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'" |
| 596 | |
| 597 | # Check to see that the pipe works correctly. |
| 598 | ac_pipe_works=no |
| 599 | rm -f conftest.$ac_ext |
| 600 | cat > conftest.$ac_ext <<EOF |
| 601 | #ifdef __cplusplus |
| 602 | extern "C" { |
| 603 | #endif |
| 604 | char nm_test_var; |
| 605 | void nm_test_func(){} |
| 606 | #ifdef __cplusplus |
| 607 | } |
| 608 | #endif |
| 609 | int main(){nm_test_var='a';nm_test_func;return 0;} |
| 610 | EOF |
| 611 | |
| 612 | if AC_TRY_EVAL(ac_compile); then |
| 613 | # Now try to grab the symbols. |
| 614 | ac_nlist=conftest.nm |
| 615 | |
| 616 | if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then |
| 617 | |
| 618 | # Try sorting and uniquifying the output. |
| 619 | if sort "$ac_nlist" | uniq > "$ac_nlist"T; then |
| 620 | mv -f "$ac_nlist"T "$ac_nlist" |
| 621 | else |
| 622 | rm -f "$ac_nlist"T |
| 623 | fi |
| 624 | |
| 625 | # Make sure that we snagged all the symbols we need. |
| 626 | if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then |
| 627 | if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then |
| 628 | cat <<EOF > conftest.c |
| 629 | #ifdef __cplusplus |
| 630 | extern "C" { |
| 631 | #endif |
| 632 | |
| 633 | EOF |
| 634 | # Now generate the symbol file. |
| 635 | eval "$ac_global_symbol_to_cdecl"' < "$ac_nlist" >> conftest.c' |
| 636 | |
| 637 | cat <<EOF >> conftest.c |
| 638 | #if defined (__STDC__) && __STDC__ |
| 639 | # define lt_ptr_t void * |
| 640 | #else |
| 641 | # define lt_ptr_t char * |
| 642 | # define const |
| 643 | #endif |
| 644 | |
| 645 | /* The mapping between symbol names and symbols. */ |
| 646 | const struct { |
| 647 | const char *name; |
| 648 | lt_ptr_t address; |
| 649 | } |
| 650 | changequote(,)dnl |
| 651 | lt_preloaded_symbols[] = |
| 652 | changequote([,])dnl |
| 653 | { |
| 654 | EOF |
| 655 | sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c |
| 656 | cat <<\EOF >> conftest.c |
| 657 | {0, (lt_ptr_t) 0} |
| 658 | }; |
| 659 | |
| 660 | #ifdef __cplusplus |
| 661 | } |
| 662 | #endif |
| 663 | EOF |
| 664 | # Now try linking the two files. |
| 665 | mv conftest.$ac_objext conftestm.$ac_objext |
| 666 | ac_save_LIBS="$LIBS" |
| 667 | ac_save_CFLAGS="$CFLAGS" |
| 668 | LIBS="conftestm.$ac_objext" |
| 669 | CFLAGS="$CFLAGS$no_builtin_flag" |
| 670 | if AC_TRY_EVAL(ac_link) && test -s conftest; then |
| 671 | ac_pipe_works=yes |
| 672 | else |
| 673 | echo "configure: failed program was:" >&AC_FD_CC |
| 674 | cat conftest.c >&AC_FD_CC |
| 675 | fi |
| 676 | LIBS="$ac_save_LIBS" |
| 677 | CFLAGS="$ac_save_CFLAGS" |
| 678 | else |
| 679 | echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC |
| 680 | fi |
| 681 | else |
| 682 | echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC |
| 683 | fi |
| 684 | else |
| 685 | echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC |
| 686 | fi |
| 687 | else |
| 688 | echo "$progname: failed program was:" >&AC_FD_CC |
| 689 | cat conftest.c >&AC_FD_CC |
| 690 | fi |
| 691 | rm -rf conftest* |
| 692 | |
| 693 | # Do not use the global_symbol_pipe unless it works. |
| 694 | if test "$ac_pipe_works" = yes; then |
| 695 | if test x"$ac_symprfx" = x"_"; then |
| 696 | ac_cv_sys_symbol_underscore=yes |
| 697 | else |
| 698 | ac_cv_sys_symbol_underscore=no |
| 699 | fi |
| 700 | break |
| 701 | else |
| 702 | ac_cv_sys_global_symbol_pipe= |
| 703 | fi |
| 704 | done |
| 705 | ]) |
| 706 | |
| 707 | ac_result=yes |
| 708 | if test -z "$ac_cv_sys_global_symbol_pipe"; then |
| 709 | ac_result=no |
| 710 | fi |
| 711 | AC_MSG_RESULT($ac_result) |
| 712 | ]) |
| 713 | |
| 714 | # AC_SYS_LIBTOOL_CYGWIN - find tools needed on cygwin |
| 715 | AC_DEFUN(AC_SYS_LIBTOOL_CYGWIN, |
| 716 | [AC_CHECK_TOOL(DLLTOOL, dlltool, false) |
| 717 | AC_CHECK_TOOL(AS, as, false) |
| 718 | ]) |
| 719 | |
| 720 | # AC_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols |
| 721 | # with an underscore? |
| 722 | AC_DEFUN(AC_SYS_SYMBOL_UNDERSCORE, |
| 723 | [AC_REQUIRE([AC_PROG_NM])dnl |
| 724 | AC_REQUIRE([AC_SYS_NM_PARSE])dnl |
| 725 | AC_MSG_CHECKING([for _ prefix in compiled symbols]) |
| 726 | AC_CACHE_VAL(ac_cv_sys_symbol_underscore, |
| 727 | [ac_cv_sys_symbol_underscore=no |
| 728 | cat > conftest.$ac_ext <<EOF |
| 729 | void nm_test_func(){} |
| 730 | int main(){nm_test_func;return 0;} |
| 731 | EOF |
| 732 | if AC_TRY_EVAL(ac_compile); then |
| 733 | # Now try to grab the symbols. |
| 734 | ac_nlist=conftest.nm |
| 735 | if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then |
| 736 | # See whether the symbols have a leading underscore. |
| 737 | if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then |
| 738 | ac_cv_sys_symbol_underscore=yes |
| 739 | else |
| 740 | if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then |
| 741 | : |
| 742 | else |
| 743 | echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC |
| 744 | fi |
| 745 | fi |
| 746 | else |
| 747 | echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC |
| 748 | fi |
| 749 | else |
| 750 | echo "configure: failed program was:" >&AC_FD_CC |
| 751 | cat conftest.c >&AC_FD_CC |
| 752 | fi |
| 753 | rm -rf conftest* |
| 754 | ]) |
| 755 | AC_MSG_RESULT($ac_cv_sys_symbol_underscore) |
| 756 | USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no} |
| 757 | AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl |
| 758 | ]) |
| 759 | |
| 760 | # AC_CHECK_LIBM - check for math library |
| 761 | AC_DEFUN(AC_CHECK_LIBM, [ |
| 762 | AC_CHECK_LIB(mw, _mwvalidcheckl) |
| 763 | AC_CHECK_LIB(m, cos) |
| 764 | ]) |
| 765 | |
| 766 | # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for |
| 767 | # the libltdl convenience library, adds --enable-ltdl-convenience to |
| 768 | # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor |
| 769 | # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed |
| 770 | # to be `${top_builddir}/libltdl'. Make sure you start DIR with |
| 771 | # '${top_builddir}/' (note the single quotes!) if your package is not |
| 772 | # flat, and, if you're not using automake, define top_builddir as |
| 773 | # appropriate in the Makefiles. |
| 774 | AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [ |
| 775 | case "$enable_ltdl_convenience" in |
| 776 | no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; |
| 777 | "") enable_ltdl_convenience=yes |
| 778 | ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; |
| 779 | esac |
| 780 | LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la |
| 781 | ]) |
| 782 | |
| 783 | # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for |
| 784 | # the libltdl installable library, and adds --enable-ltdl-install to |
| 785 | # the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor |
| 786 | # is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed |
| 787 | # to be `${top_builddir}/libltdl'. Make sure you start DIR with |
| 788 | # '${top_builddir}/' (note the single quotes!) if your package is not |
| 789 | # flat, and, if you're not using automake, define top_builddir as |
| 790 | # appropriate in the Makefiles. |
| 791 | # In the future, this macro may have to be called after AC_PROG_LIBTOOL. |
| 792 | AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [ |
| 793 | AC_CHECK_LIB(ltdl, main, LIBLTDL="-lltdl", [ |
| 794 | case "$enable_ltdl_install" in |
| 795 | no) AC_MSG_WARN([libltdl not installed, but installation disabled]) ;; |
| 796 | "") enable_ltdl_install=yes |
| 797 | ac_configure_args="$ac_configure_args --enable-ltdl-install" ;; |
| 798 | esac |
| 799 | ]) |
| 800 | if test x"$enable_ltdl_install" != x"no"; then |
| 801 | LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la |
| 802 | fi |
| 803 | ]) |
| 804 | |
| 805 | dnl old names |
| 806 | AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl |
| 807 | AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl |
| 808 | AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl |
| 809 | AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl |
| 810 | AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl |
| 811 | AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl |
| 812 | AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl |
| 813 | AC_DEFUN(AM_SYS_NM_PARSE, [indir([AC_SYS_NM_PARSE])])dnl |
| 814 | AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE, [indir([AC_SYS_SYMBOL_UNDERSCORE])])dnl |
| 815 | AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN, [indir([AC_SYS_LIBTOOL_CYGWIN])])dnl |
| 816 | |
| 817 | # Like AC_CONFIG_HEADER, but automatically create stamp file. |
| 818 | |
| 819 | AC_DEFUN(AM_CONFIG_HEADER, |
| 820 | [AC_PREREQ([2.12]) |
| 821 | AC_CONFIG_HEADER([$1]) |
| 822 | dnl When config.status generates a header, we must update the stamp-h file. |
| 823 | dnl This file resides in the same directory as the config header |
| 824 | dnl that is generated. We must strip everything past the first ":", |
| 825 | dnl and everything past the last "/". |
| 826 | AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl |
| 827 | ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, |
| 828 | <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, |
| 829 | <<am_indx=1 |
| 830 | for am_file in <<$1>>; do |
| 831 | case " <<$>>CONFIG_HEADERS " in |
| 832 | *" <<$>>am_file "*<<)>> |
| 833 | echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx |
| 834 | ;; |
| 835 | esac |
| 836 | am_indx=`expr "<<$>>am_indx" + 1` |
| 837 | done<<>>dnl>>) |
| 838 | changequote([,]))]) |
| 839 | |
| 840 | # Add --enable-maintainer-mode option to configure. |
| 841 | # From Jim Meyering |
| 842 | |
| 843 | # serial 1 |
| 844 | |
| 845 | AC_DEFUN(AM_MAINTAINER_MODE, |
| 846 | [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) |
| 847 | dnl maintainer-mode is disabled by default |
| 848 | AC_ARG_ENABLE(maintainer-mode, |
| 849 | [ --enable-maintainer-mode enable make rules and dependencies not useful |
| 850 | (and sometimes confusing) to the casual installer], |
| 851 | USE_MAINTAINER_MODE=$enableval, |
| 852 | USE_MAINTAINER_MODE=no) |
| 853 | AC_MSG_RESULT($USE_MAINTAINER_MODE) |
| 854 | AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) |
| 855 | MAINT=$MAINTAINER_MODE_TRUE |
| 856 | AC_SUBST(MAINT)dnl |
| 857 | ] |
| 858 | ) |
| 859 | |
| 860 | # Define a conditional. |
| 861 | |
| 862 | AC_DEFUN(AM_CONDITIONAL, |
| 863 | [AC_SUBST($1_TRUE) |
| 864 | AC_SUBST($1_FALSE) |
| 865 | if $2; then |
| 866 | $1_TRUE= |
| 867 | $1_FALSE='#' |
| 868 | else |
| 869 | $1_TRUE='#' |
| 870 | $1_FALSE= |
| 871 | fi]) |
| 872 | |
| 873 | # This file is derived from `gettext.m4'. The difference is that the |
| 874 | # included macros assume Cygnus-style source and build trees. |
| 875 | |
| 876 | # Macro to add for using GNU gettext. |
| 877 | # Ulrich Drepper <drepper@cygnus.com>, 1995. |
| 878 | # |
| 879 | # This file file be copied and used freely without restrictions. It can |
| 880 | # be used in projects which are not available under the GNU Public License |
| 881 | # but which still want to provide support for the GNU gettext functionality. |
| 882 | # Please note that the actual code is *not* freely available. |
| 883 | |
| 884 | # serial 3 |
| 885 | |
| 886 | AC_DEFUN(CY_WITH_NLS, |
| 887 | [AC_MSG_CHECKING([whether NLS is requested]) |
| 888 | dnl Default is enabled NLS |
| 889 | AC_ARG_ENABLE(nls, |
| 890 | [ --disable-nls do not use Native Language Support], |
| 891 | USE_NLS=$enableval, USE_NLS=yes) |
| 892 | AC_MSG_RESULT($USE_NLS) |
| 893 | AC_SUBST(USE_NLS) |
| 894 | |
| 895 | USE_INCLUDED_LIBINTL=no |
| 896 | |
| 897 | dnl If we use NLS figure out what method |
| 898 | if test "$USE_NLS" = "yes"; then |
| 899 | AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested]) |
| 900 | AC_MSG_CHECKING([whether included gettext is requested]) |
| 901 | AC_ARG_WITH(included-gettext, |
| 902 | [ --with-included-gettext use the GNU gettext library included here], |
| 903 | nls_cv_force_use_gnu_gettext=$withval, |
| 904 | nls_cv_force_use_gnu_gettext=no) |
| 905 | AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) |
| 906 | |
| 907 | nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" |
| 908 | if test "$nls_cv_force_use_gnu_gettext" != "yes"; then |
| 909 | dnl User does not insist on using GNU NLS library. Figure out what |
| 910 | dnl to use. If gettext or catgets are available (in this order) we |
| 911 | dnl use this. Else we have to fall back to GNU NLS library. |
| 912 | dnl catgets is only used if permitted by option --with-catgets. |
| 913 | nls_cv_header_intl= |
| 914 | nls_cv_header_libgt= |
| 915 | CATOBJEXT=NONE |
| 916 | |
| 917 | AC_CHECK_HEADER(libintl.h, |
| 918 | [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc, |
| 919 | [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")], |
| 920 | gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)]) |
| 921 | |
| 922 | if test "$gt_cv_func_gettext_libc" != "yes"; then |
| 923 | AC_CHECK_LIB(intl, bindtextdomain, |
| 924 | [AC_CACHE_CHECK([for gettext in libintl], |
| 925 | gt_cv_func_gettext_libintl, |
| 926 | [AC_TRY_LINK([], [return (int) gettext ("")], |
| 927 | gt_cv_func_gettext_libintl=yes, |
| 928 | gt_cv_func_gettext_libintl=no)])]) |
| 929 | fi |
| 930 | |
| 931 | if test "$gt_cv_func_gettext_libc" = "yes" \ |
| 932 | || test "$gt_cv_func_gettext_libintl" = "yes"; then |
| 933 | AC_DEFINE(HAVE_GETTEXT, 1, |
| 934 | [Define as 1 if you have gettext and don't want to use GNU gettext.]) |
| 935 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, |
| 936 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl |
| 937 | if test "$MSGFMT" != "no"; then |
| 938 | AC_CHECK_FUNCS(dcgettext) |
| 939 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) |
| 940 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, |
| 941 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) |
| 942 | AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; |
| 943 | return _nl_msg_cat_cntr], |
| 944 | [CATOBJEXT=.gmo |
| 945 | DATADIRNAME=share], |
| 946 | [CATOBJEXT=.mo |
| 947 | DATADIRNAME=lib]) |
| 948 | INSTOBJEXT=.mo |
| 949 | fi |
| 950 | fi |
| 951 | ]) |
| 952 | |
| 953 | dnl In the standard gettext, we would now check for catgets. |
| 954 | dnl However, we never want to use catgets for our releases. |
| 955 | |
| 956 | if test "$CATOBJEXT" = "NONE"; then |
| 957 | dnl Neither gettext nor catgets in included in the C library. |
| 958 | dnl Fall back on GNU gettext library. |
| 959 | nls_cv_use_gnu_gettext=yes |
| 960 | fi |
| 961 | fi |
| 962 | |
| 963 | if test "$nls_cv_use_gnu_gettext" = "yes"; then |
| 964 | dnl Mark actions used to generate GNU NLS library. |
| 965 | INTLOBJS="\$(GETTOBJS)" |
| 966 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, |
| 967 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) |
| 968 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) |
| 969 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, |
| 970 | [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) |
| 971 | AC_SUBST(MSGFMT) |
| 972 | USE_INCLUDED_LIBINTL=yes |
| 973 | CATOBJEXT=.gmo |
| 974 | INSTOBJEXT=.mo |
| 975 | DATADIRNAME=share |
| 976 | INTLDEPS='$(top_builddir)/../intl/libintl.a' |
| 977 | INTLLIBS=$INTLDEPS |
| 978 | LIBS=`echo $LIBS | sed -e 's/-lintl//'` |
| 979 | nls_cv_header_intl=libintl.h |
| 980 | nls_cv_header_libgt=libgettext.h |
| 981 | fi |
| 982 | |
| 983 | dnl Test whether we really found GNU xgettext. |
| 984 | if test "$XGETTEXT" != ":"; then |
| 985 | dnl If it is no GNU xgettext we define it as : so that the |
| 986 | dnl Makefiles still can work. |
| 987 | if $XGETTEXT --omit-header /dev/null 2> /dev/null; then |
| 988 | : ; |
| 989 | else |
| 990 | AC_MSG_RESULT( |
| 991 | [found xgettext programs is not GNU xgettext; ignore it]) |
| 992 | XGETTEXT=":" |
| 993 | fi |
| 994 | fi |
| 995 | |
| 996 | # We need to process the po/ directory. |
| 997 | POSUB=po |
| 998 | else |
| 999 | DATADIRNAME=share |
| 1000 | nls_cv_header_intl=libintl.h |
| 1001 | nls_cv_header_libgt=libgettext.h |
| 1002 | fi |
| 1003 | |
| 1004 | # If this is used in GNU gettext we have to set USE_NLS to `yes' |
| 1005 | # because some of the sources are only built for this goal. |
| 1006 | if test "$PACKAGE" = gettext; then |
| 1007 | USE_NLS=yes |
| 1008 | USE_INCLUDED_LIBINTL=yes |
| 1009 | fi |
| 1010 | |
| 1011 | dnl These rules are solely for the distribution goal. While doing this |
| 1012 | dnl we only have to keep exactly one list of the available catalogs |
| 1013 | dnl in configure.in. |
| 1014 | for lang in $ALL_LINGUAS; do |
| 1015 | GMOFILES="$GMOFILES $lang.gmo" |
| 1016 | POFILES="$POFILES $lang.po" |
| 1017 | done |
| 1018 | |
| 1019 | dnl Make all variables we use known to autoconf. |
| 1020 | AC_SUBST(USE_INCLUDED_LIBINTL) |
| 1021 | AC_SUBST(CATALOGS) |
| 1022 | AC_SUBST(CATOBJEXT) |
| 1023 | AC_SUBST(DATADIRNAME) |
| 1024 | AC_SUBST(GMOFILES) |
| 1025 | AC_SUBST(INSTOBJEXT) |
| 1026 | AC_SUBST(INTLDEPS) |
| 1027 | AC_SUBST(INTLLIBS) |
| 1028 | AC_SUBST(INTLOBJS) |
| 1029 | AC_SUBST(POFILES) |
| 1030 | AC_SUBST(POSUB) |
| 1031 | ]) |
| 1032 | |
| 1033 | AC_DEFUN(CY_GNU_GETTEXT, |
| 1034 | [AC_REQUIRE([AC_PROG_MAKE_SET])dnl |
| 1035 | AC_REQUIRE([AC_PROG_CC])dnl |
| 1036 | AC_REQUIRE([AC_PROG_RANLIB])dnl |
| 1037 | AC_REQUIRE([AC_ISC_POSIX])dnl |
| 1038 | AC_REQUIRE([AC_HEADER_STDC])dnl |
| 1039 | AC_REQUIRE([AC_C_CONST])dnl |
| 1040 | AC_REQUIRE([AC_C_INLINE])dnl |
| 1041 | AC_REQUIRE([AC_TYPE_OFF_T])dnl |
| 1042 | AC_REQUIRE([AC_TYPE_SIZE_T])dnl |
| 1043 | AC_REQUIRE([AC_FUNC_ALLOCA])dnl |
| 1044 | AC_REQUIRE([AC_FUNC_MMAP])dnl |
| 1045 | |
| 1046 | AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ |
| 1047 | unistd.h values.h sys/param.h]) |
| 1048 | AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ |
| 1049 | __argz_count __argz_stringify __argz_next]) |
| 1050 | |
| 1051 | if test "${ac_cv_func_stpcpy+set}" != "set"; then |
| 1052 | AC_CHECK_FUNCS(stpcpy) |
| 1053 | fi |
| 1054 | if test "${ac_cv_func_stpcpy}" = "yes"; then |
| 1055 | AC_DEFINE(HAVE_STPCPY, 1, [Define if you have the stpcpy function]) |
| 1056 | fi |
| 1057 | |
| 1058 | AM_LC_MESSAGES |
| 1059 | CY_WITH_NLS |
| 1060 | |
| 1061 | if test "x$CATOBJEXT" != "x"; then |
| 1062 | if test "x$ALL_LINGUAS" = "x"; then |
| 1063 | LINGUAS= |
| 1064 | else |
| 1065 | AC_MSG_CHECKING(for catalogs to be installed) |
| 1066 | NEW_LINGUAS= |
| 1067 | for lang in ${LINGUAS=$ALL_LINGUAS}; do |
| 1068 | case "$ALL_LINGUAS" in |
| 1069 | *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; |
| 1070 | esac |
| 1071 | done |
| 1072 | LINGUAS=$NEW_LINGUAS |
| 1073 | AC_MSG_RESULT($LINGUAS) |
| 1074 | fi |
| 1075 | |
| 1076 | dnl Construct list of names of catalog files to be constructed. |
| 1077 | if test -n "$LINGUAS"; then |
| 1078 | for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done |
| 1079 | fi |
| 1080 | fi |
| 1081 | |
| 1082 | dnl The reference to <locale.h> in the installed <libintl.h> file |
| 1083 | dnl must be resolved because we cannot expect the users of this |
| 1084 | dnl to define HAVE_LOCALE_H. |
| 1085 | if test $ac_cv_header_locale_h = yes; then |
| 1086 | INCLUDE_LOCALE_H="#include <locale.h>" |
| 1087 | else |
| 1088 | INCLUDE_LOCALE_H="\ |
| 1089 | /* The system does not provide the header <locale.h>. Take care yourself. */" |
| 1090 | fi |
| 1091 | AC_SUBST(INCLUDE_LOCALE_H) |
| 1092 | |
| 1093 | dnl Determine which catalog format we have (if any is needed) |
| 1094 | dnl For now we know about two different formats: |
| 1095 | dnl Linux libc-5 and the normal X/Open format |
| 1096 | if test -f $srcdir/po2tbl.sed.in; then |
| 1097 | if test "$CATOBJEXT" = ".cat"; then |
| 1098 | AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen) |
| 1099 | |
| 1100 | dnl Transform the SED scripts while copying because some dumb SEDs |
| 1101 | dnl cannot handle comments. |
| 1102 | sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed |
| 1103 | fi |
| 1104 | dnl po2tbl.sed is always needed. |
| 1105 | sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ |
| 1106 | $srcdir/po2tbl.sed.in > po2tbl.sed |
| 1107 | fi |
| 1108 | |
| 1109 | dnl In the intl/Makefile.in we have a special dependency which makes |
| 1110 | dnl only sense for gettext. We comment this out for non-gettext |
| 1111 | dnl packages. |
| 1112 | if test "$PACKAGE" = "gettext"; then |
| 1113 | GT_NO="#NO#" |
| 1114 | GT_YES= |
| 1115 | else |
| 1116 | GT_NO= |
| 1117 | GT_YES="#YES#" |
| 1118 | fi |
| 1119 | AC_SUBST(GT_NO) |
| 1120 | AC_SUBST(GT_YES) |
| 1121 | |
| 1122 | MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs" |
| 1123 | AC_SUBST(MKINSTALLDIRS) |
| 1124 | |
| 1125 | dnl *** For now the libtool support in intl/Makefile is not for real. |
| 1126 | l= |
| 1127 | AC_SUBST(l) |
| 1128 | |
| 1129 | dnl Generate list of files to be processed by xgettext which will |
| 1130 | dnl be included in po/Makefile. But only do this if the po directory |
| 1131 | dnl exists in srcdir. |
| 1132 | if test -d $srcdir/po; then |
| 1133 | test -d po || mkdir po |
| 1134 | if test "x$srcdir" != "x."; then |
| 1135 | if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then |
| 1136 | posrcprefix="$srcdir/" |
| 1137 | else |
| 1138 | posrcprefix="../$srcdir/" |
| 1139 | fi |
| 1140 | else |
| 1141 | posrcprefix="../" |
| 1142 | fi |
| 1143 | rm -f po/POTFILES |
| 1144 | sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ |
| 1145 | < $srcdir/po/POTFILES.in > po/POTFILES |
| 1146 | fi |
| 1147 | ]) |
| 1148 | |
| 1149 | # Search path for a program which passes the given test. |
| 1150 | # Ulrich Drepper <drepper@cygnus.com>, 1996. |
| 1151 | # |
| 1152 | # This file file be copied and used freely without restrictions. It can |
| 1153 | # be used in projects which are not available under the GNU Public License |
| 1154 | # but which still want to provide support for the GNU gettext functionality. |
| 1155 | # Please note that the actual code is *not* freely available. |
| 1156 | |
| 1157 | # serial 1 |
| 1158 | |
| 1159 | dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, |
| 1160 | dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) |
| 1161 | AC_DEFUN(AM_PATH_PROG_WITH_TEST, |
| 1162 | [# Extract the first word of "$2", so it can be a program name with args. |
| 1163 | set dummy $2; ac_word=[$]2 |
| 1164 | AC_MSG_CHECKING([for $ac_word]) |
| 1165 | AC_CACHE_VAL(ac_cv_path_$1, |
| 1166 | [case "[$]$1" in |
| 1167 | /*) |
| 1168 | ac_cv_path_$1="[$]$1" # Let the user override the test with a path. |
| 1169 | ;; |
| 1170 | *) |
| 1171 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" |
| 1172 | for ac_dir in ifelse([$5], , $PATH, [$5]); do |
| 1173 | test -z "$ac_dir" && ac_dir=. |
| 1174 | if test -f $ac_dir/$ac_word; then |
| 1175 | if [$3]; then |
| 1176 | ac_cv_path_$1="$ac_dir/$ac_word" |
| 1177 | break |
| 1178 | fi |
| 1179 | fi |
| 1180 | done |
| 1181 | IFS="$ac_save_ifs" |
| 1182 | dnl If no 4th arg is given, leave the cache variable unset, |
| 1183 | dnl so AC_PATH_PROGS will keep looking. |
| 1184 | ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" |
| 1185 | ])dnl |
| 1186 | ;; |
| 1187 | esac])dnl |
| 1188 | $1="$ac_cv_path_$1" |
| 1189 | if test -n "[$]$1"; then |
| 1190 | AC_MSG_RESULT([$]$1) |
| 1191 | else |
| 1192 | AC_MSG_RESULT(no) |
| 1193 | fi |
| 1194 | AC_SUBST($1)dnl |
| 1195 | ]) |
| 1196 | |
| 1197 | # Check whether LC_MESSAGES is available in <locale.h>. |
| 1198 | # Ulrich Drepper <drepper@cygnus.com>, 1995. |
| 1199 | # |
| 1200 | # This file file be copied and used freely without restrictions. It can |
| 1201 | # be used in projects which are not available under the GNU Public License |
| 1202 | # but which still want to provide support for the GNU gettext functionality. |
| 1203 | # Please note that the actual code is *not* freely available. |
| 1204 | |
| 1205 | # serial 1 |
| 1206 | |
| 1207 | AC_DEFUN(AM_LC_MESSAGES, |
| 1208 | [if test $ac_cv_header_locale_h = yes; then |
| 1209 | AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, |
| 1210 | [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], |
| 1211 | am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) |
| 1212 | if test $am_cv_val_LC_MESSAGES = yes; then |
| 1213 | AC_DEFINE(HAVE_LC_MESSAGES, 1, |
| 1214 | [Define if your locale.h file contains LC_MESSAGES.]) |
| 1215 | fi |
| 1216 | fi]) |
| 1217 | |