Skip to content
configure.ac 40.6 KiB
Newer Older
printf("just fine");
#else
#error "this is not AIX 4.3 or later"
#endif
],
 [ AC_MSG_RESULT([yes])
AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
[ case "$enableval" in
  no)
    OPT_THREAD=off
    AC_MSG_WARN(libcurl will not get built using thread-safe functions)
    ;;
  *)
    ;;
  esac
]
)

if test X"$OPT_THREAD" = Xoff
then
  AC_DEFINE(DISABLED_THREADSAFE, 1, \
Set to explicitly specify we don't want to use thread-safe functions)
else
  if test "$ipv6" != "yes"; then
    dnl dig around for gethostbyname_r()
    CURL_CHECK_GETHOSTBYNAME_R()
  dnl poke around for inet_ntoa_r()
  CURL_CHECK_INET_NTOA_R()
  dnl is there a localtime_r()
  CURL_CHECK_LOCALTIME_R()
  dnl is there a strerror_r()
  CURL_CHECK_STRERROR_R()

Daniel Stenberg's avatar
Daniel Stenberg committed
  AC_CHECK_FUNCS( gmtime_r )
dnl for recent AIX versions, we skip all the thread-safe checks above since
dnl they claim a thread-safe libc using the standard API. But there are
dnl some functions still not thread-safe. Check for these!

dnl Let's hope this split URL remains working:
dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
dnl genprogc/thread_quick_ref.htm

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

  AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])

  dnl check if this is the IMB xlc compiler
  dnl Details thanks to => http://predef.sourceforge.net/
  AC_MSG_CHECKING([if this is the xlc compiler])
  AC_EGREP_CPP([^__xlC__], [__xlC__],
         dnl action if the text is found, this it has not been replaced by the
         dnl cpp
         XLC="no"
         AC_MSG_RESULT([no]),
         dnl the text was not found, it was replaced by the cpp
         XLC="yes"
         AC_MSG_RESULT([yes])
         CFLAGS="$CFLAGS -qthreaded"
       )


  dnl is there a localtime_r()
  CURL_CHECK_LOCALTIME_R()

  dnl is there a strerror_r()
  CURL_CHECK_STRERROR_R()

  AC_CHECK_FUNCS( gmtime_r )
Daniel Stenberg's avatar
Daniel Stenberg committed
dnl **********************************************************************
dnl Back to "normal" configuring
dnl **********************************************************************

dnl Checks for header files.
AC_HEADER_STDC

dnl First check for the very most basic headers. Then we can use these
dnl ones as default-headers when checking for the rest!
AC_CHECK_HEADERS(
        sys/types.h \
        sys/time.h \
        sys/select.h \
        sys/socket.h \
        sys/ioctl.h \
Daniel Stenberg's avatar
Daniel Stenberg committed
        assert.h \
Daniel Stenberg's avatar
Daniel Stenberg committed
        unistd.h \
        limits.h \
Daniel Stenberg's avatar
Daniel Stenberg committed
        arpa/inet.h \
        net/if.h \
        netinet/in.h \
Daniel Stenberg's avatar
Daniel Stenberg committed
        netdb.h \
        sys/sockio.h \
        sys/stat.h \
        sys/param.h \
        termios.h \
        termio.h \
        sgtty.h \
        fcntl.h \
        dlfcn.h \
        alloca.h \
        winsock.h \
        time.h \
        io.h \
Daniel Stenberg's avatar
Daniel Stenberg committed
        utime.h \
Daniel Stenberg's avatar
Daniel Stenberg committed
        sys/poll.h \
        setjmp.h,
dnl to do if not found
[],
dnl to do if found
[],
dnl default includes
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
Daniel Stenberg's avatar
Daniel Stenberg committed
)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME

AC_CHECK_SIZEOF(curl_off_t, ,[
#include <stdio.h>
#include "$srcdir/include/curl/curl.h"
])
AC_CHECK_SIZEOF(size_t)
Daniel Stenberg's avatar
Daniel Stenberg committed

Daniel Stenberg's avatar
Daniel Stenberg committed
AC_CHECK_TYPE(long long,
   [AC_DEFINE(HAVE_LONGLONG, 1, [if your compiler supports long long])]
   longlong="yes"  
)

