diff options
author | Explorer09 <explorer09@gmail.com> | 2023-10-11 03:37:39 +0800 |
---|---|---|
committer | Explorer09 <explorer09@gmail.com> | 2023-10-11 04:22:54 +0800 |
commit | f541f70d0ecbb9fd80bea9909c1783b92d46d695 (patch) | |
tree | 346c0af3ae7e3d73a6a3f0b27c5ccc2482a4b25d /configure.ac | |
parent | 83041f3550ee5bb83b6f9c4dcae90d59b33e0fb5 (diff) |
Add configure check for nonnull attribute
The main reason I do this is to document the minimum compiler version
(GCC 3.3) for the attribute. But it may work with other compilers, too.
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 16d1fb9a..c922b30a 100644 --- a/configure.ac +++ b/configure.ac @@ -202,6 +202,22 @@ AC_COMPILE_IFELSE([ AC_MSG_RESULT(no)) CFLAGS="$old_CFLAGS" +AC_MSG_CHECKING(for nonnull) +old_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -Wno-error -Werror=attributes" +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE( + [[ + /* Attribute supported in GCC 3.3 or later */ + __attribute__((nonnull)) int my_strcmp(const char* a, const char* b); + __attribute__((nonnull(1))) long my_strtol(const char* str, char** endptr, int base); + ]] + )], + AC_DEFINE([HAVE_ATTR_NONNULL], 1, [The nonnull attribute is supported.]) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) +CFLAGS="$old_CFLAGS" + AC_MSG_CHECKING(for NaN support) dnl Note: AC_RUN_IFELSE does not try compiling the program at all when dnl $cross_compiling is 'yes'. |