]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Make squid_kerb_auth build out of tree along with squid
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 14 Nov 2008 09:43:02 +0000 (22:43 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 14 Nov 2008 09:43:02 +0000 (22:43 +1300)
configure.in
helpers/negotiate_auth/squid_kerb_auth/configure.in
helpers/negotiate_auth/squid_kerb_auth/squid_kerb_auth.c
helpers/negotiate_auth/squid_kerb_auth/squid_kerb_auth_test.c
include/config.h

index d537a186f636902dbdf359e5ae1f582c3f3349c1..92dfc6a810c4f0266fbfd83dfce5a894c638d878 100644 (file)
@@ -38,6 +38,11 @@ dnl Pass squid.conf directory base location to code files as a compiler define
 CFLAGS="-DDEFAULT_SQUID_CONFIG_DIR=\\\"$sysconfdir\\\" $CFLAGS"
 CXXFLAGS="-DDEFAULT_SQUID_CONFIG_DIR=\\\"$sysconfdir\\\" $CXXFLAGS"
 
+dnl Make the squid top srcdir available to sub-packages as --with-squid=PATH
+new_configure_args="$ac_configure_args --with-squid=$ac_abs_confdir"
+ac_configure_args="$new_configure_args"
+
+
 use_loadable_modules=1
 AC_MSG_CHECKING(whether to use loadable modules)
 AC_ARG_ENABLE(loadable-modules,
index 0bb1fa10e288f808926acd63ba8f0f9290f8dd4d..0d71005e5e9bfb84fc5f749384ebbf125ad55655 100644 (file)
@@ -17,6 +17,7 @@ dnl Process this file with autoconf to produce a configure script.
 
 AC_INIT([squid_kerb_auth],[1.0.5],[markus_moeller@compuserve.com])
 AM_INIT_AUTOMAKE(squid_kerb_auth,1.0.5)
+AC_CONFIG_SRCDIR([squid_kerb_auth.c])
 
 AC_PROG_CC
 AC_PROG_CPP
@@ -379,38 +380,19 @@ LIBS=$old_LIBS
 
 AC_C_BIGENDIAN
 
-eval ac_p_include=$includedir
-CPPFLAGS="$CPPFLAGS -I$ac_p_include -I../../../include"
-AC_CACHE_CHECK([for SQUID],ac_cv_have_squid,[
-AC_TRY_RUN([
-#include <config.h>
-int main(int argc, char *argv[]) {
-#ifdef SQUID_CONFIG_H
-return 0;
-#else
-return 1;
-#endif
-}],
-  ac_cv_have_squid=yes,
-  ac_cv_have_squid=no)])
-eval ac_p_lib=$libdir
-LDFLAGS="$LDFLAGS -L../../../lib -L$ac_p_lib $w_flag$ac_p_lib$w_flag_2"
-if test x"$ac_cv_have_squid" = x"yes"; then
-  AC_DEFINE(HAVE_SQUID,1, [Define to 1 if you have SQUID])
-  AC_CHECK_HEADERS(getaddrinfo.h getnameinfo.h util.h)
-  AC_CHECK_DECLS([xgetaddrinfo], [], [], [[#include <getaddrinfo.h>]])
-  AC_CHECK_DECLS([xfreeaddrinfo], [], [], [[#include <getaddrinfo.h>]])
-  AC_CHECK_DECLS([xgai_strerror], [], [], [[#include <getaddrinfo.h>]])
-  AC_CHECK_DECLS([xgetnameinfo], [], [], [[#include <getnameinfo.h>]])
-  AC_CHECK_DECLS([xstrdup], [], [], [[#include <util.h>]])
-  AC_CHECK_DECLS([xmalloc], [], [], [[#include <util.h>]])
-  AC_CHECK_DECLS([xfree], [], [], [[#include <util.h>]])
-  AC_CHECK_LIB(m,main)
-  AC_CHECK_LIB(mw,main)
-  LIBS="-lmiscutil $LIBS"
-fi
+AC_CHECK_HEADERS( \
+       errno.h \
+       netdb.h \
+       stdio.h \
+       stdlib.h \
+       string.h \
+       sys/time.h\
+       time.h \
+       unistd.h \
+)
+
+AC_CONFIG_HEADER(ska_config.h)
 
-AC_CONFIG_HEADER(config.h)
 AH_TOP([/*
  * -----------------------------------------------------------------------------
  *
@@ -440,6 +422,70 @@ AH_TOP([/*
  * -----------------------------------------------------------------------------
  */
 ])
+
+squid_dir=
+AC_ARG_WITH([squid],
+  AC_HELP_STRING([--with-squid=PATH],
+       [Special option for building bundled inside Squid. Do not define manually.]),
+  [ squid_dir=$withval ]
+)
+
+eval ac_p_include=$includedir
+CPPFLAGS="$CPPFLAGS -I$ac_p_include -I../../../ -I$squid_dir/include -I$squid_dir/src "
+AC_CACHE_CHECK([for SQUID at '$squid_dir' ],ac_cv_have_squid,[
+AC_TRY_RUN([
+#include <config.h>
+int main(int argc, char *argv[]) {
+#ifdef SQUID_CONFIG_H
+return 0;
+#else
+return 1;
+#endif
+}],
+  ac_cv_have_squid=yes,
+  ac_cv_have_squid=no)
+])
+eval ac_p_lib=$libdir
+LDFLAGS="$LDFLAGS -L../../../lib -L$ac_p_lib $w_flag$ac_p_lib$w_flag_2"
+if test "x$ac_cv_have_squid" = "xyes"; then
+  AC_DEFINE(HAVE_SQUID,1, [Define to 1 if you have SQUID])
+  AC_CHECK_HEADERS(getaddrinfo.h getnameinfo.h util.h)
+  AC_CHECK_DECLS([xgetaddrinfo], [], [], [[#include <getaddrinfo.h>]])
+  AC_CHECK_DECLS([xfreeaddrinfo], [], [], [[#include <getaddrinfo.h>]])
+  AC_CHECK_DECLS([xgai_strerror], [], [], [[#include <getaddrinfo.h>]])
+  AC_CHECK_DECLS([xgetnameinfo], [], [], [[#include <getnameinfo.h>]])
+  AC_CHECK_DECLS([xstrdup], [], [], [[#include <util.h>]])
+  AC_CHECK_DECLS([xmalloc], [], [], [[#include <util.h>]])
+  AC_CHECK_DECLS([xfree], [], [], [[#include <util.h>]])
+  AC_CHECK_LIB(m,main)
+  AC_CHECK_LIB(mw,main)
+  LIBS="-lmiscutil $LIBS"
+AH_TOP([ /* This is building inside Squid. We need their config as well. */
+/* bit of autoconf magic hack */
+#undef HAVE_SQUID
+
+#if HAVE_SQUID
+#include "config.h"
+#endif
+])
+AH_BOTTOM([
+/* Squid provides a few compat libraries */
+#ifdef HAVE_SQUID
+#ifdef HAVE_GETADDRINFO_H
+#include "getaddrinfo.h"
+#endif
+#ifdef HAVE_GETNAMEINFO_H
+#include "getnameinfo.h"
+#endif
+#ifdef HAVE_UTIL_H
+#include "util.h"
+#endif
+#endif /* HAVE_SQUID */
+])
+
+fi
+
+
 AH_BOTTOM([
 #ifdef HAVE_HEIMDAL_KERBEROS
 #ifdef HAVE_GSSAPI_GSSAPI_H
@@ -507,6 +553,6 @@ done
 
 AC_OUTPUT(Makefile)
 
-echo "configure: updating config.h"
-sed -e "s/|MAIL|/"$PACKAGE_BUGREPORT"/" config.h > .config.h.tmp
-mv .config.h.tmp config.h
+echo "configure: updating ska_config.h"
+sed -e "s/|MAIL|/"$PACKAGE_BUGREPORT"/" ska_config.h > .ska_config.h.tmp
+mv .ska_config.h.tmp ska_config.h
index bdf04332b0a95c46614678fac1d008a5ca43b6e5..b2621f67d602ecaa3ec62b2c570ec5b4dd174b44 100644 (file)
 /*
  * Hosted at http://sourceforge.net/projects/squidkerbauth
  */
+#include "ska_config.h"
+
+#if HAVE_STRING_H
 #include <string.h>
+#endif
+#if HAVE_STDIO_H
 #include <stdio.h>
+#endif
+#if HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#if HAVE_NETDB_H
 #include <netdb.h>
+#endif
+#if HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+#if HAVE_TIME_H
 #include <time.h>
+#endif
+#if HAVE_SYS_TIME_H
 #include <sys/time.h>
+#endif
 
-#include "config.h"
 
-#ifdef HAVE_SQUID
-#ifdef PACKAGE
-#undef PACKAGE
-#endif
-#ifdef PACKAGE_BUGREPORT
-#undef PACKAGE_BUGREPORT
-#endif
-#ifdef PACKAGE_NAME
-#undef PACKAGE_NAME
-#endif
-#ifdef PACKAGE_STRING
-#undef PACKAGE_STRING
-#endif
-#ifdef PACKAGE_TARNAME
-#undef PACKAGE_TARNAME
-#endif
-#ifdef PACKAGE_VERSION
-#undef PACKAGE_VERSION
-#endif
-#ifdef VERSION
-#undef VERSION
-#endif
-#ifdef HAVE_GETADDRINFO_H
-#include "getaddrinfo.h"
-#endif
-#ifdef HAVE_GETNAMEINFO_H
-#include "getnameinfo.h"
-#endif
-#ifdef HAVE_UTIL_H
-#include "util.h"
-#endif
-#ifdef PACKAGE
-#undef PACKAGE
-#endif
-#ifdef PACKAGE_BUGREPORT
-#undef PACKAGE_BUGREPORT
-#endif
-#ifdef PACKAGE_NAME
-#undef PACKAGE_NAME
-#endif
-#ifdef PACKAGE_STRING
-#undef PACKAGE_STRING
-#endif
-#ifdef PACKAGE_TARNAME
-#undef PACKAGE_TARNAME
-#endif
-#ifdef PACKAGE_VERSION
-#undef PACKAGE_VERSION
-#endif
-#ifdef VERSION
-#undef VERSION
-#endif
-/*
- * Reset varibles
- */
-#include "config.h"
-#endif
 #if !defined(HAVE_DECL_XGETADDRINFO) || !HAVE_DECL_XGETADDRINFO
 #define xgetaddrinfo    getaddrinfo
 #endif
index ef4157c13e5e12c8e912de95d98e29f198335da6..60576ecb7483182176cded353b05302842c16e93 100644 (file)
  * Hosted at http://sourceforge.net/projects/squidkerbauth
  */
 
+#include "ska_config.h"
+
+#if HAVE_STRING_H
 #include <string.h>
+#endif
+#if HAVE_STDIO_H
 #include <stdio.h>
+#endif
+#if HAVE_STDLIB_H
 #include <stdlib.h>
+#endif
+#if HAVE_NETDB_H
 #include <netdb.h>
+#endif
+#if HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+#if HAVE_TIME_H
 #include <time.h>
+#endif
+#if HAVE_SYS_TIME_H
 #include <sys/time.h>
+#endif
+#if HAVE_ERRNO_H
 #include <errno.h>
+#endif
 
-#include "config.h"
 
-#ifdef HAVE_SQUID
-#ifdef PACKAGE
-#undef PACKAGE
-#endif
-#ifdef PACKAGE_BUGREPORT
-#undef PACKAGE_BUGREPORT
-#endif
-#ifdef PACKAGE_NAME
-#undef PACKAGE_NAME
-#endif
-#ifdef PACKAGE_STRING
-#undef PACKAGE_STRING
-#endif
-#ifdef PACKAGE_TARNAME
-#undef PACKAGE_TARNAME
-#endif
-#ifdef PACKAGE_VERSION
-#undef PACKAGE_VERSION
-#endif
-#ifdef VERSION
-#undef VERSION
-#endif
-#ifdef HAVE_UTIL_H
-#include "util.h"
-#endif
-#ifdef PACKAGE
-#undef PACKAGE
-#endif
-#ifdef PACKAGE_BUGREPORT
-#undef PACKAGE_BUGREPORT
-#endif
-#ifdef PACKAGE_NAME
-#undef PACKAGE_NAME
-#endif
-#ifdef PACKAGE_STRING
-#undef PACKAGE_STRING
-#endif
-#ifdef PACKAGE_TARNAME
-#undef PACKAGE_TARNAME
-#endif
-#ifdef PACKAGE_VERSION
-#undef PACKAGE_VERSION
-#endif
-#ifdef VERSION
-#undef VERSION
-#endif
-/*
- * Reset varibles
- */
-#include "config.h"
-#endif
 #if !defined(HAVE_DECL_XMALLOC) || !HAVE_DECL_XMALLOC
 #define xmalloc malloc
 #endif
index 8bfbe58ae354ae70f16150df4a2d4e13d3d2115e..7b0e6527df86a1cc86fc263f14f4fd3922251f14 100644 (file)
 #define SQUID_CONFIG_H
 
 #include "autoconf.h"          /* For GNU autoconf variables */
+
+#if !defined(HAVE_SQUID)
+/* sub-packages define their own version details */
 #include "version.h"
 
+#endif
+
 /* To keep API definitions clear */
 #ifdef __cplusplus
 #define SQUIDCEXTERN extern "C"