OSDN Git Service

* regclass.c (init_reg_autoinc): New function.
[pf3gnuchains/gcc-fork.git] / gcc / aclocal.m4
index 2ffb048..6e5fa4a 100644 (file)
@@ -1,3 +1,5 @@
+sinclude(../config/accross.m4)
+
 dnl See if stdbool.h properly defines bool and true/false.
 AC_DEFUN(gcc_AC_HEADER_STDBOOL,
 [AC_CACHE_CHECK([for working stdbool.h],
@@ -75,27 +77,6 @@ if test x = y ; then
 fi
 ])
 
-dnl Check if we have vprintf and possibly _doprnt.
-dnl Note autoconf checks for vprintf even though we care about vfprintf.
-AC_DEFUN(gcc_AC_FUNC_VFPRINTF_DOPRNT,
-[AC_FUNC_VPRINTF
-vfprintf=
-doprint=
-if test $ac_cv_func_vprintf != yes ; then
-  vfprintf=vfprintf.o
-  if test $ac_cv_func__doprnt != yes ; then
-    doprint=doprint.o
-  fi
-fi
-AC_SUBST(vfprintf)
-AC_SUBST(doprint)
-])    
-
-dnl Check if we have strstr.
-AC_DEFUN([gcc_AC_FUNC_STRSTR],
-  [AC_CHECK_FUNCS([strstr], [strstr=], [strstr=strstr.o])
-   AC_SUBST([strstr])])
-
 dnl See if the printf functions in libc support %p in format strings.
 AC_DEFUN(gcc_AC_FUNC_PRINTF_PTR,
 [AC_CACHE_CHECK(whether the printf functions support %p,
@@ -327,10 +308,7 @@ procedure conftest is begin null; end conftest;
 EOF
 gcc_cv_prog_adac=no
 # Have to do ac_tool_prefix and user overrides by hand.
-user_adac=$ADAC
-user_cc=$CC
-for cand in ${ac_tool_prefix}$user_adac        $user_adac      \
-           ${ac_tool_prefix}$user_cc   $user_cc        \
+for cand in ${ADAC+"$ADAC"} ${CC+"$CC"}        \
            ${ac_tool_prefix}gcc        gcc             \
            ${ac_tool_prefix}cc         cc              \
            ${ac_tool_prefix}gnatgcc    gnatgcc         \
@@ -342,7 +320,7 @@ for cand in ${ac_tool_prefix}$user_adac     $user_adac      \
   # has not been installed.  This is fixed in 2.95.4, 3.0.2, and 3.1.
   # Therefore we must check for the error message as well as an
   # unsuccessful exit.
-  errors=`$cand -c conftest.adb 2>&1 || echo failure`
+  errors=`($cand -c conftest.adb) 2>&1 || echo failure`
   if test x"$errors" = x; then
     gcc_cv_prog_adac=$cand
     break
@@ -681,14 +659,13 @@ AC_CACHE_CHECK(for working mmap from /dev/zero,
  then ac_cv_func_mmap_dev_zero=no
  else ac_cv_func_mmap_dev_zero=buggy
  fi],
- # If this is not cygwin, and /dev/zero is a character device, it's probably
- # safe to assume it works.
+ # When cross-building, assume that this works, unless we know it
+ # doesn't.  Of course, we have no way of knowing if there even is a /dev/zero
+ # on the host, let alone whether mmap will work on it.
  [case "$host_os" in
    cygwin* | win32 | pe | mingw* ) ac_cv_func_mmap_dev_zero=buggy ;;
-   * ) if test -c /dev/zero
-       then ac_cv_func_mmap_dev_zero=yes
-       else ac_cv_func_mmap_dev_zero=no
-       fi ;;
+   darwin* ) ac_cv_func_mmap_dev_zero=no ;;
+   * ) ac_cv_func_mmap_dev_zero=yes ;;
   esac])
 ])
 if test $ac_cv_func_mmap_dev_zero = yes; then
@@ -708,7 +685,10 @@ AC_CACHE_CHECK([for working mmap with MAP_ANON(YMOUS)],
  fi],
  # Unlike /dev/zero, it is not safe to assume MAP_ANON(YMOUS) works
  # just because it's there. Some SCO Un*xen define it but don't implement it.
- ac_cv_func_mmap_anon=no)
+ [case "$host_os" in
+   darwin* ) ac_cv_func_mmap_anon=yes ;;
+   * ) ac_cv_func_mmap_anon=no ;;
+  esac])
 ])
 if test $ac_cv_func_mmap_anon = yes; then
   AC_DEFINE(HAVE_MMAP_ANON, 1,
@@ -761,7 +741,10 @@ int main()
 
   exit(0);
 }], ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no,
-ac_cv_func_mmap_file=no)])
+ [case "$host_os" in
+   darwin* ) ac_cv_func_mmap_file=yes ;;
+   * ) ac_cv_func_mmap_file=no ;;
+  esac])])
 if test $ac_cv_func_mmap_file = yes; then
   AC_DEFINE(HAVE_MMAP_FILE, 1,
            [Define if read-only mmap of a plain file works.])
