backport from HEAD
[freeradius.git] / src / modules / rlm_sql / configure.in
1 AC_INIT(rlm_sql.c)
2 AC_REVISION($Revision$)
3 AC_DEFUN(modname,[rlm_sql])
4
5 fail=
6 SMART_LIBS=
7 SMART_CLFAGS=
8 if test x$with_[]modname != xno; then
9
10         AC_PROG_CC
11
12         dnl extra argument: --with-experimental-modules
13         EXPERIMENTAL=
14         AC_ARG_WITH(experimental-modules,
15         [  --with-experimental-modules      Use experimental and unstable modules. (default=no) ],
16         [ case "$withval" in
17                 yes)
18                         EXPERIMENTAL=yes
19                         ;;
20                 *)
21         esac ]
22         )
23
24         mysubdirs=
25         if test "x$EXPERIMENTAL" = "xyes"; then
26           for foo in `find ./drivers -name configure -print`; do
27             bar=`echo $foo | sed 's%/configure$%%g'`
28             mysubdirs="$mysubdirs $bar"
29           done
30         else
31           for foo in `cat stable`; do
32             mysubdirs="$mysubdirs ./drivers/$foo"
33           done
34         fi
35
36         SQL_MODULES=
37         if test "x$EXPERIMENTAL" = "xyes"; then
38           for foo in `ls ./drivers | grep rlm`; do
39             SQL_MODULES="$SQL_MODULES $foo"
40           done
41         else
42           for foo in `cat stable`; do
43             SQL_MODULES="$SQL_MODULES $foo"
44           done
45         fi
46
47         dnl # don't ask... this is done to avoid autoconf stupidities.
48         ln -s ../../../install-sh install-sh
49
50         dnl #
51         dnl #  Don't change the variable name here.  Autoconf goes bonkers
52         dnl #  if you do.
53         dnl #
54         AC_CONFIG_SUBDIRS($mysubdirs)
55         rm install-sh
56
57         dnl # 
58         dnl # Don't bother looking for errors in the child directories
59         dnl # 
60
61         targetname=modname
62 else
63         targetname=
64         echo \*\*\* module modname is disabled.
65 fi
66
67 if test x"$fail" != x""; then
68         if test x"${enable_strict_dependencies}" = x"yes"; then
69                 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
70         else
71                 AC_MSG_WARN([silently not building ]modname[.])
72                 AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.])
73                 if test x"$headersuggestion" != x; then
74                         AC_MSG_WARN([$headersuggestion]) 
75                 fi
76                 if test x"$libsuggestion" != x; then
77                         AC_MSG_WARN([$libsuggestion]) 
78                 fi
79                 targetname=""
80         fi
81 fi
82
83
84 sql_ldflags=$SMART_LIBS
85 sql_cflags=$SMART_CFLAGS
86 AC_SUBST(sql_ldflags)
87 AC_SUBST(sql_cflags)
88 AC_SUBST(targetname)
89 AC_SUBST(SQL_MODULES)
90 AC_OUTPUT(\
91         ./Makefile \
92         ./drivers/Makefile
93 )