[PATCH] Added libcurl to build system.
Stefan Thomas
thomas at eload24.com
Wed Oct 14 00:01:42 PDT 2009
---
CMakeLists.txt | 9 ++++
config.h.cmake | 3 +
configure.ac | 15 +++++++
m4/libcurl.m4 | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++
poppler/Makefile.am | 8 ++++
5 files changed, 140 insertions(+), 0 deletions(-)
create mode 100644 m4/libcurl.m4
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3348711..1c609bf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,7 @@ set(CAIRO_VERSION "1.8.4")
macro_bool_to_01(ENABLE_SPLASH HAVE_SPLASH)
find_package(Freetype REQUIRED)
find_package(Fontconfig REQUIRED)
+macro_optional_find_package(CURL)
macro_optional_find_package(JPEG)
macro_optional_find_package(PNG)
if(JPEG_FOUND)
@@ -94,6 +95,10 @@ set(HAVE_FREETYPE_H ON)
if(ENABLE_ZLIB)
include_directories(${ZLIB_INCLUDE_DIR})
endif(ENABLE_ZLIB)
+if(CURL_FOUND)
+ include_directories(${CURL_INCLUDE_DIR})
+ set(ENABLE_LIBCURL ON)
+endif(CURL_FOUND)
if(JPEG_FOUND)
include_directories(${JPEG_INCLUDE_DIR})
set(ENABLE_LIBJPEG ON)
@@ -239,6 +244,9 @@ if(ENABLE_ZLIB)
)
set(poppler_LIBS ${poppler_LIBS} ${ZLIB_LIBRARIES})
endif(ENABLE_ZLIB)
+if(CURL_FOUND)
+ set(poppler_LIBS ${poppler_LIBS} ${CURL_LIBRARIES})
+endif(CURL_FOUND)
if(LIBOPENJPEG_FOUND)
set(poppler_SRCS ${poppler_SRCS}
poppler/JPEG2000Stream.cc
@@ -459,6 +467,7 @@ show_end_message("glib wrapper" GLIB_FOUND)
show_end_message("use libjpeg" ENABLE_LIBJPEG)
show_end_message("use libpng" ENABLE_LIBPNG)
show_end_message("use zlib" ENABLE_ZLIB)
+show_end_message("use curl" ENABLE_LIBCURL)
show_end_message("use libopenjpeg" LIBOPENJPEG_FOUND)
show_end_message("use cms" USE_CMS)
show_end_message("command line utils" ENABLE_UTILS)
diff --git a/config.h.cmake b/config.h.cmake
index 7b57de0..62c0df1 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -7,6 +7,9 @@
#cmakedefine ENABLE_ZLIB 1
/* Use libpng to export images in pdftohtml. */
+#cmakedefine ENABLE_LIBCURL 1
+
+/* Use libpng to export images in pdftohtml. */
#cmakedefine ENABLE_LIBPNG 1
/* Use liblcms for color management. */
diff --git a/configure.ac b/configure.ac
index 13d492a..c138341 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,6 +149,20 @@ AM_CONDITIONAL(BUILD_ZLIB, test x$enable_zlib = xyes)
AH_TEMPLATE([ENABLE_ZLIB],
[Use zlib instead of builtin zlib decoder.])
+dnl Test for libcurl
+AC_ARG_ENABLE(libcurl,
+ AC_HELP_STRING([--disable-libcurl],
+ [Don't build against libcurl.]),
+ enable_libcurl=$enableval,
+ enable_libcurl="try")
+if test x$enable_libcurl != xno; then
+ POPPLER_FIND_CURL
+fi
+
+AM_CONDITIONAL(BUILD_LIBCURL, test x$enable_libcurl = xyes)
+AH_TEMPLATE([ENABLE_LIBCURL],
+ [Build against libcurl.])
+
dnl Test for libopenjpeg
AC_ARG_ENABLE(libopenjpeg,
@@ -574,6 +588,7 @@ echo " use gtk-doc: $enable_gtk_doc"
echo " use libjpeg: $enable_libjpeg"
echo " use libpng: $enable_libpng"
echo " use zlib: $enable_zlib"
+echo " use libcurl: $enable_libcurl"
echo " use libopenjpeg: $enable_libopenjpeg"
echo " use cms: $enable_cms"
echo " command line utils: $enable_utils"
diff --git a/m4/libcurl.m4 b/m4/libcurl.m4
new file mode 100644
index 0000000..2b47691
--- /dev/null
+++ b/m4/libcurl.m4
@@ -0,0 +1,105 @@
+dnl Based on libpng.m4
+
+AC_DEFUN([AC_FIND_FILE],
+[
+$3=NO
+for i in $2;
+do
+ for j in $1;
+ do
+ echo "configure: __oline__: $i/$j" >&AC_FD_CC
+ if test -r "$i/$j"; then
+ echo "taking that" >&AC_FD_CC
+ $3=$i
+ break 2
+ fi
+ done
+done
+])
+
+AC_DEFUN([FIND_CURL_HELPER],
+[
+AC_MSG_CHECKING([for libcurl])
+AC_CACHE_VAL(ac_cv_lib_curl,
+[
+ac_save_LIBS="$LIBS"
+LIBS="$all_libraries $USER_LDFLAGS -lcurl -lm"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
+AC_TRY_LINK(
+[
+#ifdef __cplusplus
+extern "C" {
+#endif
+void curl_version();
+#ifdef __cplusplus
+}
+#endif
+],
+[curl_version();],
+ eval "ac_cv_lib_curl=-lcurl",
+ eval "ac_cv_lib_curl=no")
+LIBS="$ac_save_LIBS"
+CFLAGS="$ac_save_CFLAGS"
+])
+
+if eval "test ! \"`echo $ac_cv_lib_curl`\" = no"; then
+ enable_libcurl=yes
+ LIBCURL_LIBS="$ac_cv_lib_curl"
+ AC_MSG_RESULT($ac_cv_lib_curl)
+else
+ AC_MSG_RESULT(no)
+ $1
+fi
+])
+
+
+AC_DEFUN([POPPLER_FIND_CURL],
+[
+dnl first look for libraries
+FIND_CURL_HELPER(
+ FIND_CURL_HELPER(normal, [],
+ [
+ LIBCURL_LIBS=
+ ]
+ )
+)
+
+dnl then search the headers
+curl_incdirs="`eval echo $includedir` /usr/include /usr/local/include "
+AC_FIND_FILE(curl/curl.h, $curl_incdirs, curl_incdir)
+test "x$curl_incdir" = xNO && curl_incdir=
+
+dnl if headers _and_ libraries are missing, this is no error, and we
+dnl continue with a warning (the user will get no http support)
+dnl if only one is missing, it means a configuration error, but we still
+dnl only warn
+if test -n "$curl_incdir" && test -n "$LIBCURL_LIBS" ; then
+ AC_DEFINE_UNQUOTED(ENABLE_LIBCURL, 1, [Define if you have libcurl])
+else
+ if test -n "$curl_incdir" ; then
+ AC_MSG_WARN([
+There is an installation error in libcurl support. You seem to have only the
+headers installed. You may need to either provide correct --with-extra-...
+options, or the development package of libcurl. You can get a source package of
+libcurl from http://curl.haxx.se/download.html
+Disabling HTTP support.
+])
+ elif test -n "$LIBCURL_LIBS" ; then
+ AC_MSG_WARN([
+There is an installation error in libcurl support. You seem to have only the
+libraries installed. You may need to either provide correct --with-extra-...
+options, or the development package of libcurl. You can get a source package of
+libcurl from http://curl.haxx.se/download.html
+Disabling HTTP support.
+])
+ else
+ AC_MSG_WARN([libcurl not found. disable HTTP support.])
+ fi
+ curl_incdir=
+ enable_libcurl=no
+ LIBCURL_LIBS=
+fi
+
+AC_SUBST(LIBCURL_LIBS)
+])
diff --git a/poppler/Makefile.am b/poppler/Makefile.am
index ec79e31..24a22a4 100644
--- a/poppler/Makefile.am
+++ b/poppler/Makefile.am
@@ -98,6 +98,13 @@ zlib_libs = \
endif
+if BUILD_LIBCURL
+
+libcurl_libs = \
+ $(LIBCURL_LIBS)
+
+endif
+
if BUILD_ABIWORD_OUTPUT
abiword_sources = \
@@ -144,6 +151,7 @@ libpoppler_la_LIBADD = \
$(libjpeg_libs) \
$(libpng_libs) \
$(zlib_libs) \
+ $(libcurl_libs) \
$(libjpeg2000_libs) \
$(abiword_libs) \
$(FREETYPE_LIBS) \
--
1.6.0.4
--------------090607010404040105030602
Content-Type: text/plain;
name="0002-Added-rudimentary-HTTP-streaming-support.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="0002-Added-rudimentary-HTTP-streaming-support.patch"
More information about the poppler
mailing list