| 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_PROTOTYPES, [ |
| 115 |
AC_MSG_CHECKING(if the compiler supports function prototypes) |
| 116 |
AC_TRY_COMPILE(,[extern void exit(int status);],[wi_cv_prototypes=yes |
| 117 |
AC_DEFINE(PROTOTYPES)],wi_cv_prototypes=no) |
| 118 |
AC_MSG_RESULT($wi_cv_prototypes) |
| 119 |
]) |
| 120 |
dnl |
| 121 |
dnl |
| 122 |
dnl |
| 123 |
AC_DEFUN(wi_ANSI_C, [ |
| 124 |
AC_MSG_CHECKING(ANSI-style function definitions) |
| 125 |
AC_TRY_COMPILE(,[int blubb(int x) { return 0; }],[wi_cv_ansi_funcs=yes |
| 126 |
AC_DEFINE(ANSI_FUNCS)],wi_cv_ansi_funcs=no) |
| 127 |
AC_MSG_RESULT($wi_cv_ansi_funcs) |
| 128 |
]) |
| 129 |
dnl |
| 130 |
dnl |
| 131 |
dnl |
| 132 |
AC_DEFUN(wi_HEADER_SYS_SELECT_H, [ |
| 133 |
# See if <sys/select.h> is includable after <sys/time.h> |
| 134 |
if test "$ac_cv_header_sys_time_h" = no ; then |
| 135 |
AC_CHECK_HEADERS(sys/time.h sys/select.h) |
| 136 |
else |
| 137 |
AC_CHECK_HEADERS(sys/select.h) |
| 138 |
fi |
| 139 |
if test "$ac_cv_header_sys_select_h" = yes ; then |
| 140 |
AC_MSG_CHECKING([if <sys/select.h> is compatible with <sys/time.h>]) |
| 141 |
selecth=yes |
| 142 |
if test "$ac_cv_header_sys_time_h" = yes ; then |
| 143 |
AC_TRY_COMPILE([#include <sys/time.h> |
| 144 |
#include <sys/select.h>],[ |
| 145 |
fd_set a; |
| 146 |
struct timeval tmval; |
| 147 |
|
| 148 |
tmval.tv_sec = 0;],selecth=yes,selecth=no) |
| 149 |
|
| 150 |
if test "$selecth" = yes ; then |
| 151 |
AC_DEFINE(CAN_USE_SYS_SELECT_H) |
| 152 |
fi |
| 153 |
fi |
| 154 |
AC_MSG_RESULT($selecth) |
| 155 |
fi |
| 156 |
]) |
| 157 |
dnl |
| 158 |
dnl |
| 159 |
dnl |
| 160 |
AC_DEFUN(wi_LIB_RESOLV, [ |
| 161 |
# See if we could access two well-known sites without help of any special |
| 162 |
# libraries, like resolv. |
| 163 |
|
| 164 |
AC_TRY_RUN([ |
| 165 |
#include <sys/types.h> |
| 166 |
#include <sys/socket.h> |
| 167 |
#include <netinet/in.h> |
| 168 |
#include <netdb.h> |
| 169 |
|
| 170 |
main() |
| 171 |
{ |
| 172 |
struct hostent *hp1, *hp2; |
| 173 |
int result; |
| 174 |
|
| 175 |
hp1 = gethostbyname("gatekeeper.dec.com"); |
| 176 |
hp2 = gethostbyname("ftp.ncsa.uiuc.edu"); |
| 177 |
result = ((hp1 != (struct hostent *) 0) && (hp2 != (struct hostent *) 0)); |
| 178 |
exit(! result); |
| 179 |
}],look_for_resolv=no,look_for_resolv=yes,look_for_resolv=yes) |
| 180 |
|
| 181 |
AC_MSG_CHECKING([if we need to look for -lresolv]) |
| 182 |
AC_MSG_RESULT($look_for_resolv) |
| 183 |
if test "$look_for_resolv" = yes ; then |
| 184 |
AC_CHECK_LIB(resolv,main) |
| 185 |
else |
| 186 |
ac_cv_lib_resolv=no |
| 187 |
fi |
| 188 |
]) |
| 189 |
dnl |
| 190 |
dnl |
| 191 |
dnl |
| 192 |
|
| 193 |
AC_DEFUN(wi_LIB_NSL, [ |
| 194 |
AC_MSG_CHECKING(if we can use -lnsl) |
| 195 |
ac_save_LIBS="$LIBS"; |
| 196 |
LIBS="$LIBS -lnsl"; |
| 197 |
AC_CACHE_VAL(r_cv_use_libnsl, [ |
| 198 |
AC_TRY_RUN( |
| 199 |
main() { if (getpwuid(getuid())) exit(0); exit(-1); }, |
| 200 |
nc_cv_use_libnsl=yes, nc_cv_use_libnsl=no, nc_cv_use_libnsl=no) |
| 201 |
]) |
| 202 |
if test "$nc_cv_use_libnsl" = "no"; then LIBS="$ac_save_LIBS"; fi |
| 203 |
AC_MSG_RESULT($nc_cv_use_libnsl) |
| 204 |
])dnl |
| 205 |
|
| 206 |
dnl |
| 207 |
dnl |
| 208 |
dnl |
| 209 |
|
| 210 |
AC_DEFUN(nc_PATH_PROG_ZCAT, [ |
| 211 |
AC_PATH_PROG(GZCAT,gzcat) |
| 212 |
AC_PATH_PROG(ZCAT,zcat) |
| 213 |
if test "x$GZCAT" = x ; then |
| 214 |
if test "x$ZCAT" != x ; then |
| 215 |
# See if zcat is really gzcat. gzcat has a --version option, regular |
| 216 |
# zcat does not. |
| 217 |
AC_MSG_CHECKING(if zcat is really gzcat in disguise) |
| 218 |
if $ZCAT --version 2> /dev/null ; then |
| 219 |
AC_DEFINE_UNQUOTED(GZCAT, "$ZCAT") |
| 220 |
AC_MSG_RESULT(yes) |
| 221 |
else |
| 222 |
AC_MSG_RESULT(no) |
| 223 |
fi |
| 224 |
fi |
| 225 |
else |
| 226 |
AC_DEFINE_UNQUOTED(GZCAT, "$GZCAT") |
| 227 |
fi |
| 228 |
|
| 229 |
if test "x$ZCAT" != x ; then |
| 230 |
AC_DEFINE_UNQUOTED(ZCAT, "$ZCAT") |
| 231 |
fi |
| 232 |
]) |
| 233 |
dnl |
| 234 |
dnl |
| 235 |
dnl |
| 236 |
AC_DEFUN(wi_SYSV_EXTRA_DIRS, [ |
| 237 |
# Use System V because their curses extensions are required. This must |
| 238 |
# be done early so we use the -I and -L in the library checks also. |
| 239 |
# This is mostly a Solaris/SunOS hack. Note that doing this will also |
| 240 |
# use all of the other System V libraries and headers. |
| 241 |
|
| 242 |
AC_MSG_CHECKING(for alternative System V libraries) |
| 243 |
if test -f /usr/5include/curses.h ; then |
| 244 |
CPPFLAGS="$CPPFLAGS -I/usr/5include" |
| 245 |
LDFLAGS="$LDFLAGS -L/usr/5lib" |
| 246 |
AC_MSG_RESULT(yes) |
| 247 |
else |
| 248 |
AC_MSG_RESULT(no) |
| 249 |
fi |
| 250 |
]) |
| 251 |
dnl |
| 252 |
dnl |
| 253 |
dnl |
| 254 |
AC_DEFUN(wi_DEFINE_UNAME, [ |
| 255 |
# Get first 127 chars of all uname information. Some folks have |
| 256 |
# way too much stuff there, so grab only the first 127. |
| 257 |
unam=`uname -a 2>/dev/null | cut -c1-127` |
| 258 |
if test "$unam" != "" ; then |
| 259 |
AC_DEFINE_UNQUOTED(UNAME, "$unam") |
| 260 |
fi |
| 261 |
]) |
| 262 |
dnl |
| 263 |
dnl |
| 264 |
dnl |
| 265 |
AC_DEFUN(wi_READLINE_WITH_NCURSES, [ |
| 266 |
# Readline and Ncurses could both define "backspace". |
| 267 |
# Warn about this if we have both things in our definitions list. |
| 268 |
|
| 269 |
if test "$ac_cv_lib_readline" = yes && test "$ac_cv_lib_ncurses" = yes ; then |
| 270 |
|
| 271 |
AC_MSG_CHECKING(if readline and ncurses will link together) |
| 272 |
j="$LIBS" |
| 273 |
LIBS="-lreadline -lncurses" |
| 274 |
AC_TRY_LINK(,[ |
| 275 |
readline("prompt"); |
| 276 |
endwin(); |
| 277 |
],k=yes,k=no) |
| 278 |
if test "$k" = no ; then |
| 279 |
AC_MSG_RESULT(no) |
| 280 |
# Remove '-lreadline' from LIBS. |
| 281 |
LIBS=`echo $j | sed s/-lreadline//g` |
| 282 |
ac_cv_lib_readline=no |
| 283 |
AC_WARN([The versions of GNU readline and ncurses you have installed on this system |
| 284 |
can't be used together, because they use the same symbol, backspace. If |
| 285 |
possible, recompile one of the libraries with -Dbackspace=back_space, then |
| 286 |
re-run configure.]) |
| 287 |
|
| 288 |
else |
| 289 |
AC_MSG_RESULT(yes) |
| 290 |
LIBS="$j" |
| 291 |
fi |
| 292 |
|
| 293 |
fi |
| 294 |
]) |
| 295 |
dnl |
| 296 |
dnl |
| 297 |
dnl |