1 |
dnl libssl.m4--Ssl libraries and includes |
2 |
dnl Derrick Brashear |
3 |
dnl from KTH kafs and Arla |
4 |
dnl $Id: libssl.m4,v 1.8 2002/12/21 18:44:25 cg2v Exp $ |
5 |
|
6 |
AC_DEFUN(CMU_LIBSSL_INC_WHERE1, [ |
7 |
saved_CPPFLAGS=$CPPFLAGS |
8 |
CPPFLAGS="$saved_CPPFLAGS -I$1" |
9 |
CMU_CHECK_HEADER_NOCACHE(openssl/ssl.h, |
10 |
ac_cv_found_libssl_inc=yes, |
11 |
ac_cv_found_libssl_inc=no) |
12 |
CPPFLAGS=$saved_CPPFLAGS |
13 |
]) |
14 |
|
15 |
AC_DEFUN(CMU_LIBSSL_INC_WHERE, [ |
16 |
for i in $1; do |
17 |
AC_MSG_CHECKING(for libssl headers in $i) |
18 |
CMU_LIBSSL_INC_WHERE1($i) |
19 |
CMU_TEST_INCPATH($i, ssl) |
20 |
if test "$ac_cv_found_libssl_inc" = "yes"; then |
21 |
ac_cv_libssl_where_inc=$i |
22 |
AC_MSG_RESULT(found) |
23 |
break |
24 |
else |
25 |
AC_MSG_RESULT(not found) |
26 |
fi |
27 |
done |
28 |
]) |
29 |
|
30 |
AC_DEFUN(CMU_LIBSSL_LIB_WHERE1, [ |
31 |
saved_LIBS=$LIBS |
32 |
LIBS="$saved_LIBS -L$1 -lssl -lcrypto $LIB_SOCKET" |
33 |
AC_TRY_LINK(, |
34 |
[SSL_write();], |
35 |
[ac_cv_found_ssl_lib=yes], |
36 |
ac_cv_found_ssl_lib=no) |
37 |
LIBS=$saved_LIBS |
38 |
]) |
39 |
|
40 |
AC_DEFUN(CMU_LIBSSL_LIB_WHERE, [ |
41 |
for i in $1; do |
42 |
AC_MSG_CHECKING(for libssl libraries in $i) |
43 |
CMU_LIBSSL_LIB_WHERE1($i) |
44 |
dnl deal with false positives from implicit link paths |
45 |
CMU_TEST_LIBPATH($i, ssl) |
46 |
if test "$ac_cv_found_ssl_lib" = "yes" ; then |
47 |
ac_cv_libssl_where_lib=$i |
48 |
AC_MSG_RESULT(found) |
49 |
break |
50 |
else |
51 |
AC_MSG_RESULT(not found) |
52 |
fi |
53 |
done |
54 |
]) |
55 |
|
56 |
AC_DEFUN(CMU_LIBSSL, [ |
57 |
AC_REQUIRE([CMU_SOCKETS]) |
58 |
AC_ARG_WITH(libssl, |
59 |
[ --with-libssl=PREFIX Compile with Libssl support], |
60 |
[if test "X$with_libssl" = "X"; then |
61 |
with_libssl=yes |
62 |
fi]) |
63 |
AC_ARG_WITH(libssl-lib, |
64 |
[ --with-libssl-lib=dir use libssl libraries in dir], |
65 |
[if test "$withval" = "yes" -o "$withval" = "no"; then |
66 |
AC_MSG_ERROR([No argument for --with-libssl-lib]) |
67 |
fi]) |
68 |
AC_ARG_WITH(libssl-include, |
69 |
[ --with-libssl-include=dir use libssl headers in dir], |
70 |
[if test "$withval" = "yes" -o "$withval" = "no"; then |
71 |
AC_MSG_ERROR([No argument for --with-libssl-include]) |
72 |
fi]) |
73 |
|
74 |
if test "X$with_libssl" != "X"; then |
75 |
if test "$with_libssl" != "yes" -a "$with_libssl" != no; then |
76 |
ac_cv_libssl_where_lib=$with_libssl/lib |
77 |
ac_cv_libssl_where_inc=$with_libssl/include |
78 |
fi |
79 |
fi |
80 |
|
81 |
if test "$with_libssl" != "no"; then |
82 |
if test "X$with_libssl_lib" != "X"; then |
83 |
ac_cv_libssl_where_lib=$with_libssl_lib |
84 |
fi |
85 |
if test "X$ac_cv_libssl_where_lib" = "X"; then |
86 |
CMU_LIBSSL_LIB_WHERE(/usr/local/lib/openssl /usr/lib/openssl /usr/local/lib /usr/lib) |
87 |
fi |
88 |
|
89 |
if test "X$with_libssl_include" != "X"; then |
90 |
ac_cv_libssl_where_inc=$with_libssl_include |
91 |
fi |
92 |
if test "X$ac_cv_libssl_where_inc" = "X"; then |
93 |
CMU_LIBSSL_INC_WHERE(/usr/local/include /usr/include) |
94 |
fi |
95 |
fi |
96 |
|
97 |
AC_MSG_CHECKING(whether to include libssl) |
98 |
if test "X$ac_cv_libssl_where_lib" = "X" -a "X$ac_cv_libssl_where_inc" = "X"; then |
99 |
ac_cv_found_libssl=no |
100 |
AC_MSG_RESULT(no) |
101 |
else |
102 |
ac_cv_found_libssl=yes |
103 |
AC_MSG_RESULT(yes) |
104 |
LIBSSL_INC_DIR=$ac_cv_libssl_where_inc |
105 |
LIBSSL_LIB_DIR=$ac_cv_libssl_where_lib |
106 |
LIBSSL_INC_FLAGS="-I${LIBSSL_INC_DIR}" |
107 |
LIBSSL_LIB_FLAGS="-L${LIBSSL_LIB_DIR} -lssl -lcrypto" |
108 |
if test "X$RPATH" = "X"; then |
109 |
RPATH="" |
110 |
fi |
111 |
case "${host}" in |
112 |
*-*-linux*) |
113 |
if test "X$RPATH" = "X"; then |
114 |
RPATH="-Wl,-rpath,${LIBSSL_LIB_DIR}" |
115 |
else |
116 |
RPATH="${RPATH}:${LIBSSL_LIB_DIR}" |
117 |
fi |
118 |
;; |
119 |
*-*-hpux*) |
120 |
if test "X$RPATH" = "X"; then |
121 |
RPATH="-Wl,+b${LIBSSL_LIB_DIR}" |
122 |
else |
123 |
RPATH="${RPATH}:${LIBSSL_LIB_DIR}" |
124 |
fi |
125 |
;; |
126 |
*-*-irix*) |
127 |
if test "X$RPATH" = "X"; then |
128 |
RPATH="-Wl,-rpath,${LIBSSL_LIB_DIR}" |
129 |
else |
130 |
RPATH="${RPATH}:${LIBSSL_LIB_DIR}" |
131 |
fi |
132 |
;; |
133 |
*-*-solaris2*) |
134 |
if test "$ac_cv_prog_gcc" = yes; then |
135 |
if test "X$RPATH" = "X"; then |
136 |
RPATH="-Wl,-R${LIBSSL_LIB_DIR}" |
137 |
else |
138 |
RPATH="${RPATH}:${LIBSSL_LIB_DIR}" |
139 |
fi |
140 |
else |
141 |
RPATH="${RPATH} -R${LIBSSL_LIB_DIR}" |
142 |
fi |
143 |
;; |
144 |
esac |
145 |
AC_SUBST(RPATH) |
146 |
fi |
147 |
AC_SUBST(LIBSSL_INC_DIR) |
148 |
AC_SUBST(LIBSSL_LIB_DIR) |
149 |
AC_SUBST(LIBSSL_INC_FLAGS) |
150 |
AC_SUBST(LIBSSL_LIB_FLAGS) |
151 |
]) |