Submitter | Carl-Daniel Hailfinger |
---|---|
Date | 2010-02-26 14:01:25 |
Message ID | <4B87D435.20107@gmx.net> |
Download | mbox | patch |
Permalink | /patch/981/ |
State | Superseded |
Headers | show |
Comments
Am Freitag, den 26.02.2010, 15:01 +0100 schrieb Carl-Daniel Hailfinger: > Idwer reported problems with the current libpci check on > > FreeBSD 8.0-RELEASE i386 As I don't really know what the problem ist, I have to guess here. As I understand it, linking against -lpci without linking -lz at the same time yields a linker error on FreeBSD. > - @printf "Checking for libpci... " > + @printf "Checking for libpci (method 1)... " > @$(shell ( echo "#include <pci/pci.h>"; \ > echo "int main(int argc, char **argv)"; \ > echo "{ return 0; }"; ) > .test1.c ) > - @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test1.c -o .test1 -lpci $(LIBS) >/dev/null 2>&1 && \ > - echo "found." || ( echo "not found."; echo; \ > - echo "Please install libpci (package pciutils)."; \ > - echo "See README for more information."; echo; \ > - rm -f .test1.c .test1; exit 1) > + @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test1.c -o .test1 $(LIBS) >/dev/null 2>&1 && \ > + echo "found." || ( echo "not found."; \ This does not include "-lpci" anymore. It should succeed on every system where the include file pci/pci.h can be found. But that has already been checked on the previous check. The "--print-file-name" calls thus never seem to get executed. Regards, Michael Karcher
2010/2/26 Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> > Idwer reported problems with the current libpci check on > > FreeBSD 8.0-RELEASE i386 > > This is caused by a strict linker. Parsing linker error messages is an > exercise in futility, so I implemented fallback library detection with > $CC --print-file-name. > This fallback will fail on llvm-clang (llvm bug 5137), but such machines > hopefully have a more permissive linker and will never hit that code path. > The fallback will also fail on NetBSD where we should look for > libpciutils instead, but that hopefully doesn't have a strict linker > either. > > Side note: The configure checks in the Makefile are now so unwieldy that > a separate configure script will definitely improve readability. > > Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> > > Index: flashrom-libpci_robust_detection/Makefile > =================================================================== > --- flashrom-libpci_robust_detection/Makefile (Revision 916) > +++ flashrom-libpci_robust_detection/Makefile (Arbeitskopie) > @@ -251,21 +251,30 @@ > echo "Please install libpci headers (package > pciutils-devel)."; \ > echo "See README for more information."; echo; > \ > rm -f .test.c .test.o; exit 1) > - @printf "Checking for libpci... " > + @printf "Checking for libpci (method 1)... " > @$(shell ( echo "#include <pci/pci.h>"; \ > echo "int main(int argc, char **argv)"; \ > echo "{ return 0; }"; ) > .test1.c ) > - @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test1.c -o .test1 -lpci > $(LIBS) >/dev/null 2>&1 && \ > - echo "found." || ( echo "not found."; echo; > \ > - echo "Please install libpci (package pciutils)."; > \ > - echo "See README for more information."; echo; > \ > - rm -f .test1.c .test1; exit 1) > + @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test1.c -o .test1 $(LIBS) > >/dev/null 2>&1 && \ > + echo "found." || ( echo "not found."; \ > + $(CC) --print-file-name=libpci.so >/dev/null 2>&1 && ( > \ > + printf "Checking for dynamic libpci (method 2)... "; > \ > + $(CC) --print-file-name=libpci.so 2>/dev/null | grep -q / > && \ > + echo "found." || ( echo "not found."; > \ > + printf "Checking for static libpci (method 2)... " > \ > + $(CC) --print-file-name=libpci.a 2>/dev/null | grep -q / && > \ > + echo "found." || ( echo "not found."; echo; > \ > + echo "Please install libpci (package pciutils)."; > \ > + echo "See README for more information."; echo; > \ > + rm -f .test1.c .test1; exit 1) ) ) || ( echo > "unavailable."; echo; \ > + echo "Please install libpci (package pciutils)."; > \ > + echo "See README for more information."; echo; )) > @printf "Checking if libpci is sufficient... " > @printf "" > .libdeps > - @$(CC) $(LDFLAGS) .test.o -o .test -lpci $(LIBS) >/dev/null 2>&1 && > \ > + @$(CC) $(LDFLAGS) .test.o -o .test $(LIBS) >/dev/null 2>&1 && > \ > echo "yes." || ( echo "no."; > \ > printf "Checking if libz is present and supplies all needed > symbols..."; \ > - $(CC) $(LDFLAGS) .test.o -o .test -lpci -lz $(LIBS) > >/dev/null 2>&1 && \ > + $(CC) $(LDFLAGS) .test.o -o .test $(LIBS) -lz >/dev/null > 2>&1 && \ > ( echo "yes."; echo "NEEDLIBZ := yes" > .libdeps ) || ( echo > "no."; echo; \ > echo "Please install libz."; \ > echo "See README for more information."; echo; > \ > Acked-by: Idwer Vollering <vidwer@gmail.com> $ gmake Checking for a C compiler... found. Checking for libpci headers... found. Checking for libpci (method 1)... not found. Checking for dynamic libpci (method 2)... not found. not found. Please install libpci (package pciutils). See README for more information. unavailable. Please install libpci (package pciutils). See README for more information. Checking if libpci is sufficient... no. Checking if libz is present and supplies all needed symbols...yes. Checking for FTDI support... not found. cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o jedec.o -c jedec.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o stm50flw0x0x.o -c stm50flw0x0x.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o w39v040c.o -c w39v040c.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o w39v080fa.o -c w39v080fa.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o sharplhf00l04.o -c sharplhf00l04.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o w29ee011.o -c w29ee011.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o sst28sf040.o -c sst28sf040.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o m29f400bt.o -c m29f400bt.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o 82802ab.o -c 82802ab.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o pm49fl00x.o -c pm49fl00x.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o sst49lfxxxc.o -c sst49lfxxxc.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o sst_fwhub.o -c sst_fwhub.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o flashchips.o -c flashchips.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o spi.o -c spi.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o spi25.o -c spi25.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o flashrom.o -c flashrom.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o cli_classic.o -c cli_classic.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o cli_output.o -c cli_output.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o print.o -c print.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o udelay.o -c udelay.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o programmer.o -c programmer.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o chipset_enable.o -c chipset_enable.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o board_enable.o -c board_enable.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o cbtable.o -c cbtable.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o dmi.o -c dmi.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o it87spi.o -c it87spi.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o ichspi.o -c ichspi.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o sb600spi.o -c sb600spi.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o wbsio_spi.o -c wbsio_spi.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o internal.o -c internal.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o serprog.o -c serprog.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o nic3com.o -c nic3com.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o satasii.o -c satasii.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o ft2232_spi.o -c ft2232_spi.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o dummyflasher.o -c dummyflasher.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o drkaiser.o -c drkaiser.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o buspirate_spi.o -c buspirate_spi.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o pcidev.o -c pcidev.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o physmap.o -c physmap.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o hwaccess.o -c hwaccess.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o layout.o -c layout.c cc -Os -Wall -Werror -Wshadow -I/usr/local/include -D'INTERNAL_SUPPORT=1' -D'SERPROG_SUPPORT=1' -D'NIC3COM_SUPPORT=1' -D'SATASII_SUPPORT=1' -D'DUMMY_SUPPORT=1' -D'DRKAISER_SUPPORT=1' -D'BUSPIRATE_SPI_SUPPORT=1' -D'NEED_PCI=1' -D'FLASHROM_VERSION="0.9.1-r919"' -o serial.o -c serial.c cc -L/usr/local/lib -o flashrom jedec.o stm50flw0x0x.o w39v040c.o w39v080fa.o sharplhf00l04.o w29ee011.o sst28sf040.o m29f400bt.o 82802ab.o pm49fl00x.o sst49lfxxxc.o sst_fwhub.o flashchips.o spi.o spi25.o flashrom.o cli_classic.o cli_output.o print.o udelay.o programmer.o chipset_enable.o board_enable.o cbtable.o dmi.o it87spi.o ichspi.o sb600spi.o wbsio_spi.o internal.o serprog.o nic3com.o satasii.o ft2232_spi.o dummyflasher.o drkaiser.o buspirate_spi.o pcidev.o physmap.o hwaccess.o layout.o serial.o -lz -lpci > > > -- > "I do consider assignment statements and pointer variables to be among > computer science's most valuable treasures." > -- Donald E. Knuth > > > _______________________________________________ > flashrom mailing list > flashrom@flashrom.org > http://www.flashrom.org/mailman/listinfo/flashrom >
2010/2/27 Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de> > Am Freitag, den 26.02.2010, 15:01 +0100 schrieb Carl-Daniel Hailfinger: > > Idwer reported problems with the current libpci check on > > > > FreeBSD 8.0-RELEASE i386 > As I don't really know what the problem ist, I have to guess here. As I > understand it, linking against -lpci without linking -lz at the same > time yields a linker error on FreeBSD. > Correct. I worked around that by adding "-c" to line 258 of Makefile ( http://www.flashrom.org/trac/flashrom/browser/trunk/Makefile#L258 ); instructions are at http://flashrom.org/Downloads too. > > - @printf "Checking for libpci... " > > + @printf "Checking for libpci (method 1)... " > > @$(shell ( echo "#include <pci/pci.h>"; \ > > echo "int main(int argc, char **argv)"; \ > > echo "{ return 0; }"; ) > .test1.c ) > > - @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test1.c -o .test1 -lpci > $(LIBS) >/dev/null 2>&1 && \ > > - echo "found." || ( echo "not found."; echo; > \ > > - echo "Please install libpci (package pciutils)."; > \ > > - echo "See README for more information."; echo; > \ > > - rm -f .test1.c .test1; exit 1) > > + @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test1.c -o .test1 $(LIBS) > >/dev/null 2>&1 && \ > > + echo "found." || ( echo "not found."; \ > This does not include "-lpci" anymore. It should succeed on every system > where the include file pci/pci.h can be found. But that has already been > checked on the previous check. The "--print-file-name" calls thus never > seem to get executed. > > Regards, > Michael Karcher > > > _______________________________________________ > flashrom mailing list > flashrom@flashrom.org > http://www.flashrom.org/mailman/listinfo/flashrom >
Patch
Index: flashrom-libpci_robust_detection/Makefile =================================================================== --- flashrom-libpci_robust_detection/Makefile (Revision 916) +++ flashrom-libpci_robust_detection/Makefile (Arbeitskopie) @@ -251,21 +251,30 @@ echo "Please install libpci headers (package pciutils-devel)."; \ echo "See README for more information."; echo; \ rm -f .test.c .test.o; exit 1) - @printf "Checking for libpci... " + @printf "Checking for libpci (method 1)... " @$(shell ( echo "#include <pci/pci.h>"; \ echo "int main(int argc, char **argv)"; \ echo "{ return 0; }"; ) > .test1.c ) - @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test1.c -o .test1 -lpci $(LIBS) >/dev/null 2>&1 && \ - echo "found." || ( echo "not found."; echo; \ - echo "Please install libpci (package pciutils)."; \ - echo "See README for more information."; echo; \ - rm -f .test1.c .test1; exit 1) + @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test1.c -o .test1 $(LIBS) >/dev/null 2>&1 && \ + echo "found." || ( echo "not found."; \ + $(CC) --print-file-name=libpci.so >/dev/null 2>&1 && ( \ + printf "Checking for dynamic libpci (method 2)... "; \ + $(CC) --print-file-name=libpci.so 2>/dev/null | grep -q / && \ + echo "found." || ( echo "not found."; \ + printf "Checking for static libpci (method 2)... " \ + $(CC) --print-file-name=libpci.a 2>/dev/null | grep -q / && \ + echo "found." || ( echo "not found."; echo; \ + echo "Please install libpci (package pciutils)."; \ + echo "See README for more information."; echo; \ + rm -f .test1.c .test1; exit 1) ) ) || ( echo "unavailable."; echo; \ + echo "Please install libpci (package pciutils)."; \ + echo "See README for more information."; echo; )) @printf "Checking if libpci is sufficient... " @printf "" > .libdeps - @$(CC) $(LDFLAGS) .test.o -o .test -lpci $(LIBS) >/dev/null 2>&1 && \ + @$(CC) $(LDFLAGS) .test.o -o .test $(LIBS) >/dev/null 2>&1 && \ echo "yes." || ( echo "no."; \ printf "Checking if libz is present and supplies all needed symbols..."; \ - $(CC) $(LDFLAGS) .test.o -o .test -lpci -lz $(LIBS) >/dev/null 2>&1 && \ + $(CC) $(LDFLAGS) .test.o -o .test $(LIBS) -lz >/dev/null 2>&1 && \ ( echo "yes."; echo "NEEDLIBZ := yes" > .libdeps ) || ( echo "no."; echo; \ echo "Please install libz."; \ echo "See README for more information."; echo; \
Idwer reported problems with the current libpci check on FreeBSD 8.0-RELEASE i386 This is caused by a strict linker. Parsing linker error messages is an exercise in futility, so I implemented fallback library detection with $CC --print-file-name. This fallback will fail on llvm-clang (llvm bug 5137), but such machines hopefully have a more permissive linker and will never hit that code path. The fallback will also fail on NetBSD where we should look for libpciutils instead, but that hopefully doesn't have a strict linker either. Side note: The configure checks in the Makefile are now so unwieldy that a separate configure script will definitely improve readability. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>