2 # -*- Mode: shell-script -*-
4 ## mk-shdefs.in - extract the substitutions in config.status into
5 ## environment variables.
7 ## This file is part of AutoGen.
8 ## AutoGen Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
10 ## AutoGen is free software: you can redistribute it and/or modify it
11 ## under the terms of the GNU General Public License as published by the
12 ## Free Software Foundation, either version 3 of the License, or
13 ## (at your option) any later version.
15 ## AutoGen is distributed in the hope that it will be useful, but
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 ## See the GNU General Public License for more details.
20 ## You should have received a copy of the GNU General Public License along
21 ## with this program. If not, see <http://www.gnu.org/licenses/>.
24 echo "$prog fatal error: $*"
30 prog=`basename $1 .sh`
33 if (exec 2> /dev/null ; unset CDPATH)
35 elif test ${#CDPATH} -gt 0
45 builddir=`cd $builddir >/dev/null && pwd`
47 srcdir=`cd $srcdir >/dev/null && pwd`
49 cd ${builddir} || die no builddir
51 # top_builddir may be relative to the build directory that corresponds
52 # to the source directory for this file. Make it absolute
54 top_builddir=`cd @top_builddir@ >/dev/null && pwd`
56 cd ${builddir} >/dev/null && cd @top_srcdir@ >/dev/null && pwd`
59 exec 3> shdef-temp.in || die cannot create output
66 exec_prefix="@exec_prefix@"
67 PACKAGE_TARNAME='@PACKAGE_TARNAME@'
70 # Skip the stuff we force to be first
72 skip_list='top_srcdir|top_builddir|prefix|exec_prefix|PACKAGE_TARNAME'
74 # skip the autoconf/automake internal names
76 skip_list=${skip_list}"|a[mc]_.*|.*_TRUE|.*_FALSE|HAVE_.*|AM*"
78 # These must be in the correct order. Ensure it and don't do 'em twice
80 eval_fmt='eval "%s=\\"@%s@\\""\n'
81 for v in datarootdir mandir localedir infodir docdir datadir \
82 libdir libexecdir sbindir bindir \
83 includedir localstatedir sharedstatedir sysconfdir oldincludedir
84 do printf "${eval_fmt}" $v $v
85 skip_list=${skip_list}"|$v"
88 for f in `${GREP} '^S\["' config.status`
90 v=`echo "$f" | ${SED} 's/".=.*//;s/[SD]\["//'`
91 x=`echo "$v" | ${EGREP} "^($skip_list)\$"`
92 test "X$x" = X || continue
95 *'$('* ) : ;; # no make file only substitutions
96 *'missing --run '* ) : ;; # no bootstrap tools
97 S*\$* ) printf "${eval_fmt}" $v $v ;;
98 S* ) echo "$v='@$v@'" ;;
108 ../config.status --file shdef-temp
110 cmd='`set -o | '${AWK}" '/^allexport/ {print \$2}'"\`
112 #! `which echo` this-file-should-be-sourced,-not-executed
113 # -*- Mode: shell-script -*-
117 * ) cleara='set +a' ; set -a ;;
120 top_srcdir="$top_srcdir"
121 top_builddir="$top_builddir"
133 tmp=$(mktemp -d /tmp/shdefs-XXXXXXXXX)
134 exec 2>> $tmp/mk-shdef.log