diff options
| author | Mattias EngdegÄrd | 2022-04-08 14:57:17 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2022-04-08 15:00:38 +0200 |
| commit | 13c8cc58bbd829ca4616dea09cb050dc977db9ae (patch) | |
| tree | caaf2085c7c49adb360f3a654c8fbd27e1784e5b | |
| parent | e2f3b0f16eb34ac6f4941ddcf5b8ee24642656fc (diff) | |
| download | emacs-13c8cc58bbd829ca4616dea09cb050dc977db9ae.tar.gz emacs-13c8cc58bbd829ca4616dea09cb050dc977db9ae.zip | |
Enable warnings when building as a developer with Clang
The configure-script logic that automatically enables warnings when
building in a development tree didn't work for Clang because it was
identified as an old GCC version.
* configure.ac: Don't test Clang version as if it were GCC.
| -rw-r--r-- | configure.ac | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac index cda2a04be95..6b834a2f655 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -965,6 +965,17 @@ AC_DEFUN([gl_GCC_VERSION_IFELSE], | |||
| 965 | ] | 965 | ] |
| 966 | ) | 966 | ) |
| 967 | 967 | ||
| 968 | # clang is unduly picky about some things. | ||
| 969 | AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang], | ||
| 970 | [AC_COMPILE_IFELSE( | ||
| 971 | [AC_LANG_PROGRAM([[ | ||
| 972 | #ifndef __clang__ | ||
| 973 | error "not clang"; | ||
| 974 | #endif | ||
| 975 | ]])], | ||
| 976 | [emacs_cv_clang=yes], | ||
| 977 | [emacs_cv_clang=no])]) | ||
| 978 | |||
| 968 | AC_ARG_ENABLE([gcc-warnings], | 979 | AC_ARG_ENABLE([gcc-warnings], |
| 969 | [AS_HELP_STRING([--enable-gcc-warnings@<:@=TYPE@:>@], | 980 | [AS_HELP_STRING([--enable-gcc-warnings@<:@=TYPE@:>@], |
| 970 | [control generation of GCC warnings. The TYPE 'yes' | 981 | [control generation of GCC warnings. The TYPE 'yes' |
| @@ -984,7 +995,11 @@ AC_ARG_ENABLE([gcc-warnings], | |||
| 984 | # just a release imported into Git for patch management. | 995 | # just a release imported into Git for patch management. |
| 985 | gl_gcc_warnings=no | 996 | gl_gcc_warnings=no |
| 986 | if test -e "$srcdir"/.git && test ! -f "$srcdir"/.tarball-version; then | 997 | if test -e "$srcdir"/.git && test ! -f "$srcdir"/.tarball-version; then |
| 987 | gl_GCC_VERSION_IFELSE([5], [3], [gl_gcc_warnings=warn-only]) | 998 | # Clang typically identifies itself as GCC 4.2 or something similar |
| 999 | # even if it is recent enough to accept the warnings we enable. | ||
| 1000 | AS_IF([test "$emacs_cv_clang" = yes], | ||
| 1001 | [gl_gcc_warnings=warn-only], | ||
| 1002 | [gl_GCC_VERSION_IFELSE([5], [3], [gl_gcc_warnings=warn-only])]) | ||
| 988 | fi]) | 1003 | fi]) |
| 989 | 1004 | ||
| 990 | AC_ARG_ENABLE([check-lisp-object-type], | 1005 | AC_ARG_ENABLE([check-lisp-object-type], |
| @@ -996,17 +1011,6 @@ if test "$enable_check_lisp_object_type" = yes; then | |||
| 996 | [Define to enable compile-time checks for the Lisp_Object data type.]) | 1011 | [Define to enable compile-time checks for the Lisp_Object data type.]) |
| 997 | fi | 1012 | fi |
| 998 | 1013 | ||
| 999 | # clang is unduly picky about some things. | ||
| 1000 | AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang], | ||
| 1001 | [AC_COMPILE_IFELSE( | ||
| 1002 | [AC_LANG_PROGRAM([[ | ||
| 1003 | #ifndef __clang__ | ||
| 1004 | error "not clang"; | ||
| 1005 | #endif | ||
| 1006 | ]])], | ||
| 1007 | [emacs_cv_clang=yes], | ||
| 1008 | [emacs_cv_clang=no])]) | ||
| 1009 | |||
| 1010 | WERROR_CFLAGS= | 1014 | WERROR_CFLAGS= |
| 1011 | # When compiling with GCC, prefer -isystem to -I when including system | 1015 | # When compiling with GCC, prefer -isystem to -I when including system |
| 1012 | # include files, to avoid generating useless diagnostics for the files. | 1016 | # include files, to avoid generating useless diagnostics for the files. |