Skip to content
configure.ac 71.6 KiB
Newer Older
Daniel Stenberg's avatar
Daniel Stenberg committed
                geteuid \
                getppid \
Daniel Stenberg's avatar
Daniel Stenberg committed
                sigsetjmp \
                getprotobyname \
dnl if found
[],
dnl if not found, $ac_func is the name we check for
eval skipcheck=\$skipcheck_$func
if test "x$skipcheck" != "xyes"; then
  AC_MSG_CHECKING([deeper for $func])
  AC_TRY_LINK( [],
               [ $func ();],
               AC_MSG_RESULT(yes!)
Daniel Stenberg's avatar
Daniel Stenberg committed
               eval "ac_cv_func_$func=yes"
               def=`echo "HAVE_$func" | tr 'a-z' 'A-Z'`
Daniel Stenberg's avatar
Daniel Stenberg committed
               AC_DEFINE_UNQUOTED($def, 1, [If you have $func]),
dnl For some reason, the check above doesn't properly detect select() with
dnl Msys/Mingw
if test "$ac_cv_func_select" = "no"; then
  AC_MSG_CHECKING([for select in ws2_32])
  AC_TRY_LINK([
#undef inline
#ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#else
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#endif
#endif
    ],[
      select(0,(fd_set *)NULL,(fd_set *)NULL,(fd_set *)NULL,(struct timeval *)NULL);
Guenter Knauf's avatar
Guenter Knauf committed
    ],[
      AC_MSG_RESULT([yes])
      HAVE_SELECT="1"
      AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
        [Define to 1 if you have the select function.])
    ],[
Yang Tse's avatar
Yang Tse committed
      AC_MSG_ERROR([You can't compile without a select])
dnl sigsetjmp() might be a macro and no function so if it isn't found already
dnl we make an extra check here!
if test "$ac_cv_func_sigsetjmp" != "yes"; then
  AC_MSG_CHECKING([for sigsetjmp defined as macro])
  AC_TRY_LINK( [#include <setjmp.h>],
               [sigjmp_buf jmpenv;
                sigsetjmp(jmpenv, 1);],
               AC_MSG_RESULT(yes)
               AC_DEFINE(HAVE_SIGSETJMP, 1, [If you have sigsetjmp]),
AC_CHECK_DECL(basename, ,
              AC_DEFINE(NEED_BASENAME_PROTO, 1, [If you lack a fine basename() prototype]),
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_LIBGEN_H
#include <libgen.h>
#endif
              AC_DEFINE(HAVE_NO_INET_PTON_PROTO, 1,
                        [Defined if no inet_pton() prototype available]),
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
  CURL_CHECK_WORKING_GETADDRINFO
  CURL_CHECK_NI_WITHSCOPEID
fi

AC_MSG_CHECKING([if we are Mac OS X (to disable poll)])
    disable_poll="yes";
    ;;
  *)
    ;;
esac
AC_MSG_RESULT($disable_poll)

if test "$disable_poll" = "no"; then

  dnl poll() might be badly emulated, as in Mac OS X 10.3 (and other BSDs?) and
  dnl to find out we make an extra check here!
  if test "$ac_cv_func_poll" = "yes"; then
    AC_MSG_CHECKING([if poll works with NULL inputs])
    AC_RUN_IFELSE([
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#elif defined(HAVE_POLL_H)
#include <poll.h>
#endif

  int main(void)
  {
    /* make this return 0 == timeout since there's nothing to read from */
    return poll((void *)0, 0, 10 /*ms*/);
  }
],
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll]),
    AC_MSG_RESULT(no),
    AC_MSG_RESULT(cross-compiling assumes yes)
    AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll])
    ) dnl end of AC_RUN_IFELSE
  fi dnl poll() was found
fi dnl poll()-check is not disabled
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)

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"


       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)
            aresinc=`cd $srcdir/ares && pwd`
            CPPFLAGS="$CPPFLAGS -I$aresinc"

            dnl the pwd= below cannot 'cd' into the ares dir to get the full
            dnl path to it, since it may not exist yet if we build outside of
            dnl the source tree
            pwd=`pwd`
            LDFLAGS="$LDFLAGS -L$pwd/ares"
         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_LINK_IFELSE( [
#include <ares.h>
/* provide a set of dummy functions in case c-ares was built with debug */
void curl_dofree() { }
void curl_sclose() { }
void curl_domalloc() { }
  ares_cancel(channel); /* added in 1.2.0 */
  ares_process_fd(channel, 0, 0); /* added in 1.4.0 */
  return 0;
}
],
          AC_MSG_RESULT(yes),
          AC_MSG_RESULT(no)
          AC_MSG_ERROR([c-ares library defective or too old])
          )
       fi
       ;;
  esac ],
       AC_MSG_RESULT(no)
)
Daniel Stenberg's avatar
Daniel Stenberg committed

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)
)

CURL_CHECK_NATIVE_WINDOWS

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 lame option to switch on debug options
dnl
AC_MSG_CHECKING([whether to enable debug options])
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[Enable pedantic debug options])
AC_HELP_STRING([--disable-debug],[Disable debug options]),
[ case "$enableval" in
  no)
       AC_MSG_RESULT(no)
       ;;
  *)   AC_MSG_RESULT(yes)

Daniel Stenberg's avatar
Daniel Stenberg committed
    CPPFLAGS="$CPPFLAGS -DCURLDEBUG"
    dnl set compiler "debug" options to become more picky, and remove
    dnl optimize options from CFLAGS
    CURL_CC_DEBUG_OPTS
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
       ;;
  esac ],
       AC_MSG_RESULT(no)
)

dnl ************************************************************
if test "x$ws2" = "xyes"; 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 -lws2_32"
  TEST_SERVER_LIBS="$TEST_SERVER_LIBS -lws2_32"
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)

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 \
           packages/DOS/Makefile \
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}
  LDAPS support:   ${curl_ldaps_msg}
Daniel Stenberg's avatar
Daniel Stenberg committed
])