Imported from ../bash-2.05b.tar.gz.
[platform/upstream/bash.git] / support / mkconffiles
1 #! /bin/sh
2 #
3 # mkconffiles - create _distribution and _patchlevel files in preparation
4 #               for recreating `configure' from `configure.in'
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
16 # Copyright (C) 1996-2002 Free Software Foundation, Inc.
17 #
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 2, or (at your option)
21 # any later version.
22 #
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.
27 #
28 # You should have received a copy of the GNU General Public License
29 # along with this program; if not, write to the Free Software
30 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
31
32 PROG=`basename $0`
33
34 # defaults
35 srcdir=.
36
37 distname="_distribution"
38 patchname="_patchlevel"
39
40 while [ $# -gt 0 ]; do
41         case "$1" in
42         -s)     shift; srcdir="$1"; shift;;
43         -d)     shift; outdir="$1"; shift;;
44         -v)     shift; verbose=yes ;;
45         -n)     shift; nocreate=yes;;
46         --)     shift; break;;
47         *)      echo "${PROG}: usage: ${PROG} [-s srcdir] [-d outdir] [-nv]" >&2; exit 2;;
48         esac
49 done
50
51 if [ ! -f ${srcdir}/configure ]; then
52         echo "${PROG}: ${srcdir}/configure not found" >&2
53         exit 1
54 fi
55
56 # default output directory to source directory
57 if [ -z "$outdir" ]; then
58         outdir=${srcdir}
59 fi
60
61 DISTRIB=`grep '^BASHVERS' ${srcdir}/configure | sed 's:.*=::'`
62 PATCH=`grep '^BASHPATCH' ${srcdir}/configure | sed 's:.*=::'`
63
64 if [ -n "$verbose" ]; then
65         echo "${PROG}: creating new distribution files for bash-${DISTRIB}.${PATCH} in ${outdir}"
66 fi
67
68 distout=${outdir}/${distname}
69 patchout=${outdir}/${patchname}
70
71 if [ -z "$nocreate" ]; then
72         echo "$DISTRIB" > $distout
73         echo "$PATCH"   > $patchout
74 fi
75
76 if [ -n "$verbose" ]; then
77         echo "${PROG}: created $distout and $patchout"
78 fi
79
80 exit 0