Skip to content
configure.ac 34.9 KiB
Newer Older
Daniel Stenberg's avatar
Daniel Stenberg committed
        arpa/inet.h \
        net/if.h \
        netinet/in.h \
        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
]
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"
])
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'])])
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_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";
Daniel Stenberg's avatar
Daniel Stenberg committed
AC_PROG_YACC

if test -z "$YACC"
then
  AC_MSG_CHECKING([if OK to build without bison/yacc])
  dnl no yacc is a big deal if we have no pre-fixed getdate.y
  if test -r "$srcdir/lib/getdate.c"
  then
    dnl all is well, we don't have to generate it!
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(no)
    AC_MSG_ERROR([no yacc or bison found, can't build libcurl!])
  fi
fi

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

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


Daniel Stenberg's avatar
Daniel Stenberg committed
dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib, 
dnl   $PATH:/usr/bin/:/usr/local/bin )
dnl AC_SUBST(RANLIB)

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

Daniel Stenberg's avatar
Daniel Stenberg committed
       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)
       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
            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"
       else
         CPPFLAGS="$CPPFLAGS -I$enableval/include"
         LDFLAGS="$LDFLAGS -L$enableval/lib"
       fi
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