@@ -815,35 +798,6 @@ if test $gcc_cv_enum_bf_unsigned = yes; then
     [Define if enumerated bitfields are treated as unsigned values.])
 fi])
 
-dnl Host type sizes probe.
-dnl By Kaveh R. Ghazi.  One typo fixed since.
-dnl
-AC_DEFUN([gcc_AC_COMPILE_CHECK_SIZEOF],
-[changequote(<<, >>)dnl
-dnl The name to #define.
-define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
-dnl The cache variable name.
-define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
-changequote([, ])dnl
-AC_MSG_CHECKING(size of $1)
-AC_CACHE_VAL(AC_CV_NAME,
-[for ac_size in 4 8 1 2 16 $3 ; do # List sizes in rough order of prevalence.
-  AC_TRY_COMPILE([#include "confdefs.h"
-#include <sys/types.h>
-$2
-], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
-  if test x$AC_CV_NAME != x ; then break; fi
-done
-])
-if test x$AC_CV_NAME = x ; then
-  AC_MSG_ERROR([cannot determine a size for $1])
-fi
-AC_MSG_RESULT($AC_CV_NAME)
-AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
-undefine([AC_TYPE_NAME])dnl
-undefine([AC_CV_NAME])dnl
-])
-
 dnl Probe number of bits in a byte.
 dnl Note C89 requires CHAR_BIT >= 8.
 dnl
@@ -974,49 +928,6 @@ fi
 rm -rf conftest*
 AC_LANG_RESTORE])
 
-dnl Host endianness probe.
-dnl This tests byte-within-word endianness.  GCC actually needs
-dnl to know word-within-larger-object endianness.  They are the
-dnl same on all presently supported hosts.
-dnl Differs from AC_C_BIGENDIAN in that it does not require
-dnl running a program on the host, and it defines the macro we
-dnl want to see.
-dnl
-AC_DEFUN([gcc_AC_C_COMPILE_ENDIAN],
-[AC_CACHE_CHECK(byte ordering, ac_cv_c_compile_endian,
-[ac_cv_c_compile_endian=unknown
-gcc_AC_EXAMINE_OBJECT([
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
-/* This structure must have no internal padding.  */
-  struct {
-    char prefix[sizeof "\nendian:" - 1];
-    short word;
-    char postfix[2];
- } tester = {
-    "\nendian:",
-#if SIZEOF_SHORT == 4
-    ('A' << (CHAR_BIT * 3)) | ('B' << (CHAR_BIT * 2)) |
-#endif
-    ('A' << CHAR_BIT) | 'B',
-    'X', '\n'
-};],
- [if   grep 'endian:AB' conftest.dmp >/dev/null 2>&1; then
-    ac_cv_c_compile_endian=big-endian
-  elif grep 'endian:BA' conftest.dmp >/dev/null 2>&1; then
-    ac_cv_c_compile_endian=little-endian
-  fi])
-])
-if test $ac_cv_c_compile_endian = unknown; then
-  AC_MSG_ERROR([*** unable to determine endianness])
-elif test $ac_cv_c_compile_endian = big-endian; then
-  AC_DEFINE(HOST_WORDS_BIG_ENDIAN, 1,
-  [Define if the host machine stores words of multi-word integers in
-   big-endian order.])
-fi
-])
-
 dnl Floating point format probe.
 dnl The basic concept is the same as the above: grep the object
 dnl file for an interesting string.  We have to watch out for
@@ -1079,12 +990,12 @@ format=
 fbigend=
 case $ac_cv_c_float_format in
     'IEEE (big-endian)' )
-       if test $ac_cv_c_compile_endian = little-endian; then
+       if test $ac_cv_c_bigendian = no; then
            fbigend=1
        fi
        ;;
     'IEEE (little-endian)' )
-       if test $ac_cv_c_compile_endian = big-endian; then
+       if test $ac_cv_c_bigendian = yes; then
            fbigend=0
        fi
        ;;
@@ -1122,11 +1033,12 @@ AC_DEFUN([AM_ICONV],
   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
   dnl those with the standalone portable GNU libiconv installed).
 
+  am_cv_lib_iconv_ldpath=
   AC_ARG_WITH([libiconv-prefix],
 [  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
     for dir in `echo "$withval" | tr : ' '`; do
       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
-      if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
+      if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
     done
    ])
 
@@ -1141,7 +1053,7 @@ AC_DEFUN([AM_ICONV],
       am_cv_func_iconv=yes)
     if test "$am_cv_func_iconv" != yes; then
       am_save_LIBS="$LIBS"
