Blame configure

Packit Bot a3ac83
#! /bin/sh
Packit Bot a3ac83
# configure script for GNU ed - The GNU line editor
Packit Bot a3ac83
# Copyright (C) 2006-2017 Antonio Diaz Diaz.
Packit Bot a3ac83
#
Packit Bot a3ac83
# This configure script is free software: you have unlimited permission
Packit Bot a3ac83
# to copy, distribute and modify it.
Packit Bot a3ac83
Packit Bot a3ac83
pkgname=ed
Packit Bot a3ac83
pkgversion=1.14.2
Packit Bot a3ac83
progname=ed
Packit Bot a3ac83
srctrigger=doc/${pkgname}.texi
Packit Bot a3ac83
Packit Bot a3ac83
# clear some things potentially inherited from environment.
Packit Bot a3ac83
LC_ALL=C
Packit Bot a3ac83
export LC_ALL
Packit Bot a3ac83
srcdir=
Packit Bot a3ac83
prefix=/usr/local
Packit Bot a3ac83
exec_prefix='$(prefix)'
Packit Bot a3ac83
bindir='$(exec_prefix)/bin'
Packit Bot a3ac83
datarootdir='$(prefix)/share'
Packit Bot a3ac83
infodir='$(datarootdir)/info'
Packit Bot a3ac83
mandir='$(datarootdir)/man'
Packit Bot a3ac83
program_prefix=
Packit Bot a3ac83
CC=gcc
Packit Bot a3ac83
CPPFLAGS=
Packit Bot a3ac83
CFLAGS='-Wall -W -O2'
Packit Bot a3ac83
LDFLAGS=
Packit Bot a3ac83
Packit Bot a3ac83
# checking whether we are using GNU C.
Packit Bot a3ac83
/bin/sh -c "${CC} --version" > /dev/null 2>&1 ||
Packit Bot a3ac83
	{
Packit Bot a3ac83
	CC=cc
Packit Bot a3ac83
	CFLAGS=-O2
Packit Bot a3ac83
	}
Packit Bot a3ac83
Packit Bot a3ac83
# Loop over all args
Packit Bot a3ac83
args=
Packit Bot a3ac83
no_create=
Packit Bot a3ac83
while [ $# != 0 ] ; do
Packit Bot a3ac83
Packit Bot a3ac83
	# Get the first arg, and shuffle
Packit Bot a3ac83
	option=$1 ; arg2=no
Packit Bot a3ac83
	shift
Packit Bot a3ac83
Packit Bot a3ac83
	# Add the argument quoted to args
Packit Bot a3ac83
	args="${args} \"${option}\""
Packit Bot a3ac83
Packit Bot a3ac83
	# Split out the argument for options that take them
Packit Bot a3ac83
	case ${option} in
Packit Bot a3ac83
	*=*) optarg=`echo ${option} | sed -e 's,^[^=]*=,,;s,/$,,'` ;;
Packit Bot a3ac83
	esac
Packit Bot a3ac83
Packit Bot a3ac83
	# Process the options
Packit Bot a3ac83
	case ${option} in
Packit Bot a3ac83
	--help | -h)
Packit Bot a3ac83
		echo "Usage: $0 [OPTION]... [VAR=VALUE]..."
Packit Bot a3ac83
		echo
Packit Bot a3ac83
		echo "To assign makefile variables (e.g., CC, CFLAGS...), specify them as"
Packit Bot a3ac83
		echo "arguments to configure in the form VAR=VALUE."
Packit Bot a3ac83
		echo
Packit Bot a3ac83
		echo "Options: [defaults in brackets]"
Packit Bot a3ac83
		echo "  -h, --help            display this help and exit"
Packit Bot a3ac83
		echo "  -V, --version         output version information and exit"
Packit Bot a3ac83
		echo "  --srcdir=DIR          find the sources in DIR [. or ..]"
Packit Bot a3ac83
		echo "  --prefix=DIR          install into DIR [${prefix}]"
Packit Bot a3ac83
		echo "  --exec-prefix=DIR     base directory for arch-dependent files [${exec_prefix}]"
Packit Bot a3ac83
		echo "  --bindir=DIR          user executables directory [${bindir}]"
Packit Bot a3ac83
		echo "  --datarootdir=DIR     base directory for doc and data [${datarootdir}]"
Packit Bot a3ac83
		echo "  --infodir=DIR         info files directory [${infodir}]"
Packit Bot a3ac83
		echo "  --mandir=DIR          man pages directory [${mandir}]"
Packit Bot a3ac83
		echo "  --program-prefix=NAME install program and documentation prefixed with NAME"
