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