From d87a0a4aabce8d4c80e02a4a9f3cc2ab47694c04 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 30 Jun 2015 10:16:56 -0600 Subject: [PATCH] Add check for inline support. --- config.h.in | 6 ++++++ configure | 42 ++++++++++++++++++++++++++++++++++++++++++ configure.ac | 1 + 3 files changed, 49 insertions(+) diff --git a/config.h.in b/config.h.in index a4088d109..13c9fb7ce 100644 --- a/config.h.in +++ b/config.h.in @@ -1188,6 +1188,12 @@ /* Define to `unsigned int' if does not define. */ #undef id_t +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + /* Define to `unsigned int' if does not define. */ #undef ino_t diff --git a/configure b/configure index 84b590a5f..29d6ab232 100755 --- a/configure +++ b/configure @@ -15931,6 +15931,48 @@ $as_echo "#define const /**/" >>confdefs.h fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5 $as_echo_n "checking for working volatile... " >&6; } if ${ac_cv_c_volatile+:} false; then : diff --git a/configure.ac b/configure.ac index abf046a71..5298870b5 100644 --- a/configure.ac +++ b/configure.ac @@ -2197,6 +2197,7 @@ dnl C compiler checks (to be done after os checks) dnl AC_PROG_CC_STDC AC_C_CONST +AC_C_INLINE AC_C_VOLATILE AC_MSG_CHECKING([for variadic macro support in cpp]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -- 2.40.0