2004-12-07 22:17:20 +01:00
|
|
|
# AC_PREREQ(2.57)
|
2006-11-20 09:41:04 +01:00
|
|
|
AC_INIT(libssh2, 0.15, libssh2-devel@lists.sourceforge.net)
|
2006-11-20 09:58:29 +01:00
|
|
|
AM_INIT_AUTOMAKE(libssh2, 0.15)
|
2004-12-07 22:17:20 +01:00
|
|
|
AC_CONFIG_SRCDIR([src])
|
2006-11-20 09:41:04 +01:00
|
|
|
AC_CONFIG_HEADER([src/libssh2_config.h])
|
2006-12-07 16:53:01 +01:00
|
|
|
AB_INIT
|
2004-12-07 22:17:20 +01:00
|
|
|
|
2005-01-02 00:38:34 +01:00
|
|
|
# Check for the OS.
|
2006-11-20 09:58:29 +01:00
|
|
|
# Daniel's note: this should not be necessary and we need to work to
|
|
|
|
# get this removed.
|
2005-01-02 00:38:34 +01:00
|
|
|
AC_CANONICAL_HOST
|
|
|
|
case "$host" in
|
|
|
|
*-cygwin)
|
|
|
|
CFLAGS="$CFLAGS -DLIBSSH2_WIN32"
|
|
|
|
;;
|
2005-02-17 21:41:34 +01:00
|
|
|
*darwin*)
|
|
|
|
CFLAGS="$CFLAGS -DLIBSSH2_DARWIN"
|
|
|
|
;;
|
2006-02-24 00:14:35 +01:00
|
|
|
*hpux*)
|
|
|
|
;;
|
2005-01-02 00:38:34 +01:00
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
2005-05-05 20:45:42 +02:00
|
|
|
|
2007-03-27 15:11:19 +02:00
|
|
|
# Some systems (Solaris?) have socket() in -lsocket.
|
|
|
|
AC_SEARCH_LIBS(socket, socket)
|
2005-05-05 20:45:42 +02:00
|
|
|
|
2007-03-27 15:11:19 +02:00
|
|
|
# Solaris has inet_addr() in -lnsl.
|
2007-03-27 15:05:35 +02:00
|
|
|
AC_SEARCH_LIBS(inet_addr, nsl)
|
2007-03-27 14:59:00 +02:00
|
|
|
|
2005-05-05 20:45:42 +02:00
|
|
|
AC_SUBST(LIBS)
|
2004-12-07 22:17:20 +01:00
|
|
|
|
|
|
|
AC_PROG_CC
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_PROG_LN_S
|
|
|
|
AC_PROG_MAKE_SET
|
2006-11-20 09:58:29 +01:00
|
|
|
AC_PROG_LIBTOOL
|
2004-12-07 22:17:20 +01:00
|
|
|
AC_C_BIGENDIAN
|
|
|
|
if test -z "$PKG_CONFIG"; then
|
|
|
|
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
|
|
|
fi
|
|
|
|
|
2007-01-15 19:16:07 +01:00
|
|
|
# Look for libgcrypt.
|
|
|
|
AC_ARG_WITH(libgcrypt,
|
|
|
|
AC_HELP_STRING([--with-libgcrypt],[Use libgcrypt for crypto]),
|
|
|
|
use_libgcrypt=$withval,use_libgcrypt=no)
|
|
|
|
if test "$use_libgcrypt" != "no"; then
|
2007-04-05 12:23:54 +02:00
|
|
|
AC_LIB_HAVE_LINKFLAGS([gcrypt], [], [#include <gcrypt.h>])
|
2007-01-15 19:16:07 +01:00
|
|
|
fi
|
2007-04-05 12:23:54 +02:00
|
|
|
if test "$ac_cv_libgcrypt" = yes; then
|
|
|
|
use_libgcrypt=yes
|
2007-01-15 19:16:07 +01:00
|
|
|
AC_DEFINE(LIBSSH2_LIBGCRYPT, 1, [Use libgcrypt])
|
|
|
|
fi
|
2007-01-16 16:13:50 +01:00
|
|
|
AM_CONDITIONAL(LIBGCRYPT, test "$use_libgcrypt" != "no")
|
2007-01-15 19:16:07 +01:00
|
|
|
|
2007-03-27 17:56:08 +02:00
|
|
|
# Need to define SHLIB_SUFFIX_NAME before checking for libcrypt and libz
|
|
|
|
# $shrext_cmds (from libtool) can contain commands so it must be eval'd
|
2007-03-27 17:57:23 +02:00
|
|
|
# Simon's note: replace the find-openssl/libz logic with Bruno's
|
|
|
|
# AC_LIB_LINKFLAGS which is more portable and flexible.
|
2007-03-27 17:56:08 +02:00
|
|
|
eval SHLIB_SUFFIX_NAME=\"$shrext_cmds\"
|
2007-03-27 17:57:23 +02:00
|
|
|
AC_SUBST(SHLIB_SUFFIX_NAME)
|
2007-03-27 17:56:08 +02:00
|
|
|
|
2004-12-07 22:17:20 +01:00
|
|
|
#
|
|
|
|
# Look for OpenSSL
|
|
|
|
#
|
|
|
|
AC_ARG_WITH(openssl,
|
|
|
|
AC_HELP_STRING([--with-openssl=DIR],[Look for OpenSSL in PATH]),
|
|
|
|
[LIBSSH2_OPENSSL_DIR=$withval],[LIBSSH2_OPENSSL_DIR=yes])
|
|
|
|
|
2007-01-23 11:37:14 +01:00
|
|
|
if test "$use_libgcrypt" = "no"; then
|
|
|
|
|
2004-12-07 22:17:20 +01:00
|
|
|
if test "$LIBSSH2_OPENSSL_DIR" = "no" || test "$LIBSSH2_OPENSSL_DIR" = "yes"; then
|
|
|
|
unset LIBSSH2_OPENSSL_DIR
|
|
|
|
fi
|
|
|
|
|
|
|
|
found_openssl=no
|
2006-05-27 00:36:48 +02:00
|
|
|
pkgcfg_openssl=no
|
2004-12-07 22:17:20 +01:00
|
|
|
unset OPENSSL_INCDIR
|
2006-05-27 00:36:48 +02:00
|
|
|
unset OPENSSL_INCLINE
|
|
|
|
unset OPENSSL_LIBLINE
|
2004-12-07 22:17:20 +01:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([for OpenSSL])
|
|
|
|
|
|
|
|
# Explicit path given, use it rather than pkg-config
|
|
|
|
if test ! -z "$LIBSSH2_OPENSSL_DIR"; then
|
|
|
|
found_openssl=yes
|
2006-05-27 00:36:48 +02:00
|
|
|
OPENSSL_LIBLINE="-L$LIBSSH2_OPENSSL_DIR/lib -lcrypto"
|
|
|
|
OPENSSL_INCLINE="-I$LIBSSH2_OPENSSL_DIR/include"
|
2004-12-07 22:17:20 +01:00
|
|
|
OPENSSL_INCDIR=$LIBSSH2_OPENSSL_DIR/include
|
|
|
|
AC_MSG_RESULT([Using explicit path $LIBSSH2_OPENSSL_DIR])
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If pkg-config is found try using it
|
|
|
|
if test "$found_openssl" = "no" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then
|
|
|
|
found_openssl=yes
|
2006-05-27 00:36:48 +02:00
|
|
|
pkgcfg_openssl=yes
|
|
|
|
OPENSSL_LIBLINE=`$PKG_CONFIG --libs openssl`
|
2006-11-17 11:26:11 +01:00
|
|
|
OPENSSL_INCLINE=`$PKG_CONFIG --cflags-only-I openssl`
|
2004-12-07 22:17:20 +01:00
|
|
|
AC_MSG_RESULT([Using paths from pkg-config])
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Elsewise, search for OpenSSL wherever it might be
|
|
|
|
if test "$found_openssl" = "no"; then
|
|
|
|
OPENSSL_SEARCH_PATH="/usr/local/ssl /usr/local /usr /usr/local/openssl"
|
|
|
|
|
|
|
|
for i in $OPENSSL_SEARCH_PATH; do
|
|
|
|
if test -r $i/include/openssl/evp.h; then
|
2006-05-27 00:36:48 +02:00
|
|
|
OPENSSL_INCLINE="-I$i/include"
|
2004-12-07 22:17:20 +01:00
|
|
|
OPENSSL_INCDIR=$i/include
|
|
|
|
fi
|
|
|
|
if test -r $i/include/openssl/hmac.h; then
|
2006-05-27 00:36:48 +02:00
|
|
|
OPENSSL_INCLINE="-I$i/include"
|
2004-12-07 22:17:20 +01:00
|
|
|
OPENSSL_INCDIR=$i/include
|
|
|
|
fi
|
2007-03-27 17:56:08 +02:00
|
|
|
if test -r $i/lib/libcrypto.a -o -r $i/lib/libcrypto$SHLIB_SUFFIX_NAME; then
|
2006-05-27 00:36:48 +02:00
|
|
|
OPENSSL_LIBLINE="-L$i/lib -lcrypto"
|
2004-12-07 22:17:20 +01:00
|
|
|
fi
|
2006-05-27 00:36:48 +02:00
|
|
|
test -n "$OPENSSL_INCLINE" && test -n "$OPENSSL_LIBLINE" && break
|
2004-12-07 22:17:20 +01:00
|
|
|
done
|
|
|
|
|
2006-05-27 00:36:48 +02:00
|
|
|
if test -z "$OPENSSL_INCLINE"; then
|
2004-12-07 22:17:20 +01:00
|
|
|
AC_MSG_ERROR([Cannot find OpenSSL's <evp.h> or <hmac.h>])
|
|
|
|
fi
|
|
|
|
|
2006-05-27 00:36:48 +02:00
|
|
|
if test -z "$OPENSSL_LIBLINE"; then
|
2004-12-07 22:17:20 +01:00
|
|
|
AC_MSG_ERROR([Cannot find OpenSSL's libcrypto])
|
|
|
|
fi
|
|
|
|
|
2006-05-27 00:36:48 +02:00
|
|
|
AC_MSG_RESULT([$OPENSSL_INCLINE $OPENSSL_LIBLINE])
|
2004-12-07 22:17:20 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Confirm required OpenSSL libs
|
|
|
|
#
|
2006-05-27 00:36:48 +02:00
|
|
|
if test ! "$pkgcfg_openssl" = "yes"; then
|
|
|
|
if test ! -r $OPENSSL_INCDIR/openssl/bn.h || test ! -r $OPENSSL_INCDIR/openssl/evp.h || \
|
|
|
|
test ! -r $OPENSSL_INCDIR/openssl/hmac.h || test ! -r $OPENSSL_INCDIR/openssl/pem.h || \
|
|
|
|
test ! -r $OPENSSL_INCDIR/openssl/sha.h; then
|
|
|
|
AC_MSG_ERROR([Missing one or more of <openssl/bn.h>, <openssl/evp.h>, <openssl/hmac.h>, <openssl/pem.h>, <openssl/sha.h>])
|
|
|
|
fi
|
2004-12-07 22:17:20 +01:00
|
|
|
fi
|
|
|
|
|
2006-05-27 00:36:48 +02:00
|
|
|
CFLAGS="$CFLAGS $OPENSSL_INCLINE"
|
|
|
|
LDFLAGS="$LDFLAGS $OPENSSL_LIBLINE"
|
2004-12-07 22:17:20 +01:00
|
|
|
|
2007-01-23 11:37:14 +01:00
|
|
|
fi
|
|
|
|
|
2004-12-07 22:17:20 +01:00
|
|
|
#
|
|
|
|
# zlib
|
|
|
|
#
|
|
|
|
AC_ARG_WITH(libz,
|
|
|
|
AC_HELP_STRING([--with-libz=PATH],[Look for libz in PATH]),
|
|
|
|
[LIBSSH2_LIBZ_DIR=$withval],[LIBSSH2_LIBZ_DIR="/usr/local /usr /usr/local/libz /usr/libz /usr/local/zlib /usr/zlib"])
|
|
|
|
|
|
|
|
if test "$LIBSSH2_LIBZ_DIR" = "no" || test "$LIBSSH2_LIBZ_DIR" = "yes"; then
|
|
|
|
unset LIBSSH2_LIBZ_DIR
|
|
|
|
fi
|
|
|
|
|
|
|
|
unset LIBZ_INCDIR
|
|
|
|
unset LIBZ_LIBDIR
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([for libz])
|
|
|
|
|
|
|
|
for i in $LIBSSH2_LIBZ_DIR; do
|
|
|
|
if test -r $i/include/zlib.h; then
|
|
|
|
LIBZ_INCDIR=$i/include
|
|
|
|
fi
|
2007-03-27 17:56:08 +02:00
|
|
|
if test -r $i/lib/libz.a -o -r $i/lib/libz$SHLIB_SUFFIX_NAME; then
|
2004-12-07 22:17:20 +01:00
|
|
|
LIBZ_LIBDIR=$i/lib
|
|
|
|
fi
|
|
|
|
test -n "$LIBZ_INCDIR" && test -n "$LIBZ_LIBDIR" && break
|
|
|
|
done
|
|
|
|
|
|
|
|
if test -n "$LIBZ_INCDIR" && test -n "$LIBZ_LIBDIR"; then
|
|
|
|
AC_MSG_RESULT([Found in $LIBZ_INCDIR $LIBZ_LIBDIR])
|
|
|
|
CFLAGS="$CFLAGS -I$LIBZ_INCDIR"
|
|
|
|
LDFLAGS="$LDFLAGS -L$LIBZ_LIBDIR -lz"
|
|
|
|
AC_DEFINE(LIBSSH2_HAVE_ZLIB, 1, [Compile in zlib support])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([Cannot find libz's <zlib.h>])
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Optional Settings
|
|
|
|
#
|
|
|
|
AC_ARG_ENABLE(crypt-none,
|
|
|
|
AC_HELP_STRING([--enable-crypt-none],[Permit "none" cipher -- NOT RECOMMENDED]),
|
|
|
|
[AC_DEFINE(LIBSSH2_CRYPT_NONE, 1, [Enable "none" cipher -- NOT RECOMMENDED])])
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(mac-none,
|
|
|
|
AC_HELP_STRING([--enable-mac-none],[Permit "none" MAC -- NOT RECOMMENDED]),
|
|
|
|
[AC_DEFINE(LIBSSH2_MAC_NONE, 1, [Enable "none" MAC -- NOT RECOMMENDED])])
|
|
|
|
|
2004-12-31 01:15:18 +01:00
|
|
|
AC_ARG_ENABLE(gex-new,
|
|
|
|
AC_HELP_STRING([--disable-gex-new],[Disable "new" diffie-hellman-group-exchange-sha1 method]),
|
|
|
|
[GEX_NEW=$enableval])
|
|
|
|
if test "$GEX_NEW" != "no"; then
|
|
|
|
AC_DEFINE(LIBSSH2_DH_GEX_NEW, 1, [Enable newer diffie-hellman-group-exchange-sha1 syntax])
|
|
|
|
fi
|
|
|
|
|
2006-12-13 09:45:49 +01:00
|
|
|
dnl ************************************************************
|
|
|
|
dnl option to switch on compiler debug options
|
|
|
|
dnl
|
|
|
|
AC_MSG_CHECKING([whether to enable pedantic and debug compiler options])
|
2007-02-03 00:23:36 +01:00
|
|
|
AC_ARG_ENABLE(debug,
|
|
|
|
AC_HELP_STRING([--enable-debug],[Enable pedantic and debug options])
|
|
|
|
AC_HELP_STRING([--disable-debug],[Disable debug options]),
|
2006-12-13 09:45:49 +01:00
|
|
|
[ case "$enableval" in
|
|
|
|
no)
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
;;
|
|
|
|
*) AC_MSG_RESULT(yes)
|
|
|
|
|
|
|
|
CPPFLAGS="$CPPFLAGS -DLIBSSH2DEBUG"
|
|
|
|
CFLAGS="$CFLAGS -g"
|
|
|
|
|
|
|
|
dnl set compiler "debug" options to become more picky, and remove
|
|
|
|
dnl optimize options from CFLAGS
|
|
|
|
CURL_CC_DEBUG_OPTS
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
],
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
)
|
|
|
|
|
2004-12-07 22:17:20 +01:00
|
|
|
# Checks for header files.
|
|
|
|
# AC_HEADER_STDC
|
2007-04-13 00:00:55 +02:00
|
|
|
AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h])
|
|
|
|
AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/ioctl.h sys/time.h])
|
2007-04-27 00:59:29 +02:00
|
|
|
AC_CHECK_HEADERS([arpa/inet.h netinet/in.h])
|
2005-03-23 01:21:26 +01:00
|
|
|
AC_CHECK_FUNCS(poll gettimeofday select)
|
2004-12-07 22:17:20 +01:00
|
|
|
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
AC_C_CONST
|
2006-11-20 23:10:56 +01:00
|
|
|
AC_C_INLINE
|
2004-12-07 22:17:20 +01:00
|
|
|
|
2007-02-07 22:39:17 +01:00
|
|
|
CURL_CHECK_NONBLOCKING_SOCKET
|
|
|
|
|
2004-12-07 22:17:20 +01:00
|
|
|
AC_CONFIG_FILES([Makefile
|
2007-01-09 10:49:15 +01:00
|
|
|
src/Makefile
|
2007-02-02 17:21:20 +01:00
|
|
|
tests/Makefile
|
|
|
|
example/Makefile
|
2007-02-02 23:27:06 +01:00
|
|
|
example/simple/Makefile
|
|
|
|
docs/Makefile])
|
2004-12-07 22:17:20 +01:00
|
|
|
AC_OUTPUT
|