[libcroco] Modernise and simplify configure



commit 6637c802c0a4c685a4e1866c9f7b033c2dd78979
Author: Christian Persch <chpe gnome org>
Date:   Sun Dec 11 21:34:39 2011 +0100

    Modernise and simplify configure

 configure.in               |  124 ++++++++++++--------------------------------
 csslint/Makefile.am        |    5 +-
 docs/reference/Makefile.am |    2 +
 libcroco.pc.in             |    1 -
 src/Makefile.am            |    6 +--
 src/cr-sel-eng.h           |    6 +--
 src/libcroco-config.h.in   |    5 +-
 tests/Makefile.am          |    4 +-
 8 files changed, 44 insertions(+), 109 deletions(-)
---
diff --git a/configure.in b/configure.in
index 5edf3a4..de741f5 100644
--- a/configure.in
+++ b/configure.in
@@ -36,32 +36,19 @@ AC_SUBST(LIBCROCO_VERSION_INFO)
 AC_SUBST(LIBCROCO_VERSION_NUMBER)
 AC_SUBST(LIBCROCO_CURRENT)
 AC_SUBST(LIBCROCO_AGE)
-AC_SUBST(VERSION)
-
-dnl
-dnl First, here goes the list
-dnl of the version of the libraries we depend
-dnl on.
-dnl
-
-GLIB2_VERSION=2.0
-LIBXML2_VERSION=2.4.23
 
 dnl Checks for programs.
 AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_CPP
-
-dnl Make sure we have an ANSI compiler
-AM_C_PROTOTYPES
-test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
-
-dnl Checks for libraries.
-dnl Checks for header files.
+AC_PROG_MAKE_SET
 AC_STDC_HEADERS
 AC_ISC_POSIX
 
-AM_PROG_LIBTOOL
+LT_INIT([])
+
+CROCO_LIB=libcroco-$LIBCROCO_MAJOR_VERSION.$LIBCROCO_MINOR_VERSION.la
+AC_SUBST(CROCO_LIB)
 
 case "$host" in
   *-*-cygwin*|*-*-mingw*)
@@ -95,81 +82,16 @@ dnl ************************************************
 dnl end of check of the different --enable-feature options
 dnl *************************************************
 
