Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2185

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/85/2185/1

simplify external module check with macro

- a >12.000 LOC configure.ac is more than enough for everybody
- removing some 100 lines cant hurt
- the SYSTEM_LIBCDR=$SYSTEM_CDR stuff should be removed in a later step,
  by renaming them in the build

Change-Id: I5c065c5c341561258800a124b0fc1f40b3d59211
---
M configure.ac
1 file changed, 65 insertions(+), 165 deletions(-)



diff --git a/configure.ac b/configure.ac
index 5b0853415..a864745 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7134,6 +7134,26 @@
 fi
 AC_SUBST(SYSTEM_STDLIBS)
 
+AC_DEFUN([libo_PUBLISH_MODULE], [
+AC_SUBST(SYSTEM_$1)
+AC_SUBST($1_CFLAGS)
+AC_SUBST($1_LIBS)
+])
+
+AC_DEFUN([libo_CHECK_SYSTEM_MODULE], [
+AC_MSG_CHECKING([which $1 to use])
+if test "$with_system_$1" = "yes"; then
+    AC_MSG_RESULT([external])
+    SYSTEM_$2=YES
+    PKG_CHECK_MODULES([$2], [$3])
+else
+    AC_MSG_RESULT([internal])
+    SYSTEM_$2=NO
+    BUILD_TYPE="$BUILD_TYPE $2"
+fi
+libo_PUBLISH_MODULE([$2])
+])
+
 dnl ===================================================================
 dnl Check for system zlib
 dnl ===================================================================
@@ -7148,24 +7168,11 @@
     esac
 fi
 
-AC_MSG_CHECKING([which zlib to use])
-if test "$with_system_zlib" = "yes"; then
-    AC_MSG_RESULT([external])
-    SYSTEM_ZLIB=YES
-    AC_CHECK_HEADER(zlib.h, [],
-        [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
-    AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
-        [AC_MSG_ERROR(zlib not found or functional)], [])
-else
-    AC_MSG_RESULT([internal])
-    SYSTEM_ZLIB=NO
-    BUILD_TYPE="$BUILD_TYPE ZLIB"
+if test "$with_system_zlib" = "no"; then
     ZLIB_CFLAGS="-I${OUTDIR}/inc/external/zlib"
     ZLIB_LIBS="-L${OUTDIR}/lib -lz"
 fi
-AC_SUBST(ZLIB_CFLAGS)
-AC_SUBST(ZLIB_LIBS)
-AC_SUBST(SYSTEM_ZLIB)
+libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
 
 dnl ===================================================================
 dnl Check for system jpeg
@@ -7198,15 +7205,12 @@
 AC_SUBST(SYSTEM_JPEG)
 AC_SUBST([MINGW_JPEG_DLL])
 
+
 dnl ===================================================================
 dnl Check for system clucene
 dnl ===================================================================
-AC_MSG_CHECKING([which clucene to use])
+libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core])
 if test "$with_system_clucene" = "yes"; then
-    AC_MSG_RESULT([external])
-    SYSTEM_CLUCENE=YES
-    PKG_CHECK_MODULES(CLUCENE, libclucene-core)
-
     AC_LANG_PUSH([C++])
     save_CXXFLAGS=$CXXFLAGS
     save_CPPFLAGS=$CPPFLAGS
@@ -7221,175 +7225,95 @@
     AC_LANG_POP([C++])
 
     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
-else
-    AC_MSG_RESULT([internal])
-    SYSTEM_CLUCENE=NO
-    BUILD_TYPE="$BUILD_TYPE CLUCENE"
 fi
-AC_SUBST(SYSTEM_CLUCENE)
-AC_SUBST(CLUCENE_CFLAGS)
-AC_SUBST(CLUCENE_LIBS)
 
 dnl ===================================================================
 dnl Check for system expat
 dnl ===================================================================
-AC_MSG_CHECKING([which expat to use])
+libo_CHECK_SYSTEM_MODULE([expat],[EXPAT],[expat])
 if test "$with_system_expat" = "yes"; then
