]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Factored setresuid, libdb and regex checks out of main configure.in file
authorFrancesco Chemolli <kinkie@squid-cache.org>
Mon, 2 Aug 2010 19:33:59 +0000 (21:33 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Mon, 2 Aug 2010 19:33:59 +0000 (21:33 +0200)
acinclude/os-deps.m4
configure.in

index 7ad895c1c03d365a14739441299fd84500430669..682300b04e7e7c2d8e8f066ff6c585aca9183785 100644 (file)
@@ -793,3 +793,24 @@ AC_DEFUN([SQUID_CHECK_WINSOCK_LIB],[
   AC_CHECK_HEADERS(winsock2.h winsock.h)
   SQUID_STATE_ROLLBACK(winsock)
 ])
+
+
+dnl check that setresuid is properly implemented.
+dnl sets squid_cv_resuid_works to "yes" or "no"
+AC_DEFUN([SQUID_CHECK_SETRESUID_WORKS],[
+  AC_CACHE_CHECK(if setresuid is actually implemented, squid_cv_resuid_works,
+    AC_RUN_IFELSE([
+      AC_LANG_SOURCE([[
+#include <stdlib.h>
+  int main(int argc, char **argv) {
+    if(setresuid(-1,-1,-1)) {
+      perror("setresuid:");
+      return 1;
+    }
+    return 0;
+  }
+  ]])],[
+    squid_cv_resuid_works="yes" ],[
+    squid_cv_resuid_works="no" ],[])
+  )
+])
index b95836b2b0170bfe12452453749626330ceac52a..f931bff0e0e505e3a14b46b146c353751370e6e3 100644 (file)
@@ -20,6 +20,7 @@ m4_include([acinclude/compiler-flags.m4])
 m4_include([acinclude/os-deps.m4])
 m4_include([acinclude/krb5.m4])
 m4_include([acinclude/pam.m4])
+m4_include([acinclude/lib-checks.m4])
 
 PRESET_CFLAGS="$CFLAGS"
 PRESET_LDFLAGS="$LDFLAGS"
@@ -2528,22 +2529,7 @@ AC_CHECK_DECL(dbopen,,,[
 #endif])
 
 dnl 1.85
-AC_CACHE_CHECK(if dbopen needs -ldb,ac_cv_dbopen_libdb, [
-SAVED_LIBS="$LIBS"; LIBS="$LIBS -ldb"
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
-#if HAVE_DB_185_H
-#include <db_185.h>
-#elif HAVE_DB_H
-#include <db.h>
-#endif]], [[dbopen("", 0, 0, DB_HASH, (void *)0L)]])],[ac_cv_dbopen_libdb="yes"],[ac_cv_dbopen_libdb="no"])
-LIBS="$SAVED_LIBS"
-])
+SQUID_CHECK_DBOPEN_NEEDS_LIBDB
 if test "x$ac_cv_dbopen_libdb" = "xyes"; then
     LIB_DB="-ldb"
 fi
@@ -2781,19 +2767,8 @@ case $squid_opt_io_loop_engine in
   select) AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop]) ;;
 esac
 
-AC_CACHE_CHECK(if setresuid is actually implemented, ac_cv_func_setresuid,
-  AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <stdlib.h>
-  int main(int argc, char **argv) {
-    if(setresuid(-1,-1,-1)) {
-      perror("setresuid:");
-      return 1;
-    }
-    return 0;
-  }
-  ]])],[ac_cv_func_setresuid="yes"],[ac_cv_func_setresuid="no"],[])
-)
-if test "x$ac_cv_func_setresuid" = "xyes" ; then
+SQUID_CHECK_SETRESUID_WORKS
+if test "x$squid_cv_resuid_works" = "xyes" ; then
   AC_DEFINE(HAVE_SETRESUID,1,[Yay! Another Linux brokenness. Knowing that setresuid() exists is not enough, because RedHat 5.0 declares setresuid() but does not implement it.])
 fi
 
@@ -2901,19 +2876,17 @@ if test "x${enable_gnuregex:=auto}" = "xauto" ; then
          ;;
     esac
 fi
-AC_MSG_CHECKING(if GNUregex needs to be compiled)
-# gnuregex is autodetect, and we could not find the regexp calls
-if test "x$enable_gnuregex" = "xauto" -a "x$ac_cv_func_regcomp" = "xno"; then
-  enable_gnuregex="yes"
-fi
+
 # try detecting if it is needed
 if test "x$enable_gnuregex" = "xauto" ; then
-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include <sys/types.h>
-#include <regex.h> ]], [[
-regex_t t; regcomp(&t,"",0);]])],
-  [enable_gnuregex="no"],[enable_gnuregex="yes"])
+  SQUID_CHECK_REGEX_WORKS
+  if test "x$squid_cv_regex_works" = "xyes" ; then
+    enable_gnuregex=no
+  else
+    enable_gnuregex=yes
+  fi
 fi
+AC_MSG_CHECKING(if GNUregex needs to be compiled)
 AC_MSG_RESULT($enable_gnuregex)
 if test "x$enable_gnuregex" = "xyes"; then
   # for some reason (force-enable, test..) gnuregex was found as needed. Override any system lib