| Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | # |
| 3 | # mkconffiles - create _distribution and _patchlevel files in preparation |
| Chet Ramey | ac50fba | 2014-02-26 09:36:43 -0500 | [diff] [blame] | 4 | # for recreating `configure' from `configure.ac' |
| Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 5 | # |
| 6 | # options: |
| 7 | # -s srcdir directory where `configure' resides (defaults to `.') |
| 8 | # -d outdir directory where the files should be written (defaults |
| 9 | # to "$srcdir") |
| 10 | # -v verbose |
| 11 | # -n nocreate - don't create the output files |
| 12 | # |
| 13 | # Chet Ramey |
| 14 | # chet@po.cwru.edu |
| 15 | |
| Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 16 | # Copyright (C) 1996-2002 Free Software Foundation, Inc. |
| 17 | # |
| Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 18 | # This program is free software: you can redistribute it and/or modify |
| 19 | # it under the terms of the GNU General Public License as published by |
| 20 | # the Free Software Foundation, either version 3 of the License, or |
| 21 | # (at your option) any later version. |
| Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 22 | # |
| Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 23 | # This program is distributed in the hope that it will be useful, |
| 24 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 25 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 26 | # GNU General Public License for more details. |
| Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 27 | # |
| Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 28 | # You should have received a copy of the GNU General Public License |
| 29 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| Jari Aalto | 7117c2d | 2002-07-17 14:10:11 +0000 | [diff] [blame] | 30 | |
| Jari Aalto | d166f04 | 1997-06-05 14:59:13 +0000 | [diff] [blame] | 31 | PROG=`basename $0` |
| 32 | |
| 33 | # defaults |
| 34 | srcdir=. |
| 35 | |
| 36 | distname="_distribution" |
| 37 | patchname="_patchlevel" |
| 38 | |
| 39 | while [ $# -gt 0 ]; do |
| 40 | case "$1" in |
| 41 | -s) shift; srcdir="$1"; shift;; |
| 42 | -d) shift; outdir="$1"; shift;; |
| 43 | -v) shift; verbose=yes ;; |
| 44 | -n) shift; nocreate=yes;; |
| 45 | --) shift; break;; |
| 46 | *) echo "${PROG}: usage: ${PROG} [-s srcdir] [-d outdir] [-nv]" >&2; exit 2;; |
| 47 | esac |
| 48 | done |
| 49 | |
| 50 | if [ ! -f ${srcdir}/configure ]; then |
| 51 | echo "${PROG}: ${srcdir}/configure not found" >&2 |
| 52 | exit 1 |
| 53 | fi |
| 54 | |
| 55 | # default output directory to source directory |
| 56 | if [ -z "$outdir" ]; then |
| 57 | outdir=${srcdir} |
| 58 | fi |
| 59 | |
| 60 | DISTRIB=`grep '^BASHVERS' ${srcdir}/configure | sed 's:.*=::'` |
| 61 | PATCH=`grep '^BASHPATCH' ${srcdir}/configure | sed 's:.*=::'` |
| 62 | |
| 63 | if [ -n "$verbose" ]; then |
| 64 | echo "${PROG}: creating new distribution files for bash-${DISTRIB}.${PATCH} in ${outdir}" |
| 65 | fi |
| 66 | |
| 67 | distout=${outdir}/${distname} |
| 68 | patchout=${outdir}/${patchname} |
| 69 | |
| 70 | if [ -z "$nocreate" ]; then |
| 71 | echo "$DISTRIB" > $distout |
| 72 | echo "$PATCH" > $patchout |
| 73 | fi |
| 74 | |
| 75 | if [ -n "$verbose" ]; then |
| 76 | echo "${PROG}: created $distout and $patchout" |
| 77 | fi |
| 78 | |
| 79 | exit 0 |