1#! @CONFIG_SHELL@ 2# -*- Mode: shell-script -*- 3 4## mk-shdefs.in - extract the substitutions in config.status into 5## environment variables. 6## 7## This file is part of AutoGen. 8## AutoGen Copyright (C) 1992-2018 by Bruce Korb - all rights reserved 9## 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. 14## 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. 19## 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/>. 22 23die() { 24 echo "$prog fatal error: $*" 25 kill -TERM $progpid 26 exit 1 27} >&2 28 29init() { 30 prog=`basename $1 .sh` 31 progpid=$$ 32 33 if (exec 2> /dev/null ; unset CDPATH) 34 then unset CDPATH 35 elif test ${#CDPATH} -gt 0 36 then CDPATH= 37 fi 38 39 SED='@SED@' 40 AWK='@AWK@' 41 GREP='@GREP@' 42 EGREP='@EGREP@' 43 target=`basename $2` 44 builddir=`dirname $2` 45 builddir=`cd $builddir >/dev/null && pwd` 46 srcdir=`dirname $1` 47 srcdir=`cd $srcdir >/dev/null && pwd` 48 49 cd ${builddir} || die no builddir 50 51 # top_builddir may be relative to the build directory that corresponds 52 # to the source directory for this file. Make it absolute 53 # 54 top_builddir=`cd @top_builddir@ >/dev/null && pwd` 55 top_srcdir=` 56 cd ${builddir} >/dev/null && cd @top_srcdir@ >/dev/null && pwd` 57 58 rm -f ${target} 59 exec 3> shdef-temp.in || die cannot create output 60 cd .. 61} 62 63mk_config() { 64 cat >&3 <<- _EOF_ 65 prefix='@prefix@' 66 exec_prefix="@exec_prefix@" 67 PACKAGE_TARNAME='@PACKAGE_TARNAME@' 68 _EOF_ 69 70 # Skip the stuff we force to be first 71 # 72 skip_list='top_srcdir|top_builddir|prefix|exec_prefix|PACKAGE_TARNAME' 73 74 # skip the autoconf/automake internal names 75 # 76 skip_list=${skip_list}"|a[mc]_.*|.*_TRUE|.*_FALSE|HAVE_.*|AM*" 77 78 # These must be in the correct order. Ensure it and don't do 'em twice 79 # 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" 86 done >&3 87 88 for f in `${GREP} '^S\["' config.status` 89 do 90 v=`echo "$f" | ${SED} 's/".=.*//;s/[SD]\["//'` 91 x=`echo "$v" | ${EGREP} "^($skip_list)\$"` 92 test "X$x" = X || continue 93 94 case "$f" in 95 *'$('* ) : ;; # no make file only substitutions 96 *'missing --run '* ) : ;; # no bootstrap tools 97 S*\$* ) printf "${eval_fmt}" $v $v ;; 98 S* ) echo "$v='@$v@'" ;; 99 esac 100 done >&3 101 102 exec 3>&- 103} 104 105configure() { 106 cd config 107 108 ../config.status --file shdef-temp 109 { 110 cmd='`set -o | '${AWK}" '/^allexport/ {print \$2}'"\` 111 cat <<- _EOF_ 112 #! `which echo` this-file-should-be-sourced,-not-executed 113 # -*- Mode: shell-script -*- 114 115 case "$cmd" in 116 on ) cleara=: ;; 117 * ) cleara='set +a' ; set -a ;; 118 esac 119 120 top_srcdir="$top_srcdir" 121 top_builddir="$top_builddir" 122 _EOF_ 123 124 cat shdef-temp 125 echo 'eval $cleara' 126 } > ${target} 127 128 rm -f shdef-temp* 129} 130 131set -x 132exec 9>&2 133tmp=$(mktemp --suffix=.tdir -d /tmp/shdefs-XXXXXXXXX) 134exec 2>> $tmp/mk-shdef.log 135init $0 $1 136mk_config 137configure 138exec 2>&9 9>&- 139