Imported Upstream version 1.12
[platform/upstream/ed.git] / configure
1 #! /bin/sh
2 # configure script for GNU ed - The GNU line editor
3 # Copyright (C) 2006-2015 Antonio Diaz Diaz.
4 #
5 # This configure script is free software: you have unlimited permission
6 # to copy, distribute and modify it.
7
8 pkgname=ed
9 pkgversion=1.12
10 progname=ed
11 srctrigger=doc/${pkgname}.texi
12
13 # clear some things potentially inherited from environment.
14 LC_ALL=C
15 export LC_ALL
16 srcdir=
17 prefix=/usr/local
18 exec_prefix='$(prefix)'
19 bindir='$(exec_prefix)/bin'
20 datarootdir='$(prefix)/share'
21 infodir='$(datarootdir)/info'
22 mandir='$(datarootdir)/man'
23 program_prefix=
24 CC=gcc
25 CPPFLAGS=
26 CFLAGS='-Wall -W -O2'
27 LDFLAGS=
28
29 # checking whether we are using GNU C.
30 ${CC} --version > /dev/null 2>&1
31 if [ $? != 0 ] ; then
32         CC=cc
33         CFLAGS='-W -O2'
34 fi
35
36 # Loop over all args
37 args=
38 no_create=
39 while [ $# != 0 ] ; do
40
41         # Get the first arg, and shuffle
42         option=$1 ; arg2=no
43         shift
44
45         # Add the argument quoted to args
46         args="${args} \"${option}\""
47
48         # Split out the argument for options that take them
49         case ${option} in
50         *=*) optarg=`echo ${option} | sed -e 's,^[^=]*=,,;s,/$,,'` ;;
51         esac
52
53         # Process the options
54         case ${option} in
55         --help | -h)
56                 echo "Usage: configure [options]"
57                 echo
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}]"
73                 echo
74                 exit 0 ;;
75         --version | -V)
76                 echo "Configure script for GNU ${pkgname} version ${pkgversion}"
77                 exit 0 ;;
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 ;;
86
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 ;;
96
97         CC=*)             CC=${optarg} ;;
98         CPPFLAGS=*) CPPFLAGS=${optarg} ;;
99         CFLAGS=*)     CFLAGS=${optarg} ;;
100         LDFLAGS=*)   LDFLAGS=${optarg} ;;
101
102         --*)
103                 echo "configure: WARNING: unrecognized option: '${option}'" 1>&2 ;;
104         *=* | *-*-*) ;;
105         *)
106                 echo "configure: unrecognized option: '${option}'" 1>&2
107                 echo "Try 'configure --help' for more information." 1>&2
108                 exit 1 ;;
109         esac
110
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
115                         exit 1
116                 fi
117         fi
118 done
119
120 # Find the source files, if location was not specified.
121 srcdirtext=
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,^$,.,'`
128         fi
129 fi
130
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
134         exit 1
135 fi
136
137 # Set srcdir to . if that's what it is.
138 if [ "`pwd`" = "`cd "${srcdir}" ; pwd`" ] ; then srcdir=. ; fi
139
140 echo
141 if [ -z "${no_create}" ] ; then
142         echo "creating config.status"
143         rm -f config.status
144         cat > config.status << EOF
145 #! /bin/sh
146 # This file was generated automatically by configure. Do not edit.
147 # Run this file to recreate the current configuration.
148 #
149 # This script is free software: you have unlimited permission
150 # to copy, distribute and modify it.
151
152 exec /bin/sh $0 ${args} --no-create
153 EOF
154         chmod +x config.status
155 fi
156
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}"
166 echo "CC = ${CC}"
167 echo "CPPFLAGS = ${CPPFLAGS}"
168 echo "CFLAGS = ${CFLAGS}"
169 echo "LDFLAGS = ${LDFLAGS}"
170 rm -f Makefile
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.
175 #
176 # This Makefile is free software: you have unlimited permission
177 # to copy, distribute and modify it.
178
179 pkgname = ${pkgname}
180 pkgversion = ${pkgversion}
181 progname = ${progname}
182 VPATH = ${srcdir}
183 prefix = ${prefix}
184 exec_prefix = ${exec_prefix}
185 bindir = ${bindir}
186 datarootdir = ${datarootdir}
187 infodir = ${infodir}
188 mandir = ${mandir}
189 program_prefix = ${program_prefix}
190 CC = ${CC}
191 CPPFLAGS = ${CPPFLAGS}
192 CFLAGS = ${CFLAGS}
193 LDFLAGS = ${LDFLAGS}
194 EOF
195 cat "${srcdir}/Makefile.in" >> Makefile
196
197 echo "OK. Now you can run make."