-    AC_MSG_RESULT([external])
-    SYSTEM_EXPAT=YES
-    AC_CHECK_HEADER(expat.h, [],
-        [AC_MSG_ERROR(expat.h not found. install expat)], [])
-    AC_CHECK_LIB([expat], [XML_ParserCreate], [:],
-    [AC_MSG_RESULT(expat library not found or functional.)], [])
     libo_MINGW_CHECK_DLL([EXPAT], [libexpat])
-else
-    AC_MSG_RESULT([internal])
-    SYSTEM_EXPAT=NO
-    BUILD_TYPE="$BUILD_TYPE EXPAT"
 fi
-AC_SUBST(SYSTEM_EXPAT)
-AC_SUBST([MINGW_EXPAT_DLL])
 
 dnl ===================================================================
 dnl Check for system libcdr
 dnl ===================================================================
-AC_MSG_CHECKING([which libcdr to use])
-if test "$with_system_libcdr" = "yes"; then
-    AC_MSG_RESULT([external])
-    SYSTEM_LIBCDR=YES
-    PKG_CHECK_MODULES( CDR, libcdr-0.0 >= 0.0.5 )
-elif test $_os = iOS; then
-    # libcdr depends on libwpd and libwpg and those are LGPL
-    AC_MSG_RESULT([none])
+if test $_os = iOS; then
+    # libcdr depends on libwpd and libwpg and those are LGPL, publishing empty flags
+    libo_PUBLISH_MODULE([CDR])
 else
-    AC_MSG_RESULT([internal])
-    SYSTEM_LIBCDR=NO
-    BUILD_TYPE="$BUILD_TYPE CDR"
+    libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.0 >= 0.0.5])
 fi
+SYSTEM_LIBCDR=$SYSTEM_CDR
 AC_SUBST(SYSTEM_LIBCDR)
-AC_SUBST(CDR_CFLAGS)
-AC_SUBST(CDR_LIBS)
 
 dnl ===================================================================
 dnl Check for system libmspub
 dnl ===================================================================
-AC_MSG_CHECKING([which libmspub to use])
-if test "$with_system_libmspub" = "yes"; then
-    AC_MSG_RESULT([external])
-    SYSTEM_LIBMSPUB=YES
-    PKG_CHECK_MODULES( MSPUB, libmspub-0.0 )
-elif test $_os = iOS; then
-    # libmspub depends on libwpd and libwpg and those are LGPL
-    AC_MSG_RESULT([none])
+if test $_os = iOS; then
+    # libmspub depends on libwpd and libwpg and those are LGPL, publishing empty flags
+    libo_PUBLISH_MODULE([MSPUB])
 else
-    AC_MSG_RESULT([internal])
-    SYSTEM_LIBMSPUB=NO
-    BUILD_TYPE="$BUILD_TYPE MSPUB"
+    libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.0])
 fi
+SYSTEM_LIBMSPUB=$SYSTEM_MSPUB
 AC_SUBST(SYSTEM_LIBMSPUB)
-AC_SUBST(MSPUB_CFLAGS)
-AC_SUBST(MSPUB_LIBS)
 
 dnl ===================================================================
 dnl Check for system libvisio
 dnl ===================================================================
-AC_MSG_CHECKING([which libvisio to use])
-if test "$with_system_libvisio" = "yes"; then
-    AC_MSG_RESULT([external])
-    SYSTEM_LIBVISIO=YES
-    PKG_CHECK_MODULES( VISIO, libvisio-0.0 )
-elif test $_os = iOS; then
-    # libvisio depends on libwpd and libwpg and those are LGPL
-    AC_MSG_RESULT([none])
+if test $_os = iOS; then
+    # libvisio depends on libwpd and libwpg and those are LGPL, publishing empty flags
+    libo_PUBLISH_MODULE([VISIO])
 else
-    AC_MSG_RESULT([internal])
-    SYSTEM_LIBVISIO=NO
-    BUILD_TYPE="$BUILD_TYPE VISIO"
+    libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.0])
 fi
+SYSTEM_LIBVISIO=$SYSTEM_VISIO
 AC_SUBST(SYSTEM_LIBVISIO)
-AC_SUBST(VISIO_CFLAGS)
-AC_SUBST(VISIO_LIBS)
 
 dnl ===================================================================
 dnl Check for system libcmis
 dnl ===================================================================
