1## Copyright (C) 1996-2021 The Squid Software Foundation and contributors
2##
3## Squid software is distributed under GPLv2+ license and includes
4## contributions from numerous individuals and organizations.
5## Please see the COPYING and CONTRIBUTORS files for details.
6##
7
8# This file is supposed to run all the tests required to identify which
9# configured modules are able to be built in this environment
10
11# FIXME: de-duplicate $enable_auth_basic list containing double entries.
12
13#not specified. Inherit global
14if test "x$enable_auth_basic" = "x"; then
15    enable_auth_basic=$enable_auth
16fi
17#conflicts with global
18if test "x$enable_auth_basic" != "xno" -a "x$enable_auth" = "xno" ; then
19    AC_MSG_ERROR([Basic auth requested but auth disabled])
20fi
21#define list of modules to build
22auto_auth_basic_modules=no
23if test "x$enable_auth_basic" = "xyes" ; then
24    SQUID_LOOK_FOR_MODULES([$srcdir/src/auth/basic],[enable_auth_basic])
25  auto_auth_basic_modules=yes
26fi
27#handle the "none" special case
28if test "x$enable_auth_basic" = "xnone" ; then
29    enable_auth_basic=""
30fi
31
32BASIC_AUTH_HELPERS=""
33#enable_auth_basic contains either "no" or the list of modules to be built
34enable_auth_basic="`echo $enable_auth_basic| sed -e 's/,/ /g;s/  */ /g'`"
35if test "x$enable_auth_basic" != "xno" ; then
36    AUTH_MODULES="$AUTH_MODULES basic"
37    AC_DEFINE([HAVE_AUTH_MODULE_BASIC],1,[Basic auth module is built])
38    for helper in $enable_auth_basic; do
39      dir="$srcdir/src/auth/basic/$helper"
40
41      # modules converted to autoconf macros already
42      # NP: we only need this list because m4_include() does not accept variables
43      if test "x$helper" = "xDB" ; then
44        m4_include([src/auth/basic/DB/required.m4])
45
46      elif test "x$helper" = "xLDAP" ; then
47        m4_include([src/auth/basic/LDAP/required.m4])
48
49      elif test "x$helper" = "xNCSA" ; then
50        m4_include([src/auth/basic/NCSA/required.m4])
51
52      elif test "x$helper" = "xNIS" ; then
53        m4_include([src/auth/basic/NIS/required.m4])
54
55      elif test "x$helper" = "xPAM" ; then
56        m4_include([src/auth/basic/PAM/required.m4])
57
58      elif test "x$helper" = "xPOP3" ; then
59        m4_include([src/auth/basic/POP3/required.m4])
60
61      elif test "x$helper" = "xRADIUS" ; then
62        m4_include([src/auth/basic/RADIUS/required.m4])
63
64      elif test "x$helper" = "xSASL" ; then
65        m4_include([src/auth/basic/SASL/required.m4])
66
67      elif test "x$helper" = "xSMB" ; then
68        m4_include([src/auth/basic/SMB/required.m4])
69
70      elif test "x$helper" = "xSMB_LM" ; then
71        m4_include([src/auth/basic/SMB_LM/required.m4])
72
73      elif test "x$helper" = "xSSPI" ; then
74        m4_include([src/auth/basic/SSPI/required.m4])
75
76      elif test "x$helper" = "xfake" ; then
77        m4_include([src/auth/basic/fake/required.m4])
78
79      elif test "x$helper" = "xgetpwnam" ; then
80        m4_include([src/auth/basic/getpwnam/required.m4])
81
82      # modules not yet converted to autoconf macros (or third party drop-in's)
83      elif test -f "$dir/config.test" && sh "$dir/config.test" "$squid_host_os"; then
84        BUILD_HELPER="$helper"
85      fi
86
87      if test -d "$srcdir/src/auth/basic/$helper"; then
88        if test "$BUILD_HELPER" != "$helper"; then
89          if test "x$auto_auth_basic_modules" = "xyes"; then
90            AC_MSG_NOTICE([Basic auth helper $helper ... found but cannot be built])
91          else
92            AC_MSG_ERROR([Basic auth helper $helper ... found but cannot be built])
93          fi
94        else
95          BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS $BUILD_HELPER"
96        fi
97      else
98        AC_MSG_ERROR([Basic auth helper $helper ... not found])
99      fi
100    done
101fi
102
103AC_MSG_NOTICE([Basic auth helpers to be built: $BASIC_AUTH_HELPERS])
104AM_CONDITIONAL(ENABLE_AUTH_BASIC, test "x$enable_auth_basic" != "xno")
105AC_SUBST(BASIC_AUTH_HELPERS)
106