(Fread_file_name): Handle case that DIR contains a
[bpt/emacs.git] / aclocal.m4
CommitLineData
8e82f0c2
DL
1dnl The following are from prerelease autoconf 2.14a. When 2.14 is
2dnl released, we should be able to zap them and AC_PREREQ(2.14).
3
4
5# AC_PROG_CC_STDC
6# ---------------
7# If the C compiler in not in ANSI C mode by default, try to add an
8# option to output variable @code{CC} to make it so. This macro tries
9# various options that select ANSI C on some system or another. It
10# considers the compiler to be in ANSI C mode if it handles function
11# prototypes correctly.
12AC_DEFUN(AC_PROG_CC_STDC,
13[AC_REQUIRE([AC_PROG_CC])dnl
14AC_BEFORE([$0], [AC_C_INLINE])dnl
15AC_BEFORE([$0], [AC_C_CONST])dnl
16dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
17dnl a magic option to avoid problems with ANSI preprocessor commands
18dnl like #elif.
19dnl FIXME: can't do this because then AC_AIX won't work due to a
20dnl circular dependency.
21dnl AC_BEFORE([$0], [AC_PROG_CPP])
22AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
23AC_CACHE_VAL(ac_cv_prog_cc_stdc,
24[ac_cv_prog_cc_stdc=no
25ac_save_CC="$CC"
26# Don't try gcc -ansi; that turns off useful extensions and
27# breaks some systems' header files.
28# AIX -qlanglvl=ansi
29# Ultrix and OSF/1 -std1
30# HP-UX 10.20 and later -Ae
31# HP-UX older versions -Aa -D_HPUX_SOURCE
32# SVR4 -Xc -D__EXTENSIONS__
33for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
34do
35 CC="$ac_save_CC $ac_arg"
36 AC_TRY_COMPILE(
37[#include <stdarg.h>
38#include <stdio.h>
39#include <sys/types.h>
40#include <sys/stat.h>
41/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
42struct buf { int x; };
43FILE * (*rcsopen) (struct buf *, struct stat *, int);
44static char *e (p, i)
45 char **p;
46 int i;
47{
48 return p[i];
49}
50static char *f (char * (*g) (char **, int), char **p, ...)
51{
52 char *s;
53 va_list v;
54 va_start (v,p);
55 s = g (p, va_arg (v,int));
56 va_end (v);
57 return s;
58}
59int test (int i, double x);
60struct s1 {int (*f) (int a);};
61struct s2 {int (*f) (double a);};
62int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
63int argc;
64char **argv;],
65[return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];],
66[ac_cv_prog_cc_stdc="$ac_arg"; break])
67done
68CC="$ac_save_CC"
69])
70case "x$ac_cv_prog_cc_stdc" in
71 x|xno)
72 AC_MSG_RESULT([none needed]) ;;
73 *)
74 AC_MSG_RESULT($ac_cv_prog_cc_stdc)
75 CC="$CC $ac_cv_prog_cc_stdc" ;;
76esac
77])# AC_PROG_CC_STDC
78
79# AC_C_VOLATILE
80# -------------
81# Note that, unlike const, #defining volatile to be the empty string can
82# actually turn a correct program into an incorrect one, since removing
83# uses of volatile actually grants the compiler permission to perform
84# optimizations that could break the user's code. So, do not #define
85# volatile away unless it is really necessary to allow the user's code
86# to compile cleanly. Benign compiler failures should be tolerated.
87AC_DEFUN(AC_C_VOLATILE,
88[AC_REQUIRE([AC_PROG_CC_STDC])dnl
89AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
90[AC_TRY_COMPILE(,[
91volatile int x;
92int * volatile y;],
93ac_cv_c_volatile=yes, ac_cv_c_volatile=no)])
94if test $ac_cv_c_volatile = no; then
95 AC_DEFINE(volatile,,
96 [Define to empty if the keyword `volatile' does not work.
97 Warning: valid code using `volatile' can become incorrect
98 without. Disable with care.])
99fi
100])
101
102# AC_C_PROTOTYPES
103# ---------------
104# Check if the C compiler supports prototypes, included if it needs
105# options.
106AC_DEFUN(AC_C_PROTOTYPES,
107[AC_REQUIRE([AC_PROG_CC_STDC])dnl
108AC_REQUIRE([AC_PROG_CPP])dnl
109AC_MSG_CHECKING([for function prototypes])
110if test "$ac_cv_prog_cc_stdc" != no; then
111 AC_MSG_RESULT(yes)
112 AC_DEFINE(PROTOTYPES, 1,
113 [Define if the compiler supports function prototypes.])
114else
115 AC_MSG_RESULT(no)
116fi
117])# AC_C_PROTOTYPES