1 dnl libssl.m4--Ssl libraries and includes
3 dnl from KTH kafs and Arla
4 dnl $Id: libssl.m4,v 1.10 2005/04/26 19:14:08 shadow Exp $
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
15 AC_DEFUN([CMU_LIBSSL_INC_WHERE], [
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
25 AC_MSG_RESULT(not found)
30 AC_DEFUN([CMU_LIBSSL_LIB_WHERE1], [
32 LIBS="$saved_LIBS -L$1 -lssl -lcrypto $LIB_SOCKET"
35 [ac_cv_found_ssl_lib=yes],
36 ac_cv_found_ssl_lib=no)
40 AC_DEFUN([CMU_LIBSSL_LIB_WHERE], [
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
51 AC_MSG_RESULT(not found)
56 AC_DEFUN([CMU_LIBSSL], [
57 AC_REQUIRE([CMU_FIND_LIB_SUBDIR])
58 AC_REQUIRE([CMU_SOCKETS])
60 [ --with-libssl=PREFIX Compile with Libssl support],
61 [if test "X$with_libssl" = "X"; then
64 AC_ARG_WITH(libssl-lib,
65 [ --with-libssl-lib=dir use libssl libraries in dir],
66 [if test "$withval" = "yes" -o "$withval" = "no"; then
67 AC_MSG_ERROR([No argument for --with-libssl-lib])
69 AC_ARG_WITH(libssl-include,
70 [ --with-libssl-include=dir use libssl headers in dir],
71 [if test "$withval" = "yes" -o "$withval" = "no"; then
72 AC_MSG_ERROR([No argument for --with-libssl-include])
75 if test "X$with_libssl" != "X"; then
76 if test "$with_libssl" != "yes" -a "$with_libssl" != no; then
77 ac_cv_libssl_where_lib=$with_libssl/$CMU_LIB_SUBDIR
78 ac_cv_libssl_where_inc=$with_libssl/include
82 if test "$with_libssl" != "no"; then
83 if test "X$with_libssl_lib" != "X"; then
84 ac_cv_libssl_where_lib=$with_libssl_lib
86 if test "X$ac_cv_libssl_where_lib" = "X"; then
87 CMU_LIBSSL_LIB_WHERE(/usr/local/$CMU_LIB_SUBDIR/openssl /usr/$CMU_LIB_SUBDIR/openssl /usr/local/$CMU_LIB_SUBDIR /usr/$CMU_LIB_SUBDIR)
90 if test "X$with_libssl_include" != "X"; then
91 ac_cv_libssl_where_inc=$with_libssl_include
93 if test "X$ac_cv_libssl_where_inc" = "X"; then
94 CMU_LIBSSL_INC_WHERE(/usr/local/include /usr/include)
98 AC_MSG_CHECKING(whether to include libssl)
99 if test "X$ac_cv_libssl_where_lib" = "X" -a "X$ac_cv_libssl_where_inc" = "X"; then
100 ac_cv_found_libssl=no
103 ac_cv_found_libssl=yes
105 LIBSSL_INC_DIR=$ac_cv_libssl_where_inc
106 LIBSSL_LIB_DIR=$ac_cv_libssl_where_lib
107 LIBSSL_INC_FLAGS="-I${LIBSSL_INC_DIR}"
108 LIBSSL_LIB_FLAGS="-L${LIBSSL_LIB_DIR} -lssl -lcrypto"
109 if test "X$RPATH" = "X"; then
114 if test "X$RPATH" = "X"; then
115 RPATH="-Wl,-rpath,${LIBSSL_LIB_DIR}"
117 RPATH="${RPATH}:${LIBSSL_LIB_DIR}"
121 if test "X$RPATH" = "X"; then
122 RPATH="-Wl,+b${LIBSSL_LIB_DIR}"
124 RPATH="${RPATH}:${LIBSSL_LIB_DIR}"
128 if test "X$RPATH" = "X"; then
129 RPATH="-Wl,-rpath,${LIBSSL_LIB_DIR}"
131 RPATH="${RPATH}:${LIBSSL_LIB_DIR}"
135 if test "$ac_cv_prog_gcc" = yes; then
136 if test "X$RPATH" = "X"; then
137 RPATH="-Wl,-R${LIBSSL_LIB_DIR}"
139 RPATH="${RPATH}:${LIBSSL_LIB_DIR}"
142 RPATH="${RPATH} -R${LIBSSL_LIB_DIR}"
148 AC_SUBST(LIBSSL_INC_DIR)
149 AC_SUBST(LIBSSL_LIB_DIR)
150 AC_SUBST(LIBSSL_INC_FLAGS)
151 AC_SUBST(LIBSSL_LIB_FLAGS)