-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
265 lines (234 loc) · 6.37 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT(Makefile.in)
dnl If CFLAGS isn't defined and using gcc, set CFLAGS to something reasonable.
dnl Otherwise, just prevent autoconf from molesting CFLAGS.
CFLAGS=$CFLAGS
AC_PROG_CC
if test "x$CFLAGS" = "x" ; then
no_CFLAGS="yes"
fi
if test "x$no_CFLAGS" = "xyes" -a "x$GCC" = "xyes" ; then
CFLAGS="-Wall -pipe -g3"
fi
A_CFLAGS=""
AC_SUBST(A_CFLAGS)
S_CFLAGS="-fPIC -DPIC"
AC_SUBST(S_CFLAGS)
AC_PROG_CPP
AC_PROG_AWK
dnl Must do this now, otherwise it is only done for NetBSD (see 'case' below)
dnl Platform-specific settings. The ABI can probably be determined
dnl programmatically, but doing so is error-prone, which makes it generally
dnl not worth the trouble.
AC_CANONICAL_HOST
case "${host}" in
*-*-darwin*)
CFLAGS="$CFLAGS -fno-common -no-cpp-precomp"
ABI="macho"
;;
*-*-freebsd*)
ABI="elf"
;;
*-*-linux*)
ABI="elf"
;;
*-*-netbsd*)
AC_MSG_CHECKING(ABI)
AC_EGREP_CPP(yes,
[#ifdef __ELF__
yes
#endif
],
ABI="elf",
ABI="aout")
AC_MSG_RESULT($ABI)
;;
*-*-solaris2*)
ABI="elf"
AC_DEFINE([SUNOS],[],[Solaris])
;;
*-*-hpux*)
ABI="elf"
;;
*)
AC_MSG_RESULT(Unsupported operating system: ${host})
ABI="elf"
;;
esac
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PATH_PROGS(AR, ar gar, , $PATH)
dnl Search for termcap access routines in termcap, tinfo, curses, and ncurses.
AC_CHECK_LIB([termcap], [tgetent], , \
[AC_CHECK_LIB([tinfo], [tgetent], , \
[AC_CHECK_LIB([curses], [tgetent], , \
[AC_CHECK_LIB([ncurses], [tgetent], , \
[AC_MSG_ERROR(termcap support not found)])])])])
dnl Use termcap.h if it exists; otherwise we need both term.h and [n]curses.h.
AC_CHECK_HEADERS(termcap.h term.h)
AC_CHECK_HEADERS(curses.h ncurses.h)
AC_CHECK_HEADERS(sys/cdefs.h vis.h alloca.h)
AC_CHECK_FUNCS(issetugid)
AC_CHECK_FUNCS(strlcat, , CCSRCS="$CCSRCS np/strlcat.c")
AC_CHECK_FUNCS(strlcpy, , CCSRCS="$CCSRCS np/strlcpy.c")
AC_CHECK_FUNCS(fgetln, , CCSRCS="$CCSRCS np/fgetln.c")
AC_CHECK_FUNCS(strvis, , CCSRCS="$CCSRCS np/vis.c")
AC_CHECK_FUNCS(strunvis, , CCSRCS="$CCSRCS np/unvis.c")
AC_EGREP_CPP(found,
[#include <sys/cdefs.h>
#ifdef __RCSID
found
#endif
], , [CPPFLAGS="$CPPFLAGS '-D__RCSID(x)='"])
AC_EGREP_CPP(found,
[#include <sys/cdefs.h>
#ifdef __COPYRIGHT
found
#endif
], , [CPPFLAGS="$CPPFLAGS '-D__COPYRIGHT(x)='"])
AC_EGREP_CPP(found,
[#include <sys/cdefs.h>
#ifdef __RENAME
found
#endif
], , [CPPFLAGS="$CPPFLAGS '-D__RENAME(x)='"])
AC_EGREP_CPP(found,
[#include <sys/cdefs.h>
#ifdef _DIAGASSERT
found
#endif
], , [CPPFLAGS="$CPPFLAGS '-D_DIAGASSERT(x)='"])
dnl Enable readline compatibility by default.
AC_ARG_ENABLE(readline, [ --disable-readline Disable readline compatibility],
if test "x$enable_readline" != "xyes" ; then
enable_readline="no"
fi
,
enable_readline="yes"
)
dnl Optionally enable debugging.
AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging code],
if test "x$enable_debug" != "xyes" ; then
enable_debug="no"
fi
,
enable_debug="no"
)
if test "x$enable_debug" = "xyes" ; then
CPPFLAGS="$CPPFLAGS -DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG"
CPPFLAGS="$CPPFLAGS -DDEBUG_REFRESH -DDEBUG_PASTE"
else
CFLAGS="$CFLAGS -O"
fi
dnl
dnl File lists. This is done here instead of in the Makefile in order to avoid
dnl the need for conditionals.
dnl
dnl .c files.
ACSRCS="common.c emacs.c vi.c"
BCSRCS="chared.c el.c hist.c filecomplete.c key.c map.c parse.c prompt.c read.c refresh.c search.c sig.c term.c tty.c"
CCSRCS="$CCSRCS history.c tokenizer.c"
dnl Generated .c files.
AGCSRCS="fcns.c help.c"
BGCSRCS="editline.c"
dnl .h files.
HDRS="chared.h el.h hist.h filecomplete.h key.h map.h parse.h prompt.h refresh.h search.h sig.h sys.h term.h tokenizer.h tty.h"
dnl Installed .h files.
IHDRS="histedit.h"
dnl Installed headers for readline compatibility.
IHDR_LINKS=
dnl Generated .h files.
AGHDRS="common.h emacs.h vi.h"
BGHDRS="fcns.h help.h"
dnl Header installation directories.
HDR_DIRS="include"
dnl Man pages.
MAN3="editline.3"
MAN5="editrc.5"
MAN3_LINKS=
for i in el_init.3 el_end.3 el_reset.3 el_gets.3 el_getc.3 el_push.3 \
el_parse.3 el_set.3 el_get.3 el_source.3 el_resize.3 el_line.3 \
el_insertstr.3 el_deletestr.3 history_init.3 history_end.3 \
history.3 ; do
MAN3_LINKS="$MAN3_LINKS editline.3 $i"
done
dnl Man page installation directories.
MAN_DIRS="man/man3 man/man5"
dnl Library settings.
LIB_DIRS="lib"
LIB_MAJOR="2"
LIB_MINOR="6"
LIB_A="libedit.a"
LIB_A_LINKS=
if test "x$ABI" = "xelf" ; then
LIB_S="libedit.so.$LIB_MAJOR"
LIB_S_LINK="libedit.so"
LIB_S_LINKS="$LIB_S $LIB_S_LINK"
S_LDFLAGS="-shared"
elif test "x$ABI" = "xaout" ; then
LIB_S="libedit.so.$LIB_MAJOR.$LIB_MINOR"
LIB_S_LINKS=
S_LDFLAGS="-shared"
elif test "x$ABI" = "xmacho" ; then
S_LDFLAGS="-shared"
LIB_S="libedit.$LIB_MAJOR.dylib"
LIB_S_LINK="libedit.dylib"
LIB_S_LINKS="$LIB_S $LIB_S_LINK"
if test "x$prefix" = "xNONE" ; then
S_LDFLAGS="-dynamiclib -compatibility_version $LIB_MAJOR -current_version $LIB_MAJOR -install_name /usr/local/lib/$LIB_S -lncurses"
else
S_LDFLAGS="-dynamiclib -compatibility_version $LIB_MAJOR -current_version $LIB_MAJOR -install_name $prefix/lib/$LIB_S -lncurses"
fi
fi
dnl Test program.
TEST="TEST/test"
TCSRCS="TEST/test.c"
dnl Add files to the lists if readline compatibility is enabled.
if test "x$enable_readline" = "xyes" ; then
CCSRCS="$CCSRCS readline.c"
IHDRS="$IHDRS readline/readline.h"
IHDR_LINKS="readline.h readline/history.h"
HDR_DIRS="$HDR_DIRS include/readline"
LIB_A_LINKS="$LIB_A_LINKS libedit.a libreadline.a"
if test "x$ABI" = "xelf" ; then
LIB_S_LINKS="$LIB_S_LINKS $LIB_S_LINK libreadline.so"
elif test "x$ABI" = "xaout" ; then
LIB_S_LINKS="$LIB_S_LINKS $LIB_S libreadline.so.$LIB_MAJOR.$LIB_MINOR"
elif test "x$ABI" = "xmacho" ; then
LIB_S_LINKS="$LIB_S_LINKS $LIB_S_LINK libreadline.dylib"
fi
fi
case "${host}" in
*-*-hpux*)
S_LDFLAGS="-shared -fPIC"
;;
esac
AC_SUBST(ACSRCS)
AC_SUBST(BCSRCS)
AC_SUBST(CCSRCS)
AC_SUBST(AGCSRCS)
AC_SUBST(BGCSRCS)
AC_SUBST(HDRS)
AC_SUBST(IHDRS)
AC_SUBST(IHDR_LINKS)
AC_SUBST(AGHDRS)
AC_SUBST(BGHDRS)
AC_SUBST(HDR_DIRS)
AC_SUBST(MAN3)
AC_SUBST(MAN5)
AC_SUBST(MAN3_LINKS)
AC_SUBST(MAN_DIRS)
AC_SUBST(LIB_DIRS)
AC_SUBST(LIB_VER)
AC_SUBST(LIB_A)
AC_SUBST(LIB_A_LINKS)
AC_SUBST(LIB_S)
AC_SUBST(LIB_S_LINKS)
AC_SUBST(S_LDFLAGS)
AC_SUBST(TEST)
AC_SUBST(TCSRCS)
AC_CONFIG_HEADER(config.h)
AH_BOTTOM([#include "sys.h"])
AC_OUTPUT(Makefile makelist)