1 | # Local additions to Autoconf macros. |
---|
2 | # Copyright (C) 1992, 1994 Free Software Foundation, Inc. |
---|
3 | # Francois Pinard <pinard@iro.umontreal.ca>, 1992. |
---|
4 | |
---|
5 | # @defmac AC_PROG_CC_STDC |
---|
6 | # @maindex PROG_CC_STDC |
---|
7 | # @ovindex CC |
---|
8 | # If the C compiler in not in ANSI C mode by default, try to add an option |
---|
9 | # to output variable @code{CC} to make it so. This macro tries various |
---|
10 | # options that select ANSI C on some system or another. It considers the |
---|
11 | # compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and |
---|
12 | # handles function prototypes correctly. |
---|
13 | # |
---|
14 | # If you use this macro, you should check after calling it whether the C |
---|
15 | # compiler has been set to accept ANSI C; if not, the shell variable |
---|
16 | # @code{ac_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source |
---|
17 | # code in ANSI C, you can make an un-ANSIfied copy of it by using the |
---|
18 | # program @code{ansi2knr}, which comes with Ghostscript. |
---|
19 | # @end defmac |
---|
20 | |
---|
21 | define(fp_PROG_CC_STDC, |
---|
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_CFLAGS="$CFLAGS" |
---|
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 -Aa -D_HPUX_SOURCE |
---|
31 | # SVR4 -Xc |
---|
32 | for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc |
---|
33 | do |
---|
34 | CFLAGS="$ac_save_CFLAGS $ac_arg" |
---|
35 | AC_TRY_COMPILE( |
---|
36 | [#if !defined(__STDC__) || __STDC__ != 1 |
---|
37 | choke me |
---|
38 | #endif |
---|
39 | ], [int test (int i, double x); |
---|
40 | struct s1 {int (*f) (int a);}; |
---|
41 | struct s2 {int (*f) (double a);};], |
---|
42 | [ac_cv_prog_cc_stdc="$ac_arg"; break]) |
---|
43 | done |
---|
44 | CFLAGS="$ac_save_CFLAGS" |
---|
45 | ]) |
---|
46 | AC_MSG_RESULT($ac_cv_prog_cc_stdc) |
---|
47 | case "x$ac_cv_prog_cc_stdc" in |
---|
48 | x|xno) ;; |
---|
49 | *) CC="$CC $ac_cv_prog_cc_stdc" ;; |
---|
50 | esac |
---|
51 | ]) |
---|
52 | |
---|
53 | # Check for function prototypes. |
---|
54 | |
---|
55 | AC_DEFUN(fp_C_PROTOTYPES, |
---|
56 | [AC_REQUIRE([fp_PROG_CC_STDC]) |
---|
57 | AC_MSG_CHECKING([for function prototypes]) |
---|
58 | if test "$ac_cv_prog_cc_stdc" != no; then |
---|
59 | AC_MSG_RESULT(yes) |
---|
60 | AC_DEFINE(PROTOTYPES) |
---|
61 | U= ANSI2KNR= |
---|
62 | else |
---|
63 | AC_MSG_RESULT(no) |
---|
64 | U=_ ANSI2KNR=ansi2knr |
---|
65 | fi |
---|
66 | AC_SUBST(U)dnl |
---|
67 | AC_SUBST(ANSI2KNR)dnl |
---|
68 | ]) |
---|
69 | |
---|
70 | # Check if --with-dmalloc was given. |
---|
71 | |
---|
72 | AC_DEFUN(fp_WITH_DMALLOC, |
---|
73 | [AC_MSG_CHECKING(if malloc debugging is wanted) |
---|
74 | AC_ARG_WITH(dmalloc, |
---|
75 | [ --with-dmalloc use dmalloc, as in dmalloc.tar.gz from |
---|
76 | @/ftp.antaire.com:antaire/src/dmalloc.], |
---|
77 | [if test "$withval" = yes; then |
---|
78 | AC_MSG_RESULT(yes) |
---|
79 | AC_DEFINE(WITH_DMALLOC) |
---|
80 | LIBS="$LIBS -ldmalloc" |
---|
81 | LDFLAGS="$LDFLAGS -g" |
---|
82 | else |
---|
83 | AC_MSG_RESULT(no) |
---|
84 | fi], [AC_MSG_RESULT(no)])]) |
---|
85 | |
---|