| 1 | #! @SHELL@ | 
|---|
| 2 | # autoconf -- create `configure' using m4 macros | 
|---|
| 3 | # Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc. | 
|---|
| 4 |  | 
|---|
| 5 | # This program is free software; you can redistribute it and/or modify | 
|---|
| 6 | # it under the terms of the GNU General Public License as published by | 
|---|
| 7 | # the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 8 | # any later version. | 
|---|
| 9 |  | 
|---|
| 10 | # This program is distributed in the hope that it will be useful, | 
|---|
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 13 | # GNU General Public License for more details. | 
|---|
| 14 |  | 
|---|
| 15 | # You should have received a copy of the GNU General Public License | 
|---|
| 16 | # along with this program; if not, write to the Free Software | 
|---|
| 17 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | 
|---|
| 18 | # 02111-1307, USA. | 
|---|
| 19 |  | 
|---|
| 20 | # If given no args, create `configure' from template file `configure.in'. | 
|---|
| 21 | # With one arg, create a configure script on standard output from | 
|---|
| 22 | # the given template file. | 
|---|
| 23 |  | 
|---|
| 24 | usage="\ | 
|---|
| 25 | Usage: autoconf [-h] [--help] [-m dir] [--macrodir=dir] | 
|---|
| 26 | [-l dir] [--localdir=dir] [--version] [template-file]" | 
|---|
| 27 |  | 
|---|
| 28 | # NLS nuisances. | 
|---|
| 29 | # Only set these to C if already set.  These must not be set unconditionally | 
|---|
| 30 | # because not all systems understand e.g. LANG=C (notably SCO). | 
|---|
| 31 | # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! | 
|---|
| 32 | # Non-C LC_CTYPE values break the ctype check. | 
|---|
| 33 | if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi | 
|---|
| 34 | if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi | 
|---|
| 35 | if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi | 
|---|
| 36 | if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi | 
|---|
| 37 |  | 
|---|
| 38 | if test -z "${AC_MACRODIR}"; then | 
|---|
| 39 | if test -d "${UNIXROOT}@datadir@"; then | 
|---|
| 40 | AC_MACRODIR=${UNIXROOT}@datadir@ | 
|---|
| 41 | else | 
|---|
| 42 | AC_MACRODIR=@datadir@ | 
|---|
| 43 | fi | 
|---|
| 44 | fi | 
|---|
| 45 | : ${M4=@M4@} | 
|---|
| 46 | : ${AWK=@AWK@} | 
|---|
| 47 | case "${M4}" in | 
|---|
| 48 | [/\\]*|[a-zA-Z]:*) # Handle the case that m4 has moved since we were configured. | 
|---|
| 49 | # It may have been found originally in a build directory. | 
|---|
| 50 | test -f "${M4}" || M4=m4 ;; | 
|---|
| 51 | esac | 
|---|
| 52 |  | 
|---|
| 53 | : ${TMPDIR=/tmp} | 
|---|
| 54 | tmpout=${TMPDIR}/acout.$$ | 
|---|
| 55 | localdir= | 
|---|
| 56 | show_version=no | 
|---|
| 57 |  | 
|---|
| 58 | while test $# -gt 0 ; do | 
|---|
| 59 | case "${1}" in | 
|---|
| 60 | -h | --help | --h* ) | 
|---|
| 61 | echo "${usage}" 1>&2; exit 0 ;; | 
|---|
| 62 | --localdir=* | --l*=* ) | 
|---|
| 63 | localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" | 
|---|
| 64 | shift ;; | 
|---|
| 65 | -l | --localdir | --l*) | 
|---|
| 66 | shift | 
|---|
| 67 | test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } | 
|---|
| 68 | localdir="${1}" | 
|---|
| 69 | shift ;; | 
|---|
| 70 | --macrodir=* | --m*=* ) | 
|---|
| 71 | AC_MACRODIR="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" | 
|---|
| 72 | shift ;; | 
|---|
| 73 | -m | --macrodir | --m* ) | 
|---|
| 74 | shift | 
|---|
| 75 | test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } | 
|---|
| 76 | AC_MACRODIR="${1}" | 
|---|
| 77 | shift ;; | 
|---|
| 78 | --version | --v* ) | 
|---|
| 79 | show_version=yes; shift ;; | 
|---|
| 80 | -- )     # Stop option processing | 
|---|
| 81 | shift; break ;; | 
|---|
| 82 | - )       # Use stdin as input. | 
|---|
| 83 | break ;; | 
|---|
| 84 | -* ) | 
|---|
| 85 | echo "${usage}" 1>&2; exit 1 ;; | 
|---|
| 86 | * ) | 
|---|
| 87 | break ;; | 
|---|
| 88 | esac | 
|---|
| 89 | done | 
|---|
| 90 |  | 
|---|
| 91 | if test $show_version = yes; then | 
|---|
| 92 | version=`sed -n 's/define.AC_ACVERSION.[      ]*\([0-9.]*\).*/\1/p' \ | 
|---|
| 93 | $AC_MACRODIR/acgeneral.m4` | 
|---|
| 94 | echo "Autoconf version $version" | 
|---|
| 95 | exit 0 | 
|---|
| 96 | fi | 
|---|
| 97 |  | 
|---|
| 98 | case $# in | 
|---|
| 99 | 0) infile=configure.in ;; | 
|---|
| 100 | 1) infile="$1" ;; | 
|---|
| 101 | *) echo "$usage" >&2; exit 1 ;; | 
|---|
| 102 | esac | 
|---|
| 103 |  | 
|---|
| 104 | trap 'rm -f $tmpin $tmpout; exit 1' 1 2 15 | 
|---|
| 105 |  | 
|---|
| 106 | tmpin=${TMPDIR}/acin.$$ # Always set this, to avoid bogus errors from some rm's. | 
|---|
| 107 | if test z$infile = z-; then | 
|---|
| 108 | infile=$tmpin | 
|---|
| 109 | cat > $infile | 
|---|
| 110 | elif test ! -r "$infile"; then | 
|---|
| 111 | echo "autoconf: ${infile}: No such file or directory" >&2 | 
|---|
| 112 | exit 1 | 
|---|
| 113 | fi | 
|---|
| 114 |  | 
|---|
| 115 | if test -n "$localdir"; then | 
|---|
| 116 | use_localdir="-I$localdir -DAC_LOCALDIR=$localdir" | 
|---|
| 117 | else | 
|---|
| 118 | use_localdir= | 
|---|
| 119 | fi | 
|---|
| 120 |  | 
|---|
| 121 | # Use the frozen version of Autoconf if available. | 
|---|
| 122 | r= f= | 
|---|
| 123 | # Some non-GNU m4's don't reject the --help option, so give them /dev/null. | 
|---|
| 124 | case `$M4 --help < /dev/null 2>&1` in | 
|---|
| 125 | *reload-state*) test -r $AC_MACRODIR/autoconf.m4f && { r=--reload f=f; } ;; | 
|---|
| 126 | *traditional*) ;; | 
|---|
| 127 | *) echo Autoconf requires GNU m4 1.1 or later >&2; rm -f $tmpin; exit 1 ;; | 
|---|
| 128 | esac | 
|---|
| 129 |  | 
|---|
| 130 | $M4 -I$AC_MACRODIR -DAC_MACRODIR=$AC_MACRODIR $use_localdir $r autoconf.m4$f $infile > $tmpout || | 
|---|
| 131 | { rm -f $tmpin $tmpout; exit 2; } | 
|---|
| 132 |  | 
|---|
| 133 | # You could add your own prefixes to pattern if you wanted to check for | 
|---|
| 134 | # them too, e.g. pattern='\(AC_\|ILT_\)', except that UNIX sed doesn't do | 
|---|
| 135 | # alternation. | 
|---|
| 136 | pattern="AC_" | 
|---|
| 137 |  | 
|---|
| 138 | status=0 | 
|---|
| 139 | if grep "^[^#]*${pattern}" $tmpout > /dev/null 2>&1; then | 
|---|
| 140 | echo "autoconf: Undefined macros:" >&2 | 
|---|
| 141 | sed -n "s/^[^#]*\\(${pattern}[_A-Za-z0-9]*\\).*/\\1/p" $tmpout | | 
|---|
| 142 | while read macro; do | 
|---|
| 143 | grep -n "^[^#]*$macro" $infile /dev/null | 
|---|
| 144 | test $? -eq 1 && echo >&2 "***BUG in Autoconf--please report*** $macro" | 
|---|
| 145 | done | sort -u >&2 | 
|---|
| 146 | status=1 | 
|---|
| 147 | fi | 
|---|
| 148 |  | 
|---|
| 149 | if test $# -eq 0; then | 
|---|
| 150 | exec 4> configure; chmod +x configure 2> /dev/null | 
|---|
| 151 | else | 
|---|
| 152 | exec 4>&1 | 
|---|
| 153 | fi | 
|---|
| 154 |  | 
|---|
| 155 | # Put the real line numbers into configure to make config.log more helpful. | 
|---|
| 156 | $AWK ' | 
|---|
| 157 | /__oline__/ { printf "%d:", NR + 1 } | 
|---|
| 158 | { print } | 
|---|
| 159 | ' $tmpout | sed ' | 
|---|
| 160 | /__oline__/s/^\([0-9][0-9]*\):\(.*\)__oline__/\2\1/ | 
|---|
| 161 | ' | sed 's/IFS="${IFS}:"/IFS="${PATH_IFS}"/' >&4 | 
|---|
| 162 |  | 
|---|
| 163 | rm -f $tmpout | 
|---|
| 164 |  | 
|---|
| 165 | exit $status | 
|---|