Packit Bot a3ac83
		echo "  CC=COMPILER           C compiler to use [${CC}]"
Packit Bot a3ac83
		echo "  CPPFLAGS=OPTIONS      command line options for the preprocessor [${CPPFLAGS}]"
Packit Bot a3ac83
		echo "  CFLAGS=OPTIONS        command line options for the C compiler [${CFLAGS}]"
Packit Bot a3ac83
		echo "  LDFLAGS=OPTIONS       command line options for the linker [${LDFLAGS}]"
Packit Bot a3ac83
		echo
Packit Bot a3ac83
		exit 0 ;;
Packit Bot a3ac83
	--version | -V)
Packit Bot a3ac83
		echo "Configure script for GNU ${pkgname} version ${pkgversion}"
Packit Bot a3ac83
		exit 0 ;;
Packit Bot a3ac83
	--srcdir)            srcdir=$1 ; arg2=yes ;;
Packit Bot a3ac83
	--prefix)            prefix=$1 ; arg2=yes ;;
Packit Bot a3ac83
	--exec-prefix)  exec_prefix=$1 ; arg2=yes ;;
Packit Bot a3ac83
	--bindir)            bindir=$1 ; arg2=yes ;;
Packit Bot a3ac83
	--datarootdir)  datarootdir=$1 ; arg2=yes ;;
Packit Bot a3ac83
	--infodir)          infodir=$1 ; arg2=yes ;;
Packit Bot a3ac83
	--mandir)            mandir=$1 ; arg2=yes ;;
Packit Bot a3ac83
	--program-prefix) program_prefix=$1 ; arg2=yes ;;
Packit Bot a3ac83
Packit Bot a3ac83
	--srcdir=*)            srcdir=${optarg} ;;
Packit Bot a3ac83
	--prefix=*)            prefix=${optarg} ;;
Packit Bot a3ac83
	--exec-prefix=*)  exec_prefix=${optarg} ;;
Packit Bot a3ac83
	--bindir=*)            bindir=${optarg} ;;
Packit Bot a3ac83
	--datarootdir=*)  datarootdir=${optarg} ;;
Packit Bot a3ac83
	--infodir=*)          infodir=${optarg} ;;
Packit Bot a3ac83
	--mandir=*)            mandir=${optarg} ;;
Packit Bot a3ac83
	--program-prefix=*) program_prefix=${optarg} ;;
Packit Bot a3ac83
	--no-create)              no_create=yes ;;
Packit Bot a3ac83
Packit Bot a3ac83
	CC=*)             CC=${optarg} ;;
Packit Bot a3ac83
	CPPFLAGS=*) CPPFLAGS=${optarg} ;;
Packit Bot a3ac83
	CFLAGS=*)     CFLAGS=${optarg} ;;
Packit Bot a3ac83
	LDFLAGS=*)   LDFLAGS=${optarg} ;;
Packit Bot a3ac83
Packit Bot a3ac83
	--*)
Packit Bot a3ac83
		echo "configure: WARNING: unrecognized option: '${option}'" 1>&2 ;;
Packit Bot a3ac83
	*=* | *-*-*) ;;
Packit Bot a3ac83
	*)
Packit Bot a3ac83
		echo "configure: unrecognized option: '${option}'" 1>&2
Packit Bot a3ac83
		echo "Try 'configure --help' for more information." 1>&2
Packit Bot a3ac83
		exit 1 ;;
Packit Bot a3ac83
	esac
Packit Bot a3ac83
Packit Bot a3ac83
	# Check if the option took a separate argument
Packit Bot a3ac83
	if [ "${arg2}" = yes ] ; then
