xref: /aosp_15_r20/external/libcups/config-scripts/cups-ssl.m4 (revision 5e7646d21f1134fb0638875d812ef646c12ab91e)
1*5e7646d2SAndroid Build Coastguard Workerdnl
2*5e7646d2SAndroid Build Coastguard Workerdnl TLS stuff for CUPS.
3*5e7646d2SAndroid Build Coastguard Workerdnl
4*5e7646d2SAndroid Build Coastguard Workerdnl Copyright 2007-2019 by Apple Inc.
5*5e7646d2SAndroid Build Coastguard Workerdnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
6*5e7646d2SAndroid Build Coastguard Workerdnl
7*5e7646d2SAndroid Build Coastguard Workerdnl Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
8*5e7646d2SAndroid Build Coastguard Workerdnl
9*5e7646d2SAndroid Build Coastguard Worker
10*5e7646d2SAndroid Build Coastguard WorkerAC_ARG_ENABLE(ssl, [  --disable-ssl           disable SSL/TLS support])
11*5e7646d2SAndroid Build Coastguard WorkerAC_ARG_ENABLE(cdsassl, [  --enable-cdsassl        use CDSA for SSL/TLS support, default=first])
12*5e7646d2SAndroid Build Coastguard WorkerAC_ARG_ENABLE(gnutls, [  --enable-gnutls         use GNU TLS for SSL/TLS support, default=second])
13*5e7646d2SAndroid Build Coastguard Worker
14*5e7646d2SAndroid Build Coastguard WorkerSSLFLAGS=""
15*5e7646d2SAndroid Build Coastguard WorkerSSLLIBS=""
16*5e7646d2SAndroid Build Coastguard Workerhave_ssl=0
17*5e7646d2SAndroid Build Coastguard WorkerCUPS_SERVERKEYCHAIN=""
18*5e7646d2SAndroid Build Coastguard Worker
19*5e7646d2SAndroid Build Coastguard Workerif test x$enable_ssl != xno; then
20*5e7646d2SAndroid Build Coastguard Worker    dnl Look for CDSA...
21*5e7646d2SAndroid Build Coastguard Worker    if test $have_ssl = 0 -a "x$enable_cdsassl" != "xno"; then
22*5e7646d2SAndroid Build Coastguard Worker	if test $host_os_name = darwin; then
23*5e7646d2SAndroid Build Coastguard Worker	    AC_CHECK_HEADER(Security/SecureTransport.h, [
24*5e7646d2SAndroid Build Coastguard Worker	    	have_ssl=1
25*5e7646d2SAndroid Build Coastguard Worker		AC_DEFINE(HAVE_SSL)
26*5e7646d2SAndroid Build Coastguard Worker		AC_DEFINE(HAVE_CDSASSL)
27*5e7646d2SAndroid Build Coastguard Worker		CUPS_SERVERKEYCHAIN="/Library/Keychains/System.keychain"
28*5e7646d2SAndroid Build Coastguard Worker
29*5e7646d2SAndroid Build Coastguard Worker		dnl Check for the various security headers...
30*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_HEADER(Security/SecCertificate.h,
31*5e7646d2SAndroid Build Coastguard Worker		    AC_DEFINE(HAVE_SECCERTIFICATE_H))
32*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_HEADER(Security/SecItem.h,
33*5e7646d2SAndroid Build Coastguard Worker		    AC_DEFINE(HAVE_SECITEM_H))
34*5e7646d2SAndroid Build Coastguard Worker		AC_CHECK_HEADER(Security/SecPolicy.h,
35*5e7646d2SAndroid Build Coastguard Worker		    AC_DEFINE(HAVE_SECPOLICY_H))])
36*5e7646d2SAndroid Build Coastguard Worker	fi
37*5e7646d2SAndroid Build Coastguard Worker    fi
38*5e7646d2SAndroid Build Coastguard Worker
39*5e7646d2SAndroid Build Coastguard Worker    dnl Then look for GNU TLS...
40*5e7646d2SAndroid Build Coastguard Worker    if test $have_ssl = 0 -a "x$enable_gnutls" != "xno" -a "x$PKGCONFIG" != x; then
41*5e7646d2SAndroid Build Coastguard Worker    	AC_PATH_TOOL(LIBGNUTLSCONFIG,libgnutls-config)
42*5e7646d2SAndroid Build Coastguard Worker	if $PKGCONFIG --exists gnutls; then
43*5e7646d2SAndroid Build Coastguard Worker	    have_ssl=1
44*5e7646d2SAndroid Build Coastguard Worker	    SSLLIBS=`$PKGCONFIG --libs gnutls`
45*5e7646d2SAndroid Build Coastguard Worker	    SSLFLAGS=`$PKGCONFIG --cflags gnutls`
46*5e7646d2SAndroid Build Coastguard Worker	    AC_DEFINE(HAVE_SSL)
47*5e7646d2SAndroid Build Coastguard Worker	    AC_DEFINE(HAVE_GNUTLS)
48*5e7646d2SAndroid Build Coastguard Worker	elif test "x$LIBGNUTLSCONFIG" != x; then
49*5e7646d2SAndroid Build Coastguard Worker	    have_ssl=1
50*5e7646d2SAndroid Build Coastguard Worker	    SSLLIBS=`$LIBGNUTLSCONFIG --libs`
51*5e7646d2SAndroid Build Coastguard Worker	    SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
52*5e7646d2SAndroid Build Coastguard Worker	    AC_DEFINE(HAVE_SSL)
53*5e7646d2SAndroid Build Coastguard Worker	    AC_DEFINE(HAVE_GNUTLS)
54*5e7646d2SAndroid Build Coastguard Worker	fi
55*5e7646d2SAndroid Build Coastguard Worker
56*5e7646d2SAndroid Build Coastguard Worker	if test $have_ssl = 1; then
57*5e7646d2SAndroid Build Coastguard Worker	    CUPS_SERVERKEYCHAIN="ssl"
58*5e7646d2SAndroid Build Coastguard Worker
59*5e7646d2SAndroid Build Coastguard Worker	    SAVELIBS="$LIBS"
60*5e7646d2SAndroid Build Coastguard Worker	    LIBS="$LIBS $SSLLIBS"
61*5e7646d2SAndroid Build Coastguard Worker	    AC_CHECK_FUNC(gnutls_transport_set_pull_timeout_function, AC_DEFINE(HAVE_GNUTLS_TRANSPORT_SET_PULL_TIMEOUT_FUNCTION))
62*5e7646d2SAndroid Build Coastguard Worker	    AC_CHECK_FUNC(gnutls_priority_set_direct, AC_DEFINE(HAVE_GNUTLS_PRIORITY_SET_DIRECT))
63*5e7646d2SAndroid Build Coastguard Worker	    LIBS="$SAVELIBS"
64*5e7646d2SAndroid Build Coastguard Worker	fi
65*5e7646d2SAndroid Build Coastguard Worker    fi
66*5e7646d2SAndroid Build Coastguard Workerfi
67*5e7646d2SAndroid Build Coastguard Worker
68*5e7646d2SAndroid Build Coastguard WorkerIPPALIASES="http"
69*5e7646d2SAndroid Build Coastguard Workerif test $have_ssl = 1; then
70*5e7646d2SAndroid Build Coastguard Worker    AC_MSG_RESULT([    Using SSLLIBS="$SSLLIBS"])
71*5e7646d2SAndroid Build Coastguard Worker    AC_MSG_RESULT([    Using SSLFLAGS="$SSLFLAGS"])
72*5e7646d2SAndroid Build Coastguard Worker    IPPALIASES="http https ipps"
73*5e7646d2SAndroid Build Coastguard Workerelif test x$enable_cdsa = xyes -o x$enable_gnutls = xyes; then
74*5e7646d2SAndroid Build Coastguard Worker    AC_MSG_ERROR([Unable to enable SSL support.])
75*5e7646d2SAndroid Build Coastguard Workerfi
76*5e7646d2SAndroid Build Coastguard Worker
77*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(CUPS_SERVERKEYCHAIN)
78*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(IPPALIASES)
79*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(SSLFLAGS)
80*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(SSLLIBS)
81*5e7646d2SAndroid Build Coastguard Worker
82*5e7646d2SAndroid Build Coastguard WorkerEXPORT_SSLLIBS="$SSLLIBS"
83*5e7646d2SAndroid Build Coastguard WorkerAC_SUBST(EXPORT_SSLLIBS)
84