Mercurial > vim
comparison src/configure.ac @ 13728:603516b73349 v8.0.1736
patch 8.0.1736: check for C99 features is incomplete
commit https://github.com/vim/vim/commit/226400830b470774bf5a552e1af10706b609720c
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Apr 19 20:39:41 2018 +0200
patch 8.0.1736: check for C99 features is incomplete
Problem: Check for C99 features is incomplete.
Solution: Use AC_PROG_CC_C99 and when C99 isn't fully supported check the
features we need. (James McCoy, closes #2820)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 19 Apr 2018 20:45:06 +0200 |
parents | d35b1702a1da |
children | 9ae15cd46d84 |
comparison
equal
deleted
inserted
replaced
13727:2b3a864b3138 | 13728:603516b73349 |
---|---|
9 dnl Being able to run configure means the system is Unix (compatible). | 9 dnl Being able to run configure means the system is Unix (compatible). |
10 AC_DEFINE(UNIX) | 10 AC_DEFINE(UNIX) |
11 AC_PROG_MAKE_SET | 11 AC_PROG_MAKE_SET |
12 | 12 |
13 dnl Checks for programs. | 13 dnl Checks for programs. |
14 AC_PROG_CC_C89 dnl required by almost everything | 14 AC_PROG_CC_C99 dnl required by almost everything |
15 AC_PROG_CPP dnl required by header file checks | 15 AC_PROG_CPP dnl required by header file checks |
16 AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP | 16 AC_PROGRAM_EGREP dnl required by AC_EGREP_CPP |
17 AC_PROG_FGREP dnl finds working grep -F | 17 AC_PROG_FGREP dnl finds working grep -F |
18 AC_ISC_POSIX dnl required by AC_C_CROSS | 18 AC_ISC_POSIX dnl required by AC_C_CROSS |
19 AC_PROG_AWK dnl required for "make html" in ../doc | 19 AC_PROG_AWK dnl required for "make html" in ../doc |
28 dnl in autoconf needs it, where it uses STDC_HEADERS. | 28 dnl in autoconf needs it, where it uses STDC_HEADERS. |
29 AC_HEADER_STDC | 29 AC_HEADER_STDC |
30 AC_HEADER_SYS_WAIT | 30 AC_HEADER_SYS_WAIT |
31 | 31 |
32 dnl Check that the C99 features that Vim uses are supported: | 32 dnl Check that the C99 features that Vim uses are supported: |
33 dnl - // commands | 33 if test x"$ac_cv_prog_cc_c99" != xno; then |
34 dnl - comma after last enum item | 34 dnl If the compiler doesn't explicitly support C99, then check |
35 dnl - "long long int" and "long long unsigned" | 35 dnl for the specific features Vim uses |
36 dnl - flexible array member | 36 |
37 AC_MSG_CHECKING(if the compiler can handle Vim code) | 37 AC_TYPE_LONG_LONG_INT |
38 AC_TRY_COMPILE([#include <stdio.h>], [ | 38 if test "$ac_cv_type_long_long_int" = no; then |
39 enum { | 39 AC_MSG_FAILURE([Compiler does not support long long int]) |
40 one, // one comment | 40 fi |
41 two, // two comments | 41 |
42 three, // three comments | 42 AC_MSG_CHECKING([if the compiler supports trailing commas]) |
43 }; | 43 trailing_commas=no |
44 long long int a = 1; | 44 AC_TRY_COMPILE([], [ |
45 long long unsigned b = 2; | 45 enum { |
46 printf("a %lld and a %llu", a, b); | 46 one, |
47 ], | 47 };], |
48 AC_MSG_RESULT(yes), | 48 [AC_MSG_RESULT(yes); trailing_commas=yes], |
49 AC_MSG_ERROR([compiler does not work properly - see auto/config.log])) | 49 [AC_MSG_RESULT(no)]) |
50 if test "$trailing_commas" = no; then | |
51 AC_MSG_FAILURE([Compiler does not support trailing comma in enum]) | |
52 fi | |
53 | |
54 AC_MSG_CHECKING([if the compiler supports C++ comments]) | |
55 slash_comments=no | |
56 AC_TRY_COMPILE([], | |
57 [// C++ comments?], | |
58 [AC_MSG_RESULT(yes); slash_comments=yes], | |
59 [AC_MSG_RESULT(no)]) | |
60 if test "$slash_comments" = no; then | |
61 AC_MSG_FAILURE([Compiler does not support C++ comments]) | |
62 fi | |
63 fi | |
50 | 64 |
51 dnl Check for the flag that fails if stuff are missing. | 65 dnl Check for the flag that fails if stuff are missing. |
52 | 66 |
53 AC_MSG_CHECKING(--enable-fail-if-missing argument) | 67 AC_MSG_CHECKING(--enable-fail-if-missing argument) |
54 AC_ARG_ENABLE(fail_if_missing, | 68 AC_ARG_ENABLE(fail_if_missing, |