home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / inetutils-1.2-src.tgz / tar.out / fsf / inetutils / configure.in < prev    next >
Text File  |  1996-09-28  |  13KB  |  337 lines

  1. # Configuration for inetutils
  2. #
  3. # Copyright (C) 1995, 1996 Free Software Foundation, Inc.
  4. #
  5. # Written by Miles Bader <miles@gnu.ai.mit.edu>
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2, or (at your option)
  10. # any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. #
  21.  
  22. AC_INIT(inetd/inetd.c)
  23.  
  24. # Get macros that we use
  25. builtin(include, iumacros.m4)
  26.  
  27. # Generate <config.h>; note that we use a `header' subdirectory, which
  28. # contains all include files distributed with inetutils, and an `include'
  29. # directory, which holds those actually needed for compilation
  30. AC_CONFIG_HEADER(include/config.h:headers/config.h.in)
  31.  
  32. # config.h turns this on, so make sure it's on for our tests too
  33. CPPFLAGS=-D_BSD_SOURCE
  34.  
  35. # The list of subdirs that may be built, split into subsets (which the user
  36. # may select for compilation at config or make time); the composite list of
  37. # everything to build by default is defined at the end of this file.
  38. # (These don't contain talk or talkd, which is added later if necessary)
  39. COMMON='libtelnet libinetutils'
  40. SERVERS='inetd ftpd telnetd rshd rlogind uucpd rexecd syslogd tftpd'
  41. CLIENTS='telnet ftp rsh rcp rlogin tftp syslog'
  42. AC_SUBST(COMMON)
  43. AC_SUBST(SERVERS)
  44. AC_SUBST(CLIENTS)
  45.  
  46. # All subdirectories, whether built or not
  47. SUBDIRS="headers $SERVERS $CLIENTS $COMMON"
  48. AC_SUBST(SUBDIRS)
  49.  
  50. # Optional things we put into libinetutils (we use the name `LIBOBJS' because
  51. # that's what AC_REPLACE_FUNCS uses).
  52. LIBOBJS=''
  53. AC_SUBST(LIBOBJS)
  54.  
  55. # Include files that we link into our own include directory from headers.
  56. # Initialize it with the things we always want to use.
  57. INCLUDES="version.h crypt.h arpa/telnet.h arpa/ftp.h arpa/tftp.h"
  58.  
  59. # Files that we link from somewhere other than headers to includes .  The
  60. # number of entries in LINK_SRCS should match that in LINK_DSTS.
  61. LINK_SRCS=''
  62. LINK_DSTS=''
  63.  
  64. # By default we compile both servers and clients, but see what the user wants
  65. AC_ARG_ENABLE(servers, [  --disable-servers       don't compile servers],
  66.           , enable_servers=yes)
  67. AC_ARG_ENABLE(clients, [  --disable-clients       don't compile clients],
  68.           , enable_clients=yes)
  69. # By default, talk is only compiled if we can find libcurses
  70. AC_ARG_ENABLE(talk,    [  --disable-talk          don't compile talk or talkd],
  71.               , enable_talk=maybe)
  72. # Encryption and authentication is turned off by default
  73. AC_ARG_ENABLE(encryption, [  --enable-encryption     enable encryption],
  74.           , enable_encryption=no)
  75. AC_ARG_ENABLE(authentication,
  76.           [  --enable-authentication enable connection authentication],
  77.           , enable_authentication=no)
  78.  
  79. AC_PROG_MAKE_SET
  80.  
  81. AC_PROG_CC
  82. AC_PROG_CPP
  83. AC_PROG_INSTALL
  84. AC_PROG_YACC
  85. AC_CHECK_TOOL(AR, ar)
  86. AC_CHECK_TOOL(RANLIB, ranlib, :)
  87. AC_PATH_PROG(RM, rm, rm)
  88.  
  89. AC_CHECK_HEADERS(malloc.h errno.h string.h stdarg.h termio.h termios.h \
  90.          stdlib.h sys/tty.h sys/utsname.h glob.h \
  91.          sys/msgbuf.h krb.h des.h netinet/in_systm.h \
  92.          netinet/ip.h netinet/ip_icmp.h netinet/ip_var.h vis.h \
  93.          sys/ioctl_compat.h sys/cdefs.h utmp.h utmpx.h)
  94.  
  95. AC_CHECK_FUNCS(cgetent uname setutent_r fpathconf tcgetattr sigvec sigaction \
  96.            flock ftruncate wait3)
  97. # Functions that we will define (in libinetutils) if necessary.
  98. AC_REPLACE_FUNCS(daemon strdup)
  99.  
  100. # Use (posix) `setpgid' if it's around, otherwise assume a BSD setpgrp
  101. AC_CHECK_FUNC(setpgid, , AC_DEFINE(setpgid, setpgrp))
  102.  
  103. # EWOULDBLOCK is more or less the BSD version of posix EAGAIN.
  104. IU_CHECK_MACRO(EWOULDBLOCK, [#include <errno.h>], ,
  105.   :, AC_DEFINE(EWOULDBLOCK, EAGAIN))
  106. IU_CHECK_DECL(errno, [#include <errno.h>])
  107.  
  108. # __P is the standard name for the ansi-or-not-ansi arg-decl macro.
  109. # We define our own version in <config.h> if the system doesn't supply one.
  110. IU_CHECK_MACRO(__P,
  111.   [ #ifdef HAVE_SYS_CDEFS_H
  112.     #include <sys/cdefs.h>
  113.     #endif ])
  114.  
  115. # libutil is a 4.4BSD library that defines several functions handy for
  116. # inetutil daemons, doing such things as utmp frobbing, and pty setup.
  117. AC_CHECK_LIB(util, logout, LIBUTIL=-lutil)
  118. AC_SUBST(LIBUTIL)
  119. # Look for the functions typically defined by libutil (which of course may
  120. # not actually be in libutil), and and use our own versions if necesary.
  121. _SAVE_LIBS="$LIBS"
  122. LIBS="$LIBUTIL $LIBS"
  123. AC_REPLACE_FUNCS(login logout logwtmp openpty forkpty)
  124. LIBS="$_SAVE_LIBS"
  125.  
  126. # See if `weak refs' are possible; these make it possible (with shared
  127. # libraries) to check for the existance of a standard function at run-time
  128. # instead of compile time, which is very handy for distributing binary
  129. # version programs that automatically adapt -- in inetutils case, to whether
  130. # or not crypt is available.
  131. IU_CHECK_WEAK_REFS
  132.  
  133. # See if there's a separate libcrypt (many systems put crypt there)
  134. AC_CHECK_LIB(crypt, crypt, LIBCRYPT=-lcrypt)
  135. AC_SUBST(LIBCRYPT)
  136. # Look for the crypt function itself (in libcrypt if possible)
  137. _SAVE_LIBS="$LIBS"
  138. LIBS="$LIBCRYPT $LIBS"
  139. AC_CHECK_FUNCS(crypt)
  140. LIBS="$_SAVE_LIBS"
  141. # ... and see if it's declared anywhere
  142. IU_CHECK_DECL(crypt, [#include <unistd.h>])
  143.  
  144. # Look for the posix SEEK_ macros (for lseek), and if not found, try the
  145. # similar berkeley L_ macros; if neither can be found, use the classic unix
  146. # values.
  147. IU_CHECK_MACRO(SEEK_ macros,
  148.   [#include <unistd.h>], SEEK_SET SEEK_CUR SEEK_END,
  149.   :,
  150.   IU_CHECK_MACRO(L_ seek macros,
  151.     [#include <unistd.h>], L_SET L_INCR L_XTND,
  152.     AC_DEFINE(SEEK_SET, L_SET)
  153.     AC_DEFINE(SEEK_CUR, L_INCR)
  154.     AC_DEFINE(SEEK_END, L_XTND),
  155.     AC_DEFINE(SEEK_SET, 0)
  156.     AC_DEFINE(SEEK_CUR, 1)
  157.     AC_DEFINE(SEEK_END, 2)))
  158.  
  159. # See where to find fd_set (bit-vectors for select) manipulation macros.
  160. IU_CHECK_MACRO(fd_set macros, [#include <sys/types.h>],
  161.   FD_ZERO FD_CLR FD_SET FD_ISSET)
  162. if test "$inetutils_cv_fd_set_macros" = no; then
  163.   IU_CHECK_MACRO(fd_set macros in <sys/time.h>, [#include <sys/time.h>],
  164.     FD_ZERO FD_CLR FD_SET FD_ISSET)
  165. fi
  166.  
  167. # See if stat includes sub-second time information (the st_?timespec form is
  168. # from bsd, and the st_?time_usec form is used by the hurd; the latter will
  169. # eventually be replaced by the former).
  170. IU_CHECK_STRUCT_FIELD(stat, st_mtimespec,
  171.   [ #include <sys/types.h>
  172.     #include <sys/stat.h> ],
  173.   :,
  174.   IU_CHECK_STRUCT_FIELD(stat, st_mtime_usec,
  175.     [ #include <sys/types.h>
  176.       #include <sys/stat.h>]))
  177.  
  178. # See if a termcap library is available (under one of several names)
  179. IU_LIB_TERMCAP
  180. # If not, add a bogus version of tgetent to libinetutils, as that's the only
  181. # function actually used (to check terminal type validity), modulo any
  182. # dependencies from curses.
  183. if test -z "$LIBTERMCAP"; then
  184.   # Some packages include termcap just ;
  185.   # for those cases, we really don't need termcap.
  186.   LIBOBJS="$LIBOBJS stub_tgetent.o"
  187. fi
  188.  
  189. # Only talk uses curses, so only check for it if we want that
  190. if test "$enable_talk" != no; then
  191.   IU_LIB_CURSES
  192. fi
  193. if test "$enable_talk" = yes -a "$ac_cv_lib_curses_initscr" != yes; then
  194.   AC_MSG_WARN(curses is not available, so not building talk)
  195. fi
  196. enable_talk="$ac_cv_lib_curses_initscr"
  197. if test "$enable_talk" = yes; then
  198.   SERVERS="$SERVERS talkd"
  199.   CLIENTS="$CLIENTS talk"
  200.   # We may need our own definition for struct osockaddr (equivalent to the
  201.   # old 4.3BSD struct sockaddr, and used in grotty bsd talk protocol)
  202.   IU_CHECK_TYPE(struct osockaddr,
  203.     [ #include <sys/types.h>
  204.       #include <sys/socket.h> ],
  205.     :, AC_DEFINE(HAVE_OSOCKADDR_H) INCLUDES="$INCLUDES osockaddr.h")
  206. fi
  207. # SUBDIRS gets talk subdirs regardless of whether we're building them
  208. SUBDIRS="$SUBDIRS talkd talk"
  209.  
  210. # Look for a system `glob' function, and use our own if we can't find one (or
  211. # if the system one is missing features we need).
  212. sys_glob=no
  213. if test "$ac_cv_header_glob_h" = yes; then
  214.   AC_CHECK_LIB(glob, glob, LIBGLOB=-lglob)
  215.   _SAVE_LIBS="$LIBS"
  216.   LIBS="$LIBGLOB $LIBS"
  217.   AC_CHECK_FUNC(glob,
  218.     IU_CHECK_MACRO(system glob is ok,
  219.       [#include <glob.h>], GLOB_BRACE GLOB_TILDE,
  220.       sys_glob=yes))
  221.   LIBS="$_SAVE_LIBS"
  222. fi
  223. if test "$sys_glob" != yes; then
  224.   AC_CONFIG_SUBDIRS(glob)
  225.   LINK_SRCS="$LINK_SRCS glob/glob.h"
  226.   LINK_DSTS="$LINK_DSTS include/glob.h"
  227.   LIBGLOB="-L../glob -lglob"
  228. fi
  229. AC_SUBST(LIBGLOB)
  230.  
  231. if test "$enable_encryption" = yes -o "$enable_authentication" = yes; then
  232.   # Look for Kerberos and DES libraries
  233.   AC_CHECK_LIB(krb, krb_mk_req, LIBAUTH=-lkrb)
  234.   AC_CHECK_LIB(des, des_key_sched, LIBAUTH="$LIBAUTH -ldes")
  235. fi
  236. AC_SUBST(LIBAUTH)
  237. # define CPP macros that enable auth/encrypt code
  238. test "$enable_authentication" = yes && AC_DEFINE(AUTHENTICATION)
  239. test "$enable_encryption" = yes     && AC_DEFINE(ENCRYPTION)
  240. test "$enable_authentication" = yes -a "$ac_cv_lib_krb_krb_mk_req" = yes \
  241.   && AC_DEFINE(KRB4)
  242. test "$enable_encryption" = yes -a "$ac_cv_lib_des_des_key_sched" = yes \
  243.   && AC_DEFINE(DES_ENCRYPTION)
  244.  
  245. # We use our own version of getopt (including our own header file) if the
  246. # system one doesn't have getopt_long.
  247. AC_CHECK_FUNC(getopt_long, ,
  248.   INCLUDES="$INCLUDES getopt.h"
  249.   LIBOBJS="$LIBOBJS getopt.o getopt1.o")
  250.  
  251. # Supply versions of the BSD error reporting functions if the system doesn't
  252. AC_CHECK_FUNC(verrx, ,
  253.   INCLUDES="$INCLUDES err.h"
  254.   LIBOBJS="$LIBOBJS err.o")
  255.  
  256. IU_CHECK_TYPE(struct lastlog, [#include <utmp.h>])
  257. IU_CHECK_STRUCT_FIELD(utmp, ut_type, [#include <utmp.h>])
  258. IU_CHECK_STRUCT_FIELD(utmp, ut_host, [#include <utmp.h>])
  259. IU_CHECK_STRUCT_FIELD(utmp, ut_tv, [#include <utmp.h>])
  260.  
  261. # See if the system has strerror, and replace it if not
  262. AC_CHECK_FUNC(strerror, , LIBOBJS="$LIBOBJS strerror.o")
  263. if test "$ac_cv_func_strerror" = no; then
  264.   # No strerror, so see if the SYS_ERRLIST variable can be used by ours
  265.   AC_CHECK_FUNC(sys_errlist)
  266.   if test "$ac_cv_func_sys_errlist" = yes; then
  267.     IU_CHECK_DECL(sys_errlist, [
  268.       #include <stdio.h>
  269.       #ifdef HAVE_ERRNO_H
  270.       #include <errno.h>
  271.       #endif])
  272.   fi
  273. fi
  274.  
  275. # See if the system has hstrerror, and replace it if not
  276. AC_CHECK_FUNC(hstrerror, , LIBOBJS="$LIBOBJS hstrerror.o")
  277. if test "$ac_cv_func_hstrerror" = yes; then
  278.   IU_CHECK_DECL(hstrerror, [#include <netdb.h>])
  279. else
  280.   # No hstrerror, so see if the H_ERRLIST variable can be used by ours
  281.   AC_CHECK_FUNC(h_errlist)
  282.   if test "$ac_cv_func_h_errlist" = yes; then
  283.     IU_CHECK_DECL(h_errlist, [#include <netdb.h>])
  284.   fi
  285. fi
  286. if test "$ac_cv_func_hstrerror" = yes -o "$ac_cv_func_h_errlist" = yes; then
  287.   # If there's a system hstrerror, or we can reasonably replace it, say so.
  288.   # We still provide some definition, regardless, but this allows people to use
  289.   # a reasonable alternative if the situation allows, rather than using a
  290.   # degenerate version that only says `Host lookup error N'.
  291.   AC_DEFINE(HAVE_HSTRERROR)
  292. fi
  293.  
  294. # Checks return type of signal handlers
  295. AC_TYPE_SIGNAL
  296. # sig_t is the type of a signal handler (4.4BSD)
  297. IU_CHECK_TYPE(sig_t,
  298.   [ #include <sys/types.h>
  299.     #include <sys/signal.h> ])
  300.  
  301. # See if the __PROGNAME variable is defined, otherwise use our own.
  302. AC_CHECK_FUNC(__progname,
  303.   AC_DEFINE(HAVE___PROGNAME),
  304.   LIBOBJS="$LIBOBJS __progname.o")
  305.  
  306. # See if snprintf exists, otherwise just use a bogus version
  307. AC_CHECK_FUNC(snprintf,
  308.   AC_DEFINE(HAVE_SNPRINTF),
  309.   LIBOBJS="$LIBOBJS snprintf.o")
  310.  
  311. # SERVERS_OR_CLIENTS is the default set of things to build, and holds the
  312. # union of SERVERS and CLIENTS (we set it way down here to allow talk subdirs
  313. # to have been added to those variables by other code).
  314. SERVERS_OR_CLIENTS=''
  315. if test "$enable_servers" = yes; then
  316.   SERVERS_OR_CLIENTS="$SERVERS"
  317. fi
  318. if test "$enable_clients" = yes; then
  319.   SERVERS_OR_CLIENTS="$SERVERS_OR_CLIENTS $CLIENTS"
  320. fi
  321. AC_SUBST(SERVERS_OR_CLIENTS)
  322.  
  323. # Configure paths used by inetutils programs.  See the file `paths' for
  324. # details.
  325. PATHDEFS_MAKE=pathdefs.make
  326. PATHS_DEFS=paths.defs
  327. IU_CONFIG_PATHS($srcdir/paths, PATHDEFS_MAKE, PATHS_DEFS)
  328.  
  329. # Supply optional header files by linking a copy into the object include dir
  330. LINK_SRCS="$LINK_SRCS `for I in $INCLUDES; do echo $ac_n ' 'headers/$I$ac_c; done`"
  331. LINK_DSTS="$LINK_DSTS `for I in $INCLUDES; do echo $ac_n ' 'include/$I$ac_c; done`"
  332. AC_LINK_FILES($LINK_SRCS, $LINK_DSTS)
  333.  
  334. SUBDIR_MAKEFILES="`for D in $SUBDIRS; do echo $ac_n ' '$D/Makefile$ac_c; done`"
  335. AC_OUTPUT(Makefile config.make include/confpaths.h:headers/confpaths.h.in \
  336.       $SUBDIR_MAKEFILES)
  337.