source: branches/libc-0.6/src/gcc/fastjar/acinclude.m4

Last change on this file was 1589, checked in by bird, 21 years ago

This commit was generated by cvs2svn to compensate for changes in r1588,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 3.9 KB
Line 
1
2dnl Host type sizes probe.
3dnl By Kaveh R. Ghazi. One typo fixed since.
4dnl Modified to return a size of 0 if type doesn't exist
5dnl
6AC_DEFUN([gcc_AC_COMPILE_CHECK_SIZEOF],
7[changequote(<<, >>)dnl
8dnl The name to #define.
9define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
10dnl The cache variable name.
11define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
12changequote([, ])dnl
13AC_MSG_CHECKING(size of $1)
14AC_CACHE_VAL(AC_CV_NAME,
15[for ac_size in 4 8 1 2 16 $3 ; do # List sizes in rough order of prevalence.
16 AC_TRY_COMPILE([#include "confdefs.h"
17#include <sys/types.h>
18$2
19], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
20 if test x$AC_CV_NAME != x ; then break; fi
21done
22])
23if test x$AC_CV_NAME = x ; then
24 AC_CV_NAME=0
25fi
26AC_MSG_RESULT($AC_CV_NAME)
27AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
28undefine([AC_TYPE_NAME])dnl
29undefine([AC_CV_NAME])dnl
30])
31
32dnl Utility macro used by next two tests.
33dnl AC_EXAMINE_OBJECT(C source code,
34dnl commands examining object file,
35dnl [commands to run if compile failed]):
36dnl
37dnl Compile the source code to an object file; then convert it into a
38dnl printable representation. All unprintable characters and
39dnl asterisks (*) are replaced by dots (.). All white space is
40dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the
41dnl output, but runs of newlines are compressed to a single newline.
42dnl Finally, line breaks are forcibly inserted so that no line is
43dnl longer than 80 columns and the file ends with a newline. The
44dnl result of all this processing is in the file conftest.dmp, which
45dnl may be examined by the commands in the second argument.
46dnl
47AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
48[AC_LANG_SAVE
49AC_LANG_C
50dnl Next bit cribbed from AC_TRY_COMPILE.
51cat > conftest.$ac_ext <<EOF
52[#line __oline__ "configure"
53#include "confdefs.h"
54$1
55]EOF
56if AC_TRY_EVAL(ac_compile); then
57 od -c conftest.o |
58 sed ['s/^[0-7]*[ ]*/ /
59 s/\*/./g
60 s/ \\n/*/g
61 s/ [0-9][0-9][0-9]/./g
62 s/ \\[^ ]/./g'] |
63 tr -d '
64 ' | tr -s '*' '
65' | fold | sed '$a\
66' > conftest.dmp
67 $2
68ifelse($3, , , else
69 $3
70)dnl
71fi
72rm -rf conftest*
73AC_LANG_RESTORE])
74
75dnl Host endianness probe.
76dnl Differs from AC_C_BIGENDIAN in that it does not require
77dnl running a program on the host.
78dnl
79AC_DEFUN([fastjar_AC_COMPILE_C_BIGENDIAN],
80[AC_CACHE_CHECK(byte ordering, ac_cv_c_compile_endian,
81[ac_cv_c_compile_endian=unknown
82gcc_AC_EXAMINE_OBJECT([
83#ifdef HAVE_LIMITS_H
84# include <limits.h>
85#endif
86/* This structure must have no internal padding. */
87 struct {
88 char prefix[sizeof "\nendian:" - 1];
89 short word;
90 char postfix[2];
91 } tester = {
92 "\nendian:",
93#if SIZEOF_SHORT == 4
94 ('A' << (CHAR_BIT * 3)) | ('B' << (CHAR_BIT * 2)) |
95#endif
96 ('A' << CHAR_BIT) | 'B',
97 'X', '\n'
98};],
99 [if grep 'endian:AB' conftest.dmp >/dev/null 2>&1; then
100 ac_cv_c_compile_endian=big-endian
101 elif grep 'endian:BA' conftest.dmp >/dev/null 2>&1; then
102 ac_cv_c_compile_endian=little-endian
103 fi])
104])
105if test $ac_cv_c_compile_endian = unknown; then
106 AC_MSG_ERROR([*** unable to determine endianness])
107elif test $ac_cv_c_compile_endian = big-endian; then
108 AC_DEFINE(WORDS_BIG_ENDIAN, 1,
109 [Define if the host machine stores words of multi-word integers in
110 big-endian order.])
111fi
112])
113
114dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
115dnl of the usual 2.
116AC_DEFUN(gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG,
117[AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
118[AC_TRY_COMPILE([
119#include <sys/types.h>
120#ifdef HAVE_SYS_STAT_H
121# include <sys/stat.h>
122#endif
123#ifdef HAVE_UNISTD_H
124# include <unistd.h>
125#endif
126#ifdef HAVE_DIRECT_H
127# include <direct.h>
128#endif], [mkdir ("foo", 0);],
129 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
130if test $gcc_cv_mkdir_takes_one_arg = yes ; then
131 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a
132single argument.])
133fi
134])
Note: See TracBrowser for help on using the repository browser.