From: Francesco Chemolli Date: Wed, 2 Dec 2009 15:32:47 +0000 (+0100) Subject: More diskio modules cleanup and modularization. X-Git-Tag: SQUID_3_2_0_1~310^2~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d235bc84ce06ea1e57a3b53f0c74b3d32ae5c3eb;p=thirdparty%2Fsquid.git More diskio modules cleanup and modularization. --- diff --git a/acinclude/squid-util.m4 b/acinclude/squid-util.m4 index f73a8b146b..7e4271e958 100644 --- a/acinclude/squid-util.m4 +++ b/acinclude/squid-util.m4 @@ -94,3 +94,41 @@ for dir in $1/*; do fi done ]) + +dnl remove duplicates out of a list. +dnl dnl argument is the name of a variable to be checked and cleaned up +AC_DEFUN([SQUID_CLEANUP_MODULES_LIST],[ +squid_cleanup_tmp_outlist="" +for squid_cleanup_tmp in $$1 +do + squid_cleanup_tmp_dupe=0 + for squid_cleanup_tmp2 in $squid_cleanup_tmp_outlist + do + if test "$squid_cleanup_tmp" = "$squid_cleanup_tmp2"; then + squid_cleanup_tmp_dupe=1 + break + fi + done + if test $squid_cleanup_tmp_dupe -eq 0; then + squid_cleanup_tmp_outlist="${squid_cleanup_tmp_outlist} $squid_cleanup_tmp" + fi +done +$1=$squid_cleanup_tmp_outlist +unset squid_cleanup_tmp_outlist +unset squid_cleanup_tmp_dupe +unset squid_cleanup_tmp2 +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 +AC_DEFUN([SQUID_CHECK_EXISTING_MODULES],[ + for squid_module_check_exist_tmp in $2 + do + if ! test -d $1/$squid_module_check_exist_tmp + then + AC_MSG_ERROR([$squid_module_check_exist_tmp not found in $1]) + fi + done +]) diff --git a/configure.in b/configure.in index 5aa741e355..4bbf0a3cb1 100644 --- a/configure.in +++ b/configure.in @@ -475,6 +475,7 @@ if test "$with_dl" = "yes"; then AC_MSG_NOTICE([With dl]) fi +AC_MSG_CHECKING([for DiskIO modules to be enabled]) squid_disk_module_candidates="" squid_opt_enable_diskio=auto #values: 0(no), 1(yes), "auto"(=yes+detect modules) AC_ARG_ENABLE(disk-io, @@ -494,16 +495,18 @@ AC_ARG_ENABLE(disk-io, *) squid_opt_enable_diskio=1 squid_disk_module_candidates=" `echo $enableval| sed -e 's/,/ /g;s/ */ /g'` " + SQUID_CLEANUP_MODULES_LIST([squid_disk_module_candidates]) ;; esac ]) +# if requested to autodetect, find out what we have if test $squid_opt_enable_diskio = "auto"; then squid_opt_enable_diskio=1 - AC_MSG_CHECKING([for available DiskIO modules]) SQUID_LOOK_FOR_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates]) - AC_MSG_RESULT([$squid_disk_module_candidates]) fi + +AC_MSG_RESULT([${squid_disk_module_candidates_output:-none}]) AC_DEFINE_UNQUOTED([USE_DISKIO],[$squid_opt_enable_diskio], [DiskIO modules are expected to be available.]) @@ -525,6 +528,7 @@ DISK_OS_LIBS= DISK_MODULES= DISK_LINKOBJS= for module in $squid_disk_module_candidates none; do + # maybe not needed if test "$module" = "none"; then continue fi @@ -710,47 +714,49 @@ 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. -AC_ARG_ENABLE(storeio, - AS_HELP_STRING([--enable-storeio="list of modules"],[Build support for the list of store I/O modules. +squid_opt_enable_diskio=auto +AC_ARG_ENABLE([storeio], + AS_HELP_STRING([--enable-storeio="list of modules"], + [Build support for the list of store I/O modules. The default is only to build the "ufs" module. See src/fs for a list of available modules, or Programmers Guide section for details on how to build your custom store module]), [ case $enableval in yes) - for dir in $srcdir/src/fs/*; do - module="`basename $dir`" - if test -d "$dir" && test "$module" != CVS && test "$module" != coss; then - STORE_MODULES="$STORE_MODULES $module" - fi - done + squid_opt_enable_diskio=auto ;; no) + squid_opt_enable_diskio=no ;; *) - STORE_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`" + squid_opt_enable_diskio=yes + squid_storeio_module_candidates="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`" ;; esac -], -[ if test -z "$STORE_MODULES"; then - STORE_MODULES="ufs" - fi ]) -if test -n "$STORE_MODULES"; then +if test "$squid_opt_enable_diskio" = "auto"; then + squid_opt_enable_diskio=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. - STORE_MODULES_FULL=$STORE_MODULES - STORE_MODULES= - for module in $STORE_MODULES_FULL; do - have_mod=`echo "$STORE_MODULES" | grep "$module"` + 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 - STORE_MODULES="$STORE_MODULES $module" + squid_disk_module_candidates="$squid_disk_module_candidates $module" else AC_MSG_ERROR(storeio $module does not exist) fi done - for module in $STORE_MODULES_FULL; do + 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." @@ -758,9 +764,9 @@ if test -n "$STORE_MODULES"; then ;; esac done - AC_MSG_NOTICE([Store modules built: $STORE_MODULES]) + AC_MSG_NOTICE([Store modules built: $squid_disk_module_candidates]) fi -for fs in $STORE_MODULES none; do +for fs in $squid_disk_module_candidates none; do case "$fs" in diskd) if ! test "$FOUND_DISKIO_BLOCKING" = "yes" && ! test "$FOUND_DISKIO_DISKDAEMON" = "yes" ; then @@ -792,7 +798,7 @@ done if test -z "$UFS_FOUND" && test -n "$NEED_UFS"; then AC_MSG_NOTICE([Adding UFS, as it contains core logic for diskd and aufs]) - STORE_MODULES="$STORE_MODULES ufs" + squid_disk_module_candidates="$squid_disk_module_candidates ufs" dnl dnl Automake om MinGW needs explicit exe extension dnl for STORE_TESTS substition @@ -806,13 +812,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 STORE_MODULES, build library lists +dnl got final squid_disk_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 $STORE_MODULES; do +for fs in $squid_disk_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/'`