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