From 660b803c1f6ba64ffe4e09fd5244d5c1fc3bdde6 Mon Sep 17 00:00:00 2001 From: Peter Lemenkov <lemenkov@gmail.com> Date: Fri, 17 Sep 2010 18:58:28 +0400 Subject: [PATCH 01/10] Initial commit of autotools-related files Signed-off-by: Peter Lemenkov <lemenkov@gmail.com> --- Makefile.am | 210 +++++++++++++++++++++++++++++++++++++++++++++++ bootstrap.sh | 5 + configure.ac | 258 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 473 insertions(+), 0 deletions(-) create mode 100644 Makefile.am create mode 100755 bootstrap.sh create mode 100644 configure.ac diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..06e76da --- /dev/null +++ b/Makefile.am @@ -0,0 +1,210 @@ +sbin_PROGRAMS = flashrom + +man_MANS = flashrom.8 + +# FIXME use "config.h" in the future +DEFS += -DFLASHROM_VERSION=\"@VERSION@\" + +if HAVE_SYS_UTSNAME +if HAVE_UNAME +DEFS += -DHAVE_UTSNAME=1 +endif +endif + +if HAVE_DMIDECODE +DEFS += -DDMIDECODE_PATH=\"@DMIDECODE@\" +else +DEFS += -DSTANDALONE +endif + + +if HAVE_INTERNAL +internal_SOURCES = \ + board_enable.c \ + cbtable.c \ + chipset_enable.c \ + dmi.c \ + internal.c \ + processor_enable.c +if HAVE_X86_ONLY_INTERNAL +internal_x86_only_SOURCES = \ + ich_descriptors.c \ + ichspi.c \ + it85spi.c \ + it87spi.c \ + mcp6x_spi.c \ + sb600spi.c \ + wbsio_spi.c +endif +DEFS += -DCONFIG_INTERNAL=1 +endif + +if HAVE_SERPROG +serprog_SOURCES = serprog.c +DEFS += -DCONFIG_SERPROG=1 +endif + +if HAVE_LINUX_SPI +linux_spi_SOURCES = linux_spi.c +DEFS += -DCONFIG_LINUX_SPI=1 +endif + +if HAVE_RAYER_SPI +rayer_spi_SOURCES = rayer_spi.c +DEFS += -DCONFIG_RAYER_SPI=1 +endif + +if HAVE_BITBANG_SPI +bitbang_spi_SOURCES = bitbang_spi.c +DEFS += -DCONFIG_BITBANG_SPI=1 +endif + +if HAVE_NIC3COM +nic3com_SOURCES = nic3com.c +DEFS += -DCONFIG_NIC3COM=1 +endif + +if HAVE_GFXNVIDIA +gfxnvidia_SOURCES = gfxnvidia.c +DEFS += -DCONFIG_GFXNVIDIA=1 +endif + +if HAVE_SATASII +satasii_SOURCES = satasii.c +DEFS += -DCONFIG_SATASII=1 +endif + +if HAVE_ATAHPT +atahpt_SOURCES = atahpt.c +DEFS += -DCONFIG_ATAHPT=1 +endif + +if HAVE_FT2232_SPI +ft_2232_spi_SOURCES = ft2232_spi.c +DEFS += -DCONFIG_FT2232_SPI=1 +endif + +if HAVE_DUMMY +dummy_SOURCES= dummyflasher.c +DEFS += -DCONFIG_DUMMY=1 +endif + +if HAVE_DRKAISER +drkaiser_SOURCES = drkaiser.c +DEFS += -DCONFIG_DRKAISER=1 +endif + +if HAVE_NICREALTEK +nicrealtek_SOURCES = nicrealtek.c +DEFS += -DCONFIG_NICREALTEK=1 +endif + +if HAVE_NICNATSEMI +nicnatsemi_SOURCES = nicnatsemi.c +DEFS += -DCONFIG_NICNATSEMI=1 +endif + +if HAVE_NICINTEL +nicintel_SOURCES = nicintel.c +DEFS += -DCONFIG_NICINTEL=1 +endif + +if HAVE_NICINTEL_SPI +nicintel_spi_SOURCES = nicintel_spi.c +DEFS += -DCONFIG_NICINTEL_SPI=1 +endif + +if HAVE_GFXOGP +gfxogp_SOURCES = ogp_spi.c +DEFS += -DCONFIG_OGP_SPI=1 +endif + +if HAVE_BUSPIRATE_SPI +buspirate_SOURCES = buspirate_spi.c +DEFS += -DCONFIG_BUSPIRATE_SPI=1 +endif + +if HAVE_DEDIPROG +dediprog_SOURCES = dediprog.c +DEFS += -DCONFIG_DEDIPROG=1 +endif + +if HAVE_SATAMV +satamv_SOURCES = satamv.c +DEFS += -DCONFIG_SATAMV=1 +endif + +if HAVE_SERIAL +serial_SOURCES = serial.c +endif + +if HAVE_PRINT_WIKI +print_wiki_SOURCES = print_wiki.c +DEFS += -DCONFIG_PRINT_WIKI=1 +endif + +if HAVE_PCI +pci_SOURCES = pcidev.c \ + physmap.c \ + hwaccess.c +DEFS += -DNEED_PCI=1 +endif + +chip_SOURCES = 82802ab.c \ + a25.c \ + at25.c \ + flashchips.c \ + jedec.c \ + m29f400bt.c \ + pm49fl00x.c \ + sharplhf00l04.c \ + spi.c \ + spi25.c \ + sst_fwhub.c \ + sst28sf040.c \ + sst49lfxxxc.c \ + stm50flw0x0x.c \ + w29ee011.c \ + w39.c + +cli_SOURCES = \ + flashrom.c \ + cli_classic.c \ + cli_output.c \ + print.c + +lib_SOURCES = layout.c + +# Unknown purpose +# sharplhf00l04.c + +flashrom_SOURCES = \ + programmer.c \ + udelay.c \ + $(internal_SOURCES) \ + $(internal_x86_only_SOURCES) \ + $(serprog_SOURCES) \ + $(linux_spi_SOURCES) \ + $(rayer_spi_SOURCES) \ + $(bitbang_spi_SOURCES) \ + $(nic3com_SOURCES) \ + $(gfxnvidia_SOURCES) \ + $(satasii_SOURCES) \ + $(atahpt_SOURCES) \ + $(ft_2232_spi_SOURCES) \ + $(dummy_SOURCES) \ + $(drkaiser_SOURCES) \ + $(nicrealtek_SOURCES) \ + $(nicnatsemi_SOURCES) \ + $(nicintel_SOURCES) \ + $(nicintel_spi_SOURCES) \ + $(gfxogp_SOURCES) \ + $(buspirate_SOURCES) \ + $(dediprog_SOURCES) \ + $(satamv_SOURCES) \ + $(serial_SOURCES) \ + $(print_wiki_SOURCES) \ + $(pci_SOURCES) \ + $(chip_SOURCES) \ + $(cli_SOURCES) \ + $(lib_SOURCES) diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..050fe4f --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,5 @@ +#!/bin/sh +aclocal --force +/usr/bin/autoconf --force +/usr/bin/autoheader --force +automake --add-missing --copy --force-missing diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..c5e89fe --- /dev/null +++ b/configure.ac @@ -0,0 +1,258 @@ +AC_INIT([flashrom], [0.9.4-r1455], [flashrom@flashrom.org], [flashrom], [http://www.flashrom.org/]) + +AC_PREREQ(2.59) + +AC_CANONICAL_TARGET + +AC_CONFIG_SRCDIR([flashrom.c]) +AC_CONFIG_HEADERS([config.h]) +AM_INIT_AUTOMAKE([foreign]) + +# Internal (mainboard) flashing +AC_ARG_WITH([internal], + AC_HELP_STRING([--with-internal],[mainboard internal flashing support.]), + [internal="$withval"],[internal="yes"]) + +# Needs to be disabled on Windows. +AC_ARG_WITH([serprog], + AC_HELP_STRING([--with-serprog],[serprog support.]), + [serprog="$withval"],[serprog="yes"]) + +AC_ARG_WITH([linux_spi], + AC_HELP_STRING([--with-linux-spi],[Linux SPI subsystem support.]), + [linux_spi="$withval"],[linux_spi="no"]) + +AC_ARG_WITH([rayer_spi], + AC_HELP_STRING([--with-rayer-spi],[RayeR SPIPGM hardware support.]), + [rayer_spi="$withval"],[rayer_spi="yes"]) + +AC_ARG_WITH([nic3com], + AC_HELP_STRING([--with-nic3com],[3Com NICs support.]), + [nic3com="$withval"],[nic3com="yes"]) + +AC_ARG_WITH([gfxnvidia], + AC_HELP_STRING([--with-gfxnvidia],[NVIDIA graphics cards support. Note: write and erase do not work properly.]), + [gfxnvidia="$withval"],[gfxnvidia="yes"]) + +AC_ARG_WITH([satasii], + AC_HELP_STRING([--with-satasii],[SiI SATA controllers support.]), + [satasii="$withval"],[satasii="yes"]) + +AC_ARG_WITH([atahpt], + AC_HELP_STRING([--with-atahpt],[Highpoint (HPT) ATA/RAID controller support. IMPORTANT: This code is not yet working!]), + [atahpt="$withval"],[atahpt="no"]) + +AC_ARG_WITH([ft2232_spi], + AC_HELP_STRING([--with-ft2232-spi],[FT2232 SPI dongles support.]), + [ft2232_spi="$withval"],[ft2232_spi="yes"]) + +AC_ARG_WITH([dummy], + AC_HELP_STRING([--with-dummy],[dummy flashing support.]), + [dummy="$withval"],[dummy="yes"]) + +AC_ARG_WITH([drkaiser], + AC_HELP_STRING([--with-drkaiser],[Dr. Kaiser support.]), + [drkaiser="$withval"],[drkaiser="yes"]) + +AC_ARG_WITH([nicrealtek], + AC_HELP_STRING([--with-nicrealtek],[Realtek NICs support.]), + [nicrealtek="$withval"],[nicrealtek="yes"]) + +AC_ARG_WITH([nicnatsemi], + AC_HELP_STRING([--with-nicnatsemi],[National Semiconductor NICs support. Incomplete and untested.]), + [nicnatsemi="$withval"],[nicnatsemi="no"]) + +AC_ARG_WITH([nicintel], + AC_HELP_STRING([--with-nicintel],[Intel NICs support.]), + [nicintel="$withval"],[nicintel="yes"]) + +AC_ARG_WITH([nicintel_spi], + AC_HELP_STRING([--with-nicintel-spi],[SPI on Intel NICs support.]), + [nicintel_spi="$withval"],[nicintel_spi="yes"]) + +AC_ARG_WITH([gfxogp], + AC_HELP_STRING([--with-gfxogp],[The Open Graphics Project graphics card support.]), + [gfxogp="$withval"],[gfxogp="yes"]) + +AC_ARG_WITH([buspirate_spi], + AC_HELP_STRING([--with-buspirate-spi],[Bus Pirate SPI support.]), + [buspirate_spi="$withval"],[buspirate_spi="yes"]) + +AC_ARG_WITH([dediprog], + AC_HELP_STRING([--with-dediprog],[Dediprog SF100 support. Incomplete and untested.]), + [dediprog="$withval"],[dediprog="no"]) + +AC_ARG_WITH([satamv], + AC_HELP_STRING([--with-satamv],[Marvell SATA controllers support.]), + [satamv="$withval"],[satamv="yes"]) + +# Specific for Flashrom Wiki +AC_ARG_WITH([print_wiki], + AC_HELP_STRING([--with-print-wiki],[enable wiki export support. It is only useful if you have Flashrom wiki access.]), + [print_wiki="$withval"],[print_wiki="no"]) + +AC_C_BIGENDIAN( + [AC_DEFINE([__FLASHROM_BIG_ENDIAN__], [1], [Big endian])], + [AC_DEFINE([__FLASHROM_LITTLE_ENDIAN__], [1], [Little endian])], + [AC_MSG_ERROR([Unknown endianness])], + [AC_MSG_ERROR([No support for universal binaries yet])] + ) + +# Check for CPU-specific features +case $target_cpu in + i386|i486|i586|i686|i786|x86_64) + if test "$internal" = 'yes'; then + enable_x86_only_internal="yes" + fi + ;; + mips*|power*) + if test "$nic3com" = 'yes'; then + AC_MSG_WARN([NIC 3Com is not supported for this target ($target_cpu). No PCI port I/O access on this architecture yet.]) + nic3com="no" + fi + if test "$nicnatsemi" = 'yes'; then + AC_MSG_WARN([NIC NatSemi is not supported for this target ($target_cpu). No PCI port I/O access on this architecture yet.]) + nicnatsemi="no" + fi + if test "$nicrealtek" = 'yes'; then + AC_MSG_WARN([NIC Realtek is not supported for this target ($target_cpu). No PCI port I/O access on this architecture yet.]) + nicrealtek="no" + fi + if test "$rayer_spi" = 'yes'; then + AC_MSG_WARN([RayeR SPIPGM is not supported for this target ($target_cpu). No PCI port I/O access on this architecture yet.]) + rayer_spi="no" + fi + if test "$satamv" = 'yes'; then + AC_MSG_WARN([Marvell SATA is not supported for this target ($target_cpu). No PCI port I/O access on this architecture yet]) + satamv="no" + fi + if test "$atahpt" = 'yes'; then + AC_MSG_WARN([Highpoint (HPT) ATA/RAID controller support is not supported for this target ($target_cpu). No PCI port I/O access on this architecture yet.]) + atahpt="no" + fi + ;; + *) + AC_MSG_ERROR([No support for this target ($target_cpu) yet]) + ;; +esac + +# Enable OS-specific compilation flags +# TODO + +# Check whether we need seial support +if test "$serprog" = 'yes' -o \ + "$buspirate_spi" = 'yes' ; then + serial="yes" +fi + +# Check whether we need PCI support +if test "$internal" = 'yes' -o \ + "$rayer_spi" = 'yes' -o \ + "$nic3com" = 'yes' -o \ + "$gfxnvidia" = 'yes' -o \ + "$satasii" = 'yes' -o \ + "$atahpt" = 'yes' -o \ + "$drkaiser" = 'yes' -o \ + "$nicrealtek" = 'yes' -o \ + "$nicnatsemi" = 'yes' -o \ + "$nicintel" = 'yes' -o \ + "$nicintel_spi" = 'yes' -o \ + "$gfxogp" = 'yes' -o \ + "$satamv" = 'yes' ; then + pci="yes" +fi + +if test "$rayer_spi" = 'yes' -o \ + "$internal" = 'yes' -o \ + "$nicintel_spi" = 'yes' -o \ + "$gfxogp" = 'yes' ; then + bitbang_spi="yes" +fi + +# Checks for programs. +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_MAKE_SET + +AC_PATH_PROG([DMIDECODE], dmidecode, [], [$PATH$PATH_SEPARATOR/usr/sbin]) + +# Checks for header files. +AC_CHECK_HEADERS([DirectIO/darwinio.h arpa/inet.h asm/sunddi.h fcntl.h inttypes.h limits.h machine/cpufunc.h machine/sysarch.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/io.h sys/ioctl.h sys/psw.h sys/socket.h sys/sysi86.h sys/time.h sys/utsname.h termios.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_INLINE +AC_TYPE_OFF_T +AC_TYPE_SIZE_T +AC_CHECK_SIZEOF(int) +dnl mingw (for instance) lacks ssize_t +AC_CHECK_TYPE(ssize_t, int) +AC_CHECK_TYPE(uint8_t, unsigned char) +AC_CHECK_TYPE(uint16_t, unsigned short) +AC_CHECK_TYPE(uint64_t, unsigned long long) +if test $ac_cv_sizeof_int -eq 4 ; then +AC_CHECK_TYPE(uint32_t, unsigned int) +elif test $ac_cv_size_long -eq 4 ; then +AC_CHECK_TYPE(uint32_t, unsigned long) +else +AC_MSG_ERROR([no 32-bit type found]) +fi + +# Checks for library functions. +AC_FUNC_MALLOC +AC_FUNC_MMAP +AC_FUNC_REALLOC +AC_CHECK_FUNCS([gethostbyaddr gethostbyname getpagesize gettimeofday memmove memset munmap socket strcasecmp strchr strcspn strdup strerror strncasecmp strspn strstr strtol strtoul uname]) + +# Checks for pcilib +if test "$pci" = 'yes' ; then + AC_CHECK_LIB([pci], [pci_alloc],,[AC_MSG_ERROR([pci library missing])]) +fi + +# check for socket (required for SunOS) +if test "$serprog" = 'yes' ; then + AC_CHECK_LIB([socket], [socket]) +fi + +# Check for libusb +if test "$dediprog" = 'yes' -o "$ft2232_spi" = 'yes' ; then + AC_CHECK_LIB([usb], [usb_init]) +fi + +if test "$ft2232_spi" = 'yes' ; then +# AC_CHECK_LIB([ftdi],[main],,[AC_MSG_ERROR([ftdi library missing which is required for ft2232-spi])]) + AC_CHECK_LIB([ftdi],[main],,[ft2232_spi="no"]) +fi + +# For Makefile.am +AM_CONDITIONAL(HAVE_INTERNAL, test "$internal" = "yes") +AM_CONDITIONAL(HAVE_DMIDECODE, test "$DMIDECODE" != "") +AM_CONDITIONAL(HAVE_X86_ONLY_INTERNAL, test "$enable_x86_only_internal" = "yes") +AM_CONDITIONAL(HAVE_SERPROG, test "$serprog" = "yes") +AM_CONDITIONAL(HAVE_LINUX_SPI, test "$linux_spi" = "yes") +AM_CONDITIONAL(HAVE_RAYER_SPI, test "$rayer_spi" = "yes") +AM_CONDITIONAL(HAVE_BITBANG_SPI, test "$bitbang_spi" = "yes") +AM_CONDITIONAL(HAVE_NIC3COM, test "$nic3com" = "yes") +AM_CONDITIONAL(HAVE_GFXNVIDIA, test "$gfxnvidia" = "yes") +AM_CONDITIONAL(HAVE_SATASII, test "$satasii" = "yes") +AM_CONDITIONAL(HAVE_ATAHPT, test "$atahpt" = "yes") +AM_CONDITIONAL(HAVE_FT2232_SPI, test "$ft2232_spi" = "yes") +AM_CONDITIONAL(HAVE_DUMMY, test "$dummy" = "yes") +AM_CONDITIONAL(HAVE_DRKAISER, test "$drkaiser" = "yes") +AM_CONDITIONAL(HAVE_NICREALTEK, test "$nicrealtek" = "yes") +AM_CONDITIONAL(HAVE_NICNATSEMI, test "$nicnatsemi" = "yes") +AM_CONDITIONAL(HAVE_NICINTEL, test "$nicintel" = "yes") +AM_CONDITIONAL(HAVE_NICINTEL_SPI, test "$nicintel_spi" = "yes") +AM_CONDITIONAL(HAVE_GFXOGP, test "$gfxogp" = "yes") +AM_CONDITIONAL(HAVE_BUSPIRATE_SPI, test "$buspirate_spi" = "yes") +AM_CONDITIONAL(HAVE_DEDIPROG, test "$dediprog" = "yes") +AM_CONDITIONAL(HAVE_SATAMV, test "$satamv" = "yes") +AM_CONDITIONAL(HAVE_SERIAL, test "$serial" = "yes") +AM_CONDITIONAL(HAVE_PCI, test "$pci" = "yes") +AM_CONDITIONAL(HAVE_PRINT_WIKI, test "$print_wiki" = "yes") + +# FIXME remove in the future +AM_CONDITIONAL(HAVE_SYS_UTSNAME, test "$ac_cv_header_sys_utsname_h" = "yes") +AM_CONDITIONAL(HAVE_UNAME, test "$ac_cv_func_uname" = "yes") + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT -- 1.7.6.4