Skip to content
configure.ac 73.7 KiB
Newer Older
TYPE_IN_ADDR_T
CURL_CHECK_FUNC_SELECT
Yang Tse's avatar
 
Yang Tse committed
CURL_CHECK_FUNC_BASENAME
Yang Tse's avatar
 
Yang Tse committed
CURL_CHECK_FUNC_CLOSESOCKET
CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
Yang Tse's avatar
 
Yang Tse committed
CURL_CHECK_FUNC_CONNECT
CURL_CHECK_FUNC_FDOPEN
CURL_CHECK_FUNC_FREEADDRINFO
CURL_CHECK_FUNC_FTRUNCATE
CURL_CHECK_FUNC_GETHOSTBYADDR_R
CURL_CHECK_FUNC_GETHOSTBYNAME_R
CURL_CHECK_FUNC_GETHOSTNAME
CURL_CHECK_FUNC_GETSERVBYPORT_R
CURL_CHECK_FUNC_GMTIME_R
CURL_CHECK_FUNC_INET_NTOA_R
CURL_CHECK_FUNC_IOCTL
CURL_CHECK_FUNC_IOCTLSOCKET
CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
CURL_CHECK_FUNC_LOCALTIME_R
CURL_CHECK_FUNC_MEMRCHR
CURL_CHECK_FUNC_POLL
CURL_CHECK_FUNC_SIGACTION
CURL_CHECK_FUNC_SIGINTERRUPT
CURL_CHECK_FUNC_SIGNAL
CURL_CHECK_FUNC_SIGSETJMP
Yang Tse's avatar
 
Yang Tse committed
CURL_CHECK_FUNC_SOCKET
Yang Tse's avatar
Yang Tse committed
CURL_CHECK_FUNC_STRCASECMP
CURL_CHECK_FUNC_STRCASESTR
CURL_CHECK_FUNC_STRCMPI
CURL_CHECK_FUNC_STRDUP
CURL_CHECK_FUNC_STRERROR_R
Yang Tse's avatar
Yang Tse committed
CURL_CHECK_FUNC_STRICMP
CURL_CHECK_FUNC_STRLCAT
CURL_CHECK_FUNC_STRNCASECMP
CURL_CHECK_FUNC_STRNCMPI
CURL_CHECK_FUNC_STRNICMP
CURL_CHECK_FUNC_STRTOK_R
CURL_CHECK_FUNC_STRTOLL
Daniel Stenberg's avatar
Daniel Stenberg committed
dnl Checks for library functions.
dnl AC_PROG_GCC_TRADITIONAL
case $host in
  *msdosdjgpp)
     ac_cv_func_pipe=no
     skipcheck_pipe=yes
     AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
    ;;
esac
Yang Tse's avatar
 
Yang Tse committed
AC_CHECK_FUNCS([fork \
  geteuid \
  getpass_r \
  getppid \
  getprotobyname \
  getpwuid \
  getrlimit \
  gettimeofday \
  inet_addr \
  perror \
  pipe \
  setlocale \
  setmode \
  setrlimit \
  uname \
  utime
],[
],[
  func="$ac_func"
  eval skipcheck=\$skipcheck_$func
  if test "x$skipcheck" != "xyes"; then
    AC_MSG_CHECKING([deeper for $func])
    AC_LINK_IFELSE([
      AC_LANG_PROGRAM([[
      ]],[[
        $func ();
      ]])
    ],[
      AC_MSG_RESULT([yes])
      eval "ac_cv_func_$func=yes"
      AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$func]), [1],
        [Define to 1 if you have the $func function.])
    ],[
      AC_MSG_RESULT([but still no])
    ])
  fi
])

dnl Check if the getnameinfo function is available
dnl and get the types of five of its arguments.
CURL_CHECK_FUNC_GETNAMEINFO
if test "$ipv6" = "yes"; then
  if test "$ac_cv_func_getaddrinfo" = "yes"; then
    AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
    IPV6_ENABLED=1
    AC_SUBST(IPV6_ENABLED)
  fi
dnl ************************************************************
dnl enable non-blocking communications
dnl
CURL_CHECK_OPTION_NONBLOCKING
CURL_CHECK_NONBLOCKING_SOCKET

