1 #-----------------------------------------------------------------------------
2 # installdirs.m4 (c) Matze Braun <matze@braunis.de>
3 # Macros for outputing the installation paths which autoconf gathers into the
5 #-----------------------------------------------------------------------------
7 #-----------------------------------------------------------------------------
8 # AC_OUTPUT_INSTALLDIRS
9 # Transforms the installation dirs which are gathered by autoconf and sets
10 # properties in the Jamconfig file for them. We deal with stuff like
11 # variable references inside the paths (often the paths contain ${prefix})
12 # and with correct quoting here.
13 # The script will set the INSTALLDIR.PREFIX, INSTALLDIR.EXEC_PREFIX,
14 # INSTALLDIR.APPLICATION, INSTALLDIR.SBIN, INSTALLDIR.LIBEXEC,
15 # INSTALLDIR.DATA, INSTALLDIR.MAP, INSTALLDIR.CONFIG, INSTALLDIR.SHAREDSTATE
16 # INSTALLDIR.LOCALSTATE, INSTALLDIR.PLUGIN, INSTALLDIR.DOC
17 # INSTALLDIR.LIBRARY, INSTALLDIR.INCLUDE, INSTALLDIR.OLDINCLUDE,
18 # INSTALLDIR.INFO, INSTALLDIR.MAN
19 #-----------------------------------------------------------------------------
20 AC_DEFUN([AC_OUTPUT_INSTALLDIRS],[
21 # Handle the case when no prefix is given. And the special case when a path
22 # contains more than 2 slashes, these paths seem to be correct but jam fails
24 AS_IF([test $prefix = NONE], [prefix="$ac_default_prefix"],
25 [prefix=`echo "$prefix" | sed -e 's:///*:/:g'`])
26 AS_IF([test $exec_prefix = NONE],
27 [exec_prefix="AS_ESCAPE([$(prefix)])"],
28 [exec_prefix=`echo "$exec_prefix" | sed -e 's:///*:/:g'`])
30 prefix=AC_FIX_VARIABLEREF([$prefix])
31 exec_prefix=AC_FIX_VARIABLEREF([$exec_prefix])
32 bindir=AC_FIX_VARIABLEREF([$bindir])
33 sbindir=AC_FIX_VARIABLEREF([$sbindir])
34 libexecdir=AC_FIX_VARIABLEREF([$libexecdir])
35 datadir=AC_FIX_VARIABLEREF([$datadir])
36 sysconfdir=AC_FIX_VARIABLEREF([$sysconfdir])
37 sharedstatedir=AC_FIX_VARIABLEREF([$sharedstatedir])
38 localstatedir=AC_FIX_VARIABLEREF([$localstatedir])
39 libdir=AC_FIX_VARIABLEREF([$libdir])
40 includedir=AC_FIX_VARIABLEREF([$includedir])
41 oldincludedir=AC_FIX_VARIABLEREF([$oldincludedir])
42 infodir=AC_FIX_VARIABLEREF([$infodir])
43 mandir=AC_FIX_VARIABLEREF([$mandir])
45 #hack to get the order right :-/ (autoconf --trace reports wrong order...)
53 AC_SUBST(sharedstatedir)
54 AC_SUBST(localstatedir)
57 AC_SUBST(oldincludedir)
62 #-----------------------------------------------------------------------------
64 # Fixes the output from AC_PROG_INSTALL
65 #-----------------------------------------------------------------------------
66 AC_DEFUN([AC_FIX_INSTALL], [
67 AC_REQUIRE([AC_PROG_INSTALL])
68 INSTALL=AC_FIX_VARIABLEREF([$INSTALL])
69 INSTALL_PROGRAM=AC_FIX_VARIABLEREF([$INSTALL_PROGRAM])
70 INSTALL_SCRIPT=AC_FIX_VARIABLEREF([$INSTALL_SCRIPT])
71 INSTALL_DATA=AC_FIX_VARIABLEREF([$INSTALL_DATA])
75 AC_SUBST([INSTALL_PROGRAM])
76 AC_SUBST([INSTALL_SCRIPT])
77 AC_SUBST([INSTALL_DATA])
80 #-----------------------------------------------------------------------------
81 # AC_PREPARE_INSTALLPATH
82 # Transform variables of the form ${bla} to $(bla) inside the string and
83 # correctly quotes backslashes.
84 # This is needed if you want to output some of the paths that autoconf
85 # creates to the Jamconfig file.
86 #-----------------------------------------------------------------------------
87 AC_DEFUN([AC_FIX_VARIABLEREF],
88 dnl We need all the strange \\\\ quoting here, because the command will be
89 dnl inserted into a "" block and sed needs quoting as well
90 [`echo "$1" | sed -e 's/\${\([[a-zA-Z_][a-zA-Z_]]*\)}/$(\1)/g' -e 's/\\\\/\\\\\\\\/g'`])