[PATCH weston 1/4] build: make default backend configurable

Pekka Paalanen ppaalanen at gmail.com
Wed Nov 7 02:25:12 PST 2012


Instead of hardcoding drm-backend.so as the default if environment
presents neither Wayland nor X11, have a ./configure option to change
it. It still defaults to drm-backend.so, if not given.

Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
 configure.ac     |   10 ++++++++++
 man/Makefile.am  |    1 +
 man/weston.man   |    2 +-
 src/compositor.c |    2 +-
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 35a8097..20a16c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,9 @@ AC_PROG_SED
 LT_PREREQ([2.2])
 LT_INIT([disable-static])
 
+AC_ARG_VAR([WESTON_NATIVE_BACKEND],
+           [Set the native backend to use, if Weston is not running under Wayland nor X11. @<:@default=drm-backend.so@:>@])
+
 PKG_PROG_PKG_CONFIG()
 
 AC_CHECK_FUNC([dlopen], [],
@@ -249,6 +252,13 @@ fi
 AC_SUBST(GCC_CFLAGS)
 AC_SUBST(GCC_CXXFLAGS)
 
+if test "x$WESTON_NATIVE_BACKEND" = "x"; then
+	WESTON_NATIVE_BACKEND="drm-backend.so"
+fi
+AC_MSG_NOTICE([Weston's native backend: $WESTON_NATIVE_BACKEND])
+AC_DEFINE_UNQUOTED([WESTON_NATIVE_BACKEND], ["$WESTON_NATIVE_BACKEND"],
+		   [The default backend to load, if not wayland nor x11.])
+
 WAYLAND_SCANNER_RULES(['$(top_srcdir)/protocol'])
 
 AC_CONFIG_FILES([Makefile
diff --git a/man/Makefile.am b/man/Makefile.am
index 71d2073..4ff6bc7 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -1,6 +1,7 @@
 man_MANS = weston.1
 
 MAN_SUBSTS = \
+	-e 's|__weston_native_backend__|$(WESTON_NATIVE_BACKEND)|g' \
 	-e 's|__weston_modules_dir__|$(pkglibdir)|g' \
 	-e 's|__version__|$(PACKAGE_VERSION)|g'
 
diff --git a/man/weston.man b/man/weston.man
index 7ccfac8..efb6d2b 100644
--- a/man/weston.man
+++ b/man/weston.man
@@ -98,7 +98,7 @@ Load
 instead of the default backend. The file is searched for in
 .IR "__weston_modules_dir__" ,
 or you can pass an absolute path. The default backend is 
-.I drm-backend.so
+.I __weston_native_backend__
 unless the environment suggests otherwise, see
 .IR DISPLAY " and " WAYLAND_DISPLAY .
 .TP
diff --git a/src/compositor.c b/src/compositor.c
index 855203a..71006f9 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -3150,7 +3150,7 @@ int main(int argc, char *argv[])
 		else if (getenv("DISPLAY"))
 			backend = "x11-backend.so";
 		else
-			backend = "drm-backend.so";
+			backend = WESTON_NATIVE_BACKEND;
 	}
 
 	config_file = config_file_path("weston.ini");
-- 
1.7.8.6



More information about the wayland-devel mailing list