From: Yann E. MORIN <yann.morin.1998@free.fr>
Subject: [PATCH 1/2] configure.ac + Makefile.am: fix the imlib2 detection

Although imlib2 is correctly checked for, the variables used to get
the CFLAGS and LIBS are wrong (perhaps a remnant of the pre-imlib2
era, when giblib was using imlib).

Fix some iunder-quoting in configure.ac.

Remove legacy configure.in.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 configure.ac       |   22 ++++++++--------------
 configure.in       |   51 ---------------------------------------------------
 giblib-config.in   |    4 ++--
 giblib.pc.in       |    4 ++--
 giblib/Makefile.am |    4 ++--
 5 files changed, 14 insertions(+), 71 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6807d86..eef29fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,8 +2,8 @@ dnl Process this file with autoconf to produce a configure script.
 
 AC_INIT
 AC_CONFIG_SRCDIR([giblib/gib_list.c])
-AM_CONFIG_HEADER(giblib/giblib_config.h)
-AM_INIT_AUTOMAKE(giblib, 1.2.4, no-define)
+AM_CONFIG_HEADER([giblib/giblib_config.h])
+AM_INIT_AUTOMAKE([giblib], [1.2.4], [no-define])
 
 AC_ISC_POSIX
 AC_PROG_CC
@@ -17,16 +17,10 @@ AM_SANITY_CHECK
 AM_MAINTAINER_MODE
 AM_WITH_DMALLOC
 
-AC_PATH_GENERIC(imlib2, 1.0.0, [
-  AC_SUBST(IMLIB_LIBS)
-  AC_SUBST(IMLIB_CFLAGS) ],
-  AC_MSG_ERROR(Cannot find imlib2: Is imlib2-config in the path?) )
-
-dnl the above doesn't work for some reason :/
-IMLIB_LIBS=`imlib2-config --libs`
-IMLIB_CFLAGS=`imlib2-config --cflags`
-AC_SUBST(IMLIB_LIBS)
-AC_SUBST(IMLIB_CFLAGS)
+AC_PATH_GENERIC([imlib2], [1.0.0], [
+  AC_SUBST([IMLIB2_LIBS])
+  AC_SUBST([IMLIB2_CFLAGS]) ],
+  [AC_MSG_ERROR([Cannot find imlib2: Is imlib2-config in the path?])])
 
 LIBS="$LIBS -lm"
 CFLAGS="$CFLAGS -Wall"
@@ -48,7 +42,7 @@ $PACKAGE $VERSION
 Configuration:
 --------------
 
-Imlib2 libs:	$IMLIB_LIBS
-Imlib2 cflags:  $IMLIB_CFLAGS
+Imlib2 libs:	$IMLIB2_LIBS
+Imlib2 cflags:  $IMLIB2_CFLAGS
 CFLAGS:			$CFLAGS
 "
diff --git a/configure.in b/configure.in
deleted file mode 100644
index 432cb16..0000000
--- a/configure.in
+++ /dev/null
@@ -1,51 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-
-AC_INIT(giblib/gib_list.c)
-AM_INIT_AUTOMAKE(giblib, 1.2.4, no-define)
-AM_CONFIG_HEADER(giblib/giblib_config.h)
-
-AC_ISC_POSIX
-AC_PROG_CC
-AM_PROG_CC_STDC
-AC_HEADER_STDC
-AM_PROG_LIBTOOL
-AC_PROG_INSTALL
-AC_PROG_MAKE_SET
-AM_SANITY_CHECK
-
-AM_MAINTAINER_MODE
-AM_WITH_DMALLOC
-
-AC_PATH_GENERIC(imlib2, 1.0.0, [
-  AC_SUBST(IMLIB_LIBS)
-  AC_SUBST(IMLIB_CFLAGS) ],
-  AC_MSG_ERROR(Cannot find imlib2: Is imlib2-config in the path?) )
-
-dnl the above doesn't work for some reason :/
-IMLIB_LIBS=`imlib2-config --libs`
-IMLIB_CFLAGS=`imlib2-config --cflags`
-AC_SUBST(IMLIB_LIBS)
-AC_SUBST(IMLIB_CFLAGS)
-
-LIBS="$LIBS -lm"
-CFLAGS="$CFLAGS -Wall"
-
-
-AC_OUTPUT([
-Makefile
-giblib-config
-giblib.pc
-giblib/Makefile
-], [
-chmod +x giblib-config
-])
-
-echo "
-$PACKAGE $VERSION
-Configuration:
---------------
-
-Imlib2 libs:	$IMLIB_LIBS
-Imlib2 cflags:  $IMLIB_CFLAGS
-CFLAGS:			$CFLAGS
-"
diff --git a/giblib-config.in b/giblib-config.in
index f3a7db6..cef1620 100644
--- a/giblib-config.in
+++ b/giblib-config.in
@@ -42,11 +42,11 @@ while test $# -gt 0; do
       if test @includedir@ != /usr/include ; then
         includes=-I@includedir@
       fi
-      echo $includes -I$prefix/include/giblib @IMLIB_CFLAGS@
+      echo $includes -I$prefix/include/giblib @IMLIB2_CFLAGS@
       ;;
     --libs)
       libdirs=-L@libdir@
-      echo $libdirs -lgiblib @LDFLAGS@ @IMLIB_LIBS@
+      echo $libdirs -lgiblib @LDFLAGS@ @IMLIB2_LIBS@
       ;;
     *)
       echo "${usage}" 1>&2
diff --git a/giblib.pc.in b/giblib.pc.in
index df520ae..783e6e1 100644
--- a/giblib.pc.in
+++ b/giblib.pc.in
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: giblib
 Description: wrapper library for imlib2, and other stuff
 Version: @VERSION@
-Libs: -L${libdir} -lgiblib @LDFLAGS@ @IMLIB_LIBS@
-Cflags: -I${includedir} -I${includedir}/giblib @IMLIB_CFLAGS@
+Libs: -L${libdir} -lgiblib @LDFLAGS@ @IMLIB2_LIBS@
+Cflags: -I${includedir} -I${includedir}/giblib @IMLIB2_CFLAGS@
 
diff --git a/giblib/Makefile.am b/giblib/Makefile.am
index d1edc09..49d8ac4 100644
--- a/giblib/Makefile.am
+++ b/giblib/Makefile.am
@@ -3,7 +3,7 @@ MAINTAINERCLEANFILES = Makefile.in
 
 INCLUDES = \
 -I. -I$(top_srcdir) \
--DPREFIX=\""$(prefix)"\" @IMLIB_CFLAGS@
+-DPREFIX=\""$(prefix)"\" @IMLIB2_CFLAGS@
 
 lib_LTLIBRARIES = libgiblib.la
 
@@ -24,7 +24,7 @@ libgiblib_la_SOURCES = \
     gib_utils.c gib_utils.h \
 	gib_queue.c gib_queue.h
 
-libgiblib_la_LIBADD = @IMLIB_LIBS@
+libgiblib_la_LIBADD = @IMLIB2_LIBS@
 libgiblib_la_DEPENDENCIES = giblib_config.h
 libgiblib_la_LDFLAGS = -version-info 1:6:0
 
