home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Networking / ncftp-2.4.2-MIHS / src / configure.in < prev    next >
Encoding:
Text File  |  1996-10-28  |  11.8 KB  |  470 lines

  1. dnl Process this file with autoconf to produce a configure script.
  2. dnl
  3. AC_INIT(FTP.c)
  4. AC_PREREQ(2.4)
  5. AC_CONFIG_HEADER(Config.h)
  6.  
  7. nc_cv_ncurses=yes
  8. nc_cv_curses=yes
  9. nc_cv_readline=yes
  10. nc_cv_termnet=no
  11. nc_cv_socks=no
  12. nc_cv_socks5=no
  13. nc_cv_shared_libc=no
  14. nc_cv_extra_dirs=yes
  15.  
  16. AC_ARG_ENABLE(ncurses,[  --disable-ncurses       do not try to find and use the ncurses library],nc_cv_ncurses=$enableval)
  17. AC_ARG_ENABLE(curses,[  --disable-curses        do not try to find and use the curses library],nc_cv_curses=$enableval)
  18. AC_ARG_ENABLE(readline,[  --disable-readline      do not try to find and use the readline library],nc_cv_readline=$enableval)
  19. AC_ARG_ENABLE(termnet,[  --disable-termnet       do not try to find and use the termnet library],nc_cv_termnet=$enableval)
  20. AC_ARG_ENABLE(socks,[  --disable-socks         do not try to find and use the socks library],nc_cv_socks=$enableval)
  21. AC_ARG_ENABLE(socks5,[  --disable-socks5         do not try to find and use the socks5 library],nc_cv_socks5=$enableval)
  22. AC_ARG_ENABLE(shared-libc,[  --disable-shared-libc   do not try to find and use the shared std C lib],nc_cv_shared_libc=$enableval)
  23. AC_ARG_ENABLE(extra-dirs,[  --disable-extra-dirs    do not look for additional -L and -I dirs],nc_cv_extra_dirs=$enableval)
  24.  
  25. dnl Look for programs in the prefix directory too.
  26. PATH="${prefix}/bin:${PATH}"
  27.  
  28. changequote(<<, >>)dnl
  29. host=`uname -n 2>/dev/null | tr '[A-Z]' '[a-z]'`
  30. os=`uname -s 2>/dev/null | tr '[A-Z]' '[a-z]'`
  31. changequote([, ])dnl
  32. os_v=`uname -v 2>/dev/null`
  33. os_r=`uname -r 2>/dev/null`
  34.  
  35. PROGS=ncftp
  36. PROG1=ncftp
  37. PROG2=ncftp.static
  38. SLDFLAGS='-static'
  39. Z31=''
  40. Z32=''
  41.  
  42. case "$host" in
  43.     ibmf*|ibmn*)
  44.         if test -f /usr/gleason/.profile ; then
  45.             CC=cc
  46.             CFLAGS='-O2'
  47.             LDFLAGS='-s'
  48.             SLDFLAGS=''
  49.             PROGS=ncftp
  50.             PROG1=ncftp
  51.             PROG2=ncftp.static
  52.         fi
  53.         ;;
  54.  
  55.     aux8*)
  56.         if test -f /usr/gleason/.profile ; then
  57.             CC=cc
  58.             CFLAGS='-O'
  59.             LDFLAGS='-s'
  60.             SLDFLAGS=''
  61.             PROGS=ncftp
  62.             PROG1=ncftp
  63.             PROG2=ncftp.shared
  64.             os='sco3'
  65.         fi
  66.         ;;
  67.  
  68.     xena*)
  69.         if test -f /usr/gleason/.profile ; then
  70.             CC=cc
  71.             CFLAGS='-O2 -K pentium -w3'
  72.             LDFLAGS='-s'
  73.             SLDFLAGS='-Bstatic'
  74.             PROG1=ncftp.shared
  75.             PROG2=ncftp
  76.             PROGS=ncftp
  77.         fi
  78.         ;;
  79.  
  80.     hpi*)
  81.         if test -f /usr/gleason/.profile ; then
  82.             CC=cc
  83.             CFLAGS='-O -Ae'
  84.             LDFLAGS='-s'
  85.             SLDFLAGS='-Wl,-B,immediate'
  86.             PROG1=ncftp.shared
  87.             PROG2=ncftp
  88.             PROGS=ncftp
  89.         fi
  90.         ;;
  91.  
  92.     elwood*)
  93.         if test -f /var/home/mgleason/.profile ; then
  94.             CC=cc
  95.             CFLAGS='-O -g'
  96.             SLDFLAGS='-static'
  97.             LDFLAGS='-s'
  98.             PROG1=ncftp.shared
  99.             PROG2=ncftp
  100.             PROGS=ncftp
  101.         fi
  102.         ;;
  103.  
  104.     anvil*)
  105.         if test -f /usr/gleason/.profile ; then
  106.             CC=cc
  107.             CFLAGS='-O -g'
  108.             SLDFLAGS='-static'
  109.             LDFLAGS='-s'
  110.             PROG1=ncftp.shared
  111.             PROG2=ncftp
  112.             PROGS=ncftp
  113.         fi
  114.         ;;
  115.  
  116.     redwing*)
  117.         if test -f /home/gleason/.profile ; then
  118.             CC=cc
  119.             CFLAGS='-O2 -W -Wall -Wimplicit -Wstrict-prototypes -Wmissing-prototypes -Wshadow'
  120.             LDFLAGS='-s'
  121.             SLDFLAGS='-static'
  122.             PROG1=ncftp
  123.             PROG2=ncftp.static
  124.             PROGS='ncftp ncftp.static'
  125.             Z31='    -@mv $(TGZFILE) newbin/'
  126.             Z32='    -@mv $(DTGZFILE) newbin/'
  127.         fi
  128.         ;;
  129. esac
  130.  
  131. case "$os" in
  132.     aix) OS=aix${os_v}.${os_r} ;;
  133.     hp-ux) OS=hpux ;;
  134.     netbsd) OS=netbsd ;;
  135.     scosv) OS=scosv ;;
  136.     sco3) OS=sco3 ;;
  137.     linux) OS=linux ;;
  138.     bsd/os) OS=bsdi ;;
  139.     freebsd) OS=freebsd ;;
  140.     *) OS="$os" ;;
  141. esac
  142. AC_SUBST(OS)
  143.  
  144. if test "$os" = freebsd ; then
  145.     rev=`uname -r | cut -c1`
  146.     if test "$rev" = 1 ; then
  147.         AC_WARN(Won't use the curses library on FreeBSD 1.x, because it)
  148.         AC_WARN(is missing too much of it's functionality.  Try ncurses.)
  149.         nc_cv_curses=no
  150.     fi
  151. fi
  152.  
  153. if test "$os" = ultrix ; then
  154.     AC_WARN(Won't use curses or cursesX on ULTRIX.)
  155.     AC_WARN(They don't work to my satisfaction. Try ncurses instead.)
  156.     nc_cv_curses=no
  157. fi
  158.  
  159. AC_SUBST(PROGS)
  160. AC_SUBST(PROG1)
  161. AC_SUBST(PROG2)
  162. AC_SUBST(SLDFLAGS)
  163. AC_SUBST(Z31)
  164. AC_SUBST(Z32)
  165.  
  166. AC_PROG_CC
  167. wi_CFLAGS
  168. dnl    wi_PROTOTYPES
  169. dnl    
  170. dnl    if test "$wi_cv_prototypes" = no ; then
  171. dnl        AC_WARN([Your compiler is probably won't be able to compile the package.])
  172. dnl        AC_WARN([Get gcc, or any compiler that supports function prototypes.])
  173. dnl    fi
  174.  
  175. AC_PROG_MAKE_SET
  176. AC_PATH_PROG(MORE,more,more)
  177. AC_PATH_PROG(LS,ls,/bin/ls)
  178. nc_PATH_PROG_ZCAT
  179.  
  180. # See if we should add -I/usr/local/include -L/usr/local/lib, etc.
  181. wi_EXTRA_DIRS(yes, /usr/local /usr/ccs, -)
  182.  
  183. # Look for SunOS' /usr/5lib and 5include directories, because
  184. # we want to use those for the curses stuff.  Cheat a little and
  185. # don't do this if it looks like we are going to use ncurses.
  186. if test -f /usr/local/include/ncurses/unctrl.h && test "$nc_cv_ncurses" = yes ; then
  187.     echo >/dev/null        # no op
  188. else
  189. wi_SYSV_EXTRA_DIRS
  190. fi
  191.  
  192. AC_SUBST(CC)
  193. AC_SUBST(CFLAGS)
  194. AC_SUBST(CPPFLAGS)
  195. AC_SUBST(LDFLAGS)
  196. AC_SUBST(LIBS)
  197.  
  198. wi_DEFINE_UNAME
  199. AC_DEFINE_UNQUOTED(MORE, "$MORE")
  200. AC_DEFINE_UNQUOTED(LS, "$LS")
  201.  
  202. AC_C_CONST
  203.  
  204. AC_CHECK_LIB(socket,socket)
  205. AC_CHECK_LIB(inet,main)
  206.  
  207. wi_LIB_NSL
  208. wi_LIB_RESOLV
  209.  
  210. if test "$nc_cv_socks5" = yes ; then
  211. # Look for the "SOCKS" library for use with Firewalls/Gateways.
  212. savelibs="$LIBS"
  213. AC_CHECK_LIB(db,          main)
  214. AC_CHECK_LIB(isode,       main)
  215. AC_CHECK_LIB(com_err,     main)
  216. AC_CHECK_LIB(crypto,      main)
  217. AC_CHECK_LIB(krb5,        main)
  218. AC_CHECK_LIB(gssapi_krb5, main)
  219. AC_CHECK_LIB(socks5,SOCKSinit)
  220.       if test "$ac_cv_lib_socks5" = yes ; then
  221.               nc_cv_socks=no
  222.       else
  223.               LIBS="$savelibs"
  224.       fi
  225. else
  226. ac_cv_lib_socks5=no
  227. fi
  228.  
  229. if test "$nc_cv_socks" = yes ; then
  230. # Look for the "SOCKS" library for use with Firewalls/Gateways.
  231. AC_CHECK_LIB(socks,SOCKSinit)
  232.     if test "$ac_cv_lib_socks" = yes ; then
  233.         # Socks requires PASV.
  234.         # Use FTP_DATA_PORT_MODE == 1 (kPassiveMode)
  235.         AC_DEFINE(FTP_DATA_PORT_MODE,1)
  236.     fi
  237. else
  238. ac_cv_lib_socks=no
  239. fi
  240.  
  241.  
  242. if test "$nc_cv_termnet" = yes ; then
  243. # Look for the "TERM" library for use with Linux, etc.
  244. AC_CHECK_LIB(termnet,main)
  245. else
  246. ac_cv_lib_termnet=no
  247. fi
  248.  
  249. if test "$nc_cv_readline" = no; then
  250. AC_CHECK_LIB(getline,gl_histadd)
  251. fi
  252.  
  253. # We don't need termcap directly, but on some systems you need to link
  254. # with -lcurses -ltermcap.
  255.  
  256. AC_CHECK_LIB(termcap,tgetstr,nc_cv_lib_termcap=yes,nc_cv_lib_termcap=no)
  257.  
  258. CURSESLIB=''
  259. TERMCAPLIB=''
  260. obselete_lib=no
  261.  
  262. if test $nc_cv_curses = yes ; then
  263.     # cursesX is an Ultrix oddity
  264.     AC_CHECK_LIB(cursesX,endwin,CURSESLIB=cursesX)
  265.  
  266.     if test "$CURSESLIB" = "" ; then
  267.         AC_CHECK_LIB(curses,wnoutrefresh,CURSESLIB=curses)
  268.     fi
  269.  
  270.     # Okay, maybe that didn't work, but maybe you needed to
  271.     # use -lcurses -ltermcap.
  272.     if test "$CURSESLIB" = "" ; then
  273.         if test "$nc_cv_lib_termcap" = yes ; then
  274.             unset ac_cv_lib_curses
  275.             AC_MSG_WARN([Did not detect curses, but trying again with termcap:])
  276.             AC_CHECK_LIB(curses,wnoutrefresh,CURSESLIB=curses,CURSESLIB='',-ltermcap)
  277.             if test "$CURSESLIB" = "curses" ; then
  278.                 TERMCAPLIB=-ltermcap
  279.             else
  280.                 # Okay, you don't have one ncftp can use, but maybe
  281.                 # we should tell the user if they have a shitty curses
  282.                 # library.
  283.  
  284.                 unset ac_cv_lib_curses
  285.                 if test "$nc_cv_lib_termcap" = yes ; then
  286.                     AC_CHECK_LIB(curses,endwin,obselete_lib=yes,obselete_lib=no,-ltermcap)
  287.                 else
  288.                     AC_CHECK_LIB(curses,endwin,obselete_lib=yes,obselete_lib=no)
  289.                 fi
  290.  
  291.                 if test "$obselete_lib" = no ; then    
  292.                     AC_MSG_WARN([Did not detect a useable curses library.])
  293.                 fi
  294.             fi
  295.         fi
  296.     fi
  297.  
  298.     if test "$CURSESLIB" = "" ; then
  299.         # Try termlib with Solaris 2.3
  300.         AC_CHECK_LIB(termlib,endwin,CURSESLIB=termlib)
  301.     fi
  302. fi
  303.  
  304. if test $nc_cv_ncurses = yes ; then
  305.     AC_CHECK_LIB(ncurses,endwin,CURSESLIB=ncurses)
  306.     if test "$CURSESLIB" = ncurses && test "$nc_cv_extra_dirs" = yes ; then
  307.         # See if we should add -I/usr/local/include/ncurses, etc.
  308.         wi_EXTRA_DIRS(yes, /usr/local /usr /usr/ccs, ncurses)
  309.  
  310.         # See if we should add -I/usr/local/ncurses
  311.         wi_EXTRA_IDIR(/usr/local/ncurses)
  312.  
  313.         # Some people (me) have two versions of ncurses on
  314.         # the system.  Use the one in /usr/local first.
  315.         case "$CPPFLAGS" in
  316.             */usr/local/include/ncurses*/usr/include/ncurses*)
  317.                 CPPFLAGS=`echo "$CPPFLAGS" | sed 's@-I/usr/include/ncurses@@g'`
  318.         esac
  319.     fi
  320. fi
  321.  
  322. if test "x$CURSESLIB" = xcurses -o "x$CURSESLIB" = xcursesX -o "x$CURSESLIB" = "xtermlib" ; then
  323.  
  324.     LIBS="$LIBS -l$CURSESLIB"
  325. #    if test "x$CURSESLIB" = xcursesX ; then
  326. #        LIBS="$LIBS -lcurses"
  327. #    fi
  328.     AC_DEFINE(HAVE_LIBCURSES)
  329.  
  330. elif test "x$CURSESLIB" = xncurses ; then
  331.     LIBS="$LIBS -lncurses"
  332.     AC_DEFINE(HAVE_LIBNCURSES)
  333. fi
  334.  
  335. if test "$TERMCAPLIB" != "" ; then
  336.     LIBS="$LIBS -l$TERMCAPLIB"
  337.     AC_DEFINE(HAVE_LIBTERMCAP)
  338. fi
  339.  
  340. if test "$obselete_lib" = yes ; then    
  341.     if test "x$CURSESLIB" != xncurses ; then
  342.             AC_MSG_WARN([You have an older curses library, but it])
  343.             AC_MSG_WARN([can't be used because it does not have the])
  344.             AC_MSG_WARN([functions wnoutrefresh and doupdate, which])
  345.             AC_MSG_WARN([NcFTP needs.  Consider installing the ncurses])
  346.             AC_MSG_WARN([library, from prep.ai.mit.edu, in /pub/gnu.])
  347.     fi
  348. fi
  349.  
  350. # Readline must be listed before -lcurses and/or -ltermcap.
  351. if test "$nc_cv_readline" = yes ; then
  352.     READLINELIB=''
  353.     AC_CHECK_LIB(readline,readline,READLINELIB=readline)
  354.     if test "$READLINELIB" != "" ; then
  355.         if test "$CURSESLIB" != "" ; then
  356.             LIBS=`echo "$LIBS" | sed "s@$CURSESLIB@$READLINELIB -l$CURSESLIB@"`
  357.         elif test "$TERMCAPLIB" != "" ; then
  358.             LIBS=`echo "$LIBS" | sed "s@$TERMCAPLIB@$READLINELIB -l$TERMCAPLIB@"`
  359.         fi
  360.         AC_DEFINE(HAVE_LIBREADLINE)
  361.     fi
  362. else
  363.     ac_cv_lib_readline=no
  364. fi
  365.  
  366.  
  367. if test "$ac_cv_lib_readline" = yes ; then
  368.     # Make sure we link termcap with readline if we aren't already
  369.     # linking curses or termcap.
  370.     case "$LIBS" in
  371.         *termcap*|*curses*)
  372.             ;;
  373.         *)
  374.             LIBS="$LIBS -ltermcap"
  375.             ;;
  376.     esac
  377.     AC_CHECK_FUNCS(filename_completion_function)
  378. fi
  379.  
  380.  
  381. wi_READLINE_WITH_NCURSES
  382. AC_CHECK_LIB(posix,tcgetpgrp)
  383.  
  384. if test "$nc_cv_shared_libc" = yes ; then
  385. # This should be the last library to look for.
  386. AC_CHECK_LIB(c_s,main)
  387. else
  388. ac_cv_lib_c_s=no
  389. fi
  390.  
  391. AC_FUNC_STRFTIME
  392.  
  393. AC_CHECK_FUNCS(getdomainname getcwd getwd memmove mktime symlink setlinebuf)
  394. AC_CHECK_FUNCS(strerror strcasecmp remove unlink tcgetpgrp fcntl flock)
  395.  
  396. AC_MSG_CHECKING([for domain name in /etc/resolv.conf])
  397. RESOLV_CONF_DOMAIN=""
  398. if test -f /etc/resolv.conf ; then
  399.     changequote(, )dnl
  400.     RESOLV_CONF_DOMAIN=`sed 's/[#;].*//' /etc/resolv.conf | sed -n 's/domain[     ]//p' | sed -n 1,1p | tr -d '     '`
  401.     changequote([, ])dnl
  402.     if test "$RESOLV_CONF_DOMAIN" = "" ; then
  403.         AC_MSG_RESULT([no])
  404.     else
  405.         AC_MSG_RESULT($RESOLV_CONF_DOMAIN)
  406.         RESOLV_CONF_DOMAIN=" # -DDOMAINNAME=\\\"$RESOLV_CONF_DOMAIN\\\""
  407.     fi
  408. else
  409.     AC_MSG_RESULT([no])
  410. fi
  411. AC_SUBST(RESOLV_CONF_DOMAIN)
  412.  
  413. if test "x$CURSESLIB" = x ; then
  414. # Don't check these unless we have a curses library.
  415.     ac_cv_func_curs_set=no
  416.     ac_cv_func_getmaxyx=no
  417.     ac_cv_func_beep=no
  418.     ac_cv_func_notimeout=no
  419. else
  420.     AC_CHECK_FUNCS(curs_set getmaxyx beep notimeout)
  421.     if test $ac_cv_func_getmaxyx = no ; then
  422.         AC_MSG_CHECKING(for maxx or _maxx in WINDOW structure)
  423.         AC_TRY_COMPILE([#include <curses.h>],[
  424.         WINDOW *w;
  425.     
  426.         w = newwin(10, 10, 1, 1);
  427.         w->maxx = 0;
  428.         delwin(w);],maxx=yes,_maxx=yes)
  429.         if test "$maxx" = yes ; then
  430.             AC_DEFINE(HAVE_MAXX)
  431.             AC_MSG_RESULT(maxx)
  432.         else
  433.             # Most systems use _maxx as their internal field.
  434.             AC_DEFINE(HAVE__MAXX)
  435.             AC_MSG_RESULT([assuming _maxx])
  436.         fi
  437.     fi
  438. fi
  439.  
  440. if test $ac_cv_func_getcwd = no && test $ac_cv_func_getwd = no ; then
  441. AC_WARN(This system does not have either getwd or getcwd?)
  442. AC_WARN(I find that a little hard to believe.)
  443. AC_WARN(You may want to try -DHAVE_GETWD anyway.)
  444. AC_WARN([
  445. This could also mean that your compiler isn't working])
  446. AC_WARN(with this configure script.  Check the ./config.log)
  447. AC_WARN(and look for anomalies.)
  448. fi
  449.  
  450. if test $ac_cv_func_remove = no && test $ac_cv_func_unlink = no ; then
  451. AC_WARN(This system does not have either remove or unlink?)
  452. AC_WARN(I find that a little hard to believe.)
  453. AC_WARN(You may want to try -DHAVE_UNLINK anyway.)
  454. fi
  455.  
  456. AC_HEADER_STDC
  457. AC_CHECK_HEADERS(string.h memory.h unistd.h stdarg.h termios.h termio.h sgtty.h)
  458. AC_CHECK_HEADERS(utime.h sys/time.h readline/history.h cursesX.h ncurses.h)
  459. AC_CHECK_HEADERS(limits.h termnet.h term/termnet.h fcntl.h sys/ioctl.h curses.h)
  460. AC_CHECK_HEADERS(net/errno.h sys/file.h sys/bsdtypes.h)
  461. AC_HEADER_TIME
  462.  
  463. AC_FUNC_SETVBUF_REVERSED
  464. AC_FUNC_GETPGRP
  465. AC_PROG_GCC_TRADITIONAL
  466.  
  467. AC_TYPE_SIZE_T
  468.  
  469. AC_OUTPUT(Makefile)
  470.