1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
|
#!/bin/sh
# simple configure script for tla-tools
#
# Copyright (C) 2003, 2004 Miles Bader <miles@gnu.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Written by Miles Bader <miles@gnu.org>
me=`basename $0`
# Standard make variables
prefix=${prefix:-/usr/local}
exec_prefix=${exec_prefix:-'$(prefix)'}
bindir=${bindir:-'$(exec_prefix)/bin'}
# Some messages
TRY="Try "\`"$me --help' for more information."
# sed for use before we configure $SED
BASIC_SED=${SED-sed}
CONF_VARS="srcdir prefix exec_prefix bindir"
ENV_VARS="TLA AWK ABS_AWK INSTALL SED UUIDGEN TLA_ESCAPE"
CONF_FILES="Makefile"
quoted_cmdline=""
for arg in "$@"; do
arg_rewrite=`echo "$1" | $BASIC_SED "s@'@'\\\\''@g"`
quoted_cmdline="$quoted_cmdline '$arg_rewrite'"
shift
done
eval set -- "$quoted_cmdline"
quoted_cmdline="$0$quoted_cmdline"
srcdir=`echo "$0" | $BASIC_SED -n 's@/[^/]*$@@p'`
srcdir=${srcdir:-.}
# Parse command-line options
while :; do
case "$1" in
--help)
echo "Configure script for tla-tools"
echo "Usage: $me [OPTION...]"
echo ""
echo " --prefix=DIR Set install prefix (default \`$prefix')"
echo " --exec_prefix=DIR Set prefix for executable files (default \`$exec_prefix')"
echo " --bindir=DIR Set binary directory (default \`$bindir')"
echo ""
echo " --srcdir=DIR Set directory containing tla sources (default \`$srcdir')"
echo ""
echo " --help Display a help message and exit"
echo ""
echo "The following environment variables may also be defined:"
echo ""
echo " AWK awk program (should be vaguely modern; default \`nawk')"
echo " INSTALL install program (default \`install')"
echo " TLA tla program (default \`tla')"
echo " SED GNU sed program (default \`sed')"
echo " UUIDGEN UUID generator program (default \`uuidgen')"
exit 0
;;
--*)
VAR=`echo "$1" | $BASIC_SED -e 's@^--@@' -e 's@=.*@@' -e 's@-@_@g'`
VAL=`echo "$1" | $BASIC_SED 's@.*=@@'`
if test x"$VAL" = x"$1"; then
# value in next arg
shift
VAL="$1"
fi
set_var=no
for V in $CONF_VARS; do
if test x"$VAR" = x"$V"; then
eval "$VAR=\$VAL"
set_var=yes
break
fi
done
if test $set_var = no; then
echo 1>&2 "$me: unrecognized option "\`"--$VAR'"
echo 1>&2 "$TRY"
exit 1
fi
shift
;;
-[!-]?*)
# split concatenated single-letter options apart
FIRST="$1"; shift
set -- `echo $FIRST | $BASIC_SED 's/-\(.\)\(.*\)/-\1 -\2/'` "$@"
;;
-*)
echo 1>&2 "$me: unrecognized option "\`"$1'"
echo 1>&2 "$TRY"
exit 1
;;
*=*)
eval "$1"; shift;;
*)
break;
esac
done
USER_ENV_VARS=''
for var in $ENV_VARS; do
if eval test x"\${$var+set}" = xset; then
USER_ENV_VARS="$USER_ENV_VARS $var"
fi
done
# Make variables we use
split_path=`echo $PATH | $BASIC_SED 's/:/ /g'`
# TLA
TLA=${TLA:-tla}
echo "checking for tla... $TLA"
# INSTALL
INSTALL=${INSTALL:-install}
echo "checking for install... $INSTALL"
# AWK
msg="checking for awk... "
if test x"${AWK+set}" != xset; then
awk_progs="nawk awk"
for bin_dir in $split_path; do
for awk_prog in $awk_progs; do
AWK="$bin_dir/$awk_prog"
test -x "$AWK" && break 2
done
done
if test ! -x "$AWK"; then
echo "$msg"
echo 1>&2 "$me: awk not found"
exit 2
fi
fi
echo "$msg$AWK"
# ABS_AWK (used for scripts, which need an absolute dir)
msg="checking for awk absolute path... "
if test x"${ABS_AWK+set}" != xset; then
case "$AWK" in
/*)
ABS_AWK="$AWK";;
*)
for bin_dir in $split_path; do
ABS_AWK="$bin_dir/$AWK"
test -x "$ABS_AWK" && break
done;;
esac
fi
echo "$msg$ABS_AWK"
# SED
msg="checking for GNU sed... "
if test x"${SED+set}" != xset; then
sed_progs="gsed sed"
for bin_dir in $split_path; do
for sed_prog in $sed_progs; do
SED="$bin_dir/$sed_prog"
if test -x "$SED"; then
# Make sure it's GNU sed by trying the --version option
if "$SED" --version < /dev/null 2> /dev/null | grep -i 'gnu sed' > /dev/null; then
break 2
else
unset SED
fi
fi
done
done
if test ! -x "$SED"; then
echo "$msg"
echo 1>&2 "$me: GNU sed not found"
exit 2
fi
fi
echo "$msg$SED"
# UUIDGEN
UUIDGEN=${UUIDGEN:-"uuidgen"}
echo "checking for uuidgen... $UUIDGEN"
# Check whether we can use tla --unescaped
if $TLA escape foo >/dev/null 2>/dev/null; then
TLA_ESCAPE=yes
else
TLA_ESCAPE=no
fi
echo "checking whether $TLA uses filename escapes... $TLA_ESCAPE"
#
# Output generation
#
SED_CMDS='/^#* *arch-tag:/d'
for VAR in $CONF_VARS $ENV_VARS; do
eval VAL=\""\$$VAR"\"
SED_CMDS="$SED_CMDS;s;@$VAR@;$VAL;"
done
for FILE in $CONF_FILES; do
echo "$me: Generating $FILE"
$SED "$SED_CMDS" < $srcdir/"$FILE.in" > "$FILE"
done
# Generate config.status file
(
echo "#!/bin/sh"
echo "# Generated by $quoted_cmdline"
echo "srcdir='$srcdir'"
echo "config_sed='$SED'"
echo 'if test x"$1" = x--recheck; then'
for VAR in $USER_ENV_VARS; do
eval VAL=\""\$$VAR"\"
echo " $VAR=\${$VAR:-'`echo "$VAL" | $SED "s@'@'\\\\''@g"`'}; export $VAR"
done
echo " exec $quoted_cmdline"
echo "else"
SED_CMDS_REWRITE=`echo "$SED_CMDS" | $SED "s@'@'\\\\''@g"`
echo " sed_cmds='$SED_CMDS_REWRITE'"
echo " for file in $CONF_FILES; do"
echo ' echo "$0: Generating $file"'
echo ' $config_sed "$sed_cmds" < $srcdir/"$file.in" > "$file"'
echo " done"
echo "fi"
) > config.status
chmod +x config.status
# arch-tag: 384defdf-9e33-4836-a68d-01accaef63bb
|