Permalink
Browse files

build: simplify check for glib2

Instead of hand-crafting a pkg-config check, just use the
PKG_CHECK_MODULES autoconf macro.
  • Loading branch information...
fghaas committed May 28, 2012
1 parent 5cc9b1e commit eb453b8c5265e901ad69e0df80477c38aa93c9f3
Showing with 3 additions and 37 deletions.
  1. +1 −36 configure.ac
  2. +2 −1 src/Makefile.am
View
@@ -65,42 +65,7 @@ AM_CONDITIONAL(HAVE_HELP2MAN, test x"${HELP2MAN}" != x"")
AC_CHECK_LIB([socket], [socket])
AC_CHECK_LIB([nsl], [t_open])
-#
-# glib
-#
-if test x"${PKGCONFIG}" = x""; then
- AC_MSG_ERROR(You need pkgconfig installed in order to build ${PACKAGE})
-fi
-GPKGNAME="glib-2.0"
-
-if
- $PKGCONFIG --exists $GPKGNAME
-then
- GLIBCONFIG="$PKGCONFIG $GPKGNAME"
-else
- set -x
- echo PKG_CONFIG_PATH=$PKG_CONFIG_PATH
- $PKGCONFIG --exists $GPKGNAME; echo $?
- $PKGCONFIG --cflags $GPKGNAME; echo $?
- $PKGCONFIG $GPKGNAME; echo $?
- set +x
-
- AC_MSG_ERROR(You need glib2-devel installed in order to build ${PACKAGE})
-fi
-AC_MSG_RESULT(using $GLIBCONFIG)
-
-if test "X$GLIBCONFIG" != X; then
- AC_MSG_CHECKING(for special glib includes: )
- GLIBHEAD=`$GLIBCONFIG --cflags`
- AC_MSG_RESULT($GLIBHEAD)
- CPPFLAGS="$CPPFLAGS $GLIBHEAD"
-
- AC_MSG_CHECKING(for glib library flags)
- GLIBLIB=`$GLIBCONFIG --libs`
- AC_MSG_RESULT($GLIBLIB)
- LIBS="$LIBS $GLIBLIB"
-fi
-
+PKG_CHECK_MODULES(GLIB, [glib-2.0])
# Checks for header files.
AC_FUNC_ALLOCA
View
@@ -10,7 +10,8 @@ boothd_SOURCES = config.c main.c paxos.c ticket.c transport.c \
pacemaker.c paxos_lease.c timer.c
boothd_LDADD = -lplumb -lplumbgpl
-boothd_LDFLAGS = $(OS_DYFLAGS) -L./
+boothd_LDFLAGS = $(OS_DYFLAGS) -L./ $(GLIB_LIBS)
+boothd_CPPFLAGS = $(GLIB_CFLAGS)
noinst_HEADERS = booth.h list.h pacemaker.h paxos_lease.h timer.h \
config.h log.h paxos.h ticket.h transport.h

0 comments on commit eb453b8

Please sign in to comment.