]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Partial checkpoint: enrich SQUID_CHECK_EXISTING_MODULES functionality and use it.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 2 Dec 2009 17:59:31 +0000 (18:59 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 2 Dec 2009 17:59:31 +0000 (18:59 +0100)
acinclude/squid-util.m4
configure.in

index 7e4271e958ef569c635e1aadd2991a108e27a36e..e0b546c5b93a6a24ea4b8e4fec4aa1558c18408f 100644 (file)
@@ -122,12 +122,21 @@ unset squid_cleanup_tmp
 
 dnl check that all the modules supplied as a whitespace-separated list (second
 dnl argument) exist as members of the basedir passed as first argument
-dnl call AC_MESG_ERROR if any module does not
+dnl call AC_MESG_ERROR if any module does not exist. Also sets individual variables
+dnl named $2_modulename to value "yes"
+dnl e.g. SQUID_CHECK_EXISTING_MODULES([$srcdir/src/fs],[foo_module_candidates])
+dnl where $foo_module_candidates is "foo bar gazonk"
+dnl checks whether $srcdir/src/fs/{foo,bar,gazonk} exist and are all dirs
+dnl AND sets $foo_module_candidates_foo, $foo_module_candidates_bar 
+dnl and $foo_module_candidates_gazonk to "yes"
 AC_DEFUN([SQUID_CHECK_EXISTING_MODULES],[
-  for squid_module_check_exist_tmp in $2
+  for squid_module_check_exist_tmp in $$2
   do
-    if test -d $1/$squid_module_check_exist_tmp
+    if test -d $1/$squid_module_check_exist_tmp
     then
+      eval "$2_$squid_module_check_exist_tmp='yes'"
+      #echo "defining $2_$squid_module_check_exist_tmp"
+    else
       AC_MSG_ERROR([$squid_module_check_exist_tmp not found in $1])
     fi
   done
index 4bbf0a3cb1dfddac5ef9052475ce46e58a197cfb..cf03a183d94fbe459d76b482182fdf5d17d7a2a9 100644 (file)
@@ -137,7 +137,6 @@ then
 fi
 
 
-dnl ********************************* KK ***********************
 SQUID_CC_GUESS_VARIANT
 SQUID_CC_GUESS_OPTIONS
 
@@ -507,9 +506,12 @@ if test $squid_opt_enable_diskio = "auto"; then
 fi
 
 AC_MSG_RESULT([${squid_disk_module_candidates_output:-none}])
+SQUID_CHECK_EXISTING_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
 AC_DEFINE_UNQUOTED([USE_DISKIO],[$squid_opt_enable_diskio],
     [DiskIO modules are expected to be available.])
 
+
+dnl ****************** KK HERE *********************
 dnl Some autoconf.h defines we might enable later...
 AC_DEFINE(USE_DISKIO_AIO, 0, [Whether POSIX AIO support is needed. Automatic])
 AC_DEFINE(USE_DISKIO_DISKTHREADS, 0, [Whether pthreads support is needed. Automatic])
@@ -519,10 +521,6 @@ use_diskthreads=
 AIOLIB=
 
 dnl Setup the module paths etc.
-FOUND_DISKIO_AIO=
-FOUND_DISKIO_BLOCKING=
-FOUND_DISKIO_DISKDAEMON=
-FOUND_DISKIO_DISKTHREADS=
 DISK_LIBS=
 DISK_OS_LIBS=
 DISK_MODULES=
@@ -537,10 +535,6 @@ for module in $squid_disk_module_candidates none; do
   fi
   case "$module" in
     DiskDaemon)
-       if test "$FOUND_DISKIO_DISKDAEMON" = "yes" ; then
-         AC_MSG_ERROR([DiskIO DiskDaemon module listed twice.])
-       fi
-       FOUND_DISKIO_DISKDAEMON="yes"
        AC_MSG_NOTICE([Enabling DiskDaemon DiskIO module])
        DISK_LIBS="$DISK_LIBS libDiskDaemon.a"
        DISK_MODULES="$DISK_MODULES DiskDaemon"
@@ -548,10 +542,6 @@ for module in $squid_disk_module_candidates none; do
        DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/DiskDaemon/DiskDaemonDiskIOModule.o"
        ;;
     DiskThreads)
-       if test "$FOUND_DISKIO_DISKTHREADS" = "yes" ; then
-         AC_MSG_ERROR([DiskIO DiskThreads  module listed twice.])
-       fi
-       FOUND_DISKIO_DISKTHREADS="yes"
        use_diskthreads="yes"
        LIBPTHREADS=
        SAVE_SQUID_CFLAGS="$SQUID_CFLAGS"
@@ -626,10 +616,6 @@ for module in $squid_disk_module_candidates none; do
        ;;
 
     AIO)
-       if test "$FOUND_DISKIO_AIO" = "yes" ; then
-         AC_MSG_ERROR([DiskIO AIO module listed twice.])
-       fi
-       FOUND_DISKIO_AIO="yes"
        dnl Check for POSIX AIO availability
        use_aio="yes"
        AIOLIB=
@@ -684,10 +670,6 @@ for module in $squid_disk_module_candidates none; do
        ;;
 
     Blocking)
-       if test "$FOUND_DISKIO_BLOCKING" = "yes" ; then
-         AC_MSG_ERROR([DiskIO Blocking module listed twice.])
-       fi
-       FOUND_DISKIO_BLOCKING="yes"
        AC_MSG_NOTICE([Enabling Blocking DiskIO module])
        DISK_LIBS="$DISK_LIBS libBlocking.a"
        DISK_MODULES="$DISK_MODULES Blocking"
@@ -714,7 +696,7 @@ AM_CONDITIONAL([USE_AIO_WIN32], [test "$USE_AIO_WIN32" = 1])
 
 dnl Check what Storage formats are wanted.
 dnl This version will error out with a message saying why if a required DiskIO is missing.
