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

patch to build discover without curl



hi eric

If have done some work on discover to make it build without curl. Most
of the code was already there from jeff. See the attached patch!

If added some autoconf stuff for a "--without-curl" option. I have never
used autoconf before. So please feel free to tell me if I have got
something wrong. (Could someone on debian-boot with some knowledge of
autoconf look at this and comment if its good or bad)

I also enable "--without-curl" in debian/rules.

Could you please send us an update on your efforts to make discover
ready for debian-installer. Can we access the latest version somewhere?
CVS?

I also sent a patch for the data reduction to jeff. Just in case you did
not see it:
http://lists.debian.org/debian-boot/2003/debian-boot-200310/msg00042.html

Greetings

gaudenz
diff -ru discover-2.0.2/configure.ac discover-2.0.2.new/configure.ac
--- discover-2.0.2/configure.ac	2003-02-07 17:44:15.000000000 +0100
+++ discover-2.0.2.new/configure.ac	2003-10-13 23:10:08.000000000 +0200
@@ -1,4 +1,4 @@
-# Copyright 2002 Hewlett-Packard Company
+bg# Copyright 2002 Hewlett-Packard Company
 # Copyright 2002 Progeny Linux Systems, Inc.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
@@ -91,6 +91,16 @@
 fi
 )
 
+AC_ARG_WITH([curl],
+            AC_HELP_STRING([--with-curl],
+                           [use curl for hardware data retrieving (default is YES)]),
+            [if test "x$withval" = "xyes" ; then 
+                 USE_CURL=1 
+             else 
+                 USE_CURL=0 
+             fi],
+            [USE_CURL=1])
+
 ###############################################################################
 # Checks for programs
 
@@ -105,10 +115,13 @@
 AC_PROG_LIBTOOL()
 
 AC_PATH_PROG(DOXYGEN, doxygen, false)
-AC_PATH_TOOL(CURL_CONFIG, curl-config, false)
 
