config: provide a makefile for scanpci dev tool

No function changes.

Note that automake generates a wrapper script if libpciaccess
is not installed at configuration time, which is the most common case.

If it is installed at configuration time, you get an executable.

The makefile build order ensures the lib is build before scanpci.

Reviewed-by: RĂ©mi Cardona <remi@gentoo.org>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
diff --git a/Makefile.am b/Makefile.am
index ff8db2f..31d20a0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,13 +24,14 @@
 # Include autoconf macros from m4 subdir
 ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = src
+# Order: scanpci depends on libpciaccess built in src
+SUBDIRS = src scanpci
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = pciaccess.pc
 
 MAINTAINERCLEANFILES = ChangeLog INSTALL
-EXTRA_DIST = src/scanpci.c src/scanpci.man 
+EXTRA_DIST = src/scanpci.man
 
 .PHONY: ChangeLog INSTALL
 
diff --git a/configure.ac b/configure.ac
index c0e1e9b..6980675 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,4 +124,5 @@
 
 AC_OUTPUT([Makefile
 	   src/Makefile
+	   scanpci/Makefile
            pciaccess.pc])
diff --git a/scanpci/.gitignore b/scanpci/.gitignore
new file mode 100644
index 0000000..485d4b9
--- /dev/null
+++ b/scanpci/.gitignore
@@ -0,0 +1 @@
+scanpci
diff --git a/scanpci/Makefile.am b/scanpci/Makefile.am
new file mode 100644
index 0000000..6fdf86e
--- /dev/null
+++ b/scanpci/Makefile.am
@@ -0,0 +1,29 @@
+#
+# (C) Copyright IBM Corporation 2006
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+# IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+noinst_PROGRAMS = scanpci
+
+AM_CPPFLAGS = -I$(top_srcdir)/include
+AM_LDFLAGS =  -L$(top_builddir)/src -lpciaccess
+
+scanpci_SOURCES = scanpci.c
diff --git a/src/scanpci.c b/scanpci/scanpci.c
similarity index 100%
rename from src/scanpci.c
rename to scanpci/scanpci.c
diff --git a/src/.gitignore b/src/.gitignore
deleted file mode 100644
index 5c8b286..0000000
--- a/src/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-#		Add & Override for this directory and it's subdirectories
-scanpci
diff --git a/src/Makefile.am b/src/Makefile.am
index 0ee8449..0d774e0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -77,7 +77,3 @@
 libpciaccessinclude_HEADERS = \
     $(top_srcdir)/include/pciaccess.h
 
-noinst_PROGRAMS = scanpci
-
-scanpci_SOURCES = scanpci.c
-scanpci_LDADD = libpciaccess.la