OSDN Git Service

Configure changes to enable cross compiling.
[pf3gnuchains/gcc-fork.git] / libffi / aclocal.m4
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 sinclude(../libtool.m4)
14 dnl The lines below arrange for aclocal not to bring libtool.m4
15 dnl AC_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
16 dnl to add a definition of LIBTOOL to Makefile.in.
17 ifelse(yes,no,[
18 AC_DEFUN([AC_PROG_LIBTOOL],)
19 AC_SUBST(LIBTOOL)
20 ])
21
22 AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
23 [changequote(<<, >>)dnl
24 dnl The name to #define.
25 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
26 dnl The cache variable name.
27 define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
28 changequote([, ])dnl
29 AC_MSG_CHECKING(size of $1)
30 AC_CACHE_VAL(AC_CV_NAME,
31 [for ac_size in 4 8 1 2 16 12 $2 ; do # List sizes in rough order of prevalence.
32   AC_TRY_COMPILE([#include "confdefs.h"
33 #include <sys/types.h>
34 $2
35 ], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
36   if test x$AC_CV_NAME != x ; then break; fi
37 done
38 ])
39 if test x$AC_CV_NAME = x ; then
40   AC_MSG_ERROR([cannot determine a size for $1])
41 fi
42 AC_MSG_RESULT($AC_CV_NAME)
43 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
44 undefine([AC_TYPE_NAME])dnl
45 undefine([AC_CV_NAME])dnl
46 ])
47
48 AC_DEFUN([AC_C_BIGENDIAN_CROSS],
49 [AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian,
50 [ac_cv_c_bigendian=unknown
51 # See if sys/param.h defines the BYTE_ORDER macro.
52 AC_TRY_COMPILE([#include <sys/types.h>
53 #include <sys/param.h>], [
54 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
55  bogus endian macros
56 #endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
57 AC_TRY_COMPILE([#include <sys/types.h>
58 #include <sys/param.h>], [
59 #if BYTE_ORDER != BIG_ENDIAN
60  not big endian
61 #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
62 if test $ac_cv_c_bigendian = unknown; then
63 AC_TRY_RUN([main () {
64   /* Are we little or big endian?  From Harbison&Steele.  */
65   union
66   {
67     long l;
68     char c[sizeof (long)];
69   } u;
70   u.l = 1;
71   exit (u.c[sizeof (long) - 1] == 1);
72 }], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes,
73 [ echo $ac_n "cross-compiling... " 2>&AC_FD_MSG ])
74 fi])
75 if test $ac_cv_c_bigendian = unknown; then
76 AC_MSG_CHECKING(to probe for byte ordering)
77 [
78 cat >conftest.c <<EOF
79 short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
80 short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
81 void _ascii() { char* s = (char*) ascii_mm; s = (char*) ascii_ii; }
82 short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
83 short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
84 void _ebcdic() { char* s = (char*) ebcdic_mm; s = (char*) ebcdic_ii; }
85 int main() { _ascii (); _ebcdic (); return 0; }
86 EOF
87 ] if test -f conftest.c ; then
88      if ${CC-cc} ${CFLAGS} conftest.c -o conftest.o && test -f conftest.o ; then
89         if test `grep -l BIGenDianSyS conftest.o` ; then
90            echo $ac_n ' big endian probe OK, ' 1>&AC_FD_MSG
91            ac_cv_c_bigendian=yes
92         fi
93         if test `grep -l LiTTleEnDian conftest.o` ; then
94            echo $ac_n ' little endian probe OK, ' 1>&AC_FD_MSG
95            if test $ac_cv_c_bigendian = yes ; then
96             ac_cv_c_bigendian=unknown;
97            else
98             ac_cv_c_bigendian=no
99            fi
100         fi
101         echo $ac_n 'guessing bigendian ...  ' >&AC_FD_MSG
102      fi
103   fi
104 AC_MSG_RESULT($ac_cv_c_bigendian)
105 fi
106 if test $ac_cv_c_bigendian = yes; then
107   AC_DEFINE(WORDS_BIGENDIAN, 1, [whether byteorder is bigendian])
108   BYTEORDER=4321
109 else
110   BYTEORDER=1234
111 fi
112 AC_DEFINE_UNQUOTED(BYTEORDER, $BYTEORDER, [1234 = LIL_ENDIAN, 4321 = BIGENDIAN])
113 if test $ac_cv_c_bigendian = unknown; then
114   AC_MSG_ERROR(unknown endianess - sorry, please pre-set ac_cv_c_bigendian)
115 fi
116 ])
117
118 # Like AC_CONFIG_HEADER, but automatically create stamp file.
119
120 AC_DEFUN(AM_CONFIG_HEADER,
121 [AC_PREREQ([2.12])
122 AC_CONFIG_HEADER([$1])
123 dnl When config.status generates a header, we must update the stamp-h file.
124 dnl This file resides in the same directory as the config header
125 dnl that is generated.  We must strip everything past the first ":",
126 dnl and everything past the last "/".
127 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
128 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
129 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
130 <<am_indx=1
131 for am_file in <<$1>>; do
132   case " <<$>>CONFIG_HEADERS " in
133   *" <<$>>am_file "*<<)>>
134     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
135     ;;
136   esac
137   am_indx=`expr "<<$>>am_indx" + 1`
138 done<<>>dnl>>)
139 changequote([,]))])
140
141 # Do all the work for Automake.  This macro actually does too much --
142 # some checks are only needed if your package does certain things.
143 # But this isn't really a big deal.
144
145 # serial 1
146
147 dnl Usage:
148 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
149
150 AC_DEFUN(AM_INIT_AUTOMAKE,
151 [AC_REQUIRE([AC_PROG_INSTALL])
152 PACKAGE=[$1]
153 AC_SUBST(PACKAGE)
154 VERSION=[$2]
155 AC_SUBST(VERSION)
156 dnl test to see if srcdir already configured
157 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
158   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
159 fi
160 ifelse([$3],,
161 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
162 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
163 AC_REQUIRE([AM_SANITY_CHECK])
164 AC_REQUIRE([AC_ARG_PROGRAM])
165 dnl FIXME This is truly gross.
166 missing_dir=`cd $ac_aux_dir && pwd`
167 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
168 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
169 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
170 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
171 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
172 AC_REQUIRE([AC_PROG_MAKE_SET])])
173
174 #
175 # Check to make sure that the build environment is sane.
176 #
177
178 AC_DEFUN(AM_SANITY_CHECK,
179 [AC_MSG_CHECKING([whether build environment is sane])
180 # Just in case
181 sleep 1
182 echo timestamp > conftestfile
183 # Do `set' in a subshell so we don't clobber the current shell's
184 # arguments.  Must try -L first in case configure is actually a
185 # symlink; some systems play weird games with the mod time of symlinks
186 # (eg FreeBSD returns the mod time of the symlink's containing
187 # directory).
188 if (
189    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
190    if test "[$]*" = "X"; then
191       # -L didn't work.
192       set X `ls -t $srcdir/configure conftestfile`
193    fi
194    if test "[$]*" != "X $srcdir/configure conftestfile" \
195       && test "[$]*" != "X conftestfile $srcdir/configure"; then
196
197       # If neither matched, then we have a broken ls.  This can happen
198       # if, for instance, CONFIG_SHELL is bash and it inherits a
199       # broken ls alias from the environment.  This has actually
200       # happened.  Such a system could not be considered "sane".
201       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
202 alias in your environment])
203    fi
204
205    test "[$]2" = conftestfile
206    )
207 then
208    # Ok.
209    :
210 else
211    AC_MSG_ERROR([newly created file is older than distributed files!
212 Check your system clock])
213 fi
214 rm -f conftest*
215 AC_MSG_RESULT(yes)])
216
217 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
218 dnl The program must properly implement --version.
219 AC_DEFUN(AM_MISSING_PROG,
220 [AC_MSG_CHECKING(for working $2)
221 # Run test in a subshell; some versions of sh will print an error if
222 # an executable is not found, even if stderr is redirected.
223 # Redirect stdin to placate older versions of autoconf.  Sigh.
224 if ($2 --version) < /dev/null > /dev/null 2>&1; then
225    $1=$2
226    AC_MSG_RESULT(found)
227 else
228    $1="$3/missing $2"
229    AC_MSG_RESULT(missing)
230 fi
231 AC_SUBST($1)])
232
233 # Add --enable-maintainer-mode option to configure.
234 # From Jim Meyering
235
236 # serial 1
237
238 AC_DEFUN(AM_MAINTAINER_MODE,
239 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
240   dnl maintainer-mode is disabled by default
241   AC_ARG_ENABLE(maintainer-mode,
242 [  --enable-maintainer-mode enable make rules and dependencies not useful
243                           (and sometimes confusing) to the casual installer],
244       USE_MAINTAINER_MODE=$enableval,
245       USE_MAINTAINER_MODE=no)
246   AC_MSG_RESULT($USE_MAINTAINER_MODE)
247   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
248   MAINT=$MAINTAINER_MODE_TRUE
249   AC_SUBST(MAINT)dnl
250 ]
251 )
252
253 # Define a conditional.
254
255 AC_DEFUN(AM_CONDITIONAL,
256 [AC_SUBST($1_TRUE)
257 AC_SUBST($1_FALSE)
258 if $2; then
259   $1_TRUE=
260   $1_FALSE='#'
261 else
262   $1_TRUE='#'
263   $1_FALSE=
264 fi])
265