Re: [evolution-patches] EVO_LDAP_CHECK patches again



OK. Here are the updated patches. I forgot to change ENABLE back to WITH
for the first one. Doh. I removed the AC_CACHE_CHECK and copied the evo
acinclude.m4 to connector before the diff, so it is larger this time, as
it adds in a couple of missing functions.

-- dobey

On Fri, 2004-08-13 at 10:50 -0400, Dan Winship wrote:
> > -       AC_ARG_WITH(openldap,     [  --with-openldap=[no/yes/PREFIX]      Enable LDAP support in evolution])
> > +       AC_ARG_ENABLE(openldap,     [  --enable-openldap=[no/yes/PREFIX]      Enable LDAP support in evolution], with_openldap_prefix="$withval", with_openldap_prefix="/usr")
> 
> This shouldn't be changed. The autoconf docs say to use --with-foo for
> an optional package, and --enable-foo for an optional feature.
> (If you insist on changing it anyway, you need to change $withval to
> $enableval.)
> 
> >         AC_CACHE_CHECK([for OpenLDAP], ac_cv_with_openldap, ac_cv_with_openldap="${with_openldap:=$default}")
> 
> This should go away. (It's not really doing much any more anyway.)
> AC_CACHE_CHECK can only remember one value, and we need three now.
> ($with_openldap, $with_openldap_includes, $with_openldap_libs)
> 
> 
> Also, the idea was that evo, e-d-s, and evolution-exchange should have
> identical acinclude.m4's. It looks like you copied a bugfix from e-d-s
> to evo-exchange, so that's good. If there are any other differences,
> they should be merged too.
> 
> -- Dan

Index: acinclude.m4
===================================================================
RCS file: /cvs/gnome/evolution-exchange/acinclude.m4,v
retrieving revision 1.2
diff -u -r1.2 acinclude.m4
--- acinclude.m4	3 Jun 2004 19:15:55 -0000	1.2
+++ acinclude.m4	13 Aug 2004 14:57:42 -0000
@@ -1,6 +1,61 @@
 # evolution/acinclude.m4
 # shared configure.in hacks between Evolution and Connector
 
+# EVO_CHECK_LIB(dispname, pkgname, minvers[, maxvers])
+# Checks if the package with human-readable name @dispname, known
+# to gnome-config as @pkgname exists and has an appropriate version.
+# The version must be >= @minvers. If @maxvers is equal to @minvers,
+# it must be exactly that version. Otherwise, if @maxvers is set,
+# the version must be LESS THAN @maxvers (not less than or equal).
+AC_DEFUN(EVO_CHECK_LIB, [
+	dispname="$1"
+	pkgname="$2"
+	minvers="$3"
+	maxvers="$4"
+
+	AC_MSG_CHECKING(for $dispname)
+
+	if gnome-config --libs $pkgname > /dev/null 2>&1; then
+		pkgvers=`gnome-config --modversion $pkgname | sed -e 's/^[[^0-9]]*//'`
+	else
+		pkgvers=not
+	fi
+	AC_MSG_RESULT($pkgvers found)
+
+	pkgvers=`echo $pkgvers | awk -F. '{ print $[]1 * 1000000 + $[]2 * 10000 + $[]3 * 100 + $[]4;}'`
+	cmpminvers=`echo $minvers | awk -F. '{ print $[]1 * 1000000 + $[]2 * 10000 + $[]3 * 100 + $[]4;}'`
+	cmpmaxvers=`echo $maxvers | awk -F. '{ print $[]1 * 1000000 + $[]2 * 10000 + $[]3 * 100 + $[]4;}'`
+	ok=yes
+	if test "$pkgvers" -lt $cmpminvers; then
+		ok=no
+	elif test -n "$maxvers"; then
+		if test "$pkgvers" -gt $cmpmaxvers; then
+			ok=no
+		elif test "$maxvers" != "$minvers" -a "$cmpmaxvers" -eq "$pkgvers"; then
+			ok=no
+		fi
+	fi
+	if test $ok = no; then
+		case $maxvers in
+		"")
+			dispvers="$minvers or higher"
+			;;
+		$minvers)
+			dispvers="$minvers (exactly)"
+			;;
+		*)
+			dispvers="$minvers or higher, but less than $maxvers,"
+			;;
+		esac
+
+		AC_MSG_ERROR([
+""
+"You need $dispname $dispvers to build $PACKAGE"
+"If you think you already have this installed, consult the README."])
+	fi
+])
+
+
 # EVO_PURIFY_SUPPORT
 # Add --enable-purify. If the user turns it on, subst PURIFY and set
 # the automake conditional ENABLE_PURIFY
