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 fp_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{fp_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
21define(fp_PROG_CC_STDC,
22[AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C,
23fp_cv_prog_cc_stdc,
24[fp_cv_prog_cc_stdc=no
25ac_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			-Ae  or  -Aa -D_HPUX_SOURCE
31# SVR4			-Xc
32#  For HP-UX, we try -Ae first; this turns on ANSI but also extensions,
33#  as well as defining _HPUX_SOURCE, and we can then use long long.
34#  We keep the old version for backward compatibility.
35for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" -Xc
36do
37  CFLAGS="$ac_save_CFLAGS $ac_arg"
38  AC_TRY_COMPILE(
39[#ifndef __STDC__
40choke me
41#endif	
42], [int test (int i, double x);
43struct s1 {int (*f) (int a);};
44struct s2 {int (*f) (double a);};],
45[fp_cv_prog_cc_stdc="$ac_arg"; break])
46done
47CFLAGS="$ac_save_CFLAGS"
48])
49case "x$fp_cv_prog_cc_stdc" in
50  x|xno) ;;
51  *) CC="$CC $fp_cv_prog_cc_stdc" ;;
52esac
53])
54
55AC_DEFUN(AC_PROG_LN,
56[AC_MSG_CHECKING(whether ln works)
57AC_CACHE_VAL(ac_cv_prog_LN,
58[rm -f conftestdata conftestlink
59echo > conftestdata
60if ln conftestdata conftestlink 2>/dev/null
61then
62  rm -f conftestdata conftestlink
63  ac_cv_prog_LN="ln"
64else
65  rm -f conftestdata
66  ac_cv_prog_LN="cp"
67fi])dnl
68LN="$ac_cv_prog_LN"
69if test "$ac_cv_prog_LN" = "ln"; then
70  AC_MSG_RESULT(yes)
71else
72  AC_MSG_RESULT(no)
73fi
74AC_SUBST(LN)dnl
75])
76
77builtin(include, aczsh.m4)
78