[upower PATCH] build: don't rely on files' presence to define the default backend.

Diego Elio Pettenò flameeyes at flameeyes.eu
Thu Sep 1 04:14:41 PDT 2011


Files might not be there, or in the case of cross-compilation, they most
definitely won't be there (and if they are, they are not the ones you
should be looking for). Instead use the autoconf-defined $host variable to
identify for what system we're building for.

Signed-off-by: Diego Elio Pettenò <flameeyes at flameeyes.eu>
---
 configure.ac |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9afd298..e3f2ccb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -173,16 +173,13 @@ AC_ARG_WITH([backend],
 	    AS_HELP_STRING([--with-backend=<option>],
 			   [Default backend to use linux, freebsd, openbsd, dummy (dummy)]))
 # default to a sane option
+AC_CANONICAL_HOST
 if test x$with_backend = x; then
-	if test -e /usr/include/gudev-1.0/gudev/gudev.h ; then
-		with_backend=linux
-	elif test -e /usr/include/dev/acpica/acpiio.h ; then
-	    	with_backend=freebsd
-	elif test -e /usr/include/machine/apmvar.h ; then
-	    	with_backend=openbsd
-	else
-		with_backend=dummy
-	fi
+	AS_CASE([$host],
+		[*-linux*],   [with_backend=linux],
+		[*-freebsd*], [with_backend=freebsd],
+		[*-openbsd*], [with_backedn=openbsd],
+		              [with_backend=dummy])
 fi
 AC_DEFINE_UNQUOTED(BACKEND, "$with_backend", [backend])
 AC_SUBST(BACKEND, "$with_backend")
-- 
1.7.6.1



More information about the devkit-devel mailing list