2 # configure script for GNU ed - The GNU line editor
3 # Copyright (C) 2006-2015 Antonio Diaz Diaz.
5 # This configure script is free software: you have unlimited permission
6 # to copy, distribute and modify it.
11 srctrigger=doc/${pkgname}.texi
13 # clear some things potentially inherited from environment.
18 exec_prefix='$(prefix)'
19 bindir='$(exec_prefix)/bin'
20 datarootdir='$(prefix)/share'
21 infodir='$(datarootdir)/info'
22 mandir='$(datarootdir)/man'
29 # checking whether we are using GNU C.
30 ${CC} --version > /dev/null 2>&1
39 while [ $# != 0 ] ; do
41 # Get the first arg, and shuffle
45 # Add the argument quoted to args
46 args="${args} \"${option}\""
48 # Split out the argument for options that take them
50 *=*) optarg=`echo ${option} | sed -e 's,^[^=]*=,,;s,/$,,'` ;;
56 echo "Usage: configure [options]"
58 echo "Options: [defaults in brackets]"
59 echo " -h, --help display this help and exit"
60 echo " -V, --version output version information and exit"
61 echo " --srcdir=DIR find the sources in DIR [. or ..]"
62 echo " --prefix=DIR install into DIR [${prefix}]"
63 echo " --exec-prefix=DIR base directory for arch-dependent files [${exec_prefix}]"
64 echo " --bindir=DIR user executables directory [${bindir}]"
65 echo " --datarootdir=DIR base directory for doc and data [${datarootdir}]"
66 echo " --infodir=DIR info files directory [${infodir}]"
67 echo " --mandir=DIR man pages directory [${mandir}]"
68 echo " --program-prefix=NAME install program and documentation prefixed with NAME"
69 echo " CC=COMPILER C compiler to use [${CC}]"
70 echo " CPPFLAGS=OPTIONS command line options for the preprocessor [${CPPFLAGS}]"
71 echo " CFLAGS=OPTIONS command line options for the C compiler [${CFLAGS}]"
72 echo " LDFLAGS=OPTIONS command line options for the linker [${LDFLAGS}]"
76 echo "Configure script for GNU ${pkgname} version ${pkgversion}"
78 --srcdir) srcdir=$1 ; arg2=yes ;;
79 --prefix) prefix=$1 ; arg2=yes ;;
80 --exec-prefix) exec_prefix=$1 ; arg2=yes ;;
81 --bindir) bindir=$1 ; arg2=yes ;;
82 --datarootdir) datarootdir=$1 ; arg2=yes ;;
83 --infodir) infodir=$1 ; arg2=yes ;;
84 --mandir) mandir=$1 ; arg2=yes ;;
85 --program-prefix) program_prefix=$1 ; arg2=yes ;;
87 --srcdir=*) srcdir=${optarg} ;;
88 --prefix=*) prefix=${optarg} ;;
89 --exec-prefix=*) exec_prefix=${optarg} ;;
90 --bindir=*) bindir=${optarg} ;;
91 --datarootdir=*) datarootdir=${optarg} ;;
92 --infodir=*) infodir=${optarg} ;;
93 --mandir=*) mandir=${optarg} ;;
94 --program-prefix=*) program_prefix=${optarg} ;;
95 --no-create) no_create=yes ;;
98 CPPFLAGS=*) CPPFLAGS=${optarg} ;;
99 CFLAGS=*) CFLAGS=${optarg} ;;
100 LDFLAGS=*) LDFLAGS=${optarg} ;;
103 echo "configure: WARNING: unrecognized option: '${option}'" 1>&2 ;;
106 echo "configure: unrecognized option: '${option}'" 1>&2
107 echo "Try 'configure --help' for more information." 1>&2
111 # Check if the option took a separate argument
112 if [ "${arg2}" = yes ] ; then
113 if [ $# != 0 ] ; then args="${args} \"$1\"" ; shift
114 else echo "configure: Missing argument to '${option}'" 1>&2
120 # Find the source files, if location was not specified.
122 if [ -z "${srcdir}" ] ; then
123 srcdirtext="or . or .." ; srcdir=.
124 if [ ! -r "${srcdir}/${srctrigger}" ] ; then srcdir=.. ; fi
125 if [ ! -r "${srcdir}/${srctrigger}" ] ; then
126 ## the sed command below emulates the dirname command
127 srcdir=`echo $0 | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
131 if [ ! -r "${srcdir}/${srctrigger}" ] ; then
132 echo "configure: Can't find sources in ${srcdir} ${srcdirtext}" 1>&2
133 echo "configure: (At least ${srctrigger} is missing)." 1>&2
137 # Set srcdir to . if that's what it is.
138 if [ "`pwd`" = "`cd "${srcdir}" ; pwd`" ] ; then srcdir=. ; fi
141 if [ -z "${no_create}" ] ; then
142 echo "creating config.status"
144 cat > config.status << EOF
146 # This file was generated automatically by configure. Do not edit.
147 # Run this file to recreate the current configuration.
149 # This script is free software: you have unlimited permission
150 # to copy, distribute and modify it.
152 exec /bin/sh $0 ${args} --no-create
154 chmod +x config.status
157 echo "creating Makefile"
158 echo "VPATH = ${srcdir}"
159 echo "prefix = ${prefix}"
160 echo "exec_prefix = ${exec_prefix}"
161 echo "bindir = ${bindir}"
162 echo "datarootdir = ${datarootdir}"
163 echo "infodir = ${infodir}"
164 echo "mandir = ${mandir}"
165 echo "program_prefix = ${program_prefix}"
167 echo "CPPFLAGS = ${CPPFLAGS}"
168 echo "CFLAGS = ${CFLAGS}"
169 echo "LDFLAGS = ${LDFLAGS}"
171 cat > Makefile << EOF
172 # Makefile for GNU ed - The GNU line editor
173 # Copyright (C) 2006-2015 Antonio Diaz Diaz.
174 # This file was generated automatically by configure. Do not edit.
176 # This Makefile is free software: you have unlimited permission
177 # to copy, distribute and modify it.
180 pkgversion = ${pkgversion}
181 progname = ${progname}
184 exec_prefix = ${exec_prefix}
186 datarootdir = ${datarootdir}
189 program_prefix = ${program_prefix}
191 CPPFLAGS = ${CPPFLAGS}
195 cat "${srcdir}/Makefile.in" >> Makefile
197 echo "OK. Now you can run make."