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 datarootdir=AC_FIX_VARIABLEREF([$datarootdir])
36 datadir=AC_FIX_VARIABLEREF([$datadir])
37 sysconfdir=AC_FIX_VARIABLEREF([$sysconfdir])
38 sharedstatedir=AC_FIX_VARIABLEREF([$sharedstatedir])
39 localstatedir=AC_FIX_VARIABLEREF([$localstatedir])
40 libdir=AC_FIX_VARIABLEREF([$libdir])
41 includedir=AC_FIX_VARIABLEREF([$includedir])
42 oldincludedir=AC_FIX_VARIABLEREF([$oldincludedir])
43 infodir=AC_FIX_VARIABLEREF([$infodir])
44 mandir=AC_FIX_VARIABLEREF([$mandir])
46 #hack to get the order right :-/ (autoconf --trace reports wrong order...)
55 AC_SUBST(sharedstatedir)
56 AC_SUBST(localstatedir)
59 AC_SUBST(oldincludedir)
64 #-----------------------------------------------------------------------------
66 # Fixes the output from AC_PROG_INSTALL
67 #-----------------------------------------------------------------------------
68 AC_DEFUN([AC_FIX_INSTALL], [
69 AC_REQUIRE([AC_PROG_INSTALL])
70 INSTALL=AC_FIX_VARIABLEREF([$INSTALL])
71 INSTALL_PROGRAM=AC_FIX_VARIABLEREF([$INSTALL_PROGRAM])
72 INSTALL_SCRIPT=AC_FIX_VARIABLEREF([$INSTALL_SCRIPT])
73 INSTALL_DATA=AC_FIX_VARIABLEREF([$INSTALL_DATA])
77 AC_SUBST([INSTALL_PROGRAM])
78 AC_SUBST([INSTALL_SCRIPT])
79 AC_SUBST([INSTALL_DATA])
82 #-----------------------------------------------------------------------------
83 # AC_PREPARE_INSTALLPATH
84 # Transform variables of the form ${bla} to $(bla) inside the string and
85 # correctly quotes backslashes.
86 # This is needed if you want to output some of the paths that autoconf
87 # creates to the Jamconfig file.
88 #-----------------------------------------------------------------------------
89 AC_DEFUN([AC_FIX_VARIABLEREF],
90 dnl We need all the strange \\\\ quoting here, because the command will be
91 dnl inserted into a "" block and sed needs quoting as well
92 [`echo "$1" | sed -e 's/\${\([[a-zA-Z_][a-zA-Z_]]*\)}/$(\1)/g' -e 's/\\\\/\\\\\\\\/g'`])