1 | # evolution/acinclude.m4 |
---|
2 | # shared configure.in hacks between Evolution and Connector |
---|
3 | |
---|
4 | # EVO_CHECK_LIB(dispname, pkgname, minvers[, maxvers]) |
---|
5 | # Checks if the package with human-readable name @dispname, known |
---|
6 | # to gnome-config as @pkgname exists and has an appropriate version. |
---|
7 | # The version must be >= @minvers. If @maxvers is equal to @minvers, |
---|
8 | # it must be exactly that version. Otherwise, if @maxvers is set, |
---|
9 | # the version must be LESS THAN @maxvers (not less than or equal). |
---|
10 | AC_DEFUN(EVO_CHECK_LIB, [ |
---|
11 | dispname="$1" |
---|
12 | pkgname="$2" |
---|
13 | minvers="$3" |
---|
14 | maxvers="$4" |
---|
15 | |
---|
16 | AC_MSG_CHECKING(for $dispname) |
---|
17 | |
---|
18 | if gnome-config --libs $pkgname > /dev/null 2>&1; then |
---|
19 | pkgvers=`gnome-config --modversion $pkgname | sed -e 's/^[[^0-9]]*//'` |
---|
20 | else |
---|
21 | pkgvers=not |
---|
22 | fi |
---|
23 | AC_MSG_RESULT($pkgvers found) |
---|
24 | |
---|
25 | pkgvers=`echo $pkgvers | awk -F. '{ print $[]1 * 1000000 + $[]2 * 10000 + $[]3 * 100 + $[]4;}'` |
---|
26 | cmpminvers=`echo $minvers | awk -F. '{ print $[]1 * 1000000 + $[]2 * 10000 + $[]3 * 100 + $[]4;}'` |
---|
27 | cmpmaxvers=`echo $maxvers | awk -F. '{ print $[]1 * 1000000 + $[]2 * 10000 + $[]3 * 100 + $[]4;}'` |
---|
28 | ok=yes |
---|
29 | if test "$pkgvers" -lt $cmpminvers; then |
---|
30 | ok=no |
---|
31 | elif test -n "$maxvers"; then |
---|
32 | if test "$pkgvers" -gt $cmpmaxvers; then |
---|
33 | ok=no |
---|
34 | elif test "$maxvers" != "$minvers" -a "$cmpmaxvers" -eq "$pkgvers"; then |
---|
35 | ok=no |
---|
36 | fi |
---|
37 | fi |
---|
38 | if test $ok = no; then |
---|
39 | case $maxvers in |
---|
40 | "") |
---|
41 | dispvers="$minvers or higher" |
---|
42 | ;; |
---|
43 | $minvers) |
---|
44 | dispvers="$minvers (exactly)" |
---|
45 | ;; |
---|
46 | *) |
---|
47 | dispvers="$minvers or higher, but less than $maxvers," |
---|
48 | ;; |
---|
49 | esac |
---|
50 | |
---|
51 | AC_MSG_ERROR([ |
---|
52 | "" |
---|
53 | "You need $dispname $dispvers to build $PACKAGE" |
---|
54 | "If you think you already have this installed, consult the README."]) |
---|
55 | fi |
---|
56 | ]) |
---|
57 | |
---|
58 | |
---|
59 | # EVO_PURIFY_SUPPORT |
---|
60 | # Add --enable-purify. If the user turns it on, subst PURIFY and set |
---|
61 | # the automake conditional ENABLE_PURIFY |
---|
62 | AC_DEFUN(EVO_PURIFY_SUPPORT, [ |
---|
63 | AC_ARG_ENABLE(purify, |
---|
64 | [ --enable-purify=[no/yes] Enable support for building executables with Purify.],,enable_purify=no) |
---|
65 | AC_PATH_PROG(PURIFY, purify, impure) |
---|
66 | AC_ARG_WITH(purify-options, [ --with-purify-options=OPTIONS Options passed to the purify command line (defaults to PURIFYOPTIONS variable).]) |
---|
67 | if test "x$with_purify_options" = "xno"; then |
---|
68 | with_purify_options="-always-use-cache-dir=yes -cache-dir=/gnome/lib/purify" |
---|
69 | fi |
---|
70 | if test "x$PURIFYOPTIONS" = "x"; then |
---|
71 | PURIFYOPTIONS=$with_purify_options |
---|
72 | fi |
---|
73 | AC_SUBST(PURIFY) |
---|
74 | AM_CONDITIONAL(ENABLE_PURIFY, test "x$enable_purify" = "xyes" -a "x$PURIFY" != "ximpure") |
---|
75 | PURIFY="$PURIFY $PURIFYOPTIONS" |
---|
76 | ]) |
---|
77 | |
---|
78 | |
---|
79 | # EVO_LDAP_CHECK(default) |
---|
80 | # Add --with-openldap and --with-static-ldap options. --with-openldap |
---|
81 | # defaults to the given value if not specified. If LDAP support is |
---|
82 | # configured, HAVE_LDAP will be defined and the automake conditional |
---|
83 | # ENABLE_LDAP will be set. LDAP_CFLAGS and LDAP_LIBS will be set |
---|
84 | # appropriately. |
---|
85 | AC_DEFUN(EVO_LDAP_CHECK, [ |
---|
86 | default="$1" |
---|
87 | |
---|
88 | AC_ARG_WITH(openldap, [ --with-openldap=[no/yes/PREFIX] Enable LDAP support in evolution]) |
---|
89 | AC_ARG_WITH(static-ldap, [ --with-static-ldap=[no/yes] Link LDAP support statically into evolution ]) |
---|
90 | AC_CACHE_CHECK([for OpenLDAP], ac_cv_with_openldap, ac_cv_with_openldap="${with_openldap:=$default}") |
---|
91 | case $ac_cv_with_openldap in |
---|
92 | no|"") |
---|
93 | with_openldap=no |
---|
94 | ;; |
---|
95 | yes) |
---|
96 | with_openldap=/usr |
---|
97 | ;; |
---|
98 | *) |
---|
99 | with_openldap=$ac_cv_with_openldap |
---|
100 | LDAP_CFLAGS="-I$ac_cv_with_openldap/include" |
---|
101 | LDAP_LDFLAGS="-L$ac_cv_with_openldap/lib" |
---|
102 | ;; |
---|
103 | esac |
---|
104 | |
---|
105 | if test "$with_openldap" != no; then |
---|
106 | AC_DEFINE(HAVE_LDAP) |
---|
107 | |
---|
108 | case $with_static_ldap in |
---|
109 | no|"") |
---|
110 | if test -f $with_openldap/lib/libldap.la; then |
---|
111 | with_static_ldap=yes |
---|
112 | else |
---|
113 | with_static_ldap=no |
---|
114 | fi |
---|
115 | ;; |
---|
116 | *) |
---|
117 | with_static_ldap=yes |
---|
118 | ;; |
---|
119 | esac |
---|
120 | |
---|
121 | AC_CACHE_CHECK(if OpenLDAP is version 2.x, ac_cv_openldap_version2, [ |
---|
122 | CPPFLAGS_save="$CPPFLAGS" |
---|
123 | CPPFLAGS="$CPPFLAGS $LDAP_CFLAGS" |
---|
124 | AC_EGREP_CPP(yes, [ |
---|
125 | #include "ldap.h" |
---|
126 | #if LDAP_VENDOR_VERSION > 20000 |
---|
127 | yes |
---|
128 | #endif |
---|
129 | ], ac_cv_openldap_version2=yes, ac_cv_openldap_version2=no) |
---|
130 | CPPFLAGS="$CPPFLAGS_save" |
---|
131 | ]) |
---|
132 | if test "$ac_cv_openldap_version2" = no; then |
---|
133 | AC_MSG_ERROR(evolution requires OpenLDAP version >= 2) |
---|
134 | fi |
---|
135 | |
---|
136 | AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="-lresolv") |
---|
137 | AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket") |
---|
138 | AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl") |
---|
139 | AC_CHECK_LIB(lber, ber_get_tag, [ |
---|
140 | if test "$with_static_ldap" = "yes"; then |
---|
141 | LDAP_LIBS="$with_openldap/lib/liblber.a $LDAP_LIBS" |
---|
142 | |
---|
143 | # libldap might depend on OpenSSL... We need to pull |
---|
144 | # in the dependency libs explicitly here since we're |
---|
145 | # not using libtool for the configure test. |
---|
146 | if test -f $with_openldap/lib/libldap.la; then |
---|
147 | LDAP_LIBS="`. $with_openldap/lib/libldap.la; echo $dependency_libs` $LDAP_LIBS" |
---|
148 | fi |
---|
149 | else |
---|
150 | LDAP_LIBS="-llber $LDAP_LIBS" |
---|
151 | fi |
---|
152 | AC_CHECK_LIB(ldap, ldap_open, [ |
---|
153 | if test $with_static_ldap = "yes"; then |
---|
154 | LDAP_LIBS="$with_openldap/lib/libldap.a $LDAP_LIBS" |
---|
155 | else |
---|
156 | LDAP_LIBS="-lldap $LDAP_LIBS" |
---|
157 | fi], |
---|
158 | LDAP_LIBS="", $LDAP_LDFLAGS $LDAP_LIBS) |
---|
159 | LDAP_LIBS="$LDAP_LDFLAGS $LDAP_LIBS" |
---|
160 | ], LDAP_LIBS="", $LDAP_LDFLAGS $LDAP_LIBS) |
---|
161 | |
---|
162 | if test -z "$LDAP_LIBS"; then |
---|
163 | AC_MSG_ERROR(could not find OpenLDAP libraries) |
---|
164 | fi |
---|
165 | |
---|
166 | AC_SUBST(LDAP_CFLAGS) |
---|
167 | AC_SUBST(LDAP_LIBS) |
---|
168 | fi |
---|
169 | AM_CONDITIONAL(ENABLE_LDAP, test $with_openldap != no) |
---|
170 | ]) |
---|