-dnl
-dnl check glib-2.0 version
-dnl
-have_glib2=no
-CROCO_HAVE_GLIB2=0
-PKG_CHECK_MODULES(GLIB2, 
-		  [glib-2.0 >= $GLIB2_VERSION],
-		  [have_glib2=yes
-	 	  CROCO_HAVE_GLIB2=1],
-		  have_glib2=no)
-if test "$have_glib2" = no ; then
-	AC_MSG_ERROR([*** glib2 not found. See http://www.gtk.org])
-fi
-
-AC_SUBST(GLIB2_VERSION)
-AC_SUBST(CROCO_HAVE_GLIB2)
-
-dnl
-dnl check libxml2 version
-dnl
-have_libxml2=no
-CROCO_HAVE_LIBXML2=0
-PKG_CHECK_MODULES(LIBXML2, 
-			[libxml-2.0 >= $LIBXML2_VERSION],
-			[have_libxml2=yes
-			CROCO_HAVE_LIBXML2=1],
-			have_libxml2=no)
-if test "$have_libxml2" = no ; then
-    AC_MSG_ERROR([*** libxml2 not found. See http://xmlsoft.org/])
-fi
-AC_SUBST(LIBXML2_VERSION)
-AC_SUBST(CROCO_HAVE_LIBXML2)
-
-CROCO_LIB=libcroco-$LIBCROCO_MAJOR_VERSION.$LIBCROCO_MINOR_VERSION.la
-AC_SUBST(CROCO_LIB)
+##############
+# Dependencies
+##############
 
+GLIB_REQUIRED=2.0
+LIBXML_REQUIRED=2.4.23
 
-dnl **********************************
-dnl *By default compile in debug mode
-dnl **********************************
-
-if test "x$GCC" = "xyes" ; then
-	CFLAGS="$CFLAGS -Wall"
-fi
-
-
-dnl ************************
-dnl *Dodji's environment.
-dnl ************************
-
-if test "x$LOGNAME" = "xdodji" -a "x$GCC" = "xyes" ; then
-	CFLAGS="-g -Wunused -Wimplicit -Wreturn-type -Wswitch \
-	-Wcomment -Wtrigraphs -Wformat -Wchar-subscripts \ 
-        -Wparentheses -Wpointer-arith -Wcast-align \
-        -Wwrite-strings -Waggregate-return -Wstrict-prototypes \
-        -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls"
-	
-fi
-
-dnl
-dnl Define the CROCO_LIBS and CROCO_CFLAGS variables. These will be used
-dnl by client application to know where to find croco include files and libs.
-dnl
-CROCO_LIBS="-L${libdir} -lcroco-$LIBCROCO_MAJOR_VERSION.$LIBCROCO_MINOR_VERSION"
-CROCO_CFLAGS="-I${includedir}/libcroco-$LIBCROCO_MAJOR_VERSION.$LIBCROCO_MINOR_VERSION"
-
-AC_SUBST(LIBXML2_LIBS)
-AC_SUBST(LIBXML2_CFLAGS)
-AC_SUBST(CROCO_CFLAGS)
-AC_SUBST(CROCO_LIBS)
-
-AC_SUBST(LDFLAGS)
-AC_SUBST(CFLAGS)
-
-AC_PROG_MAKE_SET
+PKG_CHECK_MODULES([CROCO],[
+  glib-2.0 >= $GLIB_REQUIRED
+  libxml-2.0 >= $LIBXML_REQUIRED])
 
 ##########################################################
 # Check for -Bsymbolic-functions linker flag used to avoid
@@ -195,7 +117,27 @@ fi
 
 AC_SUBST([BSYMBOLIC_LDFLAG])
 
+###################
+# Compiler warnings
+###################
+
+CC_CHECK_CFLAGS_APPEND([ \
+  -Wall -Wextra \
+  -Wunused -Wreturn-type -Wswitch -Wcomment -Wtrigraphs \
+  -Wchar-subscripts -Wparentheses -Winline -Wredundant-decls \
+  -Wformat-nonliteral -Werror=format-security \
+  -Wsign-compare -Werror=implicit-function-declaration \
+  -Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
+  -Waggregate-return -Wcast-align -Wimplicit -Wuninitialized \
+  -Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
+  -Wpacked -Wmissing-format-attribute -Wshadow \
+  -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
+  -Wdeclaration-after-statement -Wold-style-definition \
+  -Wno-missing-field-initializers -Wno-unused-parameter \
+  -fno-common -Wno-switch-enum])
+
 ##########################################
+
 AC_OUTPUT([
 Makefile
 libcroco.pc
diff --git a/csslint/Makefile.am b/csslint/Makefile.am
index a458bcc..8209537 100644
--- a/csslint/Makefile.am
+++ b/csslint/Makefile.am
@@ -9,10 +9,9 @@ LDADD=$(croco_lib)
 INCLUDES=-I$(top_srcdir)/intl \
 	-I$(top_srcdir)/src \
 	-I$(top_builddir)/src \
-	@GLIB2_CFLAGS@ \
-	@LIBXML2_CFLAGS@
+	$(CROCO_CFLAGS)
 
-csslint_0_6_LDFLAGS= GLIB2_LIBS@ @LIBXML2_LIBS@
+csslint_0_6_LDFLAGS=$(CROCO_LIBS)
 AM_CFLAGS=$(INCLUDES)
 
 #EXTRA_DIST = $(man_MANS)
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index 411627f..0ec463d 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -43,8 +43,10 @@ content_files=\
 # CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib
 # contains GtkObjects/GObjects and you want to document signals and properties.
 GTKDOC_CFLAGS=\
+	$(CROCO_CFLAGS) \
 	$(NULL)
 GTKDOC_LIBS=\
+	$(CROCO_LIBS) \
 	$(NULL)
 
 include $(top_srcdir)/gtk-doc.make
diff --git a/libcroco.pc.in b/libcroco.pc.in
index a8b6e78..3d0dc0a 100644
--- a/libcroco.pc.in
+++ b/libcroco.pc.in
@@ -9,4 +9,3 @@ Description: a CSS2 Parsing and manipulation Library in C.
 Requires: glib-2.0 libxml-2.0
 Libs: -L${libdir} -lcroco- LIBCROCO_MAJOR_VERSION@  LIBCROCO_MINOR_VERSION@
 Cflags: -I${includedir}/libcroco- LIBCROCO_MAJOR_VERSION@  LIBCROCO_MINOR_VERSION@
-
diff --git a/src/Makefile.am b/src/Makefile.am
index f187774..e382ffe 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -101,8 +101,7 @@ libcroco_0_6_la_CPPFLAGS = \
 	$(AM_CPPFLAGS)
 
 libcroco_0_6_la_CFLAGS = \
-	@GLIB2_CFLAGS@ \
-	@LIBXML2_CFLAGS@ \
+	$(CROCO_CFLAGS) \
 	$(AM_CFLAGS)
 
 libcroco_0_6_la_LDFLAGS = \
@@ -112,5 +111,4 @@ libcroco_0_6_la_LDFLAGS = \
 	$(AM_LDFLAGS)
 
 libcroco_0_6_la_LIBADD = \
-	@GLIB2_LIBS@ \
-	@LIBXML2_LIBS@
+	$(CROCO_LIBS)
diff --git a/src/cr-sel-eng.h b/src/cr-sel-eng.h
index e64d133..cab3d14 100644
--- a/src/cr-sel-eng.h
+++ b/src/cr-sel-eng.h
@@ -30,11 +30,7 @@
 #include "cr-style.h"
 #include "cr-prop-list.h"
 
-#ifdef CROCO_HAVE_LIBXML2
- #include <libxml/tree.h>
-#endif
-
-
+#include <libxml/tree.h>
 
 /**
  * file:
diff --git a/src/libcroco-config.h.in b/src/libcroco-config.h.in
index e817cd8..7f2e217 100644
--- a/src/libcroco-config.h.in
+++ b/src/libcroco-config.h.in
@@ -12,7 +12,6 @@
 #endif
 #endif
 
-#if @CROCO_HAVE_LIBXML2@
-#define CROCO_HAVE_LIBXML2 @CROCO_HAVE_LIBXML2@
+#ifndef CROCO_HAVE_LIBXML2
+#define CROCO_HAVE_LIBXML2 (1)
 #endif
-
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 940a12f..54bd099 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -6,7 +6,7 @@ test-several-media.sh
 
 #the list of all possible tests goes here.
 
-EXTRALDFLAGS= GLIB2_LIBS@ @LIBXML2_LIBS@
+EXTRALDFLAGS=$(CROCO_LIBS)
 testprogs=test0 test1 test2 test3 test4 test5 test6
 noinst_PROGRAMS=$(testprogs)
 test0_SOURCES=test0-main.c
@@ -29,4 +29,4 @@ LDADD=$(croco_lib)
 
 INCLUDES=-I$(top_srcdir)/intl -I$(top_srcdir)/src -I$(top_builddir)/src
 
-AM_CFLAGS=-I. @LIBXML2_CFLAGS@ @GLIB2_CFLAGS@
+AM_CFLAGS=-I. $(CROCO_CFLAGS)



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