From: Joel Rosdahl Date: Sun, 28 Feb 2010 09:17:43 +0000 (+0100) Subject: Portability: Check for "extern inline" support X-Git-Tag: v3.0pre0~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=23b55608510d49340b3173ef47def69a65f92afd;p=thirdparty%2Fccache.git Portability: Check for "extern inline" support --- diff --git a/configure.ac b/configure.ac index f87a12a41..27c39fe7d 100644 --- a/configure.ac +++ b/configure.ac @@ -116,6 +116,25 @@ fi AC_C_INLINE +dnl Check for "extern inline". +AC_CACHE_CHECK( + for extern inline, + ac_cv_c_extern_inline, + [ + ac_cv_c_extern_inline=no + AC_TRY_COMPILE( + [ + extern $ac_cv_c_inline double foo(double x); + extern $ac_cv_c_inline double foo(double x) { return x+1.0; }; + double foo (double x) { return x + 1.0; }; + ], + [foo(1.0)], + [ac_cv_c_extern_inline="yes"])]) +if test "$ac_cv_c_extern_inline" != no ; then + AC_DEFINE(HAVE_EXTERN_INLINE, 1, + Define to 1 if your compiler supports extern inline) +fi + AC_CONFIG_FILES([Makefile dev.mk]) AC_OUTPUT diff --git a/hashtable_itr.h b/hashtable_itr.h index eea699a72..0c6905ab9 100644 --- a/hashtable_itr.h +++ b/hashtable_itr.h @@ -28,7 +28,12 @@ hashtable_iterator(struct hashtable *h); /* hashtable_iterator_key * - return the value of the (key,value) pair at the current position */ -extern inline void * +#ifdef HAVE_EXTERN_INLINE +extern inline +#else +static +#endif +void * hashtable_iterator_key(struct hashtable_itr *i) { return i->e->k; @@ -37,7 +42,12 @@ hashtable_iterator_key(struct hashtable_itr *i) /*****************************************************************************/ /* value - return the value of the (key,value) pair at the current position */ -extern inline void * +#ifdef HAVE_EXTERN_INLINE +extern inline +#else +static +#endif +void * hashtable_iterator_value(struct hashtable_itr *i) { return i->e->v;