if test "xyes" = "x$longlong"; then
  AC_MSG_CHECKING([if numberLL works])
  AC_COMPILE_IFELSE([long long val = 1000LL;],
   [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
   AC_MSG_RESULT(yes),
   AC_MSG_RESULT(no)
  )
fi

Daniel Stenberg's avatar
Daniel Stenberg committed

Daniel Stenberg's avatar
Daniel Stenberg committed
# check for ssize_t
Daniel Stenberg's avatar
Daniel Stenberg committed
AC_CHECK_TYPE(ssize_t, ,
   AC_DEFINE(ssize_t, int, [the signed version of size_t]))
Daniel Stenberg's avatar
Daniel Stenberg committed

TYPE_IN_ADDR_T
AC_FUNC_SELECT_ARGTYPES

Daniel Stenberg's avatar
Daniel Stenberg committed
dnl Checks for library functions.
dnl AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL
AC_CHECK_FUNCS( strtoll \
                socket \
Daniel Stenberg's avatar
Daniel Stenberg committed
                select \
                strdup \
                strstr \
Daniel Stenberg's avatar
Daniel Stenberg committed
                strtok_r \
Daniel Stenberg's avatar
Daniel Stenberg committed
                strftime \
                uname \
                strcasecmp \
Daniel Stenberg's avatar
Daniel Stenberg committed
                stricmp \
                strcmpi \
Daniel Stenberg's avatar
Daniel Stenberg committed
                gethostbyaddr \
                gettimeofday \
                inet_addr \
                inet_ntoa \
Daniel Stenberg's avatar
Daniel Stenberg committed
                inet_pton \
Daniel Stenberg's avatar
Daniel Stenberg committed
                tcsetattr \
                tcgetattr \
                perror \
Daniel Stenberg's avatar
Daniel Stenberg committed
                signal \
Daniel Stenberg's avatar
Daniel Stenberg committed
                geteuid \
Daniel Stenberg's avatar
Daniel Stenberg committed
                sigsetjmp \
                poll,
dnl if found
[],
dnl if not found, $ac_func is the name we check for
  func="$ac_func"
  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 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
)

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



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

Daniel Stenberg's avatar
Daniel Stenberg 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 ares])
AC_ARG_ENABLE(ares,
AC_HELP_STRING([--enable-ares=PATH],[Enable ares for name lookups])
AC_HELP_STRING([--disable-ares],[Disable 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_ERROR([ares doesn't work with ipv6, disable ipv6 to use ares])
       fi

       AC_DEFINE(USE_ARES, 1, [Define if you want to enable ares support])
       dnl substitute HAVE_ARES for curl-config and similar
       HAVE_ARES="1"
       AC_SUBST(HAVE_ARES)
       curl_ares_msg="enabled"

       LIBS="$LIBS -lcares"

       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() { }
int main(void)
{
  ares_channel channel;
  ares_cancel(channel);
  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 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
AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)

AC_CONFIG_FILES([Makefile \
Daniel Stenberg's avatar
Daniel Stenberg committed
	   docs/Makefile \
           docs/examples/Makefile \
Daniel Stenberg's avatar
Daniel Stenberg committed
           docs/libcurl/Makefile \
	   include/Makefile \
	   include/curl/Makefile \
Daniel Stenberg's avatar
Daniel Stenberg committed
	   src/Makefile \
Daniel Stenberg's avatar
Daniel Stenberg committed
           lib/Makefile \
           tests/Makefile \
           tests/data/Makefile \
           tests/server/Makefile \
           tests/libtest/Makefile \
Daniel Stenberg's avatar
Daniel Stenberg committed
	   packages/Makefile \
	   packages/Win32/Makefile \
	   packages/Win32/cygwin/Makefile \
Daniel Stenberg's avatar
Daniel Stenberg committed
	   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 \
           curl-config
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}
  zlib support:    ${curl_zlib_msg}
  krb4 support:    ${curl_krb4_msg}
  GSSAPI support:  ${curl_gss_msg}
  SNPEGO support:  ${curl_spnego_msg}
  c-ares support:  ${curl_ares_msg}
  ipv6 support:    ${curl_ipv6_msg}
  IDN support:     ${curl_idn_msg}
Daniel Stenberg's avatar
Daniel Stenberg committed
  Build libcurl:   Shared=${enable_shared}, Static=${enable_static} 
  Built-in manual: ${curl_manual_msg}
])