@@ -30,33 +85,20 @@
 AC_DEFUN(EVO_LDAP_CHECK, [
 	default="$1"
 
-	AC_ARG_WITH(openldap,     [  --with-openldap=[no/yes/PREFIX]      Enable LDAP support in evolution])
+	AC_ARG_WITH(openldap,     [  --enable-openldap=[no/yes/PREFIX]      Enable LDAP support in evolution], with_openldap="$withval", with_openldap="/usr")
+	AC_ARG_WITH(openldap-libs,[  --with-openldap-libs=DIR             Location of openldap libraries to link with], with_openldap_libs="$withval", with_openldap_libs="$with_openldap/lib")
+	AC_ARG_WITH(openldap-includes,[  --with-openldap-includes=DIR         Location of openldap libraries to link with], with_openldap_includes="$withval", with_openldap_includes="$with_openldap/include")
 	AC_ARG_WITH(static-ldap,  [  --with-static-ldap=[no/yes]          Link LDAP support statically into evolution ])
-	AC_CACHE_CHECK([for OpenLDAP], ac_cv_with_openldap, ac_cv_with_openldap="${with_openldap:=$default}")
-	case $ac_cv_with_openldap in
-	no|"")
-		with_openldap=no
-		;;
-	yes)
-		with_openldap=/usr
-		;;
-	*)
-		with_openldap=$ac_cv_with_openldap
-		LDAP_CFLAGS="-I$ac_cv_with_openldap/include"
-		LDAP_LDFLAGS="-L$ac_cv_with_openldap/lib"
-		;;
-	esac
+
+	LDAP_CFLAGS="-I$with_openldap_includes"
+	LDAP_LDFLAGS="-L$with_openldap_libs"
 
 	if test "$with_openldap" != no; then
-		AC_DEFINE(HAVE_LDAP, 1, [Define if you have OpenLDAP])
+		AC_DEFINE(HAVE_LDAP,1,[Define if you have LDAP support])
 
 		case $with_static_ldap in
 		no|"")
-			if test -f $with_openldap/lib/libldap.la; then
-				with_static_ldap=no
-			else
-				with_static_ldap=yes
-			fi
+			with_static_ldap=no
 			;;
 		*)
 			with_static_ldap=yes
