2 dnl Host type sizes probe.
3 dnl By Kaveh R. Ghazi. One typo fixed since.
5 AC_DEFUN([gcc_AC_COMPILE_CHECK_SIZEOF],
6 [changequote(<<, >>)dnl
7 dnl The name to #define.
8 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
9 dnl The cache variable name.
10 define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
12 AC_MSG_CHECKING(size of $1)
13 AC_CACHE_VAL(AC_CV_NAME,
14 [for ac_size in 4 8 1 2 16 $3 ; do # List sizes in rough order of prevalence.
15 AC_TRY_COMPILE([#include "confdefs.h"
16 #include <sys/types.h>
18 ], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
19 if test x$AC_CV_NAME != x ; then break; fi
22 if test x$AC_CV_NAME = x ; then
23 AC_MSG_ERROR([cannot determine a size for $1])
25 AC_MSG_RESULT($AC_CV_NAME)
26 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
27 undefine([AC_TYPE_NAME])dnl
28 undefine([AC_CV_NAME])dnl
31 dnl Utility macro used by next two tests.
32 dnl AC_EXAMINE_OBJECT(C source code,
33 dnl commands examining object file,
34 dnl [commands to run if compile failed]):
36 dnl Compile the source code to an object file; then convert it into a
37 dnl printable representation. All unprintable characters and
38 dnl asterisks (*) are replaced by dots (.). All white space is
39 dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the
40 dnl output, but runs of newlines are compressed to a single newline.
41 dnl Finally, line breaks are forcibly inserted so that no line is
42 dnl longer than 80 columns and the file ends with a newline. The
43 dnl result of all this processing is in the file conftest.dmp, which
44 dnl may be examined by the commands in the second argument.
46 AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
49 dnl Next bit cribbed from AC_TRY_COMPILE.
50 cat > conftest.$ac_ext <<EOF
51 [#line __oline__ "configure"
55 if AC_TRY_EVAL(ac_compile); then
57 sed ['s/^[0-7]*[ ]*/ /
60 s/ [0-9][0-9][0-9]/./g
74 dnl Host endianness probe.
75 dnl Differs from AC_C_BIGENDIAN in that it does not require
76 dnl running a program on the host.
78 AC_DEFUN([fastjar_AC_COMPILE_C_BIGENDIAN],
79 [AC_CACHE_CHECK(byte ordering, ac_cv_c_compile_endian,
80 [ac_cv_c_compile_endian=unknown
81 gcc_AC_EXAMINE_OBJECT([
85 /* This structure must have no internal padding. */
87 char prefix[sizeof "\nendian:" - 1];
93 ('A' << (CHAR_BIT * 3)) | ('B' << (CHAR_BIT * 2)) |
95 ('A' << CHAR_BIT) | 'B',
98 [if grep 'endian:AB' conftest.dmp >/dev/null 2>&1; then
99 ac_cv_c_compile_endian=big-endian
100 elif grep 'endian:BA' conftest.dmp >/dev/null 2>&1; then
101 ac_cv_c_compile_endian=little-endian
104 if test $ac_cv_c_compile_endian = unknown; then
105 AC_MSG_ERROR([*** unable to determine endianness])
106 elif test $ac_cv_c_compile_endian = big-endian; then
107 AC_DEFINE(WORDS_BIG_ENDIAN, 1,
108 [Define if the host machine stores words of multi-word integers in
113 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
115 AC_DEFUN(gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG,
116 [AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
118 #include <sys/types.h>
119 #ifdef HAVE_SYS_STAT_H
120 # include <sys/stat.h>
127 #endif], [mkdir ("foo", 0);],
128 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
129 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
130 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a