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