@@ -83,13 +125,20 @@
 		AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
 		AC_CHECK_LIB(lber, ber_get_tag, [
 			if test "$with_static_ldap" = "yes"; then
-				LDAP_LIBS="$with_openldap/lib/liblber.a $LDAP_LIBS"
+				LDAP_LIBS="$with_openldap_libs/liblber.a $LDAP_LIBS"
+
+				# libldap might depend on OpenSSL... We need to pull
+				# in the dependency libs explicitly here since we're
+				# not using libtool for the configure test.
+				if test -f $with_openldap_libs/libldap.la; then
+					LDAP_LIBS="`. $with_openldap_libs/libldap.la; echo $dependency_libs` $LDAP_LIBS"
+				fi
 			else
 				LDAP_LIBS="-llber $LDAP_LIBS"
 			fi
 			AC_CHECK_LIB(ldap, ldap_open, [
 					if test $with_static_ldap = "yes"; then
-						LDAP_LIBS="$with_openldap/lib/libldap.a $LDAP_LIBS"
+						LDAP_LIBS="$with_openldap_libs/libldap.a $LDAP_LIBS"
 					else
 						LDAP_LIBS="-lldap $LDAP_LIBS"
 					fi],
@@ -103,7 +152,23 @@
 
 		AC_SUBST(LDAP_CFLAGS)
 		AC_SUBST(LDAP_LIBS)
-		AC_SUBST(LDAP_LDFLAGS)
 	fi
 	AM_CONDITIONAL(ENABLE_LDAP, test $with_openldap != no)
-])
\ No newline at end of file
+])
+
+
+# EVO_PTHREAD_CHECK
+AC_DEFUN([EVO_PTHREAD_CHECK],[
+	PTHREAD_LIB=""
+	AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
+		[AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
+		    [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
+			[AC_CHECK_LIB(pthread, __pthread_attr_init_system, PTHREAD_LIB="-lpthread",
+				[AC_CHECK_FUNC(pthread_create)]
+			)]
+		    )]
+		)]
+	)
+	AC_SUBST(PTHREAD_LIB)
+	AC_PROVIDE([EVO_PTHREAD_CHECK])
+])
Index: acinclude.m4
===================================================================
RCS file: /cvs/gnome/evolution-data-server/acinclude.m4,v
retrieving revision 1.3
diff -u -r1.3 acinclude.m4
--- acinclude.m4	21 Apr 2004 19:19:01 -0000	1.3
+++ acinclude.m4	13 Aug 2004 14:58:50 -0000
@@ -85,22 +85,13 @@
 AC_DEFUN([EVO_LDAP_CHECK], [
 	default="$1"
 
-	AC_ARG_WITH(openldap,     [  --with-openldap=[no/yes/PREFIX]      Enable LDAP support in evolution])
+	AC_ARG_WITH(openldap,     [  --enable-openldap=[no/yes/PREFIX]      Enable LDAP support in evolution], with_openldap="$withval", with_openldap="/usr")
+	AC_ARG_WITH(openldap-libs,[  --with-openldap-libs=DIR             Location of openldap libraries to link with], with_openldap_libs="$withval", with_openldap_libs="$with_openldap/lib")
+	AC_ARG_WITH(openldap-includes,[  --with-openldap-includes=DIR         Location of openldap libraries to link with], with_openldap_includes="$withval", with_openldap_includes="$with_openldap/include")
 	AC_ARG_WITH(static-ldap,  [  --with-static-ldap=[no/yes]          Link LDAP support statically into evolution ])
-	AC_CACHE_CHECK([for OpenLDAP], ac_cv_with_openldap, ac_cv_with_openldap="${with_openldap:=$default}")
-	case $ac_cv_with_openldap in
-	no|"")
-		with_openldap=no
-		;;
-	yes)
-		with_openldap=/usr
-		;;
-	*)
-		with_openldap=$ac_cv_with_openldap
-		LDAP_CFLAGS="-I$ac_cv_with_openldap/include"
-		LDAP_LDFLAGS="-L$ac_cv_with_openldap/lib"
-		;;
-	esac
+
+	LDAP_CFLAGS="-I$with_openldap_includes"
+	LDAP_LDFLAGS="-L$with_openldap_libs"
 
 	if test "$with_openldap" != no; then
 		AC_DEFINE(HAVE_LDAP,1,[Define if you have LDAP support])
