build: don't rely on files' presence to define the default backend.

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@flameeyes.eu>
Signed-off-by: Richard Hughes <richard@hughsie.com>
This commit is contained in:
Diego Elio Pettenò 2011-09-01 13:14:41 +02:00 committed by Richard Hughes
parent 785ecbb6d5
commit c08c35f762

View file

@ -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")