summaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2006-06-30 15:19:49 +0200
committerWerner Koch <wk@gnupg.org>2006-06-30 15:19:49 +0200
commit640d5a8c53289f396ae018a4c36e2e8894261329 (patch)
treef2aecb490c84becc776ae45f32b027672a69ed19 /m4
parentA couple of fixes. gpg2's key generation does now work. (diff)
downloadgnupg2-640d5a8c53289f396ae018a4c36e2e8894261329.tar.xz
gnupg2-640d5a8c53289f396ae018a4c36e2e8894261329.zip
Added keyserver directory from trunk
Diffstat (limited to 'm4')
-rw-r--r--m4/ChangeLog5
-rw-r--r--m4/Makefile.am2
-rw-r--r--m4/ldap.m497
3 files changed, 104 insertions, 0 deletions
diff --git a/m4/ChangeLog b/m4/ChangeLog
index a7a9d1e36..2cc6a308e 100644
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,8 @@
+2006-06-30 Werner Koch <wk@g10code.com>
+
+ * ldap.m4: New. Taken from gnupg 1.4.4
+ * Makefile.am (EXTRA_DIST): Add ldap.me
+
2004-09-30 Werner Koch <wk@g10code.com>
* gpg-error.m4, libassuan.m4, libgcrypt.m4: Updated.
diff --git a/m4/Makefile.am b/m4/Makefile.am
index a31103ff6..d218b73b7 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -1,3 +1,5 @@
EXTRA_DIST = intmax.m4 longdouble.m4 longlong.m4 printf-posix.m4 signed.m4 size_max.m4 wchar_t.m4 wint_t.m4 xsize.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4
+EXTRA_DIST += ldap.m4
+
EXTRA_DIST += gpg-error.m4 libgcrypt.m4 libassuan.m4 ksba.m4
diff --git a/m4/ldap.m4 b/m4/ldap.m4
new file mode 100644
index 000000000..95249ac3e
--- /dev/null
+++ b/m4/ldap.m4
@@ -0,0 +1,97 @@
+dnl Check for LDAP
+dnl Copyright (C) 2005 Free Software Foundation, Inc.
+dnl
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+dnl
+dnl Defines @GPGKEYS_LDAP@ to a executable name if a working ldap
+dnl setup is found, and sets @LDAPLIBS@ to the necessary libraries.
+
+AC_DEFUN([GNUPG_CHECK_LDAP],
+[
+# Try and link a LDAP test program to weed out unusable LDAP
+# libraries. -lldap [-llber [-lresolv]] is for older OpenLDAPs.
+# OpenLDAP, circa 1999, was terrible with creating weird dependencies.
+# If all else fails, the user can play guess-the-dependency by using
+# something like ./configure LDAPLIBS="-Lfoo -lbar"
+
+AC_ARG_WITH(ldap,
+ AC_HELP_STRING([--with-ldap=DIR],[look for the LDAP library in DIR]),
+ [_ldap_with=$withval])
+
+if test x$_ldap_with != xno ; then
+
+ if test -d "$withval" ; then
+ LDAP_CPPFLAGS="-I$withval/include"
+ LDAP_LDFLAGS="-L$withval/lib"
+ fi
+
+ _ldap_save_cppflags=$CPPFLAGS
+ CPPFLAGS="${LDAP_CPPFLAGS} ${CPPFLAGS}"
+ _ldap_save_ldflags=$LDFLAGS
+ LDFLAGS="${LDAP_LDFLAGS} ${LDFLAGS}"
+
+ for MY_LDAPLIBS in ${LDAPLIBS+"$LDAPLIBS"} "-lldap" "-lldap -llber" "-lldap -llber -lresolv" "-lwldap32"; do
+ _ldap_save_libs=$LIBS
+ LIBS="$MY_LDAPLIBS $1 $LIBS"
+
+ AC_MSG_CHECKING([whether LDAP via \"$MY_LDAPLIBS\" is present and sane])
+ AC_TRY_LINK([
+#ifdef _WIN32
+#include <winsock2.h>
+#include <winldap.h>
+#else
+#include <ldap.h>
+#endif
+],[ldap_open("foobar",1234);],
+ [gnupg_cv_func_ldap_init=yes],[gnupg_cv_func_ldap_init=no])
+ AC_MSG_RESULT([$gnupg_cv_func_ldap_init])
+
+ if test $gnupg_cv_func_ldap_init = no; then
+ AC_MSG_CHECKING([whether I can make LDAP be sane with lber.h])
+ AC_TRY_LINK([#include <lber.h>
+#include <ldap.h>],[ldap_open("foobar",1234);],
+ [gnupg_cv_func_ldaplber_init=yes],[gnupg_cv_func_ldaplber_init=no])
+ AC_MSG_RESULT([$gnupg_cv_func_ldaplber_init])
+ fi
+
+ if test "$gnupg_cv_func_ldaplber_init" = yes ; then
+ AC_DEFINE(NEED_LBER_H,1,[Define if the LDAP library requires including lber.h before ldap.h])
+ fi
+
+ if test "$gnupg_cv_func_ldap_init" = yes || \
+ test "$gnupg_cv_func_ldaplber_init" = yes ; then
+ LDAPLIBS="$LDAP_LDFLAGS $MY_LDAPLIBS"
+ GPGKEYS_LDAP="gpgkeys_ldap$EXEEXT"
+
+ AC_CHECK_FUNCS(ldap_get_option ldap_set_option ldap_start_tls_s)
+
+ if test "$ac_cv_func_ldap_get_option" != yes ; then
+ AC_MSG_CHECKING([whether LDAP supports ld_errno])
+ AC_TRY_LINK([#include <ldap.h>],[LDAP *ldap; ldap->ld_errno;],
+ [gnupg_cv_func_ldap_ld_errno=yes],
+ [gnupg_cv_func_ldap_ld_errno=no])
+ AC_MSG_RESULT([$gnupg_cv_func_ldap_ld_errno])
+
+ if test "$gnupg_cv_func_ldap_ld_errno" = yes ; then
+ AC_DEFINE(HAVE_LDAP_LD_ERRNO,1,[Define if the LDAP library supports ld_errno])
+ fi
+ fi
+ fi
+
+ LIBS=$_ldap_save_libs
+
+ if test "$GPGKEYS_LDAP" != "" ; then break; fi
+ done
+
+ AC_SUBST(GPGKEYS_LDAP)
+ AC_SUBST(LDAPLIBS)
+ AC_SUBST(LDAP_CPPFLAGS)
+
+ CPPFLAGS=$_ldap_save_cppflags
+ LDFLAGS=$_ldap_save_ldflags
+fi
+])dnl