Mercurial > vim
comparison src/auto/configure @ 13674:1feeefd8cddb v8.0.1709
patch 8.0.1709: some non-C89 code may slip through
commit https://github.com/vim/vim/commit/2e324950b83fcdf60843b54a6a339183370f338a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 14 14:37:07 2018 +0200
patch 8.0.1709: some non-C89 code may slip through
Problem: Some non-C89 code may slip through.
Solution: Enforce C89 in configure. Fix detected problems. (James McCoy,
closes #2735)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 14 Apr 2018 14:45:06 +0200 |
parents | bc28260e2a2e |
children | 6b49b6ea9e43 |
comparison
equal
deleted
inserted
replaced
13673:24336952ffcf | 13674:1feeefd8cddb |
---|---|
3447 ac_ext=c | 3447 ac_ext=c |
3448 ac_cpp='$CPP $CPPFLAGS' | 3448 ac_cpp='$CPP $CPPFLAGS' |
3449 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' | 3449 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' |
3450 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' | 3450 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' |
3451 ac_compiler_gnu=$ac_cv_c_compiler_gnu | 3451 ac_compiler_gnu=$ac_cv_c_compiler_gnu |
3452 | |
3453 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 | |
3454 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } | |
3455 if ${ac_cv_prog_cc_c89+:} false; then : | |
3456 $as_echo_n "(cached) " >&6 | |
3457 else | |
3458 ac_cv_prog_cc_c89=no | |
3459 ac_save_CC=$CC | |
3460 cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
3461 /* end confdefs.h. */ | |
3462 #include <stdarg.h> | |
3463 #include <stdio.h> | |
3464 struct stat; | |
3465 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ | |
3466 struct buf { int x; }; | |
3467 FILE * (*rcsopen) (struct buf *, struct stat *, int); | |
3468 static char *e (p, i) | |
3469 char **p; | |
3470 int i; | |
3471 { | |
3472 return p[i]; | |
3473 } | |
3474 static char *f (char * (*g) (char **, int), char **p, ...) | |
3475 { | |
3476 char *s; | |
3477 va_list v; | |
3478 va_start (v,p); | |
3479 s = g (p, va_arg (v,int)); | |
3480 va_end (v); | |
3481 return s; | |
3482 } | |
3483 | |
3484 /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has | |
3485 function prototypes and stuff, but not '\xHH' hex character constants. | |
3486 These don't provoke an error unfortunately, instead are silently treated | |
3487 as 'x'. The following induces an error, until -std is added to get | |
3488 proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an | |
3489 array size at least. It's necessary to write '\x00'==0 to get something | |
3490 that's true only with -std. */ | |
3491 int osf4_cc_array ['\x00' == 0 ? 1 : -1]; | |
3492 | |
3493 /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters | |
3494 inside strings and character constants. */ | |
3495 #define FOO(x) 'x' | |
3496 int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; | |
3497 | |
3498 int test (int i, double x); | |
3499 struct s1 {int (*f) (int a);}; | |
3500 struct s2 {int (*f) (double a);}; | |
3501 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); | |
3502 int argc; | |
3503 char **argv; | |
3504 int | |
3505 main () | |
3506 { | |
3507 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; | |
3508 ; | |
3509 return 0; | |
3510 } | |
3511 _ACEOF | |
3512 for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ | |
3513 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" | |
3514 do | |
3515 CC="$ac_save_CC $ac_arg" | |
3516 if ac_fn_c_try_compile "$LINENO"; then : | |
3517 ac_cv_prog_cc_c89=$ac_arg | |
3518 fi | |
3519 rm -f core conftest.err conftest.$ac_objext | |
3520 test "x$ac_cv_prog_cc_c89" != "xno" && break | |
3521 done | |
3522 rm -f conftest.$ac_ext | |
3523 CC=$ac_save_CC | |
3524 | |
3525 fi | |
3526 # AC_CACHE_VAL | |
3527 case "x$ac_cv_prog_cc_c89" in | |
3528 x) | |
3529 { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 | |
3530 $as_echo "none needed" >&6; } ;; | |
3531 xno) | |
3532 { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 | |
3533 $as_echo "unsupported" >&6; } ;; | |
3534 *) | |
3535 CC="$CC $ac_cv_prog_cc_c89" | |
3536 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 | |
3537 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; | |
3538 esac | |
3539 if test "x$ac_cv_prog_cc_c89" != xno; then : | |
3540 | |
3541 fi | |
3542 | |
3452 ac_ext=c | 3543 ac_ext=c |
3453 ac_cpp='$CPP $CPPFLAGS' | 3544 ac_cpp='$CPP $CPPFLAGS' |
3454 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' | 3545 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' |
3455 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' | 3546 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' |
3456 ac_compiler_gnu=$ac_cv_c_compiler_gnu | 3547 ac_compiler_gnu=$ac_cv_c_compiler_gnu |
4113 if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then | 4204 if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then |
4114 echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"' | 4205 echo 'GCC 3.1 and 3.2 have a bug in the optimizer, adding "-fno-strength-reduce"' |
4115 CFLAGS="$CFLAGS -fno-strength-reduce" | 4206 CFLAGS="$CFLAGS -fno-strength-reduce" |
4116 fi | 4207 fi |
4117 fi | 4208 fi |
4209 | |
4210 CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700" | |
4118 fi | 4211 fi |
4119 | 4212 |
4120 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang version" >&5 | 4213 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang version" >&5 |
4121 $as_echo_n "checking for clang version... " >&6; } | 4214 $as_echo_n "checking for clang version... " >&6; } |
4122 CLANG_VERSION_STRING=`$CC --version 2>/dev/null | sed -n -e 's/^.*clang[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p'` | 4215 CLANG_VERSION_STRING=`$CC --version 2>/dev/null | sed -n -e 's/^.*clang[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p'` |
4185 $as_echo_n "checking for Darwin (Mac OS X)... " >&6; } | 4278 $as_echo_n "checking for Darwin (Mac OS X)... " >&6; } |
4186 if test "`(uname) 2>/dev/null`" = Darwin; then | 4279 if test "`(uname) 2>/dev/null`" = Darwin; then |
4187 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 | 4280 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 |
4188 $as_echo "yes" >&6; } | 4281 $as_echo "yes" >&6; } |
4189 MACOS_X=yes | 4282 MACOS_X=yes |
4190 CPPFLAGS="$CPPFLAGS -DMACOS_X" | 4283 CPPFLAGS="$CPPFLAGS -D_DARWIN_C_SOURCE -DMACOS_X" |
4191 | 4284 |
4192 { $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-darwin argument" >&5 | 4285 { $as_echo "$as_me:${as_lineno-$LINENO}: checking --disable-darwin argument" >&5 |
4193 $as_echo_n "checking --disable-darwin argument... " >&6; } | 4286 $as_echo_n "checking --disable-darwin argument... " >&6; } |
4194 # Check whether --enable-darwin was given. | 4287 # Check whether --enable-darwin was given. |
4195 if test "${enable_darwin+set}" = set; then : | 4288 if test "${enable_darwin+set}" = set; then : |
14339 # IBM z/OS reset CFLAGS for config.mk | 14432 # IBM z/OS reset CFLAGS for config.mk |
14340 if test "$zOSUnix" = "yes"; then | 14433 if test "$zOSUnix" = "yes"; then |
14341 CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll" | 14434 CFLAGS="-D_ALL_SOURCE -Wc,float\(ieee\),dll" |
14342 fi | 14435 fi |
14343 | 14436 |
14437 if test "$GCC" = yes -a "$GUITYPE" != "GTK"; then | |
14438 CFLAGS="$CFLAGS -ansi" | |
14439 fi | |
14440 | |
14344 ac_config_files="$ac_config_files auto/config.mk:config.mk.in" | 14441 ac_config_files="$ac_config_files auto/config.mk:config.mk.in" |
14345 | 14442 |
14346 cat >confcache <<\_ACEOF | 14443 cat >confcache <<\_ACEOF |
14347 # This file is a shell script that caches the results of configure | 14444 # This file is a shell script that caches the results of configure |
14348 # tests run on this system so they can be shared between configure | 14445 # tests run on this system so they can be shared between configure |