@@ -134,20 +125,20 @@
 		AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
 		AC_CHECK_LIB(lber, ber_get_tag, [
 			if test "$with_static_ldap" = "yes"; then
-				LDAP_LIBS="$with_openldap/lib/liblber.a $LDAP_LIBS"
+				LDAP_LIBS="$with_openldap_libs/liblber.a $LDAP_LIBS"
 
 				# libldap might depend on OpenSSL... We need to pull
 				# in the dependency libs explicitly here since we're
 				# not using libtool for the configure test.
-				if test -f $with_openldap/lib/libldap.la; then
-					LDAP_LIBS="`. $with_openldap/lib/libldap.la; echo $dependency_libs` $LDAP_LIBS"
+				if test -f $with_openldap_libs/libldap.la; then
+					LDAP_LIBS="`. $with_openldap_libs/libldap.la; echo $dependency_libs` $LDAP_LIBS"
 				fi
 			else
 				LDAP_LIBS="-llber $LDAP_LIBS"
 			fi
 			AC_CHECK_LIB(ldap, ldap_open, [
 					if test $with_static_ldap = "yes"; then
-						LDAP_LIBS="$with_openldap/lib/libldap.a $LDAP_LIBS"
+						LDAP_LIBS="$with_openldap_libs/libldap.a $LDAP_LIBS"
 					else
 						LDAP_LIBS="-lldap $LDAP_LIBS"
 					fi],
@@ -164,6 +155,7 @@
 	fi
 	AM_CONDITIONAL(ENABLE_LDAP, test $with_openldap != no)
 ])
+
 
 # EVO_PTHREAD_CHECK
 AC_DEFUN([EVO_PTHREAD_CHECK],[
Index: acinclude.m4
===================================================================
RCS file: /cvs/gnome/evolution/acinclude.m4,v
retrieving revision 1.6
diff -u -r1.6 acinclude.m4
--- acinclude.m4	4 Apr 2003 20:33:19 -0000	1.6
+++ acinclude.m4	13 Aug 2004 14:58:03 -0000
@@ -85,22 +85,13 @@
 AC_DEFUN(EVO_LDAP_CHECK, [
 	default="$1"
 
-	AC_ARG_WITH(openldap,     [  --with-openldap=[no/yes/PREFIX]      Enable LDAP support in evolution])
+	AC_ARG_WITH(openldap,     [  --enable-openldap=[no/yes/PREFIX]      Enable LDAP support in evolution], with_openldap="$withval", with_openldap="/usr")
+	AC_ARG_WITH(openldap-libs,[  --with-openldap-libs=DIR             Location of openldap libraries to link with], with_openldap_libs="$withval", with_openldap_libs="$with_openldap/lib")
+	AC_ARG_WITH(openldap-includes,[  --with-openldap-includes=DIR         Location of openldap libraries to link with], with_openldap_includes="$withval", with_openldap_includes="$with_openldap/include")
 	AC_ARG_WITH(static-ldap,  [  --with-static-ldap=[no/yes]          Link LDAP support statically into evolution ])
-	AC_CACHE_CHECK([for OpenLDAP], ac_cv_with_openldap, ac_cv_with_openldap="${with_openldap:=$default}")
-	case $ac_cv_with_openldap in
-	no|"")
-		with_openldap=no
-		;;
-	yes)
-		with_openldap=/usr
-		;;
-	*)
-		with_openldap=$ac_cv_with_openldap
-		LDAP_CFLAGS="-I$ac_cv_with_openldap/include"
-		LDAP_LDFLAGS="-L$ac_cv_with_openldap/lib"
-		;;
-	esac
+
+	LDAP_CFLAGS="-I$with_openldap_includes"
+	LDAP_LDFLAGS="-L$with_openldap_libs"
 
 	if test "$with_openldap" != no; then
 		AC_DEFINE(HAVE_LDAP,1,[Define if you have LDAP support])
@@ -134,20 +125,20 @@
 		AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
 		AC_CHECK_LIB(lber, ber_get_tag, [
 			if test "$with_static_ldap" = "yes"; then
-				LDAP_LIBS="$with_openldap/lib/liblber.a $LDAP_LIBS"
+				LDAP_LIBS="$with_openldap_libs/liblber.a $LDAP_LIBS"
 
 				# libldap might depend on OpenSSL... We need to pull
 				# in the dependency libs explicitly here since we're
 				# not using libtool for the configure test.
-				if test -f $with_openldap/lib/libldap.la; then
-					LDAP_LIBS="`. $with_openldap/lib/libldap.la; echo $dependency_libs` $LDAP_LIBS"
+				if test -f $with_openldap_libs/libldap.la; then
+					LDAP_LIBS="`. $with_openldap_libs/libldap.la; echo $dependency_libs` $LDAP_LIBS"
 				fi
 			else
 				LDAP_LIBS="-llber $LDAP_LIBS"
 			fi
 			AC_CHECK_LIB(ldap, ldap_open, [
 					if test $with_static_ldap = "yes"; then
-						LDAP_LIBS="$with_openldap/lib/libldap.a $LDAP_LIBS"
+						LDAP_LIBS="$with_openldap_libs/libldap.a $LDAP_LIBS"
 					else
 						LDAP_LIBS="-lldap $LDAP_LIBS"
 					fi],
@@ -164,6 +155,7 @@
 	fi
 	AM_CONDITIONAL(ENABLE_LDAP, test $with_openldap != no)
 ])
+
 
 # EVO_PTHREAD_CHECK
 AC_DEFUN([EVO_PTHREAD_CHECK],[


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]