more info in error message for unknown export type, fix test for sqlradius_withdomain...
[freeside.git] / rt / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4-p4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 dnl
14 dnl @synopsis RT_ENABLE_LAYOUT()
15 dnl
16 dnl Enable a specific directory layout for the installation to use.
17 dnl This configures a command-line parameter that can be specified
18 dnl at ./configure invocation.
19 dnl
20 dnl The use of this feature in this way is a little hackish, but
21 dnl better than a heap of options for every directory.
22 dnl
23 dnl This code is heavily borrowed *cough* from the Apache 2 code.
24 dnl
25
26 AC_DEFUN([RT_ENABLE_LAYOUT],[
27 AC_ARG_ENABLE(layout,
28               AC_HELP_STRING([--enable-layout=LAYOUT],
29                              [Use a specific directory layout (Default: RT3)]),
30               LAYOUT=$enableval)
31
32 if test "x$LAYOUT" = "x"; then
33         LAYOUT="RT3"
34 fi
35 RT_LAYOUT($srcdir/config.layout, $LAYOUT)
36 AC_MSG_CHECKING(for chosen layout)
37 if test "x$rt_layout_name" = "xno"; then
38         if test "x$LAYOUT" = "xno"; then
39                 AC_MSG_RESULT(none)
40         else
41                 AC_MSG_RESULT($LAYOUT)
42         fi
43         AC_MSG_ERROR([a valid layout must be specified (or the default used)])
44 else
45         AC_SUBST(rt_layout_name)
46         AC_MSG_RESULT($rt_layout_name)
47 fi
48 ])
49
50 dnl
51 dnl @synopsis RT_LAYOUT(configlayout, layoutname)
52 dnl
53 dnl This macro reads an Apache-style layout file (specified as the
54 dnl configlayout parameter), and searches for a specific layout
55 dnl (named using the layoutname parameter).
56 dnl
57 dnl The entries for a given layout are then inserted into the
58 dnl environment such that they become available as substitution
59 dnl variables. In addition, the rt_layout_name variable is set
60 dnl (but not exported) if the layout is valid.
61 dnl
62 dnl This code is heavily borrowed *cough* from the Apache 2 codebase.
63 dnl
64
65 AC_DEFUN([RT_LAYOUT],[
66         if test ! -f $srcdir/config.layout; then
67                 AC_MSG_WARN([Layout file $srcdir/config.layout not found])
68                 rt_layout_name=no
69         else
70                 pldconf=./config.pld
71                 $PERL  -0777 -p -e "\$layout = '$2';"  -e '
72                 s/.*<Layout\s+$layout>//gims; 
73                 s/\<\/Layout\>.*//s; 
74                 s/^#.*$//m;
75                 s/^\s+//gim;
76                 s/\s+$/\n/gim;
77                 s/\+$/\/rt3/gim;
78                 # m4 will not let us just use $1, we need @S|@1
79                 s/^\s*((?:bin|sbin|libexec|data|sysconf|sharedstate|localstate|lib|include|oldinclude|info|man)dir)\s*:\s*(.*)$/@S|@1=@S|@2/gim;
80                 s/^\s*(.*?)\s*:\s*(.*)$/\(test "x\@S|@@S|@1" = "xNONE" || test "x\@S|@@S|@1" = "x") && @S|@1=@S|@2/gim;
81                  ' < $1 > $pldconf
82
83                 if test -s $pldconf; then
84                         rt_layout_name=$2
85                         . $pldconf
86                         changequote({,})
87                         for var in prefix exec_prefix bindir sbindir \
88                                  sysconfdir mandir libdir datadir htmldir \
89                                  localstatedir logfiledir masonstatedir \
90                                  sessionstatedir customdir custometcdir customhtmldir \
91                                  customlexdir customlibdir manualdir; do
92                                 eval "val=\"\$$var\""
93                                 val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
94                                 val=`echo $val | 
95                                         sed -e 's:[\$]\([a-z_]*\):${\1}:g'`
96                                 eval "$var='$val'"
97                         done
98                         changequote([,])
99                 else
100                         rt_layout_name=no
101                 fi
102                 #rm $pldconf
103         fi
104         RT_SUBST_EXPANDED_ARG(prefix)
105         RT_SUBST_EXPANDED_ARG(exec_prefix)
106         RT_SUBST_EXPANDED_ARG(bindir)
107         RT_SUBST_EXPANDED_ARG(sbindir)
108         RT_SUBST_EXPANDED_ARG(sysconfdir)
109         RT_SUBST_EXPANDED_ARG(mandir)
110         RT_SUBST_EXPANDED_ARG(libdir)
111         RT_SUBST_EXPANDED_ARG(datadir)
112         RT_SUBST_EXPANDED_ARG(htmldir)
113         RT_SUBST_EXPANDED_ARG(manualdir)
114         RT_SUBST_EXPANDED_ARG(localstatedir)
115         RT_SUBST_EXPANDED_ARG(logfiledir)
116         RT_SUBST_EXPANDED_ARG(masonstatedir)
117         RT_SUBST_EXPANDED_ARG(sessionstatedir)
118         RT_SUBST_EXPANDED_ARG(customdir)
119         RT_SUBST_EXPANDED_ARG(custometcdir)
120         RT_SUBST_EXPANDED_ARG(customhtmldir)
121         RT_SUBST_EXPANDED_ARG(customlexdir)
122         RT_SUBST_EXPANDED_ARG(customlibdir)
123 ])dnl
124
125 dnl
126 dnl @synopsis   RT_SUBST_EXPANDED_ARG(var)
127 dnl
128 dnl Export (via AC_SUBST) a given variable, along with an expanded
129 dnl version of the variable (same name, but with exp_ prefix).
130 dnl
131 dnl This code is heavily borrowed *cough* from the Apache 2 source.
132 dnl
133
134 AC_DEFUN([RT_SUBST_EXPANDED_ARG],[
135         RT_EXPAND_VAR(exp_$1, [$]$1)
136         AC_SUBST($1)
137         AC_SUBST(exp_$1)
138 ])
139
140 dnl
141 dnl @synopsis   RT_EXPAND_VAR(baz, $fraz)
142 dnl
143 dnl Iteratively expands the second parameter, until successive iterations
144 dnl yield no change. The result is then assigned to the first parameter.
145 dnl
146 dnl This code is heavily borrowed from the Apache 2 codebase.
147 dnl
148
149 AC_DEFUN([RT_EXPAND_VAR],[
150         ap_last=''
151         ap_cur='$2'
152         while test "x${ap_cur}" != "x${ap_last}"; do
153                 ap_last="${ap_cur}"
154                 ap_cur=`eval "echo ${ap_cur}"`
155         done
156         $1="${ap_cur}"
157 ])
158