aclocal/openssl.ac
changeset 0 2b3e5ec03512
equal deleted inserted replaced
-1:000000000000 0:2b3e5ec03512
       
     1 dnl
       
     2 dnl Autoconf support for finding OpenSSL
       
     3 dnl
       
     4 dnl
       
     5 
       
     6 AC_DEFUN(AC_CONFIG_OPENSSL, [
       
     7     if test "$ac_bsp" = yes; then
       
     8         ac_openssldir='yes'
       
     9         
       
    10         AC_ARG_WITH(openssl,
       
    11             AC_HELP_STRING([--with-openssl=DIR],
       
    12                 [location of an OpenSSL installation (default system)]),
       
    13             ac_openssldir=$withval)
       
    14         
       
    15         ac_save_CPPFLAGS="$CPPFLAGS"
       
    16         ac_save_LDFLAGS="$LDFLAGS"
       
    17         ac_save_LIBS="$LIBS"
       
    18         
       
    19         dnl
       
    20         dnl Now check if we have a cached value, unless the user specified
       
    21         dnl something explicit with the --with-openssl= argument, in
       
    22         dnl which case we force it to redo the checks (i.e. ignore the
       
    23         dnl cached values)
       
    24         dnl
       
    25         if test "$ac_openssldir" = yes -a ! x$openssl_cv_include = x ; then
       
    26             echo "checking for OpenSSL installation... (cached) $openssl_cv_include/openssl/evp.h, $openssl_cv_lib -lcrypto"
       
    27         else
       
    28             if test "$ac_openssldir" = system -o \
       
    29                     "$ac_openssldir" = yes -o \
       
    30                     "$ac_openssldir" = "" ; 
       
    31             then
       
    32                 ac_openssldir="/usr/include"
       
    33                 
       
    34                 openssl_include=$ac_openssldir
       
    35                 openssl_lib="/usr/lib"
       
    36             else
       
    37                 openssl_include=$ac_openssldir/include
       
    38                 CPPFLAGS="-I$openssl_include"
       
    39                 openssl_lib=$ac_openssldir/lib
       
    40                 LDFLAGS="-L$openssl_lib"
       
    41            fi
       
    42             
       
    43         fi
       
    44         
       
    45         AC_CHECK_HEADERS([$openssl_include/openssl/evp.h], [], [AC_MSG_FAILURE([Cannot find OpenSSL.
       
    46        On Debian-based Linux systems, you need the 'libssl-dev' package.])])
       
    47         
       
    48         AC_CHECK_LIB([crypto], [EVP_DigestInit], [], [AC_MSG_FAILURE([Cannot find OpenSSL.
       
    49        On Debian-based Linux systems, you need the 'libssl-dev' package.])])
       
    50         
       
    51         AC_CHECK_LIB([crypto], [EVP_sha256], [], [AC_MSG_FAILURE([Cannot find EVP_sha256.
       
    52        On Mac OS X systems, you probably need an updated OpenSSL package, version 0.9.8.
       
    53        Specify   --with-openssl=/path/to/openssl LDFLAGS="-Wl,-search_paths_first"])])
       
    54 
       
    55        if test "$openssl_include" != /usr/include ; then
       
    56           EXTLIB_CFLAGS="$EXTLIB_CFLAGS -I$openssl_include"
       
    57        fi
       
    58 
       
    59        if test "$openssl_lib" != /usr/lib ; then
       
    60 	   EXTLIB_LDFLAGS="$EXTLIB_LDFLAGS -L$openssl_lib"
       
    61        fi
       
    62        
       
    63        EXTLIB_LDFLAGS="$EXTLIB_LDFLAGS -lcrypto"
       
    64 
       
    65        CPPFLAGS=$ac_save_CPPFLAGS
       
    66        LDFLAGS=$ac_save_LDFLAGS
       
    67        LIBS=$ac_save_LIBS
       
    68     fi
       
    69 ])