"Fossies" - the Fresh Open Source Software Archive

Member "tnftp-20200705/configure.ac" (5 Jul 2020, 16844 Bytes) of package /linux/privat/tnftp-20200705.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "configure.ac": 20151004_vs_20200705.

    1 #       $NetBSD: configure.ac,v 1.38 2020/07/05 11:37:02 lukem Exp $
    2 #
    3 # Process this file with autoconf to produce a configure script.
    4 
    5 AC_INIT([tnftp], [20200705], [lukem@NetBSD.org])
    6 AC_PREREQ([2.69])
    7 
    8 AC_COPYRIGHT([
    9 Copyright (c) 1999-2020 The NetBSD Foundation, Inc.
   10 All rights reserved.
   11 ])
   12 AC_REVISION([$Revision: 1.38 $])
   13 
   14 AS_SHELL_SANITIZE()
   15 
   16 AC_CONFIG_SRCDIR([tnftp.h])
   17 AC_CONFIG_AUX_DIR([buildaux])
   18 AC_CONFIG_MACRO_DIR([buildaux])
   19 AC_CONFIG_HEADERS([tnftp_config.h])
   20 AC_CONFIG_LIBOBJ_DIR([libnetbsd])
   21 
   22 AM_INIT_AUTOMAKE([-Wall -Werror foreign nostdinc silent-rules])
   23 AM_MAINTAINER_MODE()
   24 
   25 #
   26 # Arguments for which features are included.
   27 #
   28 AC_ARG_ENABLE([editcomplete],
   29               [AS_HELP_STRING([--enable-editcomplete],
   30                               [turn on command line editing and completion
   31                                (requires system or local libedit)
   32                                [default=enabled]])],
   33               [opt_editcomplete=$enableval],
   34               [opt_editcomplete=yes])
   35 AC_ARG_ENABLE([ipv6],
   36               [AS_HELP_STRING([--enable-ipv6],
   37                               [enable IPv6 support (if your OS supports it)
   38                                [default=enabled]])],
   39               [opt_ipv6=$enableval],
   40               [opt_ipv6=yes])
   41 AC_ARG_ENABLE([ssl],
   42               [AS_HELP_STRING([--enable-ssl],
   43                               [enable SSL support (requires --with-openssl)
   44                                [default=auto]])],
   45               [with_ssl=$enableval],
   46               [with_ssl=auto])
   47 AC_ARG_WITH([local-libedit],
   48             [AS_HELP_STRING([--with-local-libedit],
   49                             [use local libedit instead of system library:
   50                              yes; auto (try system, fallback to local); no
   51                              [default=auto]])],
   52             [],
   53             [with_local_libedit=auto])
   54 AC_ARG_WITH([socks],
   55             [AS_HELP_STRING([--with-socks],
   56                             [enable support for (Dante) SOCKS5 proxy
   57                              [default=auto]])],
   58             [],
   59             [with_socks=auto])
   60 
   61 #
   62 # Autoheader templates symbols.
   63 #
   64 AH_TEMPLATE([HAVE_POLL],
   65             [Define if we have poll() and it is not emulated.])
   66 AH_TEMPLATE([HAVE_PRINTF_QD],
   67             [Define if *printf() uses %qd to print 'long long'
   68              (otherwise uses %lld).])
   69 AH_TEMPLATE([HAVE_PRINTF_LONG_LONG],
   70             [Define if 'long long' is supported and
   71              *printf() supports %lld or %qd to print them.])
   72 AH_TEMPLATE([HAVE_VA_COPY],
   73             [Define to 1 if the 'va_copy' function is supported.])
   74 AH_TEMPLATE([HAVE___BUILTIN_VA_COPY],
   75             [Define to 1 if the '__builtin_va_copy' function is supported.])
   76 AH_TEMPLATE([NO_EDITCOMPLETE],
   77             [Define if disabling command-line editing and completion.])
   78 AH_TEMPLATE([USE_GLOB_H],
   79             [Define if using system <glob.h> instead of local glob.])
   80 AH_TEMPLATE([USE_INET6],
   81             [Define if using IPv6 support.])
   82 AH_TEMPLATE([USE_SOCKS],
   83             [Define if using (Dante) SOCKS5 proxy.])
   84 AH_TEMPLATE([WITH_SSL],
   85             [Define if enabling SSL support.])
   86 
   87 #
   88 # Checks for programs.
   89 #
   90 AC_PROG_CC()
   91 AC_PROG_AWK()
   92 AC_PROG_LIBTOOL()
   93 
   94 #
   95 # Checks for tool features.
   96 #
   97 AS_CASE([$target_os],
   98         [darwin*],
   99         [# Mac OS X linker needs -search_paths_first so our private libraries
  100          # are used before system libraries.
  101          #
  102          old_LDFLAGS=$LDFLAGS
  103          LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
  104          AC_MSG_CHECKING([if ld accepts -search_paths_first])
  105          AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[int i;]])],
  106                         [AC_MSG_RESULT([yes])],
  107                         [AC_MSG_RESULT([no])
  108                          LDFLAGS=$old_LDFLAGS])],
  109         )
  110 
  111 #
  112 # Checks for libraries.
  113 #
  114 
  115 # Check if libedit is required, and which implementation.
  116 #
  117 AS_IF([test "$opt_editcomplete" = yes],
  118       [AC_MSG_NOTICE([--enable-editcomplete; checking for required features])
  119        AC_SEARCH_LIBS([tgetent],
  120                       [termcap termlib curses ncurses tinfo],
  121                       [],
  122                       [AC_MSG_ERROR([no relevant library found containing tgetent])])
  123        AS_IF([test "$with_local_libedit" != yes],
  124              [AC_CHECK_LIB([edit],
  125                            [el_init],
  126                            [AC_MSG_NOTICE([using system libedit])
  127                             with_local_libedit=no],
  128                            [AS_IF([test "$with_local_libedit" = no],
  129                                   [AC_MSG_ERROR([--without-local-libedit was given, but system libedit was not found])])
  130                             AC_MSG_NOTICE([using local libedit])
  131                             with_local_libedit=yes])],
  132              [AC_MSG_NOTICE([using local libedit])])],
  133       [AC_MSG_NOTICE([--disable-editcomplete; disabling --with-local-libedit])
  134        AC_DEFINE([NO_EDITCOMPLETE], [1])
  135        with_local_libedit=no])
  136 
  137 # Check for ns and socket libraries.
  138 #
  139 AC_SEARCH_LIBS([gethostbyname], [nsl])
  140 AC_SEARCH_LIBS([socket],
  141                [socket],
  142                [],
  143                [AC_CHECK_LIB([socket],
  144                              [socket],
  145                              [LIBS="-lsocket -lnsl $LIBS"],
  146                              [],
  147                              [-lnsl])])
  148 
  149 # Check for (Dante) SOCKS5.
  150 #
  151 AS_IF([test "$with_socks" != no],
  152       [AC_MSG_NOTICE([--with-socks=$with_socks; checking for required SOCKS5 features])
  153        AC_SEARCH_LIBS([SOCKSinit],
  154                       [socksd socks],
  155                       [AC_DEFINE([USE_SOCKS], [1])
  156                        AC_MSG_NOTICE([enabling SOCKS5 support])
  157                        with_socks=yes
  158                        AS_IF([test "$opt_ipv6" = yes],
  159                              [AC_MSG_WARN(
  160                 [IPv6 is incompatible with socks, disabling IPv6 support])
  161                               opt_ipv6=no])],
  162                       [AS_IF([test "$with_socks" != auto],
  163                              [AC_MSG_ERROR(
  164                 [--with-socks was given, but SOCKSinit() was not found])])
  165                        AC_MSG_NOTICE([disabling --with-socks])
  166                        with_socks=no])])
  167 
  168 # Check for OpenSSL.
  169 #
  170 AX_CHECK_OPENSSL([have_ssl=yes])
  171 
  172 AS_IF([test "$with_ssl" != no],
  173       [AC_MSG_NOTICE([--with-ssl=$with_ssl; checking for required OpenSSL features])
  174        AS_IF([test "$have_ssl" = yes],
  175              [AC_DEFINE([WITH_SSL], [1])
  176               AC_MSG_NOTICE([enabling SSL support])
  177               with_ssl=yes],
  178              [AS_IF([test "$with_ssl" != auto],
  179                     [AC_MSG_ERROR([--with-ssl was given, but OpenSSL was not found])])
  180               AC_MSG_NOTICE([disabling --with-ssl])
  181               with_ssl=no])])
  182 
  183 #
  184 # Checks for header files.
  185 #
  186 accheck_includes='
  187 #include <stdio.h>
  188 #if defined(HAVE_SYS_TYPES_H)
  189 # include <sys/types.h>
  190 #endif
  191 #if defined(HAVE_SYS_STAT_H)
  192 # include <sys/stat.h>
  193 #endif
  194 #if defined(STDC_HEADERS)
  195 # include <stdarg.h>
  196 # include <stdlib.h>
  197 # include <string.h>
  198 #endif
  199 #if defined(TIME_WITH_SYS_TIME)
  200 # include <sys/time.h>
  201 # include <time.h>
  202 #else
  203 # if defined(HAVE_SYS_TIME_H)
  204 #  include <sys/time.h>
  205 # else
  206 #  include <time.h>
  207 # endif
  208 #endif
  209 #if defined(HAVE_LIBGEN_H)
  210 # include <libgen.h>
  211 #endif
  212 #if defined(HAVE_PWD_H)
  213 # include <pwd.h>
  214 #endif
  215 #if defined(HAVE_UNISTD_H)
  216 # include <unistd.h>
  217 #endif
  218 #if defined(HAVE_POLL_H)
  219 # include <poll.h>
  220 #elif defined(HAVE_SYS_POLL_H)
  221 # include <sys/poll.h>
  222 #endif
  223 #if defined(HAVE_SYS_SOCKET_H)
  224 # include <sys/socket.h>
  225 #endif
  226 #if defined(HAVE_NETINET_IN_H)
  227 # include <netinet/in.h>
  228 #endif
  229 #if defined(HAVE_NETINET_IN_SYSTM_H)
  230 # include <netinet/in_systm.h>
  231 #endif
  232 #if defined(HAVE_NETINET_IP_H)
  233 # include <netinet/ip.h>
  234 #endif
  235 #if defined(HAVE_NETINET_TCP_H)
  236 # include <netinet/tcp.h>
  237 #endif
  238 #if defined(HAVE_NETDB_H)
  239 # include <netdb.h>
  240 #endif
  241 #if defined(HAVE_ARPA_INET_H)
  242 # include <arpa/inet.h>
  243 #endif
  244 #if defined(HAVE_DIRENT_H)
  245 # include <dirent.h>
  246 #else
  247 # define dirent direct
  248 # if defined(HAVE_SYS_NDIR_H)
  249 #  include <sys/ndir.h>
  250 # endif
  251 # if defined(HAVE_SYS_DIR_H)
  252 #  include <sys/dir.h>
  253 # endif
  254 # if defined(HAVE_NDIR_H)
  255 #  include <ndir.h>
  256 # endif
  257 #endif
  258 ' # accheck_includes
  259 
  260 AC_CHECK_HEADERS([sys/types.h sys/ioctl.h sys/param.h sys/stat.h \
  261                   sys/socket.h sys/syslimits.h sys/time.h sys/uio.h \
  262                   sys/wait.h],
  263                  [], [], [$accheck_includes])
  264 AC_HEADER_DIRENT()
  265 AC_HEADER_RESOLV()
  266 AC_HEADER_STAT()
  267 AC_HEADER_STDC()
  268 AC_HEADER_TIME()
  269 AC_HEADER_TIOCGWINSZ()
  270 AC_CHECK_HEADERS([arpa/ftp.h arpa/inet.h arpa/nameser.h err.h \
  271                   fcntl.h libgen.h limits.h locale.h malloc.h \
  272                   netinet/in.h netinet/in_systm.h netinet/ip.h \
  273                   netinet/tcp.h \
  274                   paths.h poll.h pwd.h sys/poll.h regex.h \
  275                   setjmp.h signal.h stddef.h termcap.h termios.h \
  276                   unistd.h utime.h vis.h],
  277                   [], [], [$accheck_includes])
  278 
  279 #
  280 # Checks for typedefs, structures, and compiler characteristics.
  281 #
  282 AC_CHECK_DECLS([AI_NUMERICHOST, dirname, fclose, getpass, h_errno, pclose,
  283                 optarg, optind],
  284                [], [], [$accheck_includes])
  285 AC_TYPE_LONG_DOUBLE()
  286 AC_TYPE_LONG_LONG_INT()
  287 AC_TYPE_UINT32_T()
  288 AC_TYPE_OFF_T()
  289 AC_TYPE_PID_T()
  290 AC_TYPE_SIZE_T()
  291 AC_STRUCT_TM()
  292 AC_CHECK_MEMBERS([struct sockaddr.sa_len, struct sockaddr_in.sin_len,
  293                   struct dirent.d_namlen],
  294                  [], [], [$accheck_includes])
  295 AC_CHECK_TYPES([in_port_t, sa_family_t, socklen_t, struct addrinfo],
  296                [], [], [$accheck_includes])
  297 AC_SYS_LARGEFILE()
  298 
  299 # If IPv6 is enabled, check for necessary items.
  300 #
  301 AS_IF([test "$opt_ipv6" = yes],
  302       [AC_MSG_NOTICE([--enable-ipv6; checking for required IPv6 features])
  303        AC_CHECK_DECLS([AF_INET6, NS_IN6ADDRSZ], [], [],
  304 [$accheck_includes
  305 #if defined(HAVE_ARPA_NAMESER_H)
  306 #include <arpa/nameser.h>
  307 #endif
  308 ])
  309        AC_CHECK_TYPES([struct sockaddr_in6], [], [opt_ipv6=no],
  310                       [$accheck_includes])
  311        AS_IF([test "$opt_ipv6" = yes],
  312              [AC_MSG_NOTICE([enabling IPv6 support])
  313               AC_DEFINE([USE_INET6], [1])],
  314              [AC_MSG_NOTICE([disabling IPv6 support])])
  315        ])
  316 
  317 #
  318 # Checks for library functions.
  319 #
  320 AC_FUNC_CLOSEDIR_VOID()
  321 AC_FUNC_FORK()
  322 AC_FUNC_FSEEKO()
  323 AC_FUNC_STRCOLL()
  324 AC_REPLACE_FUNCS([dirname err fgetln getaddrinfo getnameinfo \
  325                   inet_ntop inet_pton mkstemp setprogname sl_init snprintf \
  326                   strdup strerror strlcat strlcpy strptime strsep strunvis \
  327                   strvis timegm usleep utimes vasprintf])
  328 AC_CHECK_FUNCS([getcwd gethostbyaddr gethostbyname gethostbyname2 gethostname \
  329                 getpass getpassphrase getpgrp gettimeofday isascii \
  330                 memchr memmove memset realpath regcomp \
  331                 select setlocale socket strcasecmp strchr strcspn strdup \
  332                 strerror strncasecmp strpbrk strrchr strstr strtol strtoul \
  333                 utime])
  334 AS_IF([test "$ac_cv_func_getpgrp" = yes], [AC_FUNC_GETPGRP])
  335 AS_IF([test "$ac_cv_func_strptime" = yes], [AC_CHECK_DECLS([strptime])])
  336 
  337 # Use system glob if GLOB_BRACE and GLOB_TILDE are available.
  338 #
  339 use_local_glob=yes
  340 AC_CHECK_HEADER([glob.h],
  341                 [AC_MSG_CHECKING([glob supports required extensions])
  342                  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  343 #include <glob.h>]], [[
  344 int f = GLOB_BRACE | GLOB_TILDE;
  345 ]])],
  346                          [AC_MSG_RESULT([yes])
  347               use_local_glob=no],
  348                          [AC_MSG_RESULT([no - using local version])],
  349                          [AC_MSG_RESULT([unknown - cross-compiling])])])
  350 AS_IF([test "$use_local_glob" = yes],
  351       [AC_LIBOBJ([glob])],
  352       [AC_DEFINE([USE_GLOB_H], [1])])
  353 
  354 # We assume that if sprintf() supports %lld or %qd,
  355 # then all of *printf() does. If not, disable long long
  356 # support because we don't know how to display it.
  357 #
  358 AS_IF([test "$ac_cv_type_long_long_int" = yes],
  359       [AC_MSG_CHECKING([*printf() support for %lld])
  360        can_printf_longlong=no
  361        AC_RUN_IFELSE([AC_LANG_PROGRAM([[
  362 $accheck_includes
  363 ]], [[
  364 char buf[100];
  365 sprintf(buf, "%lld", 4294967300LL);
  366 exit(0 != strcmp(buf, "4294967300"));
  367 ]])],
  368                      [AC_MSG_RESULT([yes])
  369                       can_printf_longlong=yes],
  370                      [AC_MSG_RESULT([no])],
  371                      [AC_MSG_RESULT([unknown - cross-compiling])])
  372         AS_IF([test "$can_printf_longlong" != yes],
  373               [AC_MSG_CHECKING([*printf() support for %qd])
  374                AC_RUN_IFELSE([AC_LANG_PROGRAM([[
  375 $accheck_includes
  376 ]], [[
  377 char buf[100];
  378 sprintf(buf, "%qd", 4294967300LL);
  379 exit(0 != strcmp(buf, "4294967300"));
  380 ]])],
  381                              [AC_MSG_RESULT([yes])
  382                               can_printf_longlong=yes
  383                               AC_DEFINE([HAVE_PRINTF_QD], [1])],
  384                              [AC_MSG_RESULT([no])],
  385                              [AC_MSG_RESULT([unknown - cross-compiling])])])
  386         AC_MSG_CHECKING([if *printf() can print long long ints])
  387         AS_IF([test "$can_printf_longlong" = yes],
  388               [AC_MSG_RESULT([yes])
  389                AC_DEFINE([HAVE_PRINTF_LONG_LONG], [1])
  390                AC_REPLACE_FUNCS([strtoll])],
  391               [AC_MSG_RESULT([no])])])
  392 
  393 # Handle Darwin 7 having a poll() compatibility function,
  394 # and don't use it if it's emulated.
  395 # Be conservative, if we don't find one of poll.h or sys/poll.h,
  396 # don't attempt to use poll().
  397 #
  398 AC_CHECK_TYPES([struct pollfd], [], [], [$accheck_includes])
  399 AC_CHECK_FUNC([poll],
  400               [AC_CHECK_DECL([_POLL_EMUL_H_],
  401                              [],
  402                              [AC_DEFINE([HAVE_POLL], [1])],
  403                              [$accheck_includes])])
  404 
  405 AC_MSG_CHECKING([for va_copy])
  406 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
  407 $accheck_includes
  408 ]], [[
  409 va_list ap, ap2;
  410 va_copy(ap2, ap);
  411 return 0;
  412 ]])],
  413               [AC_MSG_RESULT([yes])
  414                AC_DEFINE([HAVE_VA_COPY], [1])],
  415               [AC_MSG_RESULT([no])])
  416 
  417 AC_MSG_CHECKING([for __builtin_va_copy])
  418 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
  419 $accheck_includes
  420 ]], [[
  421 va_list ap, ap2;
  422 __builtin_va_copy(ap2, ap);
  423 return 0;
  424 ]])],
  425               [AC_MSG_RESULT([yes])
  426                AC_DEFINE([HAVE___BUILTIN_VA_COPY], [1])],
  427               [AC_MSG_RESULT([no])])
  428 
  429 AS_IF([test "$ac_cv_func_strptime" = yes],
  430       [AC_MSG_CHECKING([if strptime() needs separators between conversions])
  431        AC_RUN_IFELSE([AC_LANG_PROGRAM([[
  432 $accheck_includes
  433 ]], [[
  434 struct tm timebuf;
  435 char * res;
  436 memset(&timebuf, 0, sizeof(timebuf));
  437 res = strptime("20011122161900", "%Y%m%d%H%M%S", &timebuf);
  438 exit(!res);
  439 ]])],
  440                      [AC_MSG_RESULT([no])],
  441                      [AC_MSG_RESULT([yes - using local version])
  442                       AC_LIBOBJ([strptime])],
  443                      [AC_MSG_RESULT([unknown - cross-compiling])])])
  444 
  445 # Replace sl_init() (et al) if it provides the older API.
  446 #
  447 AS_IF([test "$ac_cv_func_sl_init" = yes],
  448       [AC_MSG_CHECKING([if sl_add() returns int])
  449        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stringlist.h>]],
  450                                           [[int f = sl_add((StringList *)0,
  451                                                            "foo");]])],
  452                          [AC_MSG_RESULT([yes])],
  453                          [AC_MSG_RESULT([no - using local version])
  454                           AC_LIBOBJ([sl_init])],
  455                          [AC_MSG_RESULT([unknown - cross-compiling])])])
  456 
  457 # Replace getaddrinfo() if missing or AI_NUMERICHOST isn't declared.
  458 #
  459 AC_MSG_CHECKING([for working getaddrinfo()])
  460 AS_IF([test "$ac_cv_have_decl_AI_NUMERICHOST" = yes],
  461       [AC_MSG_RESULT([yes])],
  462       [AS_IF([test "$ac_cv_func_getaddrinfo" = yes],
  463              [AC_LIBOBJ([getaddrinfo])
  464               AC_MSG_RESULT([no - using local version])],
  465              [AC_MSG_RESULT([using local version])])])
  466 
  467 # Check for VIS_WHITE in <vis.h>
  468 #
  469 AS_IF([test "$ac_cv_header_vis_h" = yes],
  470       [AC_CHECK_DECL([VIS_WHITE], [], [], [
  471 #include <vis.h>
  472 ])])
  473 
  474 AM_CONDITIONAL([WITH_SSL], [test "$with_ssl" = yes])
  475 AM_CONDITIONAL([OPT_EDITCOMPLETE], [test "$opt_editcomplete" = yes])
  476 AM_CONDITIONAL([WITH_LOCAL_LIBEDIT], [test "$with_local_libedit" = yes])
  477 
  478 #
  479 # Create the Makefiles.
  480 #
  481 AC_CONFIG_FILES([
  482         Makefile
  483         libedit/Makefile
  484         libnetbsd/Makefile
  485         src/Makefile
  486 ])
  487 
  488 AC_OUTPUT()
  489 
  490 # Display feature results.
  491 #
  492 AC_MSG_NOTICE([ === Configuration results ===])
  493 AC_MSG_NOTICE([Package:               $PACKAGE_STRING])
  494 AC_MSG_NOTICE([Prefix:                $prefix])
  495 AC_MSG_NOTICE([Command-line editing:  $opt_editcomplete])
  496 AC_MSG_NOTICE([Local libedit:         $with_local_libedit])
  497 AC_MSG_NOTICE([IPv6 support:          $opt_ipv6])
  498 AC_MSG_NOTICE([SOCKS5 proxy support:  $with_socks])
  499 AC_MSG_NOTICE([SSL:                   $with_ssl])
  500 AC_MSG_NOTICE([ =============================])