1dnl 2dnl originally from ncftp 2.3.0 3dnl added wi_EXTRA_PDIR and wi_ANSI_C 4dnl $Id: aclocal.m4,v 1.2 2003/10/19 17:49:24 fp Exp $ 5dnl 6AC_DEFUN(wi_EXTRA_IDIR, [ 7incdir="$1" 8if 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 22fi 23]) 24dnl 25dnl 26dnl 27dnl 28AC_DEFUN(wi_EXTRA_LDIR, [ 29libdir="$1" 30if 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 44fi 45]) 46dnl 47dnl __FP__ 48dnl 49dnl 50AC_DEFUN(wi_EXTRA_PDIR, [ 51progdir="$1" 52if 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 69fi 70]) 71dnl 72dnl 73dnl If you want to also look for include and lib subdirectories in the 74dnl $HOME tree, you supply "yes" as the first argument to this macro. 75dnl 76dnl If you want to look for subdirectories in include/lib directories, 77dnl you pass the names in argument 3, otherwise pass a dash. 78dnl 79AC_DEFUN(wi_EXTRA_DIRS, [echo "checking for extra include and lib directories..." 1>&6 80ifelse([$1], yes, [dnl 81b1=`cd .. ; pwd` 82b2=`cd ../.. ; pwd` 83exdirs="$HOME $j $b1 $b2 $prefix $2" 84],[dnl 85exdirs="$prefix $2" 86]) 87subexdirs="$3" 88if test "$subexdirs" = "" ; then 89 subexdirs="-" 90fi 91for subexdir in $subexdirs ; do 92if test "$subexdir" = "-" ; then 93 subexdir="" 94else 95 subexdir="/$subexdir" 96fi 97for 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 108done 109done 110]) 111dnl 112dnl 113dnl 114AC_DEFUN(wi_PROTOTYPES, [ 115AC_MSG_CHECKING(if the compiler supports function prototypes) 116AC_TRY_COMPILE(,[extern void exit(int status);],[wi_cv_prototypes=yes 117AC_DEFINE(PROTOTYPES)],wi_cv_prototypes=no) 118AC_MSG_RESULT($wi_cv_prototypes) 119]) 120dnl 121dnl 122dnl 123AC_DEFUN(wi_ANSI_C, [ 124AC_MSG_CHECKING(ANSI-style function definitions) 125AC_TRY_COMPILE(,[int blubb(int x) { return 0; }],[wi_cv_ansi_funcs=yes 126AC_DEFINE(ANSI_FUNCS)],wi_cv_ansi_funcs=no) 127AC_MSG_RESULT($wi_cv_ansi_funcs) 128]) 129dnl 130dnl 131dnl 132AC_DEFUN(wi_HEADER_SYS_SELECT_H, [ 133# See if <sys/select.h> is includable after <sys/time.h> 134if test "$ac_cv_header_sys_time_h" = no ; then 135AC_CHECK_HEADERS(sys/time.h sys/select.h) 136else 137AC_CHECK_HEADERS(sys/select.h) 138fi 139if 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) 155fi 156]) 157dnl 158dnl 159dnl 160AC_DEFUN(wi_LIB_RESOLV, [ 161# See if we could access two well-known sites without help of any special 162# libraries, like resolv. 163 164AC_TRY_RUN([ 165#include <sys/types.h> 166#include <sys/socket.h> 167#include <netinet/in.h> 168#include <netdb.h> 169 170main() 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 181AC_MSG_CHECKING([if we need to look for -lresolv]) 182AC_MSG_RESULT($look_for_resolv) 183if test "$look_for_resolv" = yes ; then 184AC_CHECK_LIB(resolv,main) 185else 186 ac_cv_lib_resolv=no 187fi 188]) 189dnl 190dnl 191dnl 192 193AC_DEFUN(wi_LIB_NSL, [ 194AC_MSG_CHECKING(if we can use -lnsl) 195ac_save_LIBS="$LIBS"; 196LIBS="$LIBS -lnsl"; 197AC_CACHE_VAL(r_cv_use_libnsl, [ 198AC_TRY_RUN( 199main() { if (getpwuid(getuid())) exit(0); exit(-1); }, 200nc_cv_use_libnsl=yes, nc_cv_use_libnsl=no, nc_cv_use_libnsl=no) 201]) 202if test "$nc_cv_use_libnsl" = "no"; then LIBS="$ac_save_LIBS"; fi 203AC_MSG_RESULT($nc_cv_use_libnsl) 204])dnl 205 206dnl 207dnl 208dnl 209 210AC_DEFUN(nc_PATH_PROG_ZCAT, [ 211AC_PATH_PROG(GZCAT,gzcat) 212AC_PATH_PROG(ZCAT,zcat) 213if 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 225else 226 AC_DEFINE_UNQUOTED(GZCAT, "$GZCAT") 227fi 228 229if test "x$ZCAT" != x ; then 230 AC_DEFINE_UNQUOTED(ZCAT, "$ZCAT") 231fi 232]) 233dnl 234dnl 235dnl 236AC_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 242AC_MSG_CHECKING(for alternative System V libraries) 243if test -f /usr/5include/curses.h ; then 244 CPPFLAGS="$CPPFLAGS -I/usr/5include" 245 LDFLAGS="$LDFLAGS -L/usr/5lib" 246 AC_MSG_RESULT(yes) 247else 248 AC_MSG_RESULT(no) 249fi 250]) 251dnl 252dnl 253dnl 254AC_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. 257unam=`uname -a 2>/dev/null | cut -c1-127` 258if test "$unam" != "" ; then 259 AC_DEFINE_UNQUOTED(UNAME, "$unam") 260fi 261]) 262dnl 263dnl 264dnl 265AC_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 269if test "$ac_cv_lib_readline" = yes && test "$ac_cv_lib_ncurses" = yes ; then 270 271AC_MSG_CHECKING(if readline and ncurses will link together) 272j="$LIBS" 273LIBS="-lreadline -lncurses" 274AC_TRY_LINK(,[ 275readline("prompt"); 276endwin(); 277],k=yes,k=no) 278if 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 284can't be used together, because they use the same symbol, backspace. If 285possible, recompile one of the libraries with -Dbackspace=back_space, then 286re-run configure.]) 287 288else 289 AC_MSG_RESULT(yes) 290 LIBS="$j" 291fi 292 293fi 294]) 295dnl 296dnl 297dnl 298