diff options
author | Chris Dickens <christopher.a.dickens@gmail.com> | 2020-03-30 12:28:11 -0700 |
---|---|---|
committer | Chris Dickens <christopher.a.dickens@gmail.com> | 2020-03-30 12:28:11 -0700 |
commit | 9a1bc8cafb904c20a869c74ad6d657686a1c4bb1 (patch) | |
tree | 1c6a0b258c047f83a45aa383337f63b4e85b6682 /examples | |
parent | 0c6c072733a5a2177ffc24d2614ee1151a39f02f (diff) | |
download | libusb-9a1bc8cafb904c20a869c74ad6d657686a1c4bb1.tar.gz |
build: Require C11 to build and clean up autoconfig/automake files
C11 compiler support has been available for many years now. It is not
unreasonable to require this now, and doing so allows some cleanup to
the configure script. It is no longer necessary to check for compiler
support of the '-fvibility' flag because any compiler that supports C11
will support this flag as well.
Fix up the way that compiler and linker flags are passed down to the
various makefiles. The compiler flags should be shared by all, but the
linker flags and libraries should be separated between the library and
the examples/tests. The visibility flag is only relevant for the
library and the thread flags are only relevant for sources using thread
constructs, so provide them as needed.
Rearrange configure.ac to group similar functionality and consolidate
where possible.
Based on these changes, update the Travis configuration file to include
newer versions of test platforms to ensure proper C11 compiler support.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Makefile.am | 13 | ||||
-rwxr-xr-x | examples/testlibusb.c | 8 |
2 files changed, 10 insertions, 11 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am index 6185d00..2658490 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,19 +1,18 @@ AM_CPPFLAGS = -I$(top_srcdir)/libusb LDADD = ../libusb/libusb-1.0.la +LIBS = -noinst_PROGRAMS = listdevs xusb fxload hotplugtest testlibusb +noinst_PROGRAMS = fxload hotplugtest listdevs testlibusb xusb + +fxload_SOURCES = ezusb.c ezusb.h fxload.c if HAVE_SIGACTION noinst_PROGRAMS += dpfp - if THREADS_POSIX -dpfp_threaded_CFLAGS = $(AM_CFLAGS) noinst_PROGRAMS += dpfp_threaded +dpfp_threaded_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS) +dpfp_threaded_LDADD = $(LDADD) $(THREAD_LIBS) endif -sam3u_benchmark_SOURCES = sam3u_benchmark.c noinst_PROGRAMS += sam3u_benchmark endif - -fxload_SOURCES = ezusb.c ezusb.h fxload.c -fxload_CFLAGS = $(THREAD_CFLAGS) $(AM_CFLAGS) diff --git a/examples/testlibusb.c b/examples/testlibusb.c index a6bb15a..8031e75 100755 --- a/examples/testlibusb.c +++ b/examples/testlibusb.c @@ -164,7 +164,7 @@ static void print_device(libusb_device *dev) { struct libusb_device_descriptor desc; libusb_device_handle *handle = NULL; - char string[256]; + unsigned char string[256]; int ret; uint8_t i; @@ -183,19 +183,19 @@ static void print_device(libusb_device *dev) if (desc.iManufacturer) { ret = libusb_get_string_descriptor_ascii(handle, desc.iManufacturer, string, sizeof(string)); if (ret > 0) - printf(" Manufacturer: %s\n", string); + printf(" Manufacturer: %s\n", (char *)string); } if (desc.iProduct) { ret = libusb_get_string_descriptor_ascii(handle, desc.iProduct, string, sizeof(string)); if (ret > 0) - printf(" Product: %s\n", string); + printf(" Product: %s\n", (char *)string); } if (desc.iSerialNumber && verbose) { ret = libusb_get_string_descriptor_ascii(handle, desc.iSerialNumber, string, sizeof(string)); if (ret > 0) - printf(" Serial Number: %s\n", string); + printf(" Serial Number: %s\n", (char *)string); } } |