1106792Sobriendnl $Id: configure.in,v 1.18 2002/05/23 02:42:55 lukem Exp $ 279968Sobriendnl 379968Sobriendnl configure.in -- 479968Sobriendnl process this file with autoconf to produce a configure script. 579968Sobriendnl 679968Sobrien 7106792SobrienAC_REVISION($Revision: 1.18 $)dnl 879968Sobrien 979968SobrienAC_INIT(lukemftpd.h) 1079968Sobrien 1179968Sobrien 1279968Sobriendnl Arguments for which features are included 1379968Sobriendnl 1479968SobrienAC_ARG_ENABLE(ipv6, [\ 1579968Sobrien --enable-ipv6 Enable IPv6 support (if your OS supports it). 1692282Sobrien --disable-ipv6 Disable IPv6 support (even if your OS supports it). 1792282Sobrien [default: enabled]], 1879968Sobrien opt_ipv6=$enableval, 1979968Sobrien opt_ipv6=yes) 2079968SobrienAC_ARG_ENABLE(builtinls, [\ 2179968Sobrien --enable-builtinls Enable built-in /bin/ls. [default: enabled] 2279968Sobrien --disable-builtinls Disable built-in /bin/ls.], 2379968Sobrien opt_builtinls=$enableval, 2479968Sobrien opt_builtinls=yes) 2579968Sobrien 2679968Sobrien 2779968Sobriendnl Checks for programs. 2879968Sobriendnl 2979968SobrienAC_PROG_MAKE_SET 3079968SobrienAC_PROG_CC 3179968SobrienAC_PROG_AWK 3279968SobrienAC_PROG_INSTALL 3379968SobrienAC_PROG_RANLIB 3479968SobrienAC_PROG_YACC 3579968SobrienAC_CHECK_PROGS(AR, ar) 3679968Sobrien 3779968Sobrien 3879968Sobriendnl Checks for libraries. 3979968Sobriendnl 4079968SobrienAC_CHECK_LIB(crypt, crypt) 4179968SobrienAC_CHECK_LIB(util, fparseln) 4279968Sobrienif test $ac_cv_lib_util_fparseln != yes; then 4379968Sobrien AC_CHECK_LIB(util, setproctitle) 4479968Sobrienfi 4579968SobrienAC_LIBRARY_NET 4679968SobrienAC_LIBRARY_SOCKS 4779968Sobrienif test -n "$socks"; then 4879968Sobrien if test $opt_ipv6 = yes; then 4979968Sobrien echo "IPv6 is incompatible with socks, disabling IPv6 support" 5079968Sobrien opt_ipv6=no 5179968Sobrien fi 5279968Sobrienfi 5379968SobrienAC_ARG_WITH(skey, 5479968Sobrien[ --with-skey Compile with S/Key authentication support.], 5579968Sobrien[ if test $withval = yes; then 5679968Sobrien AC_CHECK_LIB(skey, skey_haskey) 5779968Sobrien fi ] ) 5879968SobrienAC_MSG_CHECKING(whether to support S/Key) 5979968Sobrienif test x"$ac_cv_lib_skey_skey_haskey" = "xyes"; then 6079968Sobrien AC_MSG_RESULT(yes) 6179968Sobrien AC_DEFINE(SKEY, 1) 6279968Sobrienelse 6379968Sobrien AC_MSG_RESULT(no) 6479968Sobrienfi 6579968Sobrien 6679968Sobrien 6779968Sobriendnl Checks for header files. 6879968Sobriendnl 6979968SobrienAC_CONFIG_HEADER(config.h) 7079968SobrienAC_HEADER_DIRENT 7179968SobrienAC_HEADER_STDC 7279968SobrienAC_CHECK_HEADERS(arpa/nameser.h err.h fts.h libutil.h paths.h \ 7379968Sobrien sys/sysmacros.h util.h) 7479968Sobrien 7579968Sobrien 7679968Sobriendnl Checks for typedefs, structures, and compiler characteristics. 7779968Sobriendnl 7879968SobrienAC_HEADER_TIME 7979968SobrienAC_TYPE_OFF_T 8079968SobrienAC_CHECK_SIZEOF(off_t, 0) 8179968SobrienAC_MSG_TRY_LINK(for long long, ftp_cv_HAVE_LONG_LONG, [ 8279968Sobrien#include <sys/types.h>] , [ 8379968Sobrienlong long X = 2, Y = 1, Z; 8479968SobrienZ = X / Y; ], [ 8579968SobrienAC_DEFINE(HAVE_LONG_LONG, 1) 8679968Sobrienhave_long_long=yes], [have_long_long=no]) 8779968Sobrien 8879968SobrienAC_MSG_TRY_COMPILE(for in_port_t, ftp_cv_HAVE_IN_PORT_T, [ 8979968Sobrien#include <sys/types.h> 9079968Sobrien#include <netinet/in.h> ], [ in_port_t X ], [AC_DEFINE(HAVE_IN_PORT_T, 1)]) 9179968Sobrien 9279968SobrienAC_MSG_TRY_COMPILE(for sockaddr_in.sin_len, ftp_cv_HAVE_SOCKADDR_SA_LEN, [ 9379968Sobrien#include <sys/types.h> 9479968Sobrien#include <sys/socket.h> 9579968Sobrien#include <netinet/in.h> ], [ 9679968Sobrien struct sockaddr_in sin; 9779968Sobrien int X = sin.sin_len ], [AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1)]) 9879968Sobrien 9979968SobrienAC_MSG_TRY_COMPILE(for socklen_t, ftp_cv_HAVE_SOCKLEN_T, [ 10079968Sobrien#include <sys/types.h> 10179968Sobrien#include <sys/socket.h> ], [ socklen_t X ], [AC_DEFINE(HAVE_SOCKLEN_T, 1)]) 10279968Sobrien 10379968Sobrienif test $opt_ipv6 = yes; then 10479968Sobrien 10579968Sobrien AC_MSG_TRY_COMPILE(for AF_INET6, ftp_cv_HAVE_AF_INET6, [ 10679968Sobrien#include <sys/types.h> 10779968Sobrien#include <sys/socket.h> ], 10879968Sobrien [ int X = AF_INET6 ], [AC_DEFINE(HAVE_AF_INET6, 1)]) 10979968Sobrien 11079968Sobrien AC_MSG_TRY_COMPILE(for struct sockaddr_in6, ftp_cv_HAVE_SOCKADDR_IN6, [ 11179968Sobrien#include <sys/types.h> 11279968Sobrien#include <netinet/in.h> ], 11379968Sobrien [ struct sockaddr_in6 X ], [AC_DEFINE(HAVE_SOCKADDR_IN6, 1)]) 11479968Sobrien 11579968Sobrienfi 11679968Sobrien 11779968SobrienAC_MSG_TRY_COMPILE(for struct addrinfo, ftp_cv_HAVE_ADDRINFO, [ 11879968Sobrien#include <sys/types.h> 11979968Sobrien#include <sys/socket.h> 12079968Sobrien#include <netdb.h> ], 12179968Sobrien [ struct addrinfo X ], [AC_DEFINE(HAVE_ADDRINFO, 1)]) 12279968Sobrien 12379968SobrienAC_MSG_TRY_COMPILE(for d_namlen in struct dirent, ftp_cv_HAVE_D_NAMLEN, [ 12479968Sobrien#if HAVE_DIRENT_H 12579968Sobrien# include <dirent.h> 12679968Sobrien#else 12779968Sobrien# define dirent direct 12879968Sobrien# if HAVE_SYS_NDIR_H 12979968Sobrien# include <sys/ndir.h> 13079968Sobrien# endif 13179968Sobrien# if HAVE_SYS_DIR_H 13279968Sobrien# include <sys/dir.h> 13379968Sobrien# endif 13479968Sobrien# if HAVE_NDIR_H 13579968Sobrien# include <ndir.h> 13679968Sobrien# endif 13779968Sobrien#endif ], [ 13879968Sobrien struct dirent dp; 13979968Sobrien int X = dp.d_namlen; ], [AC_DEFINE(HAVE_D_NAMLEN, 1)]) 14079968Sobrien 14179968SobrienAC_MSG_TRY_COMPILE(for struct passwd.pw_expire, ftp_cv_HAVE_PW_EXPIRE, [ 14279968Sobrien#include <sys/types.h> 14379968Sobrien#include <pwd.h> ], 14479968Sobrien [ struct passwd pw; 14579968Sobrien time_t X = pw.pw_expire ], [AC_DEFINE(HAVE_PW_EXPIRE, 1)]) 14679968Sobrien 14779968SobrienAC_C_CONST 14879968Sobrien 14979968Sobrien 15079968Sobriendnl Checks for library functions. 15179968Sobriendnl 15279968SobrienAC_REPLACE_FUNCS(err fgetln getaddrinfo getgrouplist getnameinfo \ 15379968Sobrien getusershell inet_net_pton inet_ntop inet_pton mkstemp \ 15479968Sobrien sl_init snprintf strdup strerror strlcat strlcpy strsep \ 15579968Sobrien usleep vsyslog) 15679968SobrienAC_CHECK_FUNCS(flock lockf getspnam setlogin setproctitle vfork) 15779968Sobrienif test $ac_cv_lib_util_fparseln != yes; then 15879968Sobrien AC_REPLACE_FUNCS(fparseln) 15979968Sobrienfi 16079968Sobrien 16179968SobrienLIBOBJS="$LIBOBJS glob.o" 16279968Sobrien 16379968SobrienAC_MSG_TRY_COMPILE(for crypt() declaration, ftp_cv_HAVE_CRYPT_D, [ 16479968Sobrien#include <unistd.h> ], [ char *(*X)() = crypt ], [AC_DEFINE(HAVE_CRYPT_D, 1)]) 16579968Sobrien 16679968SobrienAC_MSG_TRY_COMPILE(for fclose() declaration, ftp_cv_HAVE_FCLOSE_D, [ 16779968Sobrien#include <stdio.h> ], [ int (*X)() = fclose ], [AC_DEFINE(HAVE_FCLOSE_D, 1)]) 16879968Sobrien 169106792SobrienAC_MSG_TRY_COMPILE(for FNM_CASEFOLD, ftp_cv_HAVE_FNM_CASEFOLD, [ 170106792Sobrien#include <fnmatch.h> ], [ int X = FNM_CASEFOLD ], 171106792Sobrien[AC_DEFINE(HAVE_FNM_CASEFOLD, 1)], 172106792Sobrien[LIBOBJS="$LIBOBJS fnmatch.o"]) 173106792Sobrien 17479968SobrienAC_MSG_TRY_COMPILE(for optarg declaration, ftp_cv_HAVE_OPTARG_D, [ 17579968Sobrien#include <stdlib.h> 17679968Sobrien#include <unistd.h> ], [ char *X = optarg ], [AC_DEFINE(HAVE_OPTARG_D, 1)]) 17779968Sobrien 17879968SobrienAC_MSG_TRY_COMPILE(for optind declaration, ftp_cv_HAVE_OPTIND_D, [ 17979968Sobrien#include <stdlib.h> 18079968Sobrien#include <unistd.h> ], [ int X = optind ], [AC_DEFINE(HAVE_OPTIND_D, 1)]) 18179968Sobrien 18279968SobrienAC_MSG_TRY_LINK(for optreset, ftp_cv_HAVE_OPTRESET, [ 18379968Sobrien#include <stdlib.h> 18479968Sobrien#include <unistd.h> ], [ int X = optreset ], [AC_DEFINE(HAVE_OPTRESET, 1)]) 18579968Sobrien 18679968SobrienAC_MSG_TRY_COMPILE(for pclose() declaration, ftp_cv_HAVE_PCLOSE_D, [ 18779968Sobrien#include <stdio.h> ], [ int (*X)() = pclose ], [AC_DEFINE(HAVE_PCLOSE_D, 1)]) 18879968Sobrien 18979968Sobrienif test $ac_cv_func_getusershell = yes; then 19079968Sobrien AC_MSG_TRY_COMPILE(for getusershell() declaration, 19179968Sobrien ftp_cv_HAVE_GETUSERSHELL_D, [ 19279968Sobrien #include <unistd.h> ], [ char *(*X)() = getusershell ], 19379968Sobrien [AC_DEFINE(HAVE_GETUSERSHELL_D, 1)]) 19479968Sobrienfi 19579968Sobrien 19679968Sobrien 19779968Sobrienif test $have_long_long = yes -a $ac_cv_sizeof_off_t -ge 8; then 19879968Sobrien 19979968Sobriendnl We assume that if sprintf() supports %lld or %qd, 20079968Sobriendnl then all of *printf() does. If not, disable long long 20179968Sobriendnl support because we don't know how to display it. 20279968Sobrien 20379968Sobrien AC_MSG_CHECKING(*printf() support for %lld) 20479968Sobrien can_printf_longlong=no 20579968Sobrien AC_TRY_RUN([ 20679968Sobrien #include <stdio.h> 20779968Sobrien int main() { 20879968Sobrien char buf[100]; 20979968Sobrien sprintf(buf, "%lld", 4294967300LL); 21079968Sobrien return (strcmp(buf, "4294967300")); 21179968Sobrien } 21279968Sobrien ], [ 21379968Sobrien AC_MSG_RESULT(yes) 21479968Sobrien can_printf_longlong=yes 21579968Sobrien ], [ 21679968Sobrien AC_MSG_RESULT(no) 21779968Sobrien ], [ : ]) 21879968Sobrien 21979968Sobrien if test $can_printf_longlong != yes; then 22079968Sobrien AC_MSG_CHECKING(*printf() support for %qd) 22179968Sobrien AC_TRY_RUN([ 22279968Sobrien #include <stdio.h> 22379968Sobrien int main() { 22479968Sobrien char buf[100]; 22579968Sobrien sprintf(buf, "%qd", 4294967300LL); 22679968Sobrien return (strcmp(buf, "4294967300")); 22779968Sobrien } 22879968Sobrien ], [ 22979968Sobrien AC_MSG_RESULT(yes) 23079968Sobrien can_printf_longlong=yes 23179968Sobrien AC_DEFINE(HAVE_PRINTF_QD, 1) 23279968Sobrien ], [ 23379968Sobrien AC_MSG_RESULT(no) 23479968Sobrien ], [ : ]) 23579968Sobrien fi 23679968Sobrien 23779968Sobrien if test $can_printf_longlong = yes; then 23879968Sobrien AC_DEFINE(HAVE_QUAD_SUPPORT, 1) 23979968Sobrien AC_REPLACE_FUNCS(strtoll) 24079968Sobrien fi 24179968Sobrien 24279968Sobrienfi 24379968Sobrien 24479968Sobrien 24579968Sobrienhave_rfc2553_netdb=no 24679968Sobrienif test $ac_cv_func_getaddrinfo = yes -a ! -n "$socks"; then 24779968Sobrien AC_MSG_TRY_COMPILE(for AI_NUMERICHOST, 24879968Sobrien ftp_cv_have_ai_numerichost, [ 24979968Sobrien #include <sys/types.h> 25079968Sobrien #include <sys/socket.h> 25179968Sobrien #include <netdb.h> ], 25279968Sobrien [ int X = AI_NUMERICHOST ], [ have_rfc2553_netdb=yes ]) 25379968Sobrienfi 25479968SobrienAC_MSG_CHECKING(for working getaddrinfo()) 25579968Sobrienif test $have_rfc2553_netdb = yes; then 25679968Sobrien AC_DEFINE(HAVE_RFC2553_NETDB, 1) 25779968Sobrien AC_MSG_RESULT(yes) 25879968Sobrienelse 25979968Sobrien if test $ac_cv_func_getaddrinfo = yes; then 26079968Sobrien LIBOBJS="$LIBOBJS getaddrinfo.o" 26179968Sobrien AC_MSG_RESULT(no - using local version) 26279968Sobrien else 26379968Sobrien AC_MSG_RESULT(using local version) 26479968Sobrien fi 26579968Sobrienfi 26679968Sobrien 26779968Sobrienif test $ac_cv_func_sl_init = yes; then 26879968Sobrien AC_MSG_TRY_COMPILE(if sl_add() returns int, ftp_cv_INT_SL_ADD, [ 26979968Sobrien #include <stringlist.h> ], [ int f = sl_add((StringList *)0, "foo") ], 27079968Sobrien [:] , [LIBOBJS="$LIBOBJS sl_init.o"]) 27179968Sobrienfi 27279968Sobrien 27379968Sobrien 27479968Sobriendnl Tests for stuff for inbuilt ls 27579968Sobriendnl 27679968Sobrien 27779968Sobrienif test $opt_builtinls = yes; then 27879968Sobrien AC_REPLACE_FUNCS(fts_open strmode user_from_uid) 27979968Sobrien LSOBJS="cmp.o ls.o print.o util.o" 28079968Sobrienelse 28179968Sobrien AC_DEFINE(NO_INTERNAL_LS,1) 28279968Sobrienfi 28379968Sobrien 28479968Sobrien 28579968Sobriendnl Build libukem if necessary 28679968Sobriendnl 28779968Sobrien 28879968Sobrienif test -n "$LIBOBJS"; then 28979968Sobrien INCLUDES="$INCLUDES -I\${srcdir}/../libukem" 29079968Sobrien LDFLAGS="$LDFLAGS -L../libukem" 29179968Sobrien LIBS="$LIBS -lukem" 29279968Sobrien LIBUKEM=libukem.a 29379968Sobrien LIBDEPENDS="$LIBDEPENDS ../libukem/libukem.a" 29479968Sobrienfi 29579968Sobrien 29679968Sobrien 29779968Sobriendnl Create the Makefiles 29879968Sobriendnl 29979968Sobrien 30079968SobrienAC_SUBST(INCLUDES) 30179968SobrienAC_SUBST(LIBUKEM) 30279968SobrienAC_SUBST(LIBDEPENDS) 30379968SobrienAC_SUBST(LSOBJS) 30479968Sobrien 30579968SobrienAC_OUTPUT(Makefile libukem/Makefile src/Makefile) 306