| 1 | #! /bin/sh |
| 2 | # |
| 3 | # GNU configure-like front end to metaconfig's Configure. |
| 4 | # |
| 5 | # Written by Andy Dougherty <doughera@lafayette.edu> |
| 6 | # and Matthew Green <mrg@mame.mu.oz.au>. |
| 7 | # |
| 8 | # Reformatted and modified for inclusion in the dist-3.0 package by |
| 9 | # Raphael Manfredi <ram@hptnos02.grenoble.hp.com>. |
| 10 | # |
| 11 | # This script belongs to the public domain and may be freely redistributed. |
| 12 | # |
| 13 | # The remaining of this leading shell comment may be removed if you |
| 14 | # include this script in your own package. |
| 15 | # |
| 16 | # $Log: configure,v $ |
| 17 | # Revision 3.0.1.1 1995/07/25 14:16:21 ram |
| 18 | # patch56: created |
| 19 | # |
| 20 | |
| 21 | (exit $?0) || exec sh $0 $argv:q |
| 22 | |
| 23 | case "$0" in |
| 24 | *configure) |
| 25 | if cmp $0 `echo $0 | sed -e s/configure/Configure/` >/dev/null; then |
| 26 | echo "Your configure and Configure scripts seem to be identical." |
| 27 | echo "This can happen on filesystems that aren't fully case sensitive." |
| 28 | echo "You'll have to explicitly extract Configure and run that." |
| 29 | exit 1 |
| 30 | fi |
| 31 | ;; |
| 32 | esac |
| 33 | |
| 34 | opts='' |
| 35 | verbose='' |
| 36 | create='-e' |
| 37 | while test $# -gt 0; do |
| 38 | case $1 in |
| 39 | --help) |
| 40 | cat <<EOM |
| 41 | Usage: configure.gnu [options] |
| 42 | This is GNU configure-like front end for a metaconfig-generated Configure. |
| 43 | It emulates the following GNU configure options (must be fully spelled out): |
| 44 | --help |
| 45 | --no-create |
| 46 | --prefix=PREFIX |
| 47 | --cache-file (ignored) |
| 48 | --quiet |
| 49 | --silent |
| 50 | --verbose |
| 51 | --version |
| 52 | |
| 53 | And it honours these environment variables: CC, CFLAGS and DEFS. |
| 54 | EOM |
| 55 | exit 0 |
| 56 | ;; |
| 57 | --no-create) |
| 58 | create='-E' |
| 59 | shift |
| 60 | ;; |
| 61 | --prefix=*) |
| 62 | arg=`echo $1 | sed 's/--prefix=/-Dprefix=/'` |
| 63 | opts="$opts $arg" |
| 64 | shift |
| 65 | ;; |
| 66 | --prefix) |
| 67 | shift |
| 68 | arg="-Dprefix=$1" |
| 69 | opts="$opts $arg" |
| 70 | shift |
| 71 | ;; |
| 72 | --cache-file=*) |
| 73 | shift # Just ignore it. |
| 74 | ;; |
| 75 | --quiet|--silent) |
| 76 | exec >/dev/null 2>&1 |
| 77 | shift |
| 78 | ;; |
| 79 | --verbose) |
| 80 | verbose=true |
| 81 | shift |
| 82 | ;; |
| 83 | --version) |
| 84 | copt="$copt -V" |
| 85 | shift |
| 86 | ;; |
| 87 | --*) |
| 88 | opt=`echo $1 | sed 's/=.*//'` |
| 89 | echo "This GNU configure front end does not understand $opt" |
| 90 | exit 1 |
| 91 | ;; |
| 92 | *) |
| 93 | opts="$opts '$1'" |
| 94 | shift |
| 95 | ;; |
| 96 | esac |
| 97 | done |
| 98 | |
| 99 | case "$CC" in |
| 100 | '') ;; |
| 101 | *) opts="$opts -Dcc='$CC'";; |
| 102 | esac |
| 103 | |
| 104 | # Join DEFS and CFLAGS together. |
| 105 | ccflags='' |
| 106 | case "$DEFS" in |
| 107 | '') ;; |
| 108 | *) ccflags=$DEFS;; |
| 109 | esac |
| 110 | case "$CFLAGS" in |
| 111 | '') ;; |
| 112 | *) ccflags="$ccflags $CFLAGS";; |
| 113 | esac |
| 114 | case "$ccflags" in |
| 115 | '') ;; |
| 116 | *) opts="$opts -Dccflags='$ccflags'";; |
| 117 | esac |
| 118 | case "$LDFLAGS" in |
| 119 | '') ;; |
| 120 | *) ldflags="$ldflags $LDFLAGS";; |
| 121 | esac |
| 122 | case "$ldflags" in |
| 123 | '') ;; |
| 124 | *) opts="$opts -Dldflags='$ldflags'";; |
| 125 | esac |
| 126 | |
| 127 | # Don't use -s if they want verbose mode |
| 128 | case "$verbose" in |
| 129 | '') copt="$copt -ds";; |
| 130 | *) copt="$copt -d";; |
| 131 | esac |
| 132 | |
| 133 | eval "set X sh Configure $copt $create $opts" |
| 134 | shift |
| 135 | echo "$@" |
| 136 | exec "$@" |