dnl ************************************************************
dnl nroff tool stuff
dnl
Guenter Knauf's avatar
Guenter Knauf committed
AC_PATH_PROG( PERL, perl, ,
  $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
AC_SUBST(PERL)
Daniel Stenberg's avatar
Daniel Stenberg committed

Guenter Knauf's avatar
Guenter Knauf committed
AC_PATH_PROGS( NROFF, gnroff nroff, ,
Daniel Stenberg's avatar
Daniel Stenberg committed
  $PATH:/usr/bin/:/usr/local/bin )
AC_SUBST(NROFF)
Daniel Stenberg's avatar
Daniel Stenberg committed

if test -n "$NROFF"; then
  dnl only check for nroff options if an nroff command was found

  AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
  MANOPT="-man"
  mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
  if test -z "$mancheck"; then
    MANOPT="-mandoc"
   mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
    if test -z "$mancheck"; then
      MANOPT=""
      AC_MSG_RESULT([failed])
      AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
    else
      AC_MSG_RESULT([$MANOPT])
    fi
  AC_SUBST(MANOPT)
fi

if test -z "$MANOPT"
then
  dnl if no nroff tool was found, or no option that could convert man pages
  dnl was found, then disable the built-in manual stuff
  AC_MSG_WARN([disabling built-in manual])
  USE_MANUAL="no";
dnl *************************************************************************
dnl If the manual variable still is set, then we go with providing a built-in
dnl manual

if test "$USE_MANUAL" = "1"; then
  AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
Daniel Stenberg's avatar
Daniel Stenberg committed
  curl_manual_msg="enabled"
fi

dnl set variable for use in automakefile(s)
AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)

Yang Tse's avatar
 
Yang Tse committed
aresembedded="unknown"
Yang Tse's avatar
 
Yang Tse committed
configure_rundir=`pwd`
embedded_ares_builddir="$configure_rundir/ares"
AC_MSG_CHECKING([whether to enable c-ares])
AC_HELP_STRING([--enable-ares=PATH],[Enable c-ares for name lookups])
AC_HELP_STRING([--disable-ares],[Disable c-ares for name lookups]),
[ case "$enableval" in
  no)
       AC_MSG_RESULT(no)
       ;;
  *)   AC_MSG_RESULT(yes)

       if test "x$IPV6_ENABLED" = "x1"; then
         AC_MSG_NOTICE([c-ares may not work properly with ipv6])
       AC_DEFINE(USE_ARES, 1, [Define if you want to enable c-ares support])
       dnl substitute HAVE_ARES for curl-config and similar
       HAVE_ARES="1"
       AC_SUBST(HAVE_ARES)
       curl_ares_msg="enabled"

Yang Tse's avatar
 
Yang Tse committed
       LIBS="-lcares $LIBS"

       dnl For backwards compatibility default to includes/lib in srcdir/ares
       dnl If a value is specified it is assumed that the libs are in $val/lib
       dnl and the includes are in $val/include. This is the default setup for
       dnl ares so it should not be a problem.
       if test "x$enableval" = "xyes" ; then
         if test -d "$srcdir/ares"; then
            aresembedded="yes"
            AC_CONFIG_SUBDIRS(ares)
            dnl Since c-ares has installable configured header files, path
            dnl inclusion is fully done in makefiles for in-tree builds.
Yang Tse's avatar
 
Yang Tse committed
            LDFLAGS="$LDFLAGS -L$embedded_ares_builddir"
         fi
       else
         CPPFLAGS="$CPPFLAGS -I$enableval/include"
         LDFLAGS="$LDFLAGS -L$enableval/lib"
       fi

       if test -z "$aresembedded"; then
         dnl verify that a sufficient c-ares is here if we have pointed one
         dnl out and don't use the "embedded" ares dir (in which case we don't
         dnl check it because it might not have been built yet)
         AC_MSG_CHECKING([that c-ares is good and recent enough])
           AC_LANG_PROGRAM([[
             /* set of dummy functions in case c-ares was built with debug */
             void curl_dofree() { }
             void curl_sclose() { }
             void curl_domalloc() { }
             void curl_docalloc() { }
             void curl_socket() { }
             ares_channel channel;
             ares_cancel(channel); /* added in 1.2.0 */
             ares_process_fd(channel, 0, 0); /* added in 1.4.0 */
         ],[
           AC_MSG_RESULT([yes])
         ],[
           AC_MSG_RESULT([no])
           AC_MSG_ERROR([c-ares library defective or too old])
         ])
Daniel Stenberg's avatar
Daniel Stenberg committed

Yang Tse's avatar
 
Yang Tse committed
dnl set variable for use in automakefile(s)
AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$aresembedded = xyes)

dnl ************************************************************
dnl disable verbose text strings
dnl
AC_MSG_CHECKING([whether to enable verbose strings])
AC_ARG_ENABLE(verbose,
AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
[ case "$enableval" in
  no)
       AC_MSG_RESULT(no)
       AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
       curl_verbose_msg="no"
       ;;
  *)   AC_MSG_RESULT(yes)
       ;;
  esac ],
       AC_MSG_RESULT(yes)
)

