1 |
dnl |
2 |
dnl originally from ncftp 2.3.0 |
3 |
dnl added wi_EXTRA_PDIR and wi_ANSI_C |
4 |
dnl $Id$ |
5 |
dnl |
6 |
AC_DEFUN(wi_EXTRA_IDIR, [ |
7 |
incdir="$1" |
8 |
if test -r $incdir ; then |
9 |
case "$CPPFLAGS" in |
10 |
*-I${incdir}*) |
11 |
# echo " + already had $incdir" 1>&6 |
12 |
;; |
13 |
*) |
14 |
if test "$CPPFLAGS" = "" ; then |
15 |
CPPFLAGS="-I$incdir" |
16 |
else |
17 |
CPPFLAGS="$CPPFLAGS -I$incdir" |
18 |
fi |
19 |
echo " + found $incdir" 1>&6 |
20 |
;; |
21 |
esac |
22 |
fi |
23 |
]) |
24 |
dnl |
25 |
dnl |
26 |
dnl |
27 |
dnl |
28 |
AC_DEFUN(wi_EXTRA_LDIR, [ |
29 |
libdir="$1" |
30 |
if test -r $libdir ; then |
31 |
case "$LDFLAGS" in |
32 |
*-L${libdir}*) |
33 |
# echo " + already had $libdir" 1>&6 |
34 |
;; |
35 |
*) |
36 |
if test "$LDFLAGS" = "" ; then |
37 |
LDFLAGS="-L$libdir" |
38 |
else |
39 |
LDFLAGS="$LDFLAGS -L$libdir" |
40 |
fi |
41 |
echo " + found $libdir" 1>&6 |
42 |
;; |
43 |
esac |
44 |
fi |
45 |
]) |
46 |
dnl |
47 |
dnl __FP__ |
48 |
dnl |
49 |
dnl |
50 |
AC_DEFUN(wi_EXTRA_PDIR, [ |
51 |
progdir="$1" |
52 |
if test -r $progdir ; then |
53 |
case "$PATH" in |
54 |
*:${progdir}*) |
55 |
# echo " + already had $progdir" 1>&6 |
56 |
;; |
57 |
*${progdir}:*) |
58 |
# echo " + already had $progdir" 1>&6 |
59 |
;; |
60 |
*) |
61 |
if test "$PATH" = "" ; then |
62 |
PATH="$progdir" |
63 |
else |
64 |
PATH="$PATH:$progdir" |
65 |
fi |
66 |
echo " + found $progdir" 1>&6 |
67 |
;; |
68 |
esac |
69 |
fi |
70 |
]) |
71 |
dnl |
72 |
dnl |
73 |
dnl If you want to also look for include and lib subdirectories in the |
74 |
dnl $HOME tree, you supply "yes" as the first argument to this macro. |
75 |
dnl |
76 |
dnl If you want to look for subdirectories in include/lib directories, |
77 |
dnl you pass the names in argument 3, otherwise pass a dash. |
78 |
dnl |
79 |
AC_DEFUN(wi_EXTRA_DIRS, [echo "checking for extra include and lib directories..." 1>&6 |
80 |
ifelse([$1], yes, [dnl |
81 |
b1=`cd .. ; pwd` |
82 |
b2=`cd ../.. ; pwd` |
83 |
exdirs="$HOME $j $b1 $b2 $prefix $2" |
84 |
],[dnl |
85 |
exdirs="$prefix $2" |
86 |
]) |
87 |
subexdirs="$3" |
88 |
if test "$subexdirs" = "" ; then |
89 |
subexdirs="-" |
90 |
fi |
91 |
for subexdir in $subexdirs ; do |
92 |
if test "$subexdir" = "-" ; then |
93 |
subexdir="" |
94 |
else |
95 |
subexdir="/$subexdir" |
96 |
fi |
97 |
for exdir in $exdirs ; do |
98 |
if test "$exdir" != "/usr" || test "$subexdir" != ""; then |
99 |
incdir="${exdir}/include${subexdir}" |
100 |
wi_EXTRA_IDIR($incdir) |
101 |
|
102 |
libdir="${exdir}/lib${subexdir}" |
103 |
wi_EXTRA_LDIR($libdir) |
104 |
|
105 |
progdir="${exdir}/bin${subexdirr}" |
106 |
wi_EXTRA_PDIR($progdir) |
107 |
fi |
108 |
done |
109 |
done |
110 |
]) |
111 |
dnl |
112 |
dnl |
113 |
dnl |
114 |
AC_DEFUN(wi_HEADER_SYS_SELECT_H, [ |
115 |
# See if <sys/select.h> is includable after <sys/time.h> |
116 |
if test "$ac_cv_header_sys_time_h" = no ; then |
117 |
AC_CHECK_HEADERS(sys/time.h sys/select.h) |
118 |
else |
119 |
AC_CHECK_HEADERS(sys/select.h) |
120 |
fi |
121 |
if test "$ac_cv_header_sys_select_h" = yes ; then |
122 |
AC_MSG_CHECKING([if <sys/select.h> is compatible with <sys/time.h>]) |
123 |
selecth=yes |
124 |
if test "$ac_cv_header_sys_time_h" = yes ; then |
125 |
AC_TRY_COMPILE([#include <sys/time.h> |
126 |
#include <sys/select.h>],[ |
127 |
fd_set a; |
128 |
struct timeval tmval; |
129 |
|
130 |
tmval.tv_sec = 0;],selecth=yes,selecth=no) |
131 |
|
132 |
if test "$selecth" = yes ; then |
133 |
AC_DEFINE(CAN_USE_SYS_SELECT_H) |
134 |
fi |
135 |
fi |
136 |
AC_MSG_RESULT($selecth) |
137 |
fi |
138 |
]) |
139 |
dnl |
140 |
dnl |
141 |
dnl |
142 |
AC_DEFUN(wi_LIB_RESOLV, [ |
143 |
# See if we could access two well-known sites without help of any special |
144 |
# libraries, like resolv. |
145 |
|
146 |
AC_TRY_RUN([ |
147 |
#include <sys/types.h> |
148 |
#include <sys/socket.h> |
149 |
#include <netinet/in.h> |
150 |
#include <netdb.h> |
151 |
|
152 |
main() |
153 |
{ |
154 |
struct hostent *hp1, *hp2; |
155 |
int result; |
156 |
|
157 |
hp1 = gethostbyname("gatekeeper.dec.com"); |
158 |
hp2 = gethostbyname("ftp.ncsa.uiuc.edu"); |
159 |
result = ((hp1 != (struct hostent *) 0) && (hp2 != (struct hostent *) 0)); |
160 |
exit(! result); |
161 |
}],look_for_resolv=no,look_for_resolv=yes,look_for_resolv=yes) |
162 |
|
163 |
AC_MSG_CHECKING([if we need to look for -lresolv]) |
164 |
AC_MSG_RESULT($look_for_resolv) |
165 |
if test "$look_for_resolv" = yes ; then |
166 |
AC_CHECK_LIB(resolv,main) |
167 |
else |
168 |
ac_cv_lib_resolv=no |
169 |
fi |
170 |
]) |
171 |
dnl |
172 |
dnl |
173 |
dnl |
174 |
|
175 |
AC_DEFUN(wi_LIB_NSL, [ |
176 |
AC_MSG_CHECKING(if we can use -lnsl) |
177 |
ac_save_LIBS="$LIBS"; |
178 |
LIBS="$LIBS -lnsl"; |
179 |
AC_CACHE_VAL(r_cv_use_libnsl, [ |
180 |
AC_TRY_RUN( |
181 |
main() { if (getpwuid(getuid())) exit(0); exit(-1); }, |
182 |
nc_cv_use_libnsl=yes, nc_cv_use_libnsl=no, nc_cv_use_libnsl=no) |
183 |
]) |
184 |
if test "$nc_cv_use_libnsl" = "no"; then LIBS="$ac_save_LIBS"; fi |
185 |
AC_MSG_RESULT($nc_cv_use_libnsl) |
186 |
])dnl |
187 |
|
188 |
dnl |
189 |
dnl |
190 |
dnl |
191 |
|
192 |
AC_DEFUN(nc_PATH_PROG_ZCAT, [ |
193 |
AC_PATH_PROG(GZCAT,gzcat) |
194 |
AC_PATH_PROG(ZCAT,zcat) |
195 |
if test "x$GZCAT" = x ; then |
196 |
if test "x$ZCAT" != x ; then |
197 |
# See if zcat is really gzcat. gzcat has a --version option, regular |
198 |
# zcat does not. |
199 |
AC_MSG_CHECKING(if zcat is really gzcat in disguise) |
200 |
if $ZCAT --version 2> /dev/null ; then |
201 |
AC_DEFINE_UNQUOTED(GZCAT, "$ZCAT") |
202 |
AC_MSG_RESULT(yes) |
203 |
else |
204 |
AC_MSG_RESULT(no) |
205 |
fi |
206 |
fi |
207 |
else |
208 |
AC_DEFINE_UNQUOTED(GZCAT, "$GZCAT") |
209 |
fi |
210 |
|
211 |
if test "x$ZCAT" != x ; then |
212 |
AC_DEFINE_UNQUOTED(ZCAT, "$ZCAT") |
213 |
fi |
214 |
]) |
215 |
dnl |
216 |
dnl |
217 |
dnl |
218 |
AC_DEFUN(wi_SYSV_EXTRA_DIRS, [ |
219 |
# Use System V because their curses extensions are required. This must |
220 |
# be done early so we use the -I and -L in the library checks also. |
221 |
# This is mostly a Solaris/SunOS hack. Note that doing this will also |
222 |
# use all of the other System V libraries and headers. |
223 |
|
224 |
AC_MSG_CHECKING(for alternative System V libraries) |
225 |
if test -f /usr/5include/curses.h ; then |
226 |
CPPFLAGS="$CPPFLAGS -I/usr/5include" |
227 |
LDFLAGS="$LDFLAGS -L/usr/5lib" |
228 |
AC_MSG_RESULT(yes) |
229 |
else |
230 |
AC_MSG_RESULT(no) |
231 |
fi |
232 |
]) |
233 |
dnl |
234 |
dnl |
235 |
dnl |
236 |
AC_DEFUN(wi_DEFINE_UNAME, [ |
237 |
# Get first 127 chars of all uname information. Some folks have |
238 |
# way too much stuff there, so grab only the first 127. |
239 |
unam=`uname -a 2>/dev/null | cut -c1-127` |
240 |
if test "$unam" != "" ; then |
241 |
AC_DEFINE_UNQUOTED(UNAME, "$unam") |
242 |
fi |
243 |
]) |
244 |
dnl |
245 |
dnl |
246 |
dnl |
247 |
AC_DEFUN(wi_READLINE_WITH_NCURSES, [ |
248 |
# Readline and Ncurses could both define "backspace". |
249 |
# Warn about this if we have both things in our definitions list. |
250 |
|
251 |
if test "$ac_cv_lib_readline" = yes && test "$ac_cv_lib_ncurses" = yes ; then |
252 |
|
253 |
AC_MSG_CHECKING(if readline and ncurses will link together) |
254 |
j="$LIBS" |
255 |
LIBS="-lreadline -lncurses" |
256 |
AC_TRY_LINK(,[ |
257 |
readline("prompt"); |
258 |
endwin(); |
259 |
],k=yes,k=no) |
260 |
if test "$k" = no ; then |
261 |
AC_MSG_RESULT(no) |
262 |
# Remove '-lreadline' from LIBS. |
263 |
LIBS=`echo $j | sed s/-lreadline//g` |
264 |
ac_cv_lib_readline=no |
265 |
AC_WARN([The versions of GNU readline and ncurses you have installed on this system |
266 |
can't be used together, because they use the same symbol, backspace. If |
267 |
possible, recompile one of the libraries with -Dbackspace=back_space, then |
268 |
re-run configure.]) |
269 |
|
270 |
else |
271 |
AC_MSG_RESULT(yes) |
272 |
LIBS="$j" |
273 |
fi |
274 |
|
275 |
fi |
276 |
]) |
277 |
dnl |
278 |
dnl |
279 |
dnl |