-squid_opt_enable_diskio=auto
+squid_opt_enable_storeio=auto
 AC_ARG_ENABLE([storeio],
   AS_HELP_STRING([--enable-storeio="list of modules"],
                  [Build support for the list of store I/O modules.
@@ -724,64 +706,46 @@ AC_ARG_ENABLE([storeio],
                   for details on how to build your custom store module]),
 [ case $enableval in
   yes)
-    squid_opt_enable_diskio=auto
+    squid_opt_enable_storeio=auto
        ;;
   no)
-    squid_opt_enable_diskio=no
+    squid_opt_enable_storeio=no
        ;;
   *)
-    squid_opt_enable_diskio=yes
+    squid_opt_enable_storeio=yes
        squid_storeio_module_candidates="`echo $enableval| sed -e 's/,/ /g;s/  */ /g'`"
        ;;
   esac
 ])
-if test "$squid_opt_enable_diskio" = "auto"; then
-  squid_opt_enable_diskio=yes
+if test "$squid_opt_enable_storeio" = "auto"; then
+  squid_opt_enable_storeio=yes
   AC_MSG_CHECKING([for available StoreIO modules])
   SQUID_LOOK_FOR_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
   AC_MSG_RESULT([$squid_storeio_module_candidates])
 fi
 
-if test -n "$squid_disk_module_candidates"; then
-    dnl ensure that all modules a) exist and b) only include once.
-    squid_disk_module_candidates_FULL=$squid_disk_module_candidates
-    squid_disk_module_candidates=
-    for module in $squid_disk_module_candidates_FULL; do
-        have_mod=`echo "$squid_disk_module_candidates" | grep "$module"`
-        if test "$have_mod" != ""; then
-           AC_MSG_NOTICE([Removing duplicate $module from storeio])
-       elif test -d $srcdir/src/fs/$module; then
-           squid_disk_module_candidates="$squid_disk_module_candidates $module"
-       else
-           AC_MSG_ERROR(storeio $module does not exist)
-       fi
-    done
-    for module in $squid_disk_module_candidates_FULL; do
-       case "$module" in
-       coss)
-           echo "WARNING: COSS Support is not stable yet in Squid-3. Please do not use."
-           sleep 10
-           ;;
-       esac
-    done
-    AC_MSG_NOTICE([Store modules built: $squid_disk_module_candidates])
-fi
-for fs in $squid_disk_module_candidates none; do
+SQUID_CLEANUP_MODULES_LIST([squid_storeio_module_candidates])
+SQUID_CHECK_EXISTING_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
+AC_MSG_NOTICE([Store modules built: $squid_storeio_module_candidates])
+
+for fs in $squid_storeio_module_candidates none; do
     case "$fs" in
     diskd)
-       if ! test "$FOUND_DISKIO_BLOCKING" = "yes" && ! test "$FOUND_DISKIO_DISKDAEMON" = "yes" ; then
+       if test "$squid_disk_module_candidates_Blocking" != "yes" -a "$squid_disk_module_candidates_DiskDaemon" != "yes" ; then
          AC_MSG_ERROR([Storage diskd module requires DiskIO modules: Blocking or DiskDaemon])
        fi
-       NEED_UFS="true"
+       squid_storeio_module_candidates="$squid_storeio_module_candidates ufs"
        ;;
     aufs)
-       if ! test "$FOUND_DISKIO_BLOCKING" = "yes" && ! test "$FOUND_DISKIO_DISKTHREADS" = "yes" ; then
+       if test "$squid_disk_module_candidates_Blocking" != "yes" -a "$squid_disk_module_candidates_DiskThreads" != "yes" ; then
          AC_MSG_ERROR([Storage diskd module requires DiskIO modules: Blocking or DiskThreads])
        fi
-       NEED_UFS="true"
+       squid_storeio_module_candidates="$squid_storeio_module_candidates ufs"
        ;;
     coss)
-       if ! test "$FOUND_DISKIO_AIO" = "yes"; then
+      AC_MSG_WARN([COSS Support is not stable yet in Squid-3. Please do not use.\a])
+      sleep 10
+       if ! test "$squid_disk_module_candidates_AIO" = "yes"; then
          AC_MSG_ERROR([COSS requires POSIX AIO which is not available.])
        fi
        dnl
@@ -796,9 +760,11 @@ for fs in $squid_disk_module_candidates none; do
     esac
 done
 
-if test -z "$UFS_FOUND" && test -n "$NEED_UFS"; then
+SQUID_CLEANUP_MODULES_LIST([squid_storeio_module_candidates])
+
+if test -n "$NEED_UFS"; then
     AC_MSG_NOTICE([Adding UFS, as it contains core logic for diskd and aufs])
-    squid_disk_module_candidates="$squid_disk_module_candidates ufs"
+    squid_storeio_module_candidates="$squid_storeio_module_candidates ufs"
     dnl
     dnl Automake om MinGW needs explicit exe extension
     dnl for STORE_TESTS substition
@@ -812,13 +778,13 @@ AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
 AH_TEMPLATE(HAVE_FS_COSS, "Define to 1 if coss filesystem module is build")
 
 
-dnl got final squid_disk_module_candidates, build library lists
+dnl got final squid_storeio_module_candidates, build library lists
 dnl This list will not be needed when each fs library has its own Makefile
 STORE_LIBS_TO_BUILD=
 dnl File system libraries to link executables with.
 dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
 STORE_LIBS_TO_ADD=
-for fs in $squid_disk_module_candidates; do
+for fs in $squid_storeio_module_candidates; do
     STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
     STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
     HAVE_FS_TYPE=HAVE_FS_`echo $fs | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`