]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
m4: glibc.m4 - Improve glibc-check
authorKarl Fleischmann <karl.fleischmann@open-xchange.com>
Tue, 21 Jun 2022 07:26:19 +0000 (09:26 +0200)
committerKarl Fleischmann <karl.fleischmann@open-xchange.com>
Mon, 4 Jul 2022 09:43:26 +0000 (11:43 +0200)
The previous check was based on a compilation error and negating the
value. This updated check is more clear as it runs the preprocessor with
the appropriate header file and checks if the output matches, which in
turn allows for a more forward readable definition of the
i_cv_have_glibc value.

m4/glibc.m4

index ce228093e11aa228b9286c702eabcea4ac8f8c01..0976938717bf7537086ae5c26ae304208218a3eb 100644 (file)
@@ -1,14 +1,14 @@
 AC_DEFUN([DOVECOT_GLIBC], [
   AC_CACHE_CHECK([whether we have glibc],i_cv_have_glibc,[
-    AC_TRY_COMPILE([
-      #include <stdlib.h>
-      #ifdef __GLIBC__
+    AC_EGREP_CPP([we have glibc], [
+      #include <features.h>
+      #ifdef __GNU_LIBRARY__
         we have glibc
       #endif
-    ],, [
-      i_cv_have_glibc=no
     ], [
       i_cv_have_glibc=yes
+    ], [
+      i_cv_have_glibc=no
     ])
   ])
   AS_IF([test "$i_cv_have_glibc" = "yes"], [