OSDN Git Service

2003-11-21 Andreas Jaeger <aj@suse.de>
[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_DEFUN([AM_PROG_LIBTOOL],)
20 AC_SUBST(LIBTOOL)
21 ])
22
23 # mmap(2) blacklisting.  Some platforms provide the mmap library routine
24 # but don't support all of the features we need from it.
25 AC_DEFUN([AC_FUNC_MMAP_BLACKLIST],
26 [if test $ac_cv_header_sys_mman_h != yes \
27  || test $ac_cv_func_mmap != yes; then
28    ac_cv_func_mmap_file=no
29    ac_cv_func_mmap_dev_zero=no
30    ac_cv_func_mmap_anon=no
31 else
32    AC_CACHE_CHECK([whether read-only mmap of a plain file works],
33   ac_cv_func_mmap_file,
34   [# Add a system to this blacklist if
35    # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a
36    # memory area containing the same data that you'd get if you applied
37    # read() to the same fd.  The only system known to have a problem here
38    # is VMS, where text files have record structure.
39    case "$host_os" in
40      vms* | ultrix*)
41         ac_cv_func_mmap_file=no ;;
42      *)
43         ac_cv_func_mmap_file=yes;;
44    esac])
45    AC_CACHE_CHECK([whether mmap from /dev/zero works],
46   ac_cv_func_mmap_dev_zero,
47   [# Add a system to this blacklist if it has mmap() but /dev/zero
48    # does not exist, or if mmapping /dev/zero does not give anonymous
49    # zeroed pages with both the following properties:
50    # 1. If you map N consecutive pages in with one call, and then
51    #    unmap any subset of those pages, the pages that were not
52    #    explicitly unmapped remain accessible.
53    # 2. If you map two adjacent blocks of memory and then unmap them
54    #    both at once, they must both go away.
55    # Systems known to be in this category are Windows (all variants),
56    # VMS, and Darwin.
57    case "$host_os" in
58      vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00)
59         ac_cv_func_mmap_dev_zero=no ;;
60      *)
61         ac_cv_func_mmap_dev_zero=yes;;
62    esac])
63
64    # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for.
65    AC_CACHE_CHECK([for MAP_ANON(YMOUS)], ac_cv_decl_map_anon,
66     [AC_TRY_COMPILE(
67 [#include <sys/types.h>
68 #include <sys/mman.h>
69 #include <unistd.h>
70
71 #ifndef MAP_ANONYMOUS
72 #define MAP_ANONYMOUS MAP_ANON
73 #endif
74 ],
75 [int n = MAP_ANONYMOUS;],
76     ac_cv_decl_map_anon=yes,
77     ac_cv_decl_map_anon=no)])
78
79    if test $ac_cv_decl_map_anon = no; then
80      ac_cv_func_mmap_anon=no
81    else
82      AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works],
83      ac_cv_func_mmap_anon,
84   [# Add a system to this blacklist if it has mmap() and MAP_ANON or
85    # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
86    # doesn't give anonymous zeroed pages with the same properties listed
87    # above for use of /dev/zero.
88    # Systems known to be in this category are Windows, VMS, and SCO Unix.
89    case "$host_os" in
90      vms* | cygwin* | pe | mingw* | sco* | udk* )
91         ac_cv_func_mmap_anon=no ;;
92      *)
93         ac_cv_func_mmap_anon=yes;;
94    esac])
95    fi
96 fi
97
98 if test $ac_cv_func_mmap_file = yes; then
99   AC_DEFINE(HAVE_MMAP_FILE, 1,
100             [Define if read-only mmap of a plain file works.])
101 fi
102 if test $ac_cv_func_mmap_dev_zero = yes; then
103   AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
104             [Define if mmap of /dev/zero works.])
105 fi
106 if test $ac_cv_func_mmap_anon = yes; then
107   AC_DEFINE(HAVE_MMAP_ANON, 1,
108             [Define if mmap with MAP_ANON(YMOUS) works.])
109 fi
110 ])
111
112 sinclude(../config/accross.m4)
113
114 # Like AC_CONFIG_HEADER, but automatically create stamp file.
115
116 AC_DEFUN(AM_CONFIG_HEADER,
117 [AC_PREREQ([2.12])
118 AC_CONFIG_HEADER([$1])
119 dnl When config.status generates a header, we must update the stamp-h file.
120 dnl This file resides in the same directory as the config header
121 dnl that is generated.  We must strip everything past the first ":",
122 dnl and everything past the last "/".
123 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
124 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
125 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
126 <<am_indx=1
127 for am_file in <<$1>>; do
128   case " <<$>>CONFIG_HEADERS " in
129   *" <<$>>am_file "*<<)>>
130     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
131     ;;
132   esac
133   am_indx=`expr "<<$>>am_indx" + 1`
134 done<<>>dnl>>)
135 changequote([,]))])
136
137 # Do all the work for Automake.  This macro actually does too much --
138 # some checks are only needed if your package does certain things.
139 # But this isn't really a big deal.
140
141 # serial 1
142
143 dnl Usage:
144 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
145
146 AC_DEFUN(AM_INIT_AUTOMAKE,
147 [AC_REQUIRE([AC_PROG_INSTALL])
148 PACKAGE=[$1]
149 AC_SUBST(PACKAGE)
150 VERSION=[$2]
151 AC_SUBST(VERSION)
152 dnl test to see if srcdir already configured
153 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
154   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
155 fi
156 ifelse([$3],,
157 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
158 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
159 AC_REQUIRE([AM_SANITY_CHECK])
160 AC_REQUIRE([AC_ARG_PROGRAM])
161 dnl FIXME This is truly gross.
162 missing_dir=`cd $ac_aux_dir && pwd`
163 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
164 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
165 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
166 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
167 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
168 AC_REQUIRE([AC_PROG_MAKE_SET])])
169
170 #
171 # Check to make sure that the build environment is sane.
172 #
173
174 AC_DEFUN(AM_SANITY_CHECK,
175 [AC_MSG_CHECKING([whether build environment is sane])
176 # Just in case
177 sleep 1
178 echo timestamp > conftestfile
179 # Do `set' in a subshell so we don't clobber the current shell's
180 # arguments.  Must try -L first in case configure is actually a
181 # symlink; some systems play weird games with the mod time of symlinks
182 # (eg FreeBSD returns the mod time of the symlink's containing
183 # directory).
184 if (
185    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
186    if test "[$]*" = "X"; then
187       # -L didn't work.
188       set X `ls -t $srcdir/configure conftestfile`
189    fi
190    if test "[$]*" != "X $srcdir/configure conftestfile" \
191       && test "[$]*" != "X conftestfile $srcdir/configure"; then
192
193       # If neither matched, then we have a broken ls.  This can happen
194       # if, for instance, CONFIG_SHELL is bash and it inherits a
195       # broken ls alias from the environment.  This has actually
196       # happened.  Such a system could not be considered "sane".
197       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
198 alias in your environment])
199    fi
200
201    test "[$]2" = conftestfile
202    )
203 then
204    # Ok.
205    :
206 else
207    AC_MSG_ERROR([newly created file is older than distributed files!
208 Check your system clock])
209 fi
210 rm -f conftest*
211 AC_MSG_RESULT(yes)])
212
213 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
214 dnl The program must properly implement --version.
215 AC_DEFUN(AM_MISSING_PROG,
216 [AC_MSG_CHECKING(for working $2)
217 # Run test in a subshell; some versions of sh will print an error if
218 # an executable is not found, even if stderr is redirected.
219 # Redirect stdin to placate older versions of autoconf.  Sigh.
220 if ($2 --version) < /dev/null > /dev/null 2>&1; then
221    $1=$2
222    AC_MSG_RESULT(found)
223 else
224    $1="$3/missing $2"
225    AC_MSG_RESULT(missing)
226 fi
227 AC_SUBST($1)])
228
229 # Add --enable-maintainer-mode option to configure.
230 # From Jim Meyering
231
232 # serial 1
233
234 AC_DEFUN(AM_MAINTAINER_MODE,
235 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
236   dnl maintainer-mode is disabled by default
237   AC_ARG_ENABLE(maintainer-mode,
238 [  --enable-maintainer-mode enable make rules and dependencies not useful
239                           (and sometimes confusing) to the casual installer],
240       USE_MAINTAINER_MODE=$enableval,
241       USE_MAINTAINER_MODE=no)
242   AC_MSG_RESULT($USE_MAINTAINER_MODE)
243   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
244   MAINT=$MAINTAINER_MODE_TRUE
245   AC_SUBST(MAINT)dnl
246 ]
247 )
248
249 # Define a conditional.
250
251 AC_DEFUN(AM_CONDITIONAL,
252 [AC_SUBST($1_TRUE)
253 AC_SUBST($1_FALSE)
254 if $2; then
255   $1_TRUE=
256   $1_FALSE='#'
257 else
258   $1_TRUE='#'
259   $1_FALSE=
260 fi])
261