-AC_MSG_CHECKING([which libcmis to use])
-if test "$with_system_libcmis" = "yes"; then
-    AC_MSG_RESULT([external])
-    SYSTEM_LIBCMIS=YES
-    PKG_CHECK_MODULES( CMIS, libcmis-0.3 >= 0.3.0 )
-else
-    AC_MSG_RESULT([internal])
-    SYSTEM_LIBCMIS=NO
-    BUILD_TYPE="$BUILD_TYPE CMIS"
-fi
+libo_CHECK_SYSTEM_MODULE([libcmis],[CMIS],[libcmis-0.3 >= 0.3.0])
+SYSTEM_LIBCMIS=$SYSTEM_CMIS
 AC_SUBST(SYSTEM_LIBCMIS)
-AC_SUBST(CMIS_CFLAGS)
-AC_SUBST(CMIS_LIBS)
 
 
 dnl ===================================================================
 dnl Check for system libwpd
 dnl ===================================================================
-AC_MSG_CHECKING([which libwpd to use])
-if test "$with_system_libwpd" = "yes"; then
-    AC_MSG_RESULT([external])
-    SYSTEM_LIBWPD=YES
-    PKG_CHECK_MODULES( WPD, libwpd-0.9 libwpd-stream-0.9 )
-elif test $_os = iOS; then
-    AC_MSG_RESULT([none])
+if test $_os = iOS; then
+    libo_PUBLISH_MODULE([WPD])
 else
-    AC_MSG_RESULT([internal])
-    SYSTEM_LIBWPD=NO
-    WPD_CFLAGS="-I${OUTDIR}/inc/external"
-    WPD_LIBS="-L${OUTDIR}/lib -lwpdlib"
-    BUILD_TYPE="$BUILD_TYPE WPD"
+    if test "$with_system_libwpd" = "no"; then
+        WPD_CFLAGS="-I${OUTDIR}/inc/external"
+        WPD_LIBS="-L${OUTDIR}/lib -lwpdlib"
+    fi
+    libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.9 libwpd-stream-0.9])
 fi
+SYSTEM_LIBWPD=$SYSTEM_WPD
 AC_SUBST(SYSTEM_LIBWPD)
-AC_SUBST(WPD_CFLAGS)
-AC_SUBST(WPD_LIBS)
 
 dnl ===================================================================
 dnl Check for system lcms2
 dnl ===================================================================
-AC_MSG_CHECKING([which littlecms v2 to use])
 if test "$with_system_lcms2" = "yes"; then
-    AC_MSG_RESULT([external])
-    SYSTEM_LCMS2=YES
-    PKG_CHECK_MODULES( LCMS2, lcms2 )
     libo_MINGW_CHECK_DLL([LCMS2], [liblcms2])
 else
-    AC_MSG_RESULT([internal])
     SYSTEM_LCMS2=NO
     LCMS2_LIBS="-L${OUTDIR}/lib -llcms2"
     LCMS2_CFLAGS="-I${WORKDIR}/UnpackedTarball/lcms2/include"
     if test "$GCC" = "yes"; then
         LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
     fi
-    BUILD_TYPE="$BUILD_TYPE LCMS2"
 fi
-AC_SUBST(SYSTEM_LCMS2)
-AC_SUBST(LCMS2_CFLAGS)
-AC_SUBST(LCMS2_LIBS)
+libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2])
 AC_SUBST([MINGW_LCMS2_DLL])
 
 dnl ===================================================================
 dnl Check for system cppunit
 dnl ===================================================================
-AC_MSG_CHECKING([which cppunit to use])
-if test "$with_system_cppunit" = "yes"; then
-    AC_MSG_RESULT([external])
-    SYSTEM_CPPUNIT=YES
-    # might work for earlier, too but go sure:
-    PKG_CHECK_MODULES( CPPUNIT, cppunit >= 1.12.0 )
-else
-    AC_MSG_RESULT([internal])
-    SYSTEM_CPPUNIT=NO
-    BUILD_TYPE="$BUILD_TYPE CPPUNIT"
-fi
-AC_SUBST(SYSTEM_CPPUNIT)
-AC_SUBST(CPPUNIT_CFLAGS)
-AC_SUBST(CPPUNIT_LIBS)
+libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.12.0])
 
 dnl ===================================================================
 dnl Check whether freetype is available
