Omair Eshkenazi has reported that libpci fails to build with gcc 3.x.
We require gcc 4.x for building shared libraries, but it should not
be needed when SHARED=no.
This patch changes internal.h to define PCI_ABI as the visibility
attribute only if we build a shared library.
However, this means that we need to know the configuration settings
before we include pci.h, so I had to include config.h explicitly
from internal.h and create a new symbol PCI_CONFIG_H to check whether
config.h has been already included.
c=config.h
m=config.mk
+echo >$c '#define PCI_CONFIG_H'
echo >$c "#define PCI_ARCH_`echo $cpu | tr '[a-z]' '[A-Z]'`"
echo >>$c "#define PCI_OS_`echo $sys | tr '[a-z]' '[A-Z]'`"
echo >$m 'WITH_LIBS='
# We link the dependencies _to_ the library, so we do not need explicit deps in .pc
echo >>$m 'LDLIBS='
echo >>$m 'LIB_LDLIBS=$(WITH_LIBS)'
+ echo >>$c '#define PCI_SHARED_LIB'
if [ "$SHARED" = yes ] ; then
echo >>$m 'SONAME=-Wl,-soname,$(LIBNAME).so$(ABI_VERSION)'
fi
* Can be freely distributed and used under the terms of the GNU GPL.
*/
-#ifdef __GNUC__
+#include "config.h"
+
+#ifdef PCI_SHARED_LIB
#define PCI_ABI __attribute__((visibility("default")))
#endif
#ifndef _PCI_LIB_H
#define _PCI_LIB_H
+#ifndef PCI_CONFIG_H
#include "config.h"
+#endif
+
#include "header.h"
#include "types.h"