home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / ncftp-2.3.0-base.tgz / ncftp-2.3.0-base.tar / contrib / ncftp / aclocal.m4 < prev    next >
Text File  |  1995-10-29  |  7KB  |  310 lines

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