@@ -7410,44 +7334,28 @@
 dnl ===================================================================
 dnl Check for system libwps
 dnl ===================================================================
-AC_MSG_CHECKING([which libwps to use])
-if test "$with_system_libwps" = "yes"; then
-    AC_MSG_RESULT([external])
-    SYSTEM_LIBWPS=YES
-    PKG_CHECK_MODULES( WPS, libwps-0.2 )
-elif test $_os = iOS; then
-    AC_MSG_RESULT([none])
-else
-    AC_MSG_RESULT([internal])
-    SYSTEM_LIBWPS=NO
+#elif test $_os = iOS; then
+#    AC_MSG_RESULT([none])
+if test "$with_system_libwps" = "no"; then
     WPS_CFLAGS="-I${OUTDIR}/inc/external"
     WPS_LIBS="-L${OUTDIR}/lib -lwpslib"
-    BUILD_TYPE="$BUILD_TYPE WPS"
 fi
+libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.2])
+SYSTEM_LIBWPS=$SYSTEM_WPS
 AC_SUBST(SYSTEM_LIBWPS)
-AC_SUBST(WPS_CFLAGS)
-AC_SUBST(WPS_LIBS)
 
 dnl ===================================================================
 dnl Check for system libwpg
 dnl ===================================================================
-AC_MSG_CHECKING([which libwpg to use])
-if test "$with_system_libwpg" = "yes"; then
-    AC_MSG_RESULT([external])
-    SYSTEM_LIBWPG=YES
-    PKG_CHECK_MODULES( WPG, libwpg-0.2 )
-elif test $_os = iOS; then
-    AC_MSG_RESULT([none])
-else
-    AC_MSG_RESULT([internal])
-    SYSTEM_LIBWPG=NO
+#elif test $_os = iOS; then
+#    AC_MSG_RESULT([none])
+if test "$with_system_libwpg" = "no"; then
     WPG_CFLAGS="-I${OUTDIR}/inc/external"
     WPG_LIBS="-L${OUTDIR}/lib -lwpglib"
-    BUILD_TYPE="$BUILD_TYPE WPG"
 fi
+libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.2])
+SYSTEM_LIBWPG=$SYSTEM_WPG
 AC_SUBST(SYSTEM_LIBWPG)
-AC_SUBST(WPG_CFLAGS)
-AC_SUBST(WPG_LIBS)
 
 dnl ===================================================================
 dnl Check whether freetype2 supports emboldening
@@ -9132,24 +9040,16 @@
 AC_SUBST(SYSTEM_LPSOLVE)
 AC_SUBST([MINGW_LPSOLVE_DLL])
 
+
+
 dnl ===================================================================
 dnl Checking for libexttextcat
 dnl ===================================================================
-AC_MSG_CHECKING([which libexttextcat to use])
+libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.1.1])
 if test "$with_system_libexttextcat" = "yes"; then
-    AC_MSG_RESULT([external])
-    SYSTEM_LIBEXTTEXTCAT=YES
-    PKG_CHECK_MODULES([LIBEXTTEXTCAT], [libexttextcat >= 3.1.1])
     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
-else
-    AC_MSG_RESULT([internal])
-    SYSTEM_LIBEXTTEXTCAT=NO
-    BUILD_TYPE="$BUILD_TYPE LIBEXTTEXTCAT"
 fi
-AC_SUBST(SYSTEM_LIBEXTTEXTCAT)
 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
-AC_SUBST(LIBEXTTEXTCAT_CFLAGS)
-AC_SUBST(LIBEXTTEXTCAT_LIBS)
 
 dnl ***************************************
 dnl testing libc version for Linux...

-- 
To view, visit https://gerrit.libreoffice.org/2185
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5c065c5c341561258800a124b0fc1f40b3d59211
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Björn Michaelsen <bjoern.michaelsen@canonical.com>

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.