-if test "${CURL_CONFIG}" = "false"; then
-    AC_MSG_ERROR([Can't find curl-config program.])
+if test "${USE_CURL}" = "1"; then
+    AC_PATH_TOOL(CURL_CONFIG, curl-config, false)
+
+    if test "${CURL_CONFIG}" = "false"; then
+        AC_MSG_ERROR([Can't find curl-config program.])
+    fi
 fi
 
 ###############################################################################
@@ -125,32 +138,34 @@
 # Unfortunately, curl-config --libs returns both LDFLAGS and LIBS
 # and it would be difficult to separate them.  Just dump it all into
 # LIBS.
-AC_MSG_CHECKING([for curl libs])
-curl_libs=`${CURL_CONFIG} --libs`
-if test $? -ne 0; then
-    AC_MSG_ERROR([curl-config --libs failed.])
-fi
-
-# More curl workarounds.  Adding the system include path with -I and/or
-# system library path with -L causes problems on some systems.
-curl_libs=`echo ${curl_libs} | sed -e 's|-L/usr/lib||g'`
-
-AC_MSG_RESULT(${curl_libs})
+if test "$USE_CURL" = "1" ; then
+    AC_MSG_CHECKING([for curl libs])
+    curl_libs=`${CURL_CONFIG} --libs`
+    if test $? -ne 0; then
+        AC_MSG_ERROR([curl-config --libs failed.])
+    fi
 
-# Yet more curl madness.  curl-config --cflags returns CPPFLAGS only, so
-# let's put it into CPPFLAGS where it belongs.
-AC_MSG_CHECKING([for curl cflags])
-curl_cflags=`${CURL_CONFIG} --cflags`
-if test $? -ne 0; then
-    AC_MSG_ERROR([curl-config --cflags failed.])
-fi
+    # More curl workarounds.  Adding the system include path with -I and/or
+    # system library path with -L causes problems on some systems.
+    curl_libs=`echo ${curl_libs} | sed -e 's|-L/usr/lib||g'`
+
+    AC_MSG_RESULT(${curl_libs})
+
+    # Yet more curl madness.  curl-config --cflags returns CPPFLAGS only, so
+    # let's put it into CPPFLAGS where it belongs.
+    AC_MSG_CHECKING([for curl cflags])
+    curl_cflags=`${CURL_CONFIG} --cflags`
+    if test $? -ne 0; then
+        AC_MSG_ERROR([curl-config --cflags failed.])
+    fi
 
-curl_cflags=`echo ${curl_cflags} | sed -e 's|-I/usr/include||g'`
+    curl_cflags=`echo ${curl_cflags} | sed -e 's|-I/usr/include||g'`
 
-AC_MSG_RESULT(${curl_cflags})
+    AC_MSG_RESULT(${curl_cflags})
 
-LIBS="${LIBS} ${curl_libs}"
-CPPFLAGS="${CPPFLAGS} ${curl_cflags}"
+    LIBS="${LIBS} ${curl_libs}"
+    CPPFLAGS="${CPPFLAGS} ${curl_cflags}"
+fi
 
 # check
 
@@ -300,6 +315,11 @@
 AC_DEFINE_UNQUOTED(SYSCONFDIR, "${SYSCONFDIR}",
                    [Path to system configuration directory])
 
+if test "${USE_CURL}" = "1" ; then
+    AC_DEFINE_UNQUOTED(USE_CURL, ${USE_CURL}, 
+                       [Use CURL library for retrieving hardware lists])
+fi
+
 AC_SUBST(PACKAGE_MAJOR)
 AC_SUBST(PACKAGE_MINOR)
 AC_SUBST(PACKAGE_MICRO)
@@ -316,6 +336,7 @@
 AC_SUBST(export_CPPFLAGS)
 AC_SUBST(export_LDFLAGS)
 AC_SUBST(export_LIBS)
+AC_SUBST(USE_CURL)
 
 PROGENY_CONFIG_SCRIPT(discover-config)
 PROGENY_CONFIG_SCRIPT_VAR(lt_current, ${LT_CURRENT})
diff -ru discover-2.0.2/debian/rules discover-2.0.2.new/debian/rules
--- discover-2.0.2/debian/rules	2003-10-14 01:12:53.000000000 +0200
+++ discover-2.0.2.new/debian/rules	2003-10-13 23:11:50.000000000 +0200
@@ -53,7 +53,8 @@
 		--sysconfdir=/etc \
 		--localstatedir=/var \
 		--mandir=\$${prefix}/share/man \
-		--infodir=\$${prefix}/share/info
+		--infodir=\$${prefix}/share/info \
+		--without-curl
 
 	touch $@
 
diff -ru discover-2.0.2/lib/Makefile.in discover-2.0.2.new/lib/Makefile.in
--- discover-2.0.2/lib/Makefile.in	2003-10-14 01:12:53.000000000 +0200
+++ discover-2.0.2.new/lib/Makefile.in	2003-10-13 23:10:19.000000000 +0200
@@ -15,23 +15,33 @@
 	core.c								\
 	conf.c								\
 	busclass-xml.c device-xml.c vendor-xml.c			\
-	curl.c curl.h							\
 	load-url.c load-url.h						\
 	device.c device.h						\
 	url-xml.c							\
 	utils.c utils.h version-cmp.c stack.c stack.h sysdep.c
+ifeq (@USE_CURL@,1)
+	libdiscover_SOURCES += curl.c curl.h
+endif
+
 libdiscover_HEADERS=							\
 	discover.h discover-conf.h discover-xml.h			\
-	curl.h load-url.h device.h url-xml.h utils.h stack.h sysdep.h
+	load-url.h device.h url-xml.h utils.h stack.h sysdep.h
+ifeq (@USE_CURL@,1)
+	libdiscover_HEADERS += curl.h
+endif
+
 libdiscover_OBJS=							\
 	core.lo								\
 	conf.lo								\
 	busclass-xml.lo device-xml.lo vendor-xml.lo			\
-	curl.lo								\
 	load-url.lo							\
 	device.lo							\
 	url-xml.lo							\
 	utils.lo version-cmp.lo stack.lo sysdep.lo
+ifeq (@USE_CURL@,1)
+	libdiscover_OBJS += curl.lo
+endif
+
 libdiscover_LIBS=	${libportability} ${LIBS}			\
 			${top_builddir}/${SYSDEPS}/libsysdeps.la
 
diff -ru discover-2.0.2/lib/load-url.c discover-2.0.2.new/lib/load-url.c
--- discover-2.0.2/lib/load-url.c	2003-10-14 01:12:53.000000000 +0200
+++ discover-2.0.2.new/lib/load-url.c	2003-10-13 23:15:20.000000000 +0200
@@ -31,7 +31,10 @@
 
 #include "config.h"
 #include "load-url.h"
+
+#ifdef USE_CURL
 #include "curl.h"
+#endif
 
 #ifdef HAVE_ZLIB
 #include <zlib.h>
@@ -48,10 +51,10 @@
 int
 _discover_load_url(const char *url, XML_Parser parser)
 {
-#if 0
-    return _discover_load_url_file(url, parser);
-#else
+#ifdef USE_CURL
     return _discover_load_url_curl(url, parser);
+#else
+    return _discover_load_url_file(url, parser);
 #endif
 }
 

Reply to: