forked from litespeedtech/lsmcd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ax_check_sasl.m4
97 lines (85 loc) · 2.32 KB
/
ax_check_sasl.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
dnl sasl.m4--sasl libraries and includes
dnl Derrick Brashear
dnl from KTH sasl and Arla
AC_DEFUN(CMU_SASL_INC_WHERE1, [
AC_REQUIRE([AC_PROG_CC_GNU])
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$saved_CPPFLAGS -I$1"
CMU_CHECK_HEADER_NOCACHE(sasl.h,
ac_cv_found_sasl_inc=yes,
ac_cv_found_sasl_inc=no)
CPPFLAGS=$saved_CPPFLAGS
])
AC_DEFUN(CMU_SASL_INC_WHERE, [
for i in $1; do
CMU_SASL_INC_WHERE1($i)
CMU_TEST_INCPATH($i, sasl)
if test "$ac_cv_found_sasl_inc" = "yes"; then
ac_cv_sasl_where_inc=$i
break
fi
done
])
AC_DEFUN(CMU_SASL_LIB_WHERE1, [
AC_REQUIRE([AC_PROG_CC_GNU])
saved_LIBS=$LIBS
LIBS="$saved_LIBS -L$1 -lsasl2"
AC_TRY_LINK(,
[sasl_getprop();],
[ac_cv_found_sasl_lib=yes],
ac_cv_found_sasl_lib=no)
LIBS=$saved_LIBS
])
AC_DEFUN(CMU_SASL_LIB_WHERE, [
for i in $1; do
CMU_SASL_LIB_WHERE1($i)
dnl deal with false positives from implicit link paths
CMU_TEST_LIBPATH($i, sasl)
if test "$ac_cv_found_sasl_lib" = "yes" ; then
ac_cv_sasl_where_lib=$i
break
fi
done
])
AC_DEFUN(CMU_SASL, [
AC_ARG_WITH(sasl,
[ --with-sasl=DIR Compile with libsasl in <DIR>],
with_sasl="$withval",
with_sasl="yes")
SASLFLAGS=""
LIB_SASL=""
cmu_saved_CPPFLAGS=$CPPFLAGS
cmu_saved_LDFLAGS=$LDFLAGS
cmu_saved_LIBS=$LIBS
if test -d ${with_sasl}; then
ac_cv_sasl_where_lib=${with_sasl}/lib
ac_cv_sasl_where_inc=${with_sasl}/include
SASLFLAGS="-I$ac_cv_sasl_where_inc"
LIB_SASL="-L$ac_cv_sasl_where_lib"
CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}"
LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}"
fi
# AC_CHECK_HEADER(sasl.h,
# AC_CHECK_LIB(sasl, sasl_getprop,
# ac_cv_found_sasl=yes,
# ac_cv_found_sasl=no), ac_cv_found_sasl=no)
# LIBS="$cmu_saved_LIBS"
# LDFLAGS="$cmu_saved_LDFLAGS"
# CPPFLAGS="$cmu_saved_CPPFLAGS"
# if test "$ac_cv_found_sasl" = yes; then
if test "${with_sasl}" != no; then
LIB_SASL="$LIB_SASL -lsasl2"
LIBS="$cmu_saved_LIBS $LIB_SASL"
else
LIB_SASL=""
SASLFLAGS=""
fi
AC_SUBST(LIB_SASL)
AC_SUBST(SASLFLAGS)
])
AC_DEFUN(CMU_SASL_REQUIRED,
[AC_REQUIRE([CMU_SASL])
if test "$ac_cv_found_sasl" != "yes"; then
AC_ERROR([Cannot continue without libsasl.
Get it from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/.])
fi])