Packit Bot a3ac83
		if [ $# != 0 ] ; then args="${args} \"$1\"" ; shift
Packit Bot a3ac83
		else echo "configure: Missing argument to '${option}'" 1>&2
Packit Bot a3ac83
			exit 1
Packit Bot a3ac83
		fi
Packit Bot a3ac83
	fi
Packit Bot a3ac83
done
Packit Bot a3ac83
Packit Bot a3ac83
# Find the source files, if location was not specified.
Packit Bot a3ac83
srcdirtext=
Packit Bot a3ac83
if [ -z "${srcdir}" ] ; then
Packit Bot a3ac83
	srcdirtext="or . or .." ; srcdir=.
Packit Bot a3ac83
	if [ ! -r "${srcdir}/${srctrigger}" ] ; then srcdir=.. ; fi
Packit Bot a3ac83
	if [ ! -r "${srcdir}/${srctrigger}" ] ; then
Packit Bot a3ac83
		## the sed command below emulates the dirname command
Packit Bot a3ac83
		srcdir=`echo $0 | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
Packit Bot a3ac83
	fi
Packit Bot a3ac83
fi
Packit Bot a3ac83
Packit Bot a3ac83
if [ ! -r "${srcdir}/${srctrigger}" ] ; then
Packit Bot a3ac83
	echo "configure: Can't find sources in ${srcdir} ${srcdirtext}" 1>&2
Packit Bot a3ac83
	echo "configure: (At least ${srctrigger} is missing)." 1>&2
Packit Bot a3ac83
	exit 1
Packit Bot a3ac83
fi
Packit Bot a3ac83
Packit Bot a3ac83
# Set srcdir to . if that's what it is.
Packit Bot a3ac83
if [ "`pwd`" = "`cd "${srcdir}" ; pwd`" ] ; then srcdir=. ; fi
Packit Bot a3ac83
Packit Bot a3ac83
echo
Packit Bot a3ac83
if [ -z "${no_create}" ] ; then
Packit Bot a3ac83
	echo "creating config.status"
Packit Bot a3ac83
	rm -f config.status
Packit Bot a3ac83
	cat > config.status << EOF
Packit Bot a3ac83
#! /bin/sh
Packit Bot a3ac83
# This file was generated automatically by configure. Don't edit.
Packit Bot a3ac83
# Run this file to recreate the current configuration.
Packit Bot a3ac83
#
Packit Bot a3ac83
# This script is free software: you have unlimited permission
Packit Bot a3ac83
# to copy, distribute and modify it.
Packit Bot a3ac83
Packit Bot a3ac83
exec /bin/sh $0 ${args} --no-create
Packit Bot a3ac83
EOF
Packit Bot a3ac83
	chmod +x config.status
Packit Bot a3ac83
fi
Packit Bot a3ac83
Packit Bot a3ac83
echo "creating Makefile"
Packit Bot a3ac83
echo "VPATH = ${srcdir}"
Packit Bot a3ac83
echo "prefix = ${prefix}"
Packit Bot a3ac83
echo "exec_prefix = ${exec_prefix}"
Packit Bot a3ac83
echo "bindir = ${bindir}"
Packit Bot a3ac83
echo "datarootdir = ${datarootdir}"
Packit Bot a3ac83
echo "infodir = ${infodir}"
Packit Bot a3ac83
echo "mandir = ${mandir}"
Packit Bot a3ac83
echo "program_prefix = ${program_prefix}"
Packit Bot a3ac83
echo "CC = ${CC}"
Packit Bot a3ac83
echo "CPPFLAGS = ${CPPFLAGS}"
Packit Bot a3ac83
echo "CFLAGS = ${CFLAGS}"
Packit Bot a3ac83
echo "LDFLAGS = ${LDFLAGS}"
Packit Bot a3ac83
rm -f Makefile
Packit Bot a3ac83
cat > Makefile << EOF
Packit Bot a3ac83
# Makefile for GNU ed - The GNU line editor
Packit Bot a3ac83
# Copyright (C) 2006-2017 Antonio Diaz Diaz.
Packit Bot a3ac83
# This file was generated automatically by configure. Don't edit.
Packit Bot a3ac83
#
Packit Bot a3ac83
# This Makefile is free software: you have unlimited permission
Packit Bot a3ac83
# to copy, distribute and modify it.
Packit Bot a3ac83
Packit Bot a3ac83
pkgname = ${pkgname}
Packit Bot a3ac83
pkgversion = ${pkgversion}
Packit Bot a3ac83
progname = ${progname}
Packit Bot a3ac83
VPATH = ${srcdir}
Packit Bot a3ac83
prefix = ${prefix}
Packit Bot a3ac83
exec_prefix = ${exec_prefix}
Packit Bot a3ac83
bindir = ${bindir}
Packit Bot a3ac83
datarootdir = ${datarootdir}
Packit Bot a3ac83
infodir = ${infodir}
Packit Bot a3ac83
mandir = ${mandir}
Packit Bot a3ac83
program_prefix = ${program_prefix}
Packit Bot a3ac83
CC = ${CC}
Packit Bot a3ac83
CPPFLAGS = ${CPPFLAGS}
Packit Bot a3ac83
CFLAGS = ${CFLAGS}
Packit Bot a3ac83
LDFLAGS = ${LDFLAGS}
Packit Bot a3ac83
EOF
Packit Bot a3ac83
cat "${srcdir}/Makefile.in" >> Makefile
Packit Bot a3ac83
Packit Bot a3ac83
echo "OK. Now you can run make."