[PATCH weston 3/4] configure.ac: Split common stuff to m4/common.m4

Quentin Glidic sardemff7+wayland at sardemff7.net
Fri Dec 6 14:31:25 PST 2013


From: Quentin Glidic <sardemff7+git at sardemff7.net>

Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
---
 configure.ac | 41 ++---------------------------------------
 m4/common.m4 | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 39 deletions(-)
 create mode 100644 m4/common.m4

diff --git a/configure.ac b/configure.ac
index 40ae145..eaa2af1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,32 +41,10 @@ AC_ARG_VAR([WESTON_SHELL_CLIENT],
 
 PKG_PROG_PKG_CONFIG()
 
-AC_CHECK_FUNC([dlopen], [],
-              AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
-AC_SUBST(DLOPEN_LIBS)
-
-AC_CHECK_DECL(SFD_CLOEXEC,[],
-	      [AC_MSG_ERROR("SFD_CLOEXEC is needed to compile weston")],
-	      [[#include <sys/signalfd.h>]])
-AC_CHECK_DECL(TFD_CLOEXEC,[],
-	      [AC_MSG_ERROR("TFD_CLOEXEC is needed to compile weston")],
-	      [[#include <sys/timerfd.h>]])
-AC_CHECK_DECL(CLOCK_MONOTONIC,[],
-	      [AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile weston")],
-	      [[#include <time.h>]])
-AC_CHECK_HEADERS([execinfo.h])
-
-AC_CHECK_FUNCS([mkostemp strchrnul initgroups posix_fallocate])
 
-COMPOSITOR_MODULES="wayland-server >= 1.3.90 pixman-1"
+m4_include([m4/common.m4])
 
-AC_ARG_ENABLE(egl, [  --disable-egl],,
-              enable_egl=yes)
-AM_CONDITIONAL(ENABLE_EGL, test x$enable_egl = xyes)
-if test x$enable_egl = xyes; then
-	AC_DEFINE([ENABLE_EGL], [1], [Build Weston with EGL support])
-	PKG_CHECK_MODULES(EGL, [egl >= 7.10 glesv2])
-fi
+COMPOSITOR_MODULES="wayland-server >= 1.3.90 pixman-1"
 
 AC_ARG_ENABLE(xkbcommon,
 	      AS_HELP_STRING([--disable-xkbcommon], [Disable libxkbcommon
@@ -472,21 +450,6 @@ if test "x$have_lcms" = xyes; then
 fi
 AM_CONDITIONAL(HAVE_LCMS, [test "x$have_lcms" = xyes])
 
-AC_PATH_PROG([wayland_scanner], [wayland-scanner])
-if test x$wayland_scanner = x; then
-	AC_MSG_ERROR([wayland-scanner is needed to compile weston])
-fi
-
-PKG_CHECK_MODULES(WAYLAND_SCANNER, wayland-scanner)
-AC_PATH_PROG(XMLLINT, xmllint)
-AC_ARG_WITH([dtddir],
-	    AS_HELP_STRING([--with-dtddir],
-			   [Directory containing the Wayland
-			    protocol DTD @<:@default=from pkgconfig@:>@]),
-	    [dtddir="$withval"],
-	    [dtddir=$($PKG_CONFIG --variable=pkgdatadir wayland-scanner)])
-AC_SUBST([dtddir])
-AM_CONDITIONAL([HAVE_XMLLINT], [test "x$XMLLINT" != "x" -a "x$dtddir" != "x"])
 
 AC_CONFIG_FILES([Makefile
 		 shared/Makefile
diff --git a/m4/common.m4 b/m4/common.m4
new file mode 100644
index 0000000..c7c7ed0
--- /dev/null
+++ b/m4/common.m4
@@ -0,0 +1,54 @@
+# Wayland protocol file scanner
+PKG_CHECK_MODULES(WAYLAND_SCANNER, [wayland-scanner])
+AC_ARG_VAR([wayland_scanner],[The wayland-scanner executable])
+AC_PATH_PROG([wayland_scanner], [wayland-scanner])
+if test x$wayland_scanner = x; then
+	AC_MSG_ERROR([wayland-scanner is needed to compile weston])
+fi
+
+AC_ARG_VAR([XMLLINT],[The xmllint executable])
+AC_PATH_PROG([XMLLINT], [xmllint])
+AC_ARG_WITH([dtddir],
+	    AS_HELP_STRING([--with-dtddir],
+			   [Directory containing the Wayland
+			    protocol DTD @<:@default=from pkgconfig@:>@]),,
+	    with_dtddir=yes)
+case "$with_dtddir" in
+	yes) dtddir=`$PKG_CONFIG --variable=pkgdatadir wayland-scanner` ;;
+	no) ;;
+	*) dtddir="$with_dtddir" ;;
+esac
+AC_SUBST([dtddir])
+AM_CONDITIONAL([HAVE_XMLLINT], [test -n "$XMLLINT" -a -n "$dtddir"])
+
+# System functions and features
+AC_SEARCH_LIBS([dlopen], [dl])
+case "$ac_cv_search_dlopen" in
+	"none required") ;;
+	no) AC_MSG_ERROR([dlopen support required for Weston]) ;;
+	*) DLOPEN_LIBS="$ac_cv_search_dlopen" ;;
+esac
+AC_SUBST(DLOPEN_LIBS)
+
+AC_CHECK_DECL(SFD_CLOEXEC,[],
+	      [AC_MSG_ERROR("SFD_CLOEXEC is needed to compile weston")],
+	      [[#include <sys/signalfd.h>]])
+AC_CHECK_DECL(TFD_CLOEXEC,[],
+	      [AC_MSG_ERROR("TFD_CLOEXEC is needed to compile weston")],
+	      [[#include <sys/timerfd.h>]])
+AC_CHECK_DECL(CLOCK_MONOTONIC,[],
+	      [AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile weston")],
+	      [[#include <time.h>]])
+AC_CHECK_HEADERS([execinfo.h])
+
+AC_CHECK_FUNCS([mkostemp strchrnul initgroups posix_fallocate])
+
+AC_ARG_ENABLE(egl,
+	      AS_HELP_STRING([--disable-egl],
+			     [Disable EGL support]),,
+              enable_egl=yes)
+AM_CONDITIONAL(ENABLE_EGL, test x$enable_egl = xyes)
+if test x$enable_egl = xyes; then
+	AC_DEFINE([ENABLE_EGL], [1], [Build Weston with EGL support])
+	PKG_CHECK_MODULES(EGL, [egl >= 7.10 glesv2])
+fi
-- 
1.8.4.3



More information about the wayland-devel mailing list