cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Compilation error from `urldata.h'

From: Albert Chin <curl-users_at_lists.thewrittenword.com>
Date: Thu, 3 Oct 2002 09:02:23 -0500

On Thu, Oct 03, 2002 at 03:00:36PM +0200, Daniel Stenberg wrote:
> On Wed, 2 Oct 2002, Bjorn Wiren wrote:
> > Furthermore, configure is unable to pick up a non-standard include path to
> > zlib through the --with-zlib option - the bogus "-I/include" in the
> > compilation command above is probably a result from that.
>
> Ah, and that's why it doesn't fine the zlib.h file then. Hm, that's pretty
> crappy. This zlib stuff is a rather new addition to the curl code.
>
> I've modified the configure.in script since the 7.10 release though and I
> believe it might work better now. Any chance you can grab the latest one and
> have a go in your end to test this? It requires autoconf 2.50 or later.

I like the following better. Tested with --with-zlib=[path],
--with-zlib, and --with-zlib=no. I changed --with-libz to --with-zlib
because you mention zlib in the description so it keeps the name
consistent. I have *not* added the /usr/local hack to add
/usr/local/include and /usr/local/lib to CPPFLAGS/LDFLAGS
respectively. This shouldn't be hard if you still want to do it or
force people to --with-zlib=/usr/local.

-- 
albert chin (china_at_thewrittenword.com)
-- snip snip
--- configure.in.orig	Thu Oct  3 08:31:42 2002
+++ configure.in	Thu Oct  3 09:00:50 2002
@@ -1,4 +1,4 @@
-dnl $Id: configure.in,v 1.106 2002/09/02 22:45:46 bagder Exp $
+dnl $Id: configure.in,v 1.107 2002/10/01 11:16:36 bagder Exp $
 dnl Process this file with autoconf to produce a configure script.
 
 dnl Ensure that this file is processed with autoconf 2.50 or newer
@@ -405,10 +405,9 @@
 dnl Default to compiler & linker defaults for SSL files & libraries.
 OPT_SSL=off
 AC_ARG_WITH(ssl,dnl
-[  --with-ssl[=DIR]        where to look for SSL [compiler/linker default paths]
-                          DIR points to the SSL installation [/usr/local/ssl]],
-  OPT_SSL=$withval
-)
+AC_HELP_STRING([--with-ssl=PATH], [where to look for SSL, PATH points to the SSL installation (default: /usr/local/ssl)])
+AC_HELP_STRING([--without-ssl], [disable SSL]),
+  OPT_SSL=$withval)
 
 if test X"$OPT_SSL" = Xno
 then
@@ -508,37 +507,34 @@
 dnl Check for the presence of ZLIB libraries and headers
 dnl **********************************************************************
 
-dnl Default to compiler & linker defaults for files & libraries.
-dnl OPT_ZLIB=no
-dnl AC_ARG_WITH(zlib,dnl
-dnl [  --with-zlib[=DIR]  where to look for ZLIB [compiler/linker default paths]
-dnl                      DIR points to the ZLIB installation prefix [/usr/local]],
-dnl  OPT_ZLIB=$withval,
-dnl )
-
 dnl Check for & handle argument to --with-zlib.
-dnl
-dnl NOTE:  We *always* look for ZLIB headers & libraries, all this option
-dnl        does is change where we look (by adjusting LIBS and CPPFLAGS.)
-dnl
 
-AC_MSG_CHECKING(where to look for ZLIB)
-if test X"$OPT_ZLIB" = Xno
-then
-	AC_MSG_RESULT([defaults (or given in environment)])
-else
-	test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
-	LIBS="$LIBS -L$OPT_ZLIB/lib"
-	CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
-	AC_MSG_RESULT([$OPT_ZLIB])
-fi
+_cppflags=$CPPFLAGS
+_ldflags=$LDFLAGS
 
-dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
-AC_CHECK_LIB(z, gzread, [AM_CONDITIONAL(CONTENT_ENCODING, true) 
-		         AC_DEFINE(HAVE_LIBZ)
-			 LIBS="$LIBS -lz"
-                         HAVE_LIBZ="1"
-                         AC_SUBST(HAVE_LIBZ)])
+AC_ARG_WITH(zlib,[
+AC_HELP_STRING([--with-zlib=PATH], [search for zlib in PATH])
+AC_HELP_STRING([--without-zlib], [disable use of zlib])],[
+  case "$withval" in
+  no)
+    AC_MSG_WARN([zlib disabled]) ;;
+  *)
+    if test -d "$withval"; then
+      CPPFLAGS="$CPPFLAGS -I$withval/include"
+      LDFLAGS="$LDFLAGS -L$withval/lib"
+    fi
+
+    AC_CHECK_HEADER(zlib.h,[
+      AC_CHECK_LIB(z, gzread,[
+        AM_CONDITIONAL(CONTENT_ENCODING, true)
+        AC_DEFINE(HAVE_LIBZ, 1, [If zlib is available])],[
+        CPPFLAGS=$_cppflags
+        LDFLAGS=$_ldflags]),
+      CPPFLAGS=$_cppflags
+      LDFLAGS=$_ldflags])
+    ;;
+esac
+])
 
 dnl Default is to try the thread-safe versions of a few functions
 OPT_THREAD=on
@@ -608,9 +604,6 @@
         setjmp.h
 )
 
-dnl Check for libz header
-AC_CHECK_HEADERS(zlib.h)
-
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
 AC_TYPE_SIZE_T
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-10-03