Correctly use autoconf to detect CFLAGS/LIBS 78/3478/1
authorRusty Lynch <rusty.lynch@intel.com>
Sat, 27 Apr 2013 22:51:49 +0000 (15:51 -0700)
committerRusty Lynch <rusty.lynch@intel.com>
Sat, 27 Apr 2013 23:04:04 +0000 (16:04 -0700)
By using the PKG_CHECK_MODULES macro in configure.ac, then both
the developer is given a heads up when she is missing a required
build time dependency, and hard coded flags do not break when
attempting to build after a platform level change like building
in 64bit mode where system libraries are installed in a different
location.

configure.ac
joystick_gtforce/Makefile.am
tests/Makefile.am

index 61e9d3b..445afaa 100644 (file)
@@ -28,6 +28,10 @@ AC_ARG_ENABLE(setuid-install, [  --enable-setuid-install],,
              enable_setuid_install=yes)
 AM_CONDITIONAL(ENABLE_SETUID_INSTALL, test x$enable_setuid_install = xyes)
 
+PKG_PROG_PKG_CONFIG
+
+PKG_CHECK_MODULES([GLIB], [glib-2.0])
+
 SHARED_LIBS=
 SHARED_CFLAGS=
 AC_SUBST(SHARED_LIBS)
index 6f3f8ed..3256caf 100644 (file)
@@ -1,14 +1,11 @@
 export abs_builddir
 
-glib_inc = -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/i386-linux-gnu/glib-2.0/include
-glib_lib = -lgobject-2.0 -lgthread-2.0 -lrt -lglib-2.0
-
 wayland_client_lib = -lwayland-client
 wayland_ivi_client_lib = -lico-uxf-weston-plugin
 wayland_ivi_client_inc = -I/usr/include/ico-uxf-weston-plugin
 
 AM_CFLAGS = $(GCC_CFLAGS)
-AM_CPPFLAGS = -I$(top_srcdir)/src $(wayland_ivi_client_inc) $(glib_inc) $(COMPOSITOR_CFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir)/src $(wayland_ivi_client_inc) $(GLIB_CFLAGS) $(COMPOSITOR_CFLAGS)
 
 bin_PROGRAMS =         \
        ico_ictl-joystick_gtforce
@@ -16,7 +13,7 @@ bin_PROGRAMS =                \
 check_LTLIBRARIES = $(TESTS)
 check_PROGRAMS = ico_ictl-joystick
 
-AM_LDFLAGS = -module -avoid-version -rpath $(libdir) $(glib_lib)
+AM_LDFLAGS = -module -avoid-version -rpath $(libdir) $(GLIB_LIBS)
 
 ico_ictl_joystick_gtforce_SOURCES = \
        ico_ictl-joystick.c             \
index eee4ee5..5e15f3a 100644 (file)
@@ -2,8 +2,7 @@ TESTS_ENVIRONMENT = $(SHELL) $(top_srcdir)/tests/weston-plugin-test
 
 export abs_builddir
 
-EFL_INCLUDE = `pkg-config --cflags ecore-evas ecore evas ecore-wayland elementary`
-AM_CFLAGS = $(GCC_CFLAGS) $(EFL_INCLUDE)
+AM_CFLAGS = $(GCC_CFLAGS)
 AM_CPPFLAGS = -I$(top_srcdir)/src -DUNIT_TEST $(COMPOSITOR_CFLAGS)
 
 noinst_PROGRAMS =              \