]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Portability: Check for "extern inline" support
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 28 Feb 2010 09:17:43 +0000 (10:17 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 28 Feb 2010 09:17:43 +0000 (10:17 +0100)
configure.ac
hashtable_itr.h

index f87a12a41f0e69f39fa431ddeb579c364ac0cc56..27c39fe7d9f79a113afe2fd852bb57468f6e6dce 100644 (file)
@@ -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
 
index eea699a72c81012b11ad3b4262aff957d94f1ef0..0c6905ab9a63087b82f3b802aa2c8fc706a8584c 100644 (file)
@@ -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;