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/^((?:bin|sbin|libexec|data|sysconf|sharedstate|localstate|lib|include|oldinclude|plugin|info|man)dir)\s*:\s*(.*)$/@S|@1=@S|@2/gim;
31 # uh, should be [:=], but m4 apparently substitutes something...
32 s/^(.*?)\s*(?::|=)\s*(.*)$/\(test "x\@S|@@S|@1" = "xNONE" || test "x\@S|@@S|@1" = "x") && @S|@1=@S|@2/gim;
35 if test -s $pldconf; then
39 for var in prefix exec_prefix bindir sbindir \
40 sysconfdir mandir libdir datadir htmldir fontdir \
41 localstatedir logfiledir masonstatedir plugindir \
42 sessionstatedir customdir custometcdir customhtmldir \
43 customlexdir customlibdir manualdir; do
45 val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
47 sed -e 's:[\$]\([a-z_]*\):${\1}:g'`
56 RT_SUBST_EXPANDED_ARG(prefix)
57 RT_SUBST_EXPANDED_ARG(exec_prefix)
58 RT_SUBST_EXPANDED_ARG(bindir)
59 RT_SUBST_EXPANDED_ARG(sbindir)
60 RT_SUBST_EXPANDED_ARG(sysconfdir)
61 RT_SUBST_EXPANDED_ARG(mandir)
62 RT_SUBST_EXPANDED_ARG(libdir)
63 RT_SUBST_EXPANDED_ARG(datadir)
64 RT_SUBST_EXPANDED_ARG(htmldir)
65 RT_SUBST_EXPANDED_ARG(fontdir)
66 RT_SUBST_EXPANDED_ARG(manualdir)
67 RT_SUBST_EXPANDED_ARG(plugindir)
68 RT_SUBST_EXPANDED_ARG(localstatedir)
69 RT_SUBST_EXPANDED_ARG(logfiledir)
70 RT_SUBST_EXPANDED_ARG(masonstatedir)
71 RT_SUBST_EXPANDED_ARG(sessionstatedir)
72 RT_SUBST_EXPANDED_ARG(customdir)
73 RT_SUBST_EXPANDED_ARG(custometcdir)
74 RT_SUBST_EXPANDED_ARG(customhtmldir)
75 RT_SUBST_EXPANDED_ARG(customlexdir)
76 RT_SUBST_EXPANDED_ARG(customlibdir)