|
From: <svn...@op...> - 2010-01-06 20:53:41
|
Author: scriptor Date: Wed Jan 6 21:53:30 2010 New Revision: 5979 URL: http://www.opensync.org/changeset/5979 Log: The user can now choose which LDAP library the LDAP plugin is to be linked against, when he runs cmake: Link it against libldap from openldap ( http://www.openldap.org/ ): -DUSE_OPENLDAP=on Link it against libldap60 from the Mozilla LDAP C SDK ( http://www.mozilla.org/directory/csdk.html ): -DUSE_MOZLDAP=on The previous version always chose openldap. Mozldap could only be used, when libldap from openldap was not found (not installed). Now, the user can easily switch between both libraries. Modified: plugins/ldap-sync/CMakeLists.txt plugins/ldap-sync/INSTALL plugins/ldap-sync/src/CMakeLists.txt plugins/ldap-sync/src/ldap_plugin.h Modified: plugins/ldap-sync/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/CMakeLists.txt Wed Jan 6 21:53:17 2010 (r5978) +++ plugins/ldap-sync/CMakeLists.txt Wed Jan 6 21:53:30 2010 (r5979) @@ -55,25 +55,222 @@ FIND_PACKAGE( LibXslt REQUIRED ) FIND_PACKAGE( LibLdap ) FIND_PACKAGE( LibMozLdap ) -FIND_PACKAGE( LibSASL2 ) -FIND_PACKAGE( LibGSSAPIV2 ) -FIND_PACKAGE( Check ) -IF ( NOT CHECK_FOUND ) - MESSAGE( STATUS " Could NOT find the check library: \"check\" or \"libcheck\": http://check.sourceforge.net/ . The test suite can NOT be built, therefore.") -ENDIF ( NOT CHECK_FOUND ) -# By default use openldap, if available. -# Fall back to mozldap only, if necessary (and possible, of course). +IF ( USE_OPENLDAP ) + # The user prefers openldap. So try and usd this particular library. + MESSAGE( STATUS "User has defined USE_OPENLDAP." ) + IF ( LIBLDAP_FOUND ) + SET ( USE_OPENLDAP 1 ) + # libldap and liblber from openldap + IF ( LIBLBER_FOUND ) + SET ( _LDAP_INCLUDE_DIRS ${LDAP_INCLUDE_DIR} ${LBER_INCLUDE_DIR} ) + ELSE ( LIBLBER_FOUND ) + SET ( _LDAP_INCLUDE_DIRS ${LDAP_INCLUDE_DIR} ) + ENDIF ( LIBLBER_FOUND ) + + IF ( LIBLBER_FOUND ) + SET ( _LDAP_LIBRARY_DIRS ${LDAP_LIBRARY_DIRS} ${LBER_LIBRARY_DIRS} ) + ELSE ( LIBLBER_FOUND ) + SET ( _LDAP_LIBRARY_DIRS ${LDAP_LIBRARY_DIRS} ) + ENDIF ( LIBLBER_FOUND ) + + IF ( LIBLBER_FOUND) + SET ( _LDAP_LIBRARIES ${LDAP_LIBRARY} ${LBER_LIBRARY} ) + ELSE ( LIBLBER_FOUND) + SET ( _LDAP_LIBRARIES ${LDAP_LIBRARY} ) + ENDIF ( LIBLBER_FOUND) + + ELSE ( LIBLDAP_FOUND ) + MESSAGE ( FATAL_ERROR " libldap from openldap could NOT be found, although USE_OPENLDAP has been defined. " ) + ENDIF ( LIBLDAP_FOUND ) + +ELSE ( USE_OPENLDAP ) + IF ( USE_MOZLDAP ) + # The user prefers mozldap. So try and usd this particular library. + MESSAGE ( STATUS "User has defined USE_MOZLDAP." ) + IF ( LIBMOZLDAP_FOUND ) + SET ( USE_MOZLDAP 1 ) + #libldap60 from Mozilla + IF ( MOZLDAP_INCLUDE_DIR ) + SET ( _LDAP_INCLUDE_DIRS ${MOZLDAP_INCLUDE_DIR} ) + ELSE ( MOZLDAP_INCLUDE_DIR ) + IF ( LIBMOZLDAP_INCLUDEDIR ) + SET ( _LDAP_INCLUDE_DIRS ${LIBMOZLDAP_INCLUDEDIR}) + ENDIF ( LIBMOZLDAP_INCLUDEDIR ) + ENDIF ( MOZLDAP_INCLUDE_DIR ) + + IF ( LIBMOZLDAP_LIBDIR ) + SET ( _LDAP_LIBRARY_DIRS ${LIBMOZLDAP_LIBDIR} ) + ENDIF ( LIBMOZLDAP_LIBDIR ) + + IF ( LIBMOZLDAP_LIBRARIES ) + SET ( _LDAP_LIBRARIES ${LIBMOZLDAP_LIBRARIES} ) + ELSE ( LIBMOZLDAP_LIBRARIES ) + IF ( MOZLDAP_LIBRARY ) + SET ( _LDAP_LIBRARIES ${MOZLDAP_LIBRARY} ) + ELSE ( MOZLDAP_LIBRARY ) + MESSAGE( FATAL_ERROR " Neither LIBMOZLDAP_LIBRARIES nor MOZLDAP_LIBRARY has been defined." ) + ENDIF ( MOZLDAP_LIBRARY ) + ENDIF ( LIBMOZLDAP_LIBRARIES ) + + ELSE ( LIBMOZLDAP_FOUND ) + MESSAGE (FATAL_ERROR " libmozldap from the Mozilla LDAP C SDK could NOT be found, although USE_MOZLDAP has been defined. " ) + ENDIF ( LIBMOZLDAP_FOUND ) + ELSE ( USE_MOZLDAP ) + # The user has no particular preference with regard to the LDAP library. + # By default use openldap, if available. + # Fall back to mozldap only, if necessary (and possible, of course). + MESSAGE ( STATUS "User has not chosen a particular LDAP library." ) + IF ( LIBLDAP_FOUND ) + SET ( USE_OPENLDAP 1 ) + # libldap and liblber from openldap + IF ( LIBLBER_FOUND ) + SET ( _LDAP_INCLUDE_DIRS ${LDAP_INCLUDE_DIR} ${LBER_INCLUDE_DIR} ) + ELSE ( LIBLBER_FOUND ) + SET ( _LDAP_INCLUDE_DIRS ${LDAP_INCLUDE_DIR} ) + ENDIF ( LIBLBER_FOUND ) + + IF ( LIBLBER_FOUND ) + SET ( _LDAP_LIBRARY_DIRS ${LDAP_LIBRARY_DIRS} ${LBER_LIBRARY_DIRS} ) + ELSE ( LIBLBER_FOUND ) + SET ( _LDAP_LIBRARY_DIRS ${LDAP_LIBRARY_DIRS} ) + ENDIF ( LIBLBER_FOUND ) + + IF ( LIBLBER_FOUND) + SET ( _LDAP_LIBRARIES ${LDAP_LIBRARY} ${LBER_LIBRARY} ) + ELSE ( LIBLBER_FOUND) + SET ( _LDAP_LIBRARIES ${LDAP_LIBRARY} ) + ENDIF ( LIBLBER_FOUND) + + ELSE ( LIBLDAP_FOUND ) + IF ( LIBMOZLDAP_FOUND ) + SET ( USE_MOZLDAP 1 ) + #libldap60 from Mozilla + IF ( MOZLDAP_INCLUDE_DIR ) + SET ( _LDAP_INCLUDE_DIRS ${MOZLDAP_INCLUDE_DIR} ) + ELSE ( MOZLDAP_INCLUDE_DIR ) + IF ( LIBMOZLDAP_INCLUDEDIR ) + SET ( _LDAP_INCLUDE_DIRS ${LIBMOZLDAP_INCLUDEDIR}) + ENDIF ( LIBMOZLDAP_INCLUDEDIR ) + ENDIF ( MOZLDAP_INCLUDE_DIR ) + + IF ( LIBMOZLDAP_LIBDIR ) + SET ( _LDAP_LIBRARY_DIRS ${LIBMOZLDAP_LIBDIR} ) + ENDIF ( LIBMOZLDAP_LIBDIR ) + + IF ( LIBMOZLDAP_LIBRARIES ) + SET ( _LDAP_LIBRARIES ${LIBMOZLDAP_LIBRARIES} ) + ELSE ( LIBMOZLDAP_LIBRARIES ) + IF ( MOZLDAP_LIBRARY ) + SET ( _LDAP_LIBRARIES ${MOZLDAP_LIBRARY} ) + ELSE ( MOZLDAP_LIBRARY ) + MESSAGE( FATAL_ERROR " Neither LIBMOZLDAP_LIBRARIES nor MOZLDAP_LIBRARY has been defined." ) + ENDIF ( MOZLDAP_LIBRARY ) + ENDIF ( LIBMOZLDAP_LIBRARIES ) + + ELSE ( LIBMOZLDAP_FOUND ) + MESSAGE (FATAL_ERROR " Neither libmozldap from the Mozilla LDAP C SDK nor libldap from openldap could be found. " ) + ENDIF ( LIBMOZLDAP_FOUND ) + ENDIF ( LIBLDAP_FOUND ) + ENDIF ( USE_MOZLDAP) +ENDIF ( USE_OPENLDAP ) + + +#################### + +# Determine _LDAP_INCLUDE_DIRS +IF ( LIBLDAP_FOUND ) +# # libldap and liblber from openldap +# IF ( LIBLBER_FOUND ) +# SET ( _LDAP_INCLUDE_DIRS ${LDAP_INCLUDE_DIR} ${LBER_INCLUDE_DIR} ) +# ELSE ( LIBLBER_FOUND ) +# SET ( _LDAP_INCLUDE_DIRS ${LDAP_INCLUDE_DIR} ) +# ENDIF ( LIBLBER_FOUND ) + +ELSE ( LIBLDAP_FOUND ) + IF ( LIBMOZLDAP_FOUND ) +# #libldap60 from Mozilla +# IF ( MOZLDAP_INCLUDE_DIR ) +# SET ( _LDAP_INCLUDE_DIRS ${MOZLDAP_INCLUDE_DIR} ) +# +# ELSE ( MOZLDAP_INCLUDE_DIR ) +# IF ( LIBMOZLDAP_INCLUDEDIR ) +# SET ( _LDAP_INCLUDE_DIRS ${LIBMOZLDAP_INCLUDEDIR}) +# ENDIF ( LIBMOZLDAP_INCLUDEDIR ) +# ENDIF ( MOZLDAP_INCLUDE_DIR ) + + ELSE ( LIBMOZLDAP_FOUND ) + MESSAGE( FATAL_ERROR " Neither libldap from openldap nor libldap60 from Mozilla could be found. The ldap-sync plugin requires one of these libraries including the header files, as can be found in \"development packages\" or \"SDK's\"." ) + ENDIF ( LIBMOZLDAP_FOUND ) +ENDIF ( LIBLDAP_FOUND ) + + + + +# Determine _LDAP_LIBRARY_DIRS IF ( LIBLDAP_FOUND ) - SET ( USE_OPENLDAP 1 ) +# IF ( LIBLBER_FOUND ) +# SET ( _LDAP_LIBRARY_DIRS ${LDAP_LIBRARY_DIRS} ${LBER_LIBRARY_DIRS} ) +# ELSE ( LIBLBER_FOUND ) +# SET ( _LDAP_LIBRARY_DIRS ${LDAP_LIBRARY_DIRS} ) +# ENDIF ( LIBLBER_FOUND ) +ELSE ( LIBLDAP_FOUND ) +# IF ( LIBMOZLDAP_FOUND ) +# IF ( LIBMOZLDAP_LIBDIR ) +# SET ( _LDAP_LIBRARY_DIRS ${LIBMOZLDAP_LIBDIR} ) +# ENDIF ( LIBMOZLDAP_LIBDIR ) +# ELSE ( LIBMOZLDAP_FOUND ) +# MESSAGE( FATAL_ERROR " Neither libldap from openldap nor libldap60 from Mozilla could be found. The ldap-sync plugin requires one of these." ) +# ENDIF ( LIBMOZLDAP_FOUND ) +ENDIF ( LIBLDAP_FOUND ) + + + + +# Determine _LDAP_LIBRARIES +IF ( LIBLDAP_FOUND ) +# IF ( LIBLBER_FOUND) +# SET ( _LDAP_LIBRARIES ${LDAP_LIBRARY} ${LBER_LIBRARY} ) +# ELSE ( LIBLBER_FOUND) +# SET ( _LDAP_LIBRARIES ${LDAP_LIBRARY} ) +# ENDIF ( LIBLBER_FOUND) ELSE ( LIBLDAP_FOUND ) IF ( LIBMOZLDAP_FOUND ) - SET ( USE_MOZLDAP 1 ) + +# IF ( LIBMOZLDAP_LIBRARIES ) +# SET ( _LDAP_LIBRARIES ${LIBMOZLDAP_LIBRARIES} ) +# +# ELSE ( LIBMOZLDAP_LIBRARIES ) +# IF ( MOZLDAP_LIBRARY ) +# SET ( _LDAP_LIBRARIES ${MOZLDAP_LIBRARY} ) +# ELSE ( MOZLDAP_LIBRARY ) +# MESSAGE( FATAL_ERROR " Neither LIBMOZLDAP_LIBRARIES nor MOZLDAP_LIBRARY has been defined." ) +# ENDIF ( MOZLDAP_LIBRARY ) +# +# ENDIF ( LIBMOZLDAP_LIBRARIES ) + + ELSE ( LIBMOZLDAP_FOUND ) + MESSAGE( FATAL_ERROR " Neither libldap from openldap nor libldap60 from Mozilla could be found. The ldap-sync plugin requires one of these." ) ENDIF ( LIBMOZLDAP_FOUND ) ENDIF ( LIBLDAP_FOUND ) + + +################### + + +FIND_PACKAGE( LibSASL2 ) +FIND_PACKAGE( LibGSSAPIV2 ) +FIND_PACKAGE( Check ) +IF ( NOT CHECK_FOUND ) + MESSAGE( STATUS " Could NOT find the check library: \"check\" or \"libcheck\": http://check.sourceforge.net/ . The test suite can NOT be built, therefore.") +ENDIF ( NOT CHECK_FOUND ) + + + + ############### Doxygen ############################ MESSAGE(STATUS "checking for doxygen...") FIND_PROGRAM( DOXYGEN_EXECUTABLE doxygen ) @@ -201,10 +398,12 @@ MESSAGE(STATUS "LDAP_PLUGIN_OPENSYNC_SCHEMASDIR = ${LDAP_PLUGIN_OPENSYNC_SCHEMASDIR}") IF ( USE_OPENLDAP ) - MESSAGE (STATUS "libldap from openldap is to be used.") + MESSAGE (STATUS "libldap from openldap will be used.") ELSE ( USE_OPENLDAP ) IF ( USE_MOZLDAP ) - MESSAGE (STATUS "libldap60 from Mozilla is to be used.") + MESSAGE (STATUS "libldap60 from Mozilla will be used.") + ELSE ( USE_MOZLDAP ) + MESSAGE (FATAL_ERROR "Neither libldap from openldap nor libldap60 from Mozilla has been chosen. This is not possible. The LDAP plugin requires either of these libraries.") ENDIF ( USE_MOZLDAP ) ENDIF ( USE_OPENLDAP ) Modified: plugins/ldap-sync/INSTALL ============================================================================== --- plugins/ldap-sync/INSTALL Wed Jan 6 21:53:17 2010 (r5978) +++ plugins/ldap-sync/INSTALL Wed Jan 6 21:53:30 2010 (r5979) @@ -13,6 +13,19 @@ ldconfig +By default, the LDAP plugin is linked against libldap from openldap +( http://www.openldap.org/ ). However, the user can choose to link +the LDAP plugin against libldap60 from the Mozilla LDAP C SDK +( http://www.mozilla.org/directory/csdk.html ) by + + -DUSE_MOZLDAP=on + +Likewise, -DUSE_OPENLDAP=on will link it against libldap from openldap. + + + + + B. Debug build: tar -xvjf libopensync-plugin-ldap-0.40.tar.bz2 Modified: plugins/ldap-sync/src/CMakeLists.txt ============================================================================== --- plugins/ldap-sync/src/CMakeLists.txt Wed Jan 6 21:53:17 2010 (r5978) +++ plugins/ldap-sync/src/CMakeLists.txt Wed Jan 6 21:53:30 2010 (r5979) @@ -22,90 +22,6 @@ # - -# Determine _LDAP_INCLUDE_DIRS -IF ( LIBLDAP_FOUND ) - # libldap and liblber from openldap - IF ( LIBLBER_FOUND ) - SET ( _LDAP_INCLUDE_DIRS ${LDAP_INCLUDE_DIR} ${LBER_INCLUDE_DIR} ) - ELSE ( LIBLBER_FOUND ) - SET ( _LDAP_INCLUDE_DIRS ${LDAP_INCLUDE_DIR} ) - ENDIF ( LIBLBER_FOUND ) - -ELSE ( LIBLDAP_FOUND ) - IF ( LIBMOZLDAP_FOUND ) - #libldap60 from Mozilla - IF ( MOZLDAP_INCLUDE_DIR ) - SET ( _LDAP_INCLUDE_DIRS ${MOZLDAP_INCLUDE_DIR} ) - - ELSE ( MOZLDAP_INCLUDE_DIR ) - IF ( LIBMOZLDAP_INCLUDEDIR ) - SET ( _LDAP_INCLUDE_DIRS ${LIBMOZLDAP_INCLUDEDIR}) - ENDIF ( LIBMOZLDAP_INCLUDEDIR ) - ENDIF ( MOZLDAP_INCLUDE_DIR ) - - ELSE ( LIBMOZLDAP_FOUND ) - MESSAGE( FATAL_ERROR " Neither libldap from openldap nor libldap60 from Mozilla could be found. The ldap-sync plugin requires one of these libraries including the header files, as can be found in \"development packages\" or \"SDK's\"." ) - ENDIF ( LIBMOZLDAP_FOUND ) -ENDIF ( LIBLDAP_FOUND ) - - - - -# Determine _LDAP_LIBRARY_DIRS -IF ( LIBLDAP_FOUND ) - IF ( LIBLBER_FOUND ) - SET ( _LDAP_LIBRARY_DIRS ${LDAP_LIBRARY_DIRS} ${LBER_LIBRARY_DIRS} ) - ELSE ( LIBLBER_FOUND ) - SET ( _LDAP_LIBRARY_DIRS ${LDAP_LIBRARY_DIRS} ) - ENDIF ( LIBLBER_FOUND ) -ELSE ( LIBLDAP_FOUND ) - IF ( LIBMOZLDAP_FOUND ) - IF ( LIBMOZLDAP_LIBDIR ) - SET ( _LDAP_LIBRARY_DIRS ${LIBMOZLDAP_LIBDIR} ) - ENDIF ( LIBMOZLDAP_LIBDIR ) - ELSE ( LIBMOZLDAP_FOUND ) - MESSAGE( FATAL_ERROR " Neither libldap from openldap nor libldap60 from Mozilla could be found. The ldap-sync plugin requires one of these." ) - ENDIF ( LIBMOZLDAP_FOUND ) -ENDIF ( LIBLDAP_FOUND ) - - - - -# Determine _LDAP_LIBRARIES -IF ( LIBLDAP_FOUND ) - IF ( LIBLBER_FOUND) - SET ( _LDAP_LIBRARIES ${LDAP_LIBRARY} ${LBER_LIBRARY} ) - ELSE ( LIBLBER_FOUND) - SET ( _LDAP_LIBRARIES ${LDAP_LIBRARY} ) - ENDIF ( LIBLBER_FOUND) -ELSE ( LIBLDAP_FOUND ) - IF ( LIBMOZLDAP_FOUND ) - - IF ( LIBMOZLDAP_LIBRARIES ) - SET ( _LDAP_LIBRARIES ${LIBMOZLDAP_LIBRARIES} ) - - ELSE ( LIBMOZLDAP_LIBRARIES ) - IF ( MOZLDAP_LIBRARY ) - SET ( _LDAP_LIBRARIES ${MOZLDAP_LIBRARY} ) - ELSE ( MOZLDAP_LIBRARY ) - MESSAGE( FATAL_ERROR " Neither LIBMOZLDAP_LIBRARIES nor MOZLDAP_LIBRARY has been defined." ) - ENDIF ( MOZLDAP_LIBRARY ) - - ENDIF ( LIBMOZLDAP_LIBRARIES ) - - ELSE ( LIBMOZLDAP_FOUND ) - MESSAGE( FATAL_ERROR " Neither libldap from openldap nor libldap60 from Mozilla could be found. The ldap-sync plugin requires one of these." ) - ENDIF ( LIBMOZLDAP_FOUND ) -ENDIF ( LIBLDAP_FOUND ) - - - - - - - - # Safety checks IF ( NOT _LDAP_INCLUDE_DIRS ) MESSAGE( FATAL_ERROR " _LDAP_INCLUDE_DIRS could not be determined. The ldap-sync plugin requires the header files of an LDAP client library, either from openldap or from Mozilla." ) Modified: plugins/ldap-sync/src/ldap_plugin.h ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.h Wed Jan 6 21:53:17 2010 (r5978) +++ plugins/ldap-sync/src/ldap_plugin.h Wed Jan 6 21:53:30 2010 (r5979) @@ -39,11 +39,16 @@ #include <ctype.h> #include <glib.h> -#ifdef LIBLDAP_FOUND -#include <lber.h> -#include <ldap.h> -#else -# ifdef LIBMOZLDAP_FOUND + + +#ifdef USE_OPENLDAP + +# include <lber.h> +# include <ldap.h> + +#else // ifdef USE_OPENLDAP + +# ifdef USE_MOZLDAP # ifdef MOZLDAP_INCLUDE_DIR # include <mozldap/ldap.h> # include <mozldap/ldap_ssl.h> @@ -55,8 +60,31 @@ # include <../mozldap/ldap_ssl.h> # endif # endif -# endif -#endif + +# else // ifdef USE_MOZLDAP + +# ifdef LIBLDAP_FOUND +# include <lber.h> +# include <ldap.h> +# else +# ifdef LIBMOZLDAP_FOUND +# ifdef MOZLDAP_INCLUDE_DIR +# include <mozldap/ldap.h> +# include <mozldap/ldap_ssl.h> +# else +# ifdef LIBMOZLDAP_INCLUDEDIR +// I want to make sure that it is really the "mozldap/ldap.h" that +// is to be included. And NOT some /usr/include/ldap.h. +# include <../mozldap/ldap.h> +# include <../mozldap/ldap_ssl.h> +# endif +# endif +# endif +# endif + +# endif // ifdef USE_MOZLDAP +#endif // ifdef USE_OPENLDAP + #include <libxml/parser.h> |