~ubuntu-branches/ubuntu/oneiric/gnupg2/oneiric-updates

« back to all changes in this revision

Viewing changes to m4/ldap.m4

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-10-04 10:25:53 UTC
  • mfrom: (5.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081004102553-fv62pp8dsitxli47
Tags: 2.0.9-3.1
* Non-maintainer upload.
* agent/gpg-agent.c: Deinit the threading library before exec'ing
  the command to run in --daemon mode. And because that still doesn't
  restore the sigprocmask, do that manually. Closes: #499569

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl Check for LDAP
 
2
dnl Copyright (C) 2005 Free Software Foundation, Inc.
 
3
dnl
 
4
dnl This file is free software, distributed under the terms of the GNU
 
5
dnl General Public License.  As a special exception to the GNU General
 
6
dnl Public License, this file may be distributed as part of a program
 
7
dnl that contains a configuration script generated by Autoconf, under
 
8
dnl the same distribution terms as the rest of that program.
 
9
dnl
 
10
dnl Defines @GPGKEYS_LDAP@ to a executable name if a working ldap
 
11
dnl setup is found, and sets @LDAPLIBS@ to the necessary libraries.
 
12
 
 
13
AC_DEFUN([GNUPG_CHECK_LDAP],
 
14
[
 
15
# Try and link a LDAP test program to weed out unusable LDAP
 
16
# libraries.  -lldap [-llber [-lresolv]] is for older OpenLDAPs.
 
17
# OpenLDAP, circa 1999, was terrible with creating weird dependencies.
 
18
# If all else fails, the user can play guess-the-dependency by using
 
19
# something like ./configure LDAPLIBS="-Lfoo -lbar"
 
20
 
 
21
AC_ARG_WITH(ldap,
 
22
  AC_HELP_STRING([--with-ldap=DIR],[look for the LDAP library in DIR]),
 
23
  [_ldap_with=$withval])
 
24
 
 
25
if test x$_ldap_with != xno ; then
 
26
 
 
27
  if test -d "$withval" ; then
 
28
     LDAP_CPPFLAGS="-I$withval/include"
 
29
     LDAP_LDFLAGS="-L$withval/lib"
 
30
  fi
 
31
 
 
32
  _ldap_save_cppflags=$CPPFLAGS
 
33
  CPPFLAGS="${LDAP_CPPFLAGS} ${CPPFLAGS}"
 
34
  _ldap_save_ldflags=$LDFLAGS
 
35
  LDFLAGS="${LDAP_LDFLAGS} ${LDFLAGS}"
 
36
 
 
37
  for MY_LDAPLIBS in ${LDAPLIBS+"$LDAPLIBS"} "-lldap" "-lldap -llber" "-lldap -llber -lresolv" "-lwldap32"; do
 
38
    _ldap_save_libs=$LIBS
 
39
    LIBS="$MY_LDAPLIBS $1 $LIBS"
 
40
 
 
41
    AC_MSG_CHECKING([whether LDAP via \"$MY_LDAPLIBS\" is present and sane])
 
42
    AC_TRY_LINK([
 
43
#ifdef _WIN32
 
44
#include <winsock2.h>
 
45
#include <winldap.h>
 
46
#else
 
47
#include <ldap.h>
 
48
#endif
 
49
],[ldap_open("foobar",1234);],
 
50
                [gnupg_cv_func_ldap_init=yes],[gnupg_cv_func_ldap_init=no])
 
51
    AC_MSG_RESULT([$gnupg_cv_func_ldap_init])
 
52
 
 
53
    if test $gnupg_cv_func_ldap_init = no; then
 
54
      AC_MSG_CHECKING([whether I can make LDAP be sane with lber.h])
 
55
      AC_TRY_LINK([#include <lber.h>
 
56
#include <ldap.h>],[ldap_open("foobar",1234);],
 
57
         [gnupg_cv_func_ldaplber_init=yes],[gnupg_cv_func_ldaplber_init=no])
 
58
      AC_MSG_RESULT([$gnupg_cv_func_ldaplber_init])
 
59
    fi
 
60
 
 
61
    if test "$gnupg_cv_func_ldaplber_init" = yes ; then
 
62
       AC_DEFINE(NEED_LBER_H,1,[Define if the LDAP library requires including lber.h before ldap.h])
 
63
    fi
 
64
 
 
65
    if test "$gnupg_cv_func_ldap_init" = yes || \
 
66
        test "$gnupg_cv_func_ldaplber_init" = yes ; then
 
67
       LDAPLIBS="$LDAP_LDFLAGS $MY_LDAPLIBS"
 
68
       GPGKEYS_LDAP="gpg2keys_ldap$EXEEXT"
 
69
 
 
70
       AC_CHECK_FUNCS(ldap_get_option ldap_set_option)
 
71
       # The extra test for ldap_start_tls_sA is for W32 because 
 
72
       # that is the actual function in the library.
 
73
       AC_CHECK_FUNCS(ldap_start_tls_s ldap_start_tls_sA)
 
74
 
 
75
       if test "$ac_cv_func_ldap_get_option" != yes ; then
 
76
          AC_MSG_CHECKING([whether LDAP supports ld_errno])
 
77
          AC_TRY_LINK([#include <ldap.h>],[LDAP *ldap; ldap->ld_errno;],
 
78
             [gnupg_cv_func_ldap_ld_errno=yes],
 
79
             [gnupg_cv_func_ldap_ld_errno=no])
 
80
          AC_MSG_RESULT([$gnupg_cv_func_ldap_ld_errno])
 
81
 
 
82
          if test "$gnupg_cv_func_ldap_ld_errno" = yes ; then
 
83
             AC_DEFINE(HAVE_LDAP_LD_ERRNO,1,[Define if the LDAP library supports ld_errno])
 
84
          fi
 
85
       fi
 
86
    fi
 
87
 
 
88
    LIBS=$_ldap_save_libs
 
89
 
 
90
    if test "$GPGKEYS_LDAP" != "" ; then break; fi
 
91
  done
 
92
 
 
93
  AC_SUBST(GPGKEYS_LDAP)
 
94
  AC_SUBST(LDAPLIBS)
 
95
  AC_SUBST(LDAP_CPPFLAGS)
 
96
 
 
97
  CPPFLAGS=$_ldap_save_cppflags
 
98
  LDFLAGS=$_ldap_save_ldflags
 
99
fi
 
100
])dnl