dnl ************************************************************
dnl enable SSPI support
dnl
AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
AC_ARG_ENABLE(sspi,
AC_HELP_STRING([--enable-sspi],[Enable SSPI])
AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
[ case "$enableval" in
  yes)
       if test "$ac_cv_native_windows" = "yes"; then
         AC_MSG_RESULT(yes)
         AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
         AC_SUBST(USE_WINDOWS_SSPI, [1])
         curl_sspi_msg="yes"
       else
         AC_MSG_RESULT(no)
         AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
       fi
dnl ************************************************************
dnl disable cryptographic authentication
dnl
AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
AC_ARG_ENABLE(crypto-auth,
AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
[ case "$enableval" in
  no)
       AC_MSG_RESULT(no)
       AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
       ;;
  *)   AC_MSG_RESULT(yes)
       ;;
  esac ],
       AC_MSG_RESULT(yes)
)

dnl ************************************************************
dnl disable cookies support
dnl
AC_MSG_CHECKING([whether to enable support for cookies])
AC_ARG_ENABLE(cookies,
AC_HELP_STRING([--enable-cookies],[Enable cookies support])
AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
[ case "$enableval" in
  no)
       AC_MSG_RESULT(no)
       AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
       ;;
  *)   AC_MSG_RESULT(yes)
       ;;
  esac ],
       AC_MSG_RESULT(yes)
)

dnl ************************************************************
dnl Enable hiding of internal symbols in library to reduce its size and
dnl speed dynamic linking of applications.  This currently is only supported
dnl on gcc >= 4.0 and SunPro C.
dnl
AC_MSG_CHECKING([whether to enable hidden symbols in the library])
AC_ARG_ENABLE(hidden-symbols,
AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
[ case "$enableval" in
  no)
       AC_MSG_RESULT(no)
       ;;
       AC_MSG_CHECKING([whether $CC supports it])
       if test "$GCC" = yes ; then
         if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
Guenter Knauf's avatar
Guenter Knauf committed
           AC_MSG_RESULT(yes)
           AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
           AC_DEFINE(CURL_EXTERN_SYMBOL, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
           CFLAGS="$CFLAGS -fvisibility=hidden"
Guenter Knauf's avatar
Guenter Knauf committed
         dnl Test for SunPro cc
         if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
           AC_MSG_RESULT(yes)
Guenter Knauf's avatar
Guenter Knauf committed
           AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
           AC_DEFINE(CURL_EXTERN_SYMBOL, [__global], [to make a symbol visible])
           CFLAGS="$CFLAGS -xldscope=hidden"
         else
           AC_MSG_RESULT(no)
         fi
dnl ************************************************************
dnl enforce SONAME bump

AC_MSG_CHECKING([whether to enforce SONAME bump])
AC_ARG_ENABLE(soname-bump,
AC_HELP_STRING([--enable-soname-bump],[Enable enforced SONAME bump])
AC_HELP_STRING([--disable-soname-bump],[Disable enforced SONAME bump]),
[ case "$enableval" in
  yes)   AC_MSG_RESULT(yes)
         soname_bump=yes
         ;;
  *)
         AC_MSG_RESULT(no)
)
AM_CONDITIONAL(SONAME_BUMP, test x$soname_bump = xyes)


dnl ************************************************************
if test ! -z "$winsock_LIB"; then

  dnl If ws2_32 is wanted, make sure it is the _last_ lib in LIBS (makes
  dnl things work when built with c-ares). But we can't just move it last
  dnl since then other stuff (SSL) won't build. So we simply append it to the
  dnl end.

  LIBS="$LIBS $winsock_LIB"
  TEST_SERVER_LIBS="$TEST_SERVER_LIBS $winsock_LIB"
dnl
dnl All the library dependencies put into $LIB apply to libcurl only.
dnl Those in $CURL_LIBS apply to the curl command-line client only.
dnl Those in $TEST_SERVER_LIBS apply to test servers only.
dnl Those in $ALL_LIBS apply to all targets, including test targets.
dnl
LIBCURL_LIBS=$LIBS

AC_SUBST(LIBCURL_LIBS)
AC_SUBST(CURL_LIBS)
AC_SUBST(TEST_SERVER_LIBS)
LIBS=$ALL_LIBS  dnl LIBS is a magic variable that's used for every link
AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)

dnl
dnl For keeping supported features and protocols also in pkg-config file
dnl since it is more cross-compile frient than curl-config
dnl

if test "x$USE_SSLEAY" = "x1"; then
  SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
elif test -n "$SSL_ENABLED"; then
  SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
fi
if test "@KRB4_ENABLED@" = "x1"; then
  SUPPORT_FEATURES="$SUPPORT_FEATURES KRB4"
fi
if test "x$IPV6_ENABLED" = "x1"; then
  SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
fi
if test "x$HAVE_LIBZ" = "x1"; then
  SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
fi
if test "x$HAVE_ARES" = "x1"; then
  SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
fi
if test "x$IDN_ENABLED" = "x1"; then
  SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
fi
if test "x$USE_WINDOWS_SSPI" = "x1"; then
  SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
