[PATCH]: Fix configure.ac to allow linking against PCRE on Cygwin

Corinna Vinschen vinschen at redhat.com
Thu Nov 22 23:06:37 EST 2001


Hi,

the current configure.ac file contains an unfortunately static
setting of $LIBS when the host system is Cygwin.  It always
adds -lregex to $LIBS before the --with-pcre setting is evaluated.
The later adding of -lpcreposix -lpcre doesn't work correctly
since it follows later in the link order.

The following patch changes that.  The static $LIBS setting in the
Cygwin case doesn't include -lregex.  Instead it checks the setting
of --with-pcre afterwards and adds -lregex only if -lpcreposix isn't
already contained in $LIBS.

Corinna

Index: configure.ac
===================================================================
RCS file: /cvs/openssh_cvs/configure.ac,v
retrieving revision 1.4
diff -u -p -r1.4 configure.ac
--- configure.ac	2001/11/03 19:09:33	1.4
+++ configure.ac	2001/11/22 11:57:34
@@ -65,7 +65,7 @@ case "$host" in
 	AC_DEFINE(DISABLE_LASTLOG)
 	;;
 *-*-cygwin*)
-	LIBS="$LIBS -lregex /usr/lib/textmode.o"
+	LIBS="$LIBS /usr/lib/textmode.o"
 	AC_DEFINE(HAVE_CYGWIN)
 	AC_DEFINE(USE_PIPES)
 	AC_DEFINE(DISABLE_SHADOW)
@@ -367,6 +367,17 @@ if test "x$with_tcp_wrappers" != "xno" ;
 	AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
     fi
 fi
+
+case "$host" in
+*-*-cygwin*)
+	# Check if linking agains pcre is requested, otherwise use
+	# regex lib on Cygwin
+	echo "$LIBS" | grep "pcreposix" > /dev/null 2>&1
+	if test $? -ne 0  ; then
+		LIBS="$LIBS -lregex "
+	fi
+	;;
+esac
 
 AC_CHECK_FUNC(getspnam, ,
 	AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen at redhat.com



More information about the openssh-unix-dev mailing list