(smerge-auto-leave): New function and variable.
[emacs.git] / aclocal.m4
blob8dfc4b98a0daba7c070e1d68d7fb385db083c0f2
1 dnl The following are from prerelease autoconf 2.14a.  When 2.14 is
2 dnl released, we should be able to zap them and AC_PREREQ(2.14).
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.
12 AC_DEFUN(AC_PROG_CC_STDC,
13 [AC_REQUIRE([AC_PROG_CC])dnl
14 AC_BEFORE([$0], [AC_C_INLINE])dnl
15 AC_BEFORE([$0], [AC_C_CONST])dnl
16 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
17 dnl a magic option to avoid problems with ANSI preprocessor commands
18 dnl like #elif.
19 dnl FIXME: can't do this because then AC_AIX won't work due to a
20 dnl circular dependency.
21 dnl AC_BEFORE([$0], [AC_PROG_CPP])
22 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
23 AC_CACHE_VAL(ac_cv_prog_cc_stdc,
24 [ac_cv_prog_cc_stdc=no
25 ac_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__
33 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
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.  */
42 struct buf { int x; };
43 FILE * (*rcsopen) (struct buf *, struct stat *, int);
44 static char *e (p, i)
45      char **p;
46      int i;
48   return p[i];
50 static char *f (char * (*g) (char **, int), char **p, ...)
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;
59 int test (int i, double x);
60 struct s1 {int (*f) (int a);};
61 struct s2 {int (*f) (double a);};
62 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
63 int argc;
64 char **argv;],
65 [return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];],
66 [ac_cv_prog_cc_stdc="$ac_arg"; break])
67 done
68 CC="$ac_save_CC"
70 case "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" ;;
76 esac
77 ])# AC_PROG_CC_STDC
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.
87 AC_DEFUN(AC_C_VOLATILE,
88 [AC_REQUIRE([AC_PROG_CC_STDC])dnl
89 AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
90 [AC_TRY_COMPILE(,[
91 volatile int x;
92 int * volatile y;],
93 ac_cv_c_volatile=yes, ac_cv_c_volatile=no)])
94 if 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.])
102 # AC_C_PROTOTYPES
103 # ---------------
104 # Check if the C compiler supports prototypes, included if it needs
105 # options.
106 AC_DEFUN(AC_C_PROTOTYPES,
107 [AC_REQUIRE([AC_PROG_CC_STDC])dnl
108 AC_REQUIRE([AC_PROG_CPP])dnl
109 AC_MSG_CHECKING([for function prototypes])
110 if 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.])
114 else
115   AC_MSG_RESULT(no)
117 ])# AC_C_PROTOTYPES