fi
if test "x$USE_SSLEAY" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" -o "x$GNUTLS_ENABLED" = "x1"; then
  SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
fi

AC_SUBST(SUPPORT_FEATURES)

dnl For supported protocols in pkg-config file
if test "x$CURL_DISABLE_HTTP" != "x1"; then
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
  if test "x$SSL_ENABLED" = "x1"; then
    SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
  fi
fi
if test "x$CURL_DISABLE_FTP" != "x1"; then
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
  if test "x$SSL_ENABLED" = "x1"; then
    SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
  fi
fi
if test "x$CURL_DISABLE_FILE" != "x1"; then
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
fi
if test "x$CURL_DISABLE_TELNET" != "x1"; then
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
fi
if test "x$CURL_DISABLE_LDAP" != "x1"; then
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
fi
if test "x$CURL_DISABLE_LDAPS" != "x1"; then
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
fi
if test "x$CURL_DISABLE_DICT" != "x1"; then
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
fi
if test "x$CURL_DISABLE_TFTP" != "x1"; then
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
fi
if test "x$USE_LIBSSH2" = "x1"; then
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
  SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
fi

AC_SUBST(SUPPORT_PROTOCOLS)

dnl squeeze whitespace out of some variables

squeeze CFLAGS
squeeze CPPFLAGS
squeeze DEFS
squeeze LDFLAGS
squeeze LIBS

squeeze CURL_LIBS
squeeze LIBCURL_LIBS
squeeze TEST_SERVER_LIBS
if test "x$want_curldebug_assumed" = "xyes" &&
  test "x$want_curldebug" = "xyes" && test "x$HAVE_ARES" = "x1"; then
  ac_configure_args="$ac_configure_args --enable-curldebug"
fi

AC_CONFIG_FILES([Makefile \
Guenter Knauf's avatar
Guenter Knauf committed
           docs/Makefile \
           docs/examples/Makefile \
Daniel Stenberg's avatar
Daniel Stenberg committed
           docs/libcurl/Makefile \
Guenter Knauf's avatar
Guenter Knauf committed
           include/Makefile \
           include/curl/Makefile \
           src/Makefile \
Daniel Stenberg's avatar
Daniel Stenberg committed
           lib/Makefile \
           tests/Makefile \
           tests/data/Makefile \
           tests/server/Makefile \
           tests/libtest/Makefile \
Guenter Knauf's avatar
Guenter Knauf committed
           packages/Makefile \
           packages/Win32/Makefile \
           packages/Win32/cygwin/Makefile \
           packages/Linux/Makefile \
           packages/Linux/RPM/Makefile \
           packages/Linux/RPM/curl.spec \
           packages/Linux/RPM/curl-ssl.spec \
Daniel Stenberg's avatar
Daniel Stenberg committed
           packages/EPM/curl.list \
           packages/EPM/Makefile \
           packages/vms/Makefile \
Daniel Stenberg's avatar
Daniel Stenberg committed
           packages/AIX/Makefile \
           packages/AIX/RPM/Makefile \
           packages/AIX/RPM/curl.spec \
Daniel Stenberg's avatar
Daniel Stenberg committed
           curl-config \
           libcurl.pc
Daniel Stenberg's avatar
Daniel Stenberg committed

AC_MSG_NOTICE([Configured to build curl/libcurl:

  curl version:    ${VERSION}
  Host setup:      ${host}
  Install prefix:  ${prefix}
  Compiler:        ${CC}
  SSL support:     ${curl_ssl_msg}
  SSH support:     ${curl_ssh_msg}
Daniel Stenberg's avatar
Daniel Stenberg committed
  zlib support:    ${curl_zlib_msg}
  krb4 support:    ${curl_krb4_msg}
  GSSAPI support:  ${curl_gss_msg}
  SPNEGO support:  ${curl_spnego_msg}
Daniel Stenberg's avatar
Daniel Stenberg committed
  c-ares support:  ${curl_ares_msg}
  ipv6 support:    ${curl_ipv6_msg}
  IDN support:     ${curl_idn_msg}
Guenter Knauf's avatar
Guenter Knauf committed
  Build libcurl:   Shared=${enable_shared}, Static=${enable_static}
Daniel Stenberg's avatar
Daniel Stenberg committed
  Built-in manual: ${curl_manual_msg}
  Verbose errors:  ${curl_verbose_msg}
  ca cert bundle:  ${ca}
  ca cert path:    ${capath}
Daniel Stenberg's avatar
Daniel Stenberg committed
])

if test "x$soname_bump" = "xyes"; then

cat <<EOM
  SONAME bump:     yes - WARNING: this library will be built with the SONAME
                   number bumped due to (a detected) ABI breakage.
                   See lib/README.curl_off_t for details on this.
EOM

fi