[PATCH]: Fix configure.ac to allow linking against PCRE on Cygwin
Corinna Vinschen
vinschen at redhat.com
Tue Nov 27 01:28:53 EST 2001
On Sat, Nov 24, 2001 at 01:07:46PM +0100, Corinna Vinschen wrote:
> On Fri, Nov 23, 2001 at 06:24:38PM -0800, Tim Rice wrote:
> > Yes, The more I think about it the more I don't like my fix.
> > Corinna, can you track down where ssh is failing with the libc regex
> > and write a small test program to test this?
>
> Testing for regfree() or regex.h would be sufficient. The old V8
> implementation doesn't have regfree() and the header is regexp.h.
Aaargh! Somebody added a regfree stub into Cygwin back in 1997 and
now we're stuck with that way. We could remove it from current Cygwin
sources but that wouldn't help for older Cygwin versions, apparently.
However, I think the following solution would help. It tests for
regcomp() first and if regcomp() is available, it tests additionally
for regsub() which is not defined in POSIX regex but in V8 regex.
If regsub() is available, it assumes that the libc version is not
usable and doesn't define HAVE_REGCOMP.
Then, if HAVE_REGCOMP isn't defined, it checks for regcomp() in
libregex and if that's also not available it eventually checks
for libpcre.
Is that ok?
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/26 14:28:42
@@ -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)
@@ -401,18 +401,43 @@ AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([
# We don't want to check if we did an pcre override.
if test -z "$no_comp_check" ; then
AC_CHECK_FUNC(regcomp,
- [ AC_DEFINE(HAVE_REGCOMP)],
[
- AC_CHECK_LIB(pcre, pcre_info,
+ AC_CHECK_FUNC(regsub,
+ [
+ has_regcomp=no
+ ],
+ [
+ AC_DEFINE(HAVE_REGCOMP)
+ has_regcomp=yes
+ ]
+ )
+ ],
+ [
+ has_regcomp=no
+ ]
+ )
+ # Either regcomp wasn't defined or regsub is defined (which means
+ # that the libc regex is probably an old non-POSIX implementation.
+ # Now check for -lregex and -lpcreposix to find some usable regex
+ # implementation.
+ if test "$has_regcomp" = "no" ; then
+ AC_CHECK_LIB(regex, regcomp,
[
- AC_DEFINE(HAVE_LIBPCRE)
- LIBS="$LIBS -lpcreposix -lpcre"
+ AC_DEFINE(HAVE_REGCOMP)
+ LIBS="$LIBS -lregex"
],
[
- AC_MSG_ERROR([*** No regex library found.])
- ])
- ]
- )
+ AC_CHECK_LIB(pcre, pcre_info,
+ [
+ AC_DEFINE(HAVE_LIBPCRE)
+ LIBS="$LIBS -lpcreposix -lpcre"
+ ],
+ [
+ AC_MSG_ERROR([*** No regex library found.])
+ ])
+ ]
+ )
+ fi
fi
dnl UnixWare 2.x
--
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen at redhat.com
More information about the openssh-unix-dev
mailing list