Ignore:
Timestamp:
Jan 15, 2018 8:52:29 AM (6 years ago)
Author:
ming
Message:

Re #2082: Initial implementation of GnuTLS support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/aconfigure.ac

    r5679 r5725  
    15421542AC_ARG_WITH(ssl, 
    15431543    AS_HELP_STRING([--with-ssl=DIR], 
    1544                    [Specify alternate libssl prefix]), 
     1544                   [Specify alternate SSL library prefix. This option will try 
     1545                    to find OpenSSL first, then if not found, GnuTLS. To skip 
     1546                    OpenSSL finding, use --with-gnutls option instead.]), 
    15451547    [], 
    15461548    [with_ssl=no] 
    15471549    ) 
    15481550 
     1551dnl # GnuTLS alt prefix 
     1552AC_ARG_WITH(gnutls, 
     1553    AS_HELP_STRING([--with-gnutls=DIR], 
     1554                   [Specify alternate GnuTLS prefix]), 
     1555    [], 
     1556    [with_gnutls=no] 
     1557    ) 
     1558 
    15491559dnl # Do not use default SSL installation if we are cross-compiling 
    1550 if test "x$ac_cross_compile" != "x" -a "x$with_ssl" = "xno"; then 
     1560if test "x$ac_cross_compile" != "x" -a "x$with_ssl" = "xno" -a "x$with_gnutls" = "xno"; then 
    15511561    enable_ssl=no 
    15521562fi 
     
    15551565AC_SUBST(ac_no_ssl) 
    15561566AC_SUBST(ac_ssl_has_aes_gcm,0) 
     1567AC_SUBST(ac_ssl_backend) 
    15571568AC_ARG_ENABLE(ssl, 
    15581569              AS_HELP_STRING([--disable-ssl], 
     
    15661577              ], 
    15671578              [ 
    1568                 AC_MSG_RESULT([checking for OpenSSL installations..]) 
    15691579                if test "x$with_ssl" != "xno" -a "x$with_ssl" != "x"; then 
    15701580                    CFLAGS="$CFLAGS -I$with_ssl/include" 
     
    15721582                    AC_MSG_RESULT([Using SSL prefix... $with_ssl]) 
    15731583                fi 
    1574                 AC_SUBST(openssl_h_present) 
    1575                 AC_SUBST(libssl_present) 
    1576                 AC_SUBST(libcrypto_present) 
    1577                 AC_CHECK_HEADER(openssl/ssl.h,[openssl_h_present=1]) 
    1578                 AC_CHECK_LIB(crypto,ERR_load_BIO_strings,[libcrypto_present=1 && LIBS="-lcrypto $LIBS"]) 
    1579                 AC_CHECK_LIB(ssl,SSL_CTX_new,[libssl_present=1 && LIBS="-lssl $LIBS"]) 
    1580                 if test "x$openssl_h_present" = "x1" -a "x$libssl_present" = "x1" -a "x$libcrypto_present" = "x1"; then 
     1584 
     1585                if test "x$with_gnutls" = "xno"; then 
     1586 
     1587                    AC_MSG_RESULT([checking for OpenSSL installations..]) 
     1588                    AC_SUBST(openssl_h_present) 
     1589                    AC_SUBST(libssl_present) 
     1590                    AC_SUBST(libcrypto_present) 
     1591                    AC_CHECK_HEADER(openssl/ssl.h,[openssl_h_present=1]) 
     1592                    AC_CHECK_LIB(crypto,ERR_load_BIO_strings,[libcrypto_present=1 && LIBS="-lcrypto $LIBS"]) 
     1593                    AC_CHECK_LIB(ssl,SSL_CTX_new,[libssl_present=1 && LIBS="-lssl $LIBS"]) 
     1594                    if test "x$openssl_h_present" = "x1" -a "x$libssl_present" = "x1" -a "x$libcrypto_present" = "x1"; then 
    15811595                        AC_MSG_RESULT([OpenSSL library found, SSL support enabled]) 
    15821596                         
     
    15991613                        #AC_DEFINE(PJSIP_HAS_TLS_TRANSPORT, 1) 
    16001614                        AC_DEFINE(PJ_HAS_SSL_SOCK, 1) 
    1601                 else 
    1602                         AC_MSG_RESULT([** OpenSSL libraries not found, disabling SSL support **]) 
     1615                        AC_DEFINE(PJ_SSL_SOCK_IMP, PJ_SSL_SOCK_IMP_OPENSSL) 
     1616                        ac_ssl_backend="openssl" 
     1617                    else 
     1618                        AC_MSG_RESULT([** OpenSSL libraries not found **]) 
     1619                    fi 
     1620                 
    16031621                fi 
     1622                 
     1623                if test "x$ac_ssl_backend" = "x"; then 
     1624 
     1625                    if test "x$with_gnutls" != "xno" -a "x$with_gnutls" != "x"; then 
     1626                        CFLAGS="$CFLAGS -I$with_gnutls/include" 
     1627                        LDFLAGS="$LDFLAGS -L$with_gnutls/lib" 
     1628                        AC_MSG_RESULT([Using GnuTLS prefix... $with_gnutls]) 
     1629                    fi 
     1630 
     1631                    AC_CHECK_PROGS(PKG_CONFIG, 
     1632                       $host-pkg-config pkg-config "python pkgconfig.py", 
     1633                       none) 
     1634                    AC_MSG_RESULT([checking for GnuTLS installations..]) 
     1635                    AC_SUBST(gnutls_h_present) 
     1636                    AC_SUBST(libgnutls_present) 
     1637                    AC_CHECK_HEADER(gnutls/gnutls.h, [gnutls_h_present=1]) 
     1638 
     1639                    if test "$PKG_CONFIG" != "none"; then 
     1640                        if $PKG_CONFIG --exists gnutls; then 
     1641                            LIBS="$LIBS `$PKG_CONFIG --libs gnutls`" 
     1642                            libgnutls_present=1 
     1643                        else 
     1644                            AC_CHECK_LIB(gnutls, 
     1645                             gnutls_certificate_set_x509_system_trust, 
     1646                             [libgnutls_present=1 && 
     1647                              LIBS="$LIBS -lgnutls"]) 
     1648                        fi 
     1649                    else 
     1650                        AC_MSG_RESULT([*** Warning: neither pkg-config nor python is available, disabling gnutls. ***]) 
     1651                    fi 
     1652 
     1653                    if test "x$gnutls_h_present" = "x1" -a "x$libgnutls_present" = "x1"; then 
     1654                        AC_MSG_RESULT([GnuTLS library found, SSL support enabled]) 
     1655                        AC_DEFINE(PJ_HAS_SSL_SOCK, 1) 
     1656                        AC_DEFINE(PJ_SSL_SOCK_IMP, PJ_SSL_SOCK_IMP_GNUTLS) 
     1657                        ac_ssl_backend="gnutls" 
     1658                    else 
     1659                        AC_MSG_RESULT([** No GnuTLS libraries found, disabling SSL support **]) 
     1660                    fi 
     1661                 
     1662                fi 
    16041663              ]) 
    16051664 
Note: See TracChangeset for help on using the changeset viewer.