Changeset 5959 for pjproject


Ignore:
Timestamp:
Mar 26, 2019 7:25:57 AM (5 years ago)
Author:
ming
Message:

Re #2185: Darwin SSL backend

  • Security framework availability will be automatically detected for Mac OS and iOS, and if found, Darwin SSL will be the default SSL backend.
  • OpenSSL availability will still be checked regardless of the above result, as it may be needed for DTLS.
  • Add configure option --disable-darwin-ssl to disable the automatic detection
Location:
pjproject/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/aconfigure

    r5957 r5959  
    821821with_ssl 
    822822with_gnutls 
     823enable_darwin_ssl 
    823824enable_ssl 
    824825with_opencore_amrnb 
     
    14891490                          IPPSAMPLES env var or with --with-ipp and 
    14901491                          --with-ipp-samples options 
     1492  --disable-darwin-ssl    Exclude Darwin SSL (default: autodetect) 
    14911493  --disable-ssl           Exclude SSL support the build (default: autodetect) 
    14921494 
     
    15431545  --with-ipp-arch=ARCH    Specify the Intel IPP ARCH suffix, e.g. "64" or 
    15441546                          "em64t. Default is blank for IA32" 
    1545   --with-ssl=SSL_BACKEND/DIR 
    1546                           Specify alternate SSL library prefix or SSL 
    1547                           native-backend. You can specify "darwin" as the 
    1548                           native iOS/MacOS backend using Security framework, 
    1549                           or you can specify an alternate SSL library prefix 
    1550                           directory. If a directory is specified, this option 
     1547  --with-ssl=DIR          Specify alternate SSL library prefix. This option 
    15511548                          will try to find OpenSSL first, then if not found, 
    15521549                          GnuTLS. To skip OpenSSL finding, use --with-gnutls 
     
    79467943 
    79477944 
     7945 
     7946# Check whether --enable-darwin-ssl was given. 
     7947if test "${enable_darwin_ssl+set}" = set; then : 
     7948  enableval=$enable_darwin_ssl; if test "$enable_darwin_ssl" = "no"; then 
     7949                 { $as_echo "$as_me:${as_lineno-$LINENO}: result: Checking if Darwin SSL support is disabled... yes" >&5 
     7950$as_echo "Checking if Darwin SSL support is disabled... yes" >&6; } 
     7951                fi 
     7952else 
     7953 
     7954                case $target in 
     7955                *darwin*) 
     7956                    SAVED_LIBS="$LIBS" 
     7957                    LIBS="-framework Security" 
     7958                    cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
     7959/* end confdefs.h.  */ 
     7960 
     7961int 
     7962main () 
     7963{ 
     7964 
     7965  ; 
     7966  return 0; 
     7967} 
     7968_ACEOF 
     7969if ac_fn_c_try_link "$LINENO"; then : 
     7970  ac_ssl_backend=darwin 
     7971fi 
     7972rm -f core conftest.err conftest.$ac_objext \ 
     7973    conftest$ac_exeext conftest.$ac_ext 
     7974                    LIBS="$SAVED_LIBS" 
     7975                    if test "x$ac_ssl_backend" = "xdarwin"; then 
     7976                        $as_echo "#define PJ_HAS_SSL_SOCK 1" >>confdefs.h 
     7977 
     7978                        $as_echo "#define PJ_SSL_SOCK_IMP PJ_SSL_SOCK_IMP_DARWIN" >>confdefs.h 
     7979 
     7980                        LIBS="$LIBS -framework Security" 
     7981                        { $as_echo "$as_me:${as_lineno-$LINENO}: result: Checking if Security framework for Darwin SSL is available... yes" >&5 
     7982$as_echo "Checking if Security framework for Darwin SSL is available... yes" >&6; } 
     7983                    else 
     7984                        { $as_echo "$as_me:${as_lineno-$LINENO}: result: Checking if Security framework for Darwin SSL is available... no" >&5 
     7985$as_echo "Checking if Security framework for Darwin SSL is available... no" >&6; } 
     7986                    fi 
     7987                    ;; 
     7988                esac 
     7989 
     7990fi 
     7991 
     7992 
    79487993# Check whether --enable-ssl was given. 
    79497994if test "${enable_ssl+set}" = set; then : 
     
    79578002else 
    79588003 
    7959                 if test "x$with_ssl" = "xdarwin"; then 
    7960                     SAVED_LIBS="$LIBS" 
    7961                     LIBS="-framework Security" 
    7962                     cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
    7963 /* end confdefs.h.  */ 
    7964  
    7965 int 
    7966 main () 
    7967 { 
    7968  
    7969   ; 
    7970   return 0; 
    7971 } 
    7972 _ACEOF 
    7973 if ac_fn_c_try_link "$LINENO"; then : 
    7974   ac_ssl_backend=darwin 
    7975 fi 
    7976 rm -f core conftest.err conftest.$ac_objext \ 
    7977     conftest$ac_exeext conftest.$ac_ext 
    7978                     LIBS="$SAVED_LIBS" 
    7979                     if test "x$ac_ssl_backend" = "xdarwin"; then 
    7980                         $as_echo "#define PJ_HAS_SSL_SOCK 1" >>confdefs.h 
    7981  
    7982                         $as_echo "#define PJ_SSL_SOCK_IMP PJ_SSL_SOCK_IMP_DARWIN" >>confdefs.h 
    7983  
    7984                         LIBS="$LIBS -framework Security" 
    7985                         ac_ssl_backend="darwin" 
    7986                         { $as_echo "$as_me:${as_lineno-$LINENO}: result: Checking if Security framework for Darwin SSL is available... yes" >&5 
    7987 $as_echo "Checking if Security framework for Darwin SSL is available... yes" >&6; } 
    7988                     else 
    7989                         { $as_echo "$as_me:${as_lineno-$LINENO}: result: Checking if Security framework for Darwin SSL is available... no" >&5 
    7990 $as_echo "Checking if Security framework for Darwin SSL is available... no" >&6; } 
    7991                     fi 
    7992                 fi 
    7993  
    7994                 if test "x$ac_ssl_backend" = "x" -a "x$with_ssl" != "xno" -a "x$with_ssl" != "x"; then 
     8004                if test "x$with_ssl" != "xno" -a "x$with_ssl" != "x"; then 
    79958005                    CFLAGS="$CFLAGS -I$with_ssl/include" 
    79968006                    CPPFLAGS="$CPPFLAGS -I$with_ssl/include" 
     
    80008010                fi 
    80018011 
    8002                 if test "x$ac_ssl_backend" = "x" -a "x$with_gnutls" = "xno"; then 
    8003  
     8012                if test "x$with_gnutls" = "xno"; then 
     8013                    # We still need to check for OpenSSL installations even if 
     8014                    # we find Darwin SSL above since DTLS requires OpenSSL. 
    80048015                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for OpenSSL installations.." >&5 
    80058016$as_echo "checking for OpenSSL installations.." >&6; } 
     
    81658176                        fi 
    81668177 
    8167                         # PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK 
    8168                         #AC_DEFINE(PJSIP_HAS_TLS_TRANSPORT, 1) 
    8169                         $as_echo "#define PJ_HAS_SSL_SOCK 1" >>confdefs.h 
    8170  
    8171                         $as_echo "#define PJ_SSL_SOCK_IMP PJ_SSL_SOCK_IMP_OPENSSL" >>confdefs.h 
    8172  
    8173                         ac_ssl_backend="openssl" 
     8178                        if test "x$ac_ssl_backend" = "x"; then 
     8179                            # PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK 
     8180                            #AC_DEFINE(PJSIP_HAS_TLS_TRANSPORT, 1) 
     8181                            $as_echo "#define PJ_HAS_SSL_SOCK 1" >>confdefs.h 
     8182 
     8183                            $as_echo "#define PJ_SSL_SOCK_IMP PJ_SSL_SOCK_IMP_OPENSSL" >>confdefs.h 
     8184 
     8185                            ac_ssl_backend="openssl" 
     8186                        fi 
    81748187                    else 
    81758188                        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ** OpenSSL libraries not found **" >&5 
  • pjproject/trunk/aconfigure.ac

    r5957 r5959  
    15421542dnl # SSL alt prefix 
    15431543AC_ARG_WITH(ssl, 
    1544     AS_HELP_STRING([--with-ssl=SSL_BACKEND/DIR], 
    1545                    [Specify alternate SSL library prefix or SSL native-backend. 
    1546                     You can specify "darwin" as the native iOS/MacOS backend 
    1547                     using Security framework, or you can specify an alternate 
    1548                     SSL library prefix directory. If a directory 
    1549                     is specified, this option will try to find OpenSSL first, 
    1550                     then if not found, GnuTLS. To skip OpenSSL finding, use 
    1551                     --with-gnutls option instead.]), 
     1544    AS_HELP_STRING([--with-ssl=DIR], 
     1545                   [Specify alternate SSL library prefix. This option will try 
     1546                    to find OpenSSL first, then if not found, GnuTLS. To skip 
     1547                    OpenSSL finding, use --with-gnutls option instead.]), 
    15521548    [], 
    15531549    [with_ssl=no] 
     
    15711567AC_SUBST(ac_ssl_has_aes_gcm,0) 
    15721568AC_SUBST(ac_ssl_backend) 
    1573 AC_ARG_ENABLE(ssl, 
    1574               AS_HELP_STRING([--disable-ssl], 
    1575                              [Exclude SSL support the build (default: autodetect)]) 
    1576               , 
    1577               [ 
    1578                 if test "$enable_ssl" = "no"; then 
    1579                  [ac_no_ssl=1] 
    1580                  AC_MSG_RESULT([Checking if SSL support is disabled... yes]) 
    1581                 fi 
    1582               ], 
    1583               [ 
    1584                 if test "x$with_ssl" = "xdarwin"; then 
     1569 
     1570AC_ARG_ENABLE(darwin-ssl, 
     1571              AS_HELP_STRING([--disable-darwin-ssl], 
     1572                             [Exclude Darwin SSL (default: autodetect)]), 
     1573              [if test "$enable_darwin_ssl" = "no"; then 
     1574                 AC_MSG_RESULT([Checking if Darwin SSL support is disabled... yes]) 
     1575                fi], 
     1576              [ 
     1577                case $target in 
     1578                *darwin*) 
    15851579                    SAVED_LIBS="$LIBS" 
    15861580                    LIBS="-framework Security" 
     
    15921586                        AC_DEFINE(PJ_SSL_SOCK_IMP, PJ_SSL_SOCK_IMP_DARWIN) 
    15931587                        LIBS="$LIBS -framework Security" 
    1594                         ac_ssl_backend="darwin" 
    15951588                        AC_MSG_RESULT([Checking if Security framework for Darwin SSL is available... yes]) 
    15961589                    else 
    15971590                        AC_MSG_RESULT([Checking if Security framework for Darwin SSL is available... no]) 
    15981591                    fi 
    1599                 fi 
    1600                  
    1601                 if test "x$ac_ssl_backend" = "x" -a "x$with_ssl" != "xno" -a "x$with_ssl" != "x"; then 
     1592                    ;; 
     1593                esac 
     1594              ]) 
     1595 
     1596AC_ARG_ENABLE(ssl, 
     1597              AS_HELP_STRING([--disable-ssl], 
     1598                             [Exclude SSL support the build (default: autodetect)]) 
     1599              , 
     1600              [ 
     1601                if test "$enable_ssl" = "no"; then 
     1602                 [ac_no_ssl=1] 
     1603                 AC_MSG_RESULT([Checking if SSL support is disabled... yes]) 
     1604                fi 
     1605              ], 
     1606              [ 
     1607                if test "x$with_ssl" != "xno" -a "x$with_ssl" != "x"; then 
    16021608                    CFLAGS="$CFLAGS -I$with_ssl/include" 
    16031609                    CPPFLAGS="$CPPFLAGS -I$with_ssl/include" 
     
    16061612                fi 
    16071613 
    1608                 if test "x$ac_ssl_backend" = "x" -a "x$with_gnutls" = "xno"; then 
    1609  
     1614                if test "x$with_gnutls" = "xno"; then 
     1615                    # We still need to check for OpenSSL installations even if 
     1616                    # we find Darwin SSL above since DTLS requires OpenSSL. 
    16101617                    AC_MSG_RESULT([checking for OpenSSL installations..]) 
    16111618                    AC_SUBST(openssl_h_present) 
     
    16331640                        fi 
    16341641 
    1635                         # PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK 
    1636                         #AC_DEFINE(PJSIP_HAS_TLS_TRANSPORT, 1) 
    1637                         AC_DEFINE(PJ_HAS_SSL_SOCK, 1) 
    1638                         AC_DEFINE(PJ_SSL_SOCK_IMP, PJ_SSL_SOCK_IMP_OPENSSL) 
    1639                         ac_ssl_backend="openssl" 
     1642                        if test "x$ac_ssl_backend" = "x"; then 
     1643                            # PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK 
     1644                            #AC_DEFINE(PJSIP_HAS_TLS_TRANSPORT, 1) 
     1645                            AC_DEFINE(PJ_HAS_SSL_SOCK, 1) 
     1646                            AC_DEFINE(PJ_SSL_SOCK_IMP, PJ_SSL_SOCK_IMP_OPENSSL) 
     1647                            ac_ssl_backend="openssl" 
     1648                        fi 
    16401649                    else 
    16411650                        AC_MSG_RESULT([** OpenSSL libraries not found **]) 
Note: See TracChangeset for help on using the changeset viewer.