From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4759 invoked from network); 11 May 1997 18:01:34 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 11 May 1997 18:01:34 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id NAA25956; Sun, 11 May 1997 13:47:43 -0400 (EDT) Resent-Date: Sun, 11 May 1997 13:47:43 -0400 (EDT) Date: Sun, 11 May 1997 18:51:12 +0100 (BST) From: Zefram Message-Id: <16148.199705111751@stone.dcs.warwick.ac.uk> Subject: ansi2knr X-Patch: 253 Resent-Message-ID: <"CWCNF1.0.RL6.-OWTp"@euclid> To: zsh-workers@math.gatech.edu Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3122 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu -----BEGIN PGP SIGNED MESSAGE----- This patch adds a new configure option for debugging purposes: --enable-ansi2knr, which overrides the usual logic about using ansi2knr. This is useful when testing changes that affect K&R compilation. This also fixes the fp_PROG_CC_STDC macro, so that it doesn't misuse the reserved `ac_cv_' prefix for shell parameters: autoconf standards require the cache parameter name to start with the same prefix as the macro name. -zefram *** aclocal.m4 1997/03/23 05:09:17 1.2 --- aclocal.m4 1997/05/11 13:32:27 *************** *** 2,8 **** # Copyright (C) 1992, 1994 Free Software Foundation, Inc. # Francois Pinard , 1992. ! # @defmac AC_PROG_CC_STDC # @maindex PROG_CC_STDC # @ovindex CC # If the C compiler in not in ANSI C mode by default, try to add an option --- 2,8 ---- # Copyright (C) 1992, 1994 Free Software Foundation, Inc. # Francois Pinard , 1992. ! # @defmac fp_PROG_CC_STDC # @maindex PROG_CC_STDC # @ovindex CC # If the C compiler in not in ANSI C mode by default, try to add an option *************** *** 13,27 **** # # If you use this macro, you should check after calling it whether the C # compiler has been set to accept ANSI C; if not, the shell variable ! # @code{ac_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source # code in ANSI C, you can make an un-ANSIfied copy of it by using the # program @code{ansi2knr}, which comes with Ghostscript. # @end defmac define(fp_PROG_CC_STDC, [AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, ! ac_cv_prog_cc_stdc, ! [ac_cv_prog_cc_stdc=no ac_save_CFLAGS="$CFLAGS" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. --- 13,27 ---- # # If you use this macro, you should check after calling it whether the C # compiler has been set to accept ANSI C; if not, the shell variable ! # @code{fp_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source # code in ANSI C, you can make an un-ANSIfied copy of it by using the # program @code{ansi2knr}, which comes with Ghostscript. # @end defmac define(fp_PROG_CC_STDC, [AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, ! fp_cv_prog_cc_stdc, ! [fp_cv_prog_cc_stdc=no ac_save_CFLAGS="$CFLAGS" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. *************** *** 39,68 **** ], [int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);};], ! [ac_cv_prog_cc_stdc="$ac_arg"; break]) done CFLAGS="$ac_save_CFLAGS" ]) ! case "x$ac_cv_prog_cc_stdc" in x|xno) ;; ! *) CC="$CC $ac_cv_prog_cc_stdc" ;; esac - ]) - - # Check for function prototypes. - - AC_DEFUN(fp_C_PROTOTYPES, - [AC_REQUIRE([fp_PROG_CC_STDC]) - AC_MSG_CHECKING([for function prototypes]) - if test "$ac_cv_prog_cc_stdc" != no; then - AC_MSG_RESULT(yes) - AC_DEFINE(PROTOTYPES) - U= - else - AC_MSG_RESULT(no) - U=_ - fi - AC_SUBST(U)dnl ]) builtin(include, aczsh.m4) --- 39,52 ---- ], [int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);};], ! [fp_cv_prog_cc_stdc="$ac_arg"; break]) done CFLAGS="$ac_save_CFLAGS" ]) ! case "x$fp_cv_prog_cc_stdc" in x|xno) ;; ! *) CC="$CC $fp_cv_prog_cc_stdc" ;; esac ]) builtin(include, aczsh.m4) *** configure.in 1997/05/11 12:05:44 1.39 --- configure.in 1997/05/11 13:30:04 *************** *** 179,184 **** --- 179,189 ---- [ --enable-dynamic allow dynamically loaded binary modules], [dynamic="$enableval"], [dynamic=no]) + dnl Do you want to compile as K&R C. + AC_ARG_ENABLE(ansi2knr, + [ --enable-ansi2knr translate source to K&R C before compiling], + [ansi2knr="$enableval"], [ansi2knr=default]) + dnl ------------------ dnl CHECK THE COMPILER dnl ------------------ *************** *** 258,264 **** AC_PROG_CPP dnl Figure out how to run C preprocessor. AC_PROG_GCC_TRADITIONAL dnl Do we need -traditional flag for gcc. AC_C_CONST dnl Does compiler support `const'. ! fp_C_PROTOTYPES dnl Does compiler support ANSI prototypes. AC_CHECK_SIZEOF(long, 8) dnl Number of bytes in a long. AC_FUNC_ALLOCA dnl Check how to get `alloca'. --- 263,291 ---- AC_PROG_CPP dnl Figure out how to run C preprocessor. AC_PROG_GCC_TRADITIONAL dnl Do we need -traditional flag for gcc. AC_C_CONST dnl Does compiler support `const'. ! ! fp_PROG_CC_STDC ! AC_MSG_CHECKING([whether to use prototypes]) ! if test ."$ansi2knr" = .yes || test ."$ansi2knr" = .no; then ! msg="(overridden) " ! else ! msg= ! if test ."$fp_cv_prog_cc_stdc" = .no; then ! ansi2knr=yes ! else ! ansi2knr=no ! fi ! fi ! if test "$ansi2knr" = yes; then ! AC_MSG_RESULT(${msg}no) ! U=_ ! else ! AC_MSG_RESULT(${msg}yes) ! AC_DEFINE(PROTOTYPES) ! U= ! fi ! AC_SUBST(U) ! AC_CHECK_SIZEOF(long, 8) dnl Number of bytes in a long. AC_FUNC_ALLOCA dnl Check how to get `alloca'. -----BEGIN PGP SIGNATURE----- Version: 2.6.3ia Charset: ascii iQCVAwUBM3XNxHD/+HJTpU/hAQHSqwP/Rr1PdgSvqf2XzeQER6msX2ln21cNCW/T 0Sx1RyHmTCKrfRUtk8FA2xVsatPPZsxP/HYQLGAS8gdmVm5m6MchVUqHEePYknKP a+wWbN0hwKBKY0+ahbMTBMEmG4MN1GlRXn6m3mxxPJBPQPQOzVuX/ts5V1yJzKkX TWbsXGUjyMs= =vApb -----END PGP SIGNATURE-----