2 dnl @synopsis RT_LAYOUT(configlayout, layoutname)
4 dnl This macro reads an Apache-style layout file (specified as the
5 dnl configlayout parameter), and searches for a specific layout
6 dnl (named using the layoutname parameter).
8 dnl The entries for a given layout are then inserted into the
9 dnl environment such that they become available as substitution
10 dnl variables. In addition, the rt_layout_name variable is set
11 dnl (but not exported) if the layout is valid.
13 dnl This code is heavily borrowed *cough* from the Apache 2 codebase.
16 AC_DEFUN([RT_LAYOUT],[
17 if test ! -f $srcdir/config.layout; then
18 AC_MSG_WARN([Layout file $srcdir/config.layout not found])
22 $PERL -0777 -p -e "\$layout = '$2';" -e '
23 s/.*<Layout\s+$layout>//gims;
29 # m4 will not let us just use $1, we need @S|@1
30 s/^\s*((?:bin|sbin|libexec|data|sysconf|sharedstate|localstate|lib|include|oldinclude|info|man)dir)\s*:\s*(.*)$/@S|@1=@S|@2/gim;
31 s/^\s*(.*?)\s*:\s*(.*)$/\(test "x\@S|@@S|@1" = "xNONE" || test "x\@S|@@S|@1" = "x") && @S|@1=@S|@2/gim;
34 if test -s $pldconf; then
38 for var in prefix exec_prefix bindir sbindir \
39 sysconfdir mandir libdir datadir htmldir \
40 localstatedir logfiledir masonstatedir \
41 sessionstatedir customdir custometcdir customhtmldir \
42 customlexdir customlibdir manualdir; do
44 val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
46 sed -e 's:[\$]\([a-z_]*\):${\1}:g'`
55 RT_SUBST_EXPANDED_ARG(prefix)
56 RT_SUBST_EXPANDED_ARG(exec_prefix)
57 RT_SUBST_EXPANDED_ARG(bindir)
58 RT_SUBST_EXPANDED_ARG(sbindir)
59 RT_SUBST_EXPANDED_ARG(sysconfdir)
60 RT_SUBST_EXPANDED_ARG(mandir)
61 RT_SUBST_EXPANDED_ARG(libdir)
62 RT_SUBST_EXPANDED_ARG(datadir)
63 RT_SUBST_EXPANDED_ARG(htmldir)
64 RT_SUBST_EXPANDED_ARG(manualdir)
65 RT_SUBST_EXPANDED_ARG(localstatedir)
66 RT_SUBST_EXPANDED_ARG(logfiledir)
67 RT_SUBST_EXPANDED_ARG(masonstatedir)
68 RT_SUBST_EXPANDED_ARG(sessionstatedir)
69 RT_SUBST_EXPANDED_ARG(customdir)
70 RT_SUBST_EXPANDED_ARG(custometcdir)
71 RT_SUBST_EXPANDED_ARG(customhtmldir)
72 RT_SUBST_EXPANDED_ARG(customlexdir)
73 RT_SUBST_EXPANDED_ARG(customlibdir)