From: Jeremy Huddleston Date: Sun, 9 Oct 2011 10:53:05 +0000 (-0700) Subject: scanpci: Build fix for systems without X-Git-Tag: libpciaccess-0.12.902~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9c5ce8083be53ea017bd15a63b173b4476fff23;p=platform%2Fupstream%2Flibpciaccess.git scanpci: Build fix for systems without https://bugs.freedesktop.org/show_bug.cgi?id=31133 Signed-off-by: Jeremy Huddleston --- diff --git a/configure.ac b/configure.ac index 476a4bf..d622961 100644 --- a/configure.ac +++ b/configure.ac @@ -106,6 +106,8 @@ AM_CONDITIONAL(GNU, [test "x$gnu" = xyes]) AC_SYS_LARGEFILE +AC_CHECK_HEADERS([err.h]) + AC_CHECK_HEADER([asm/mtrr.h], [have_mtrr_h="yes"], [have_mtrr_h="no"]) if test "x$have_mtrr_h" = xyes; then diff --git a/scanpci/scanpci.c b/scanpci/scanpci.c index 36ecf04..219c814 100644 --- a/scanpci/scanpci.c +++ b/scanpci/scanpci.c @@ -22,11 +22,29 @@ * DEALINGS IN THE SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include -#include #include +#ifdef HAVE_ERR_H +#include +#else +# include +# include +# define err(exitcode, format, args...) \ + errx(exitcode, format ": %s", ## args, strerror(errno)) +# define errx(exitcode, format, args...) \ + { warnx(format, ## args); exit(exitcode); } +# define warn(format, args...) \ + warnx(format ": %s", ## args, strerror(errno)) +# define warnx(format, args...) \ + fprintf(stderr, format "\n", ## args) +#endif + #include "pciaccess.h"