-      LIBS="$LIBS -liconv"
+      LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
       AC_TRY_LINK([#include <stdlib.h>
 #include <iconv.h>],
         [iconv_t cd = iconv_open("","");
@@ -1178,7 +1090,7 @@ size_t iconv();
   fi
   LIBICONV=
   if test "$am_cv_lib_iconv" = yes; then
-    LIBICONV="-liconv"
+    LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
   fi
   AC_SUBST(LIBICONV)
 ])
@@ -1593,24 +1505,16 @@ changequote([,])dnl
       INTLBISON=:
     fi
 
-    dnl These rules are solely for the distribution goal.  While doing this
-    dnl we only have to keep exactly one list of the available catalogs
-    dnl in configure.in.
-    for lang in $ALL_LINGUAS; do
-      GMOFILES="$GMOFILES $lang.gmo"
-      POFILES="$POFILES $lang.po"
-    done
+    dnl GCC LOCAL: GMOFILES/POFILES removed as unnecessary.
 
     dnl Make all variables we use known to autoconf.
     AC_SUBST(BUILD_INCLUDED_LIBINTL)
     AC_SUBST(USE_INCLUDED_LIBINTL)
     AC_SUBST(CATALOGS)
     AC_SUBST(CATOBJEXT)
-    AC_SUBST(GMOFILES)
     AC_SUBST(INTLLIBS)
     AC_SUBST(INTLDEPS)
     AC_SUBST(INTLOBJS)
-    AC_SUBST(POFILES)
     AC_SUBST(POSUB)
 dnl GCC LOCAL: Make USE_INCLUDED_LIBINTL visible to C code.
     if test $USE_INCLUDED_LIBINTL = yes; then
@@ -1664,37 +1568,42 @@ strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
    AM_LC_MESSAGES
    AM_WITH_NLS([$1],[$2],[$3])
 
-   if test "x$CATOBJEXT" != "x"; then
-     if test "x$ALL_LINGUAS" = "x"; then
-       LINGUAS=
-     else
-       AC_MSG_CHECKING(for catalogs to be installed)
-       NEW_LINGUAS=
-       for presentlang in $ALL_LINGUAS; do
-         useit=no
-         for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
-           # Use the presentlang catalog if desiredlang is
-           #   a. equal to presentlang, or
-           #   b. a variant of presentlang (because in this case,
-           #      presentlang can be used as a fallback for messages
-           #      which are not translated in the desiredlang catalog).
-           case "$desiredlang" in
-             "$presentlang"*) useit=yes;;
-           esac
-         done
-         if test $useit = yes; then
-           NEW_LINGUAS="$NEW_LINGUAS $presentlang"
-         fi
-       done
-       LINGUAS=$NEW_LINGUAS
-       AC_MSG_RESULT($LINGUAS)
-     fi
-
-     dnl Construct list of names of catalog files to be constructed.
-     dnl GCC LOCAL: Tweak for non-recursive po directory build.
-     if test -n "$LINGUAS"; then
-       for lang in $LINGUAS; do CATALOGS="$CATALOGS po/$lang$CATOBJEXT"; done
-     fi
+   dnl GCC LOCAL: The LINGUAS/ALL_LINGUAS/CATALOGS mess that was here
+   dnl has been torn out and replaced with this more sensible scheme.
+   if test "x$CATOBJEXT" != x; then
+     AC_MSG_CHECKING(for catalogs to be installed)
+     # Look for .po and .gmo files in the source directory.
+     CATALOGS=
+     XLINGUAS=
+     for cat in $srcdir/po/*$CATOBJEXT $srcdir/po/*.po; do
+       # If there aren't any .gmo files the shell will give us the
+       # literal string "../path/to/srcdir/po/*.gmo" which has to be
+       # weeded out.
+       case "$cat" in *\**)
+           continue;;
+       esac
+       # The quadruple backslash is collapsed to a double backslash
+       # by the backticks, then collapsed again by the double quotes,
+       # leaving us with one backslash in the sed expression (right
+       # before the dot that mustn't act as a wildcard).  The dot to
+       # be escaped in the second expression is hiding inside CATOBJEXT.
+       cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!$CATOBJEXT!"`
+       lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\$CATOBJEXT!!"`
+       # The user is allowed to set LINGUAS to a list of languages to
+       # install catalogs for.  If it's empty that means "all of them."
+       if test "x$LINGUAS" = x; then
+           CATALOGS="$CATALOGS $cat"
+           XLINGUAS="$XLINGUAS $lang"
+       else
+         case "$LINGUAS" in *$lang*)
+           CATALOGS="$CATALOGS $cat"
+           XLINGUAS="$XLINGUAS $lang"
+           ;;
+         esac
+       fi
+     done
+     LINGUAS="$XLINGUAS"
+     AC_MSG_RESULT($LINGUAS)
    fi
 
    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
@@ -1713,3 +1622,23 @@ strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
    INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
   ])
+
+AC_DEFUN(gcc_AC_INITFINI_ARRAY,
+[AC_ARG_ENABLE(initfini-array,
+       [  --enable-initfini-array      use .init_array/.fini_array sections],
+       [], [
+AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
+                gcc_cv_initfini_array, [dnl
+  AC_TRY_RUN([
+static int x = -1;
+int main (void) { return x; }
+int foo (void) { x = 0; }
+int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;],
+            [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
+            [gcc_cv_initfini_array=no])])
+  enable_initfini_array=$gcc_cv_initfini_array
+])
+if test $enable_initfini_array = yes; then
+  AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
+    [Define .init_array/.fini_array sections are available and working.])
+fi])