@@ -167,6 +167,7 @@ AC_CHECK_LIB([readline], [readline], [dnl
167167AH_TEMPLATE ( [ HAVE_LIBELF] ,
168168 [ Define if ELF support is enabled via libelf] )
169169AC_CHECK_LIB ( [ elf] , [ elf_getshdrstrndx] , [ have_libelf=yes] )
170+ LIBELF=""
170171if test "x$have_libelf" = xyes; then
171172 case $target in
172173 *)
@@ -176,13 +177,14 @@ if test "x$have_libelf" = xyes; then
176177 AC_DEFINE ( [ HAVE_LIBELF] )
177178 AC_CHECK_HEADERS ( [ libelf.h libelf/libelf.h] )
178179fi
179- AC_SUBST ( LIBELF , $LIBELF )
180+ AC_SUBST ( [ LIBELF] )
180181
181182AC_SEARCH_LIBS ( [ gethostent] , [ nsl] )
182183AC_SEARCH_LIBS ( [ setsockopt] , [ socket] )
183184AH_TEMPLATE ( [ HAVE_LIBUSB] ,
184185 [ Define if USB support is enabled via libusb] )
185186AC_CHECK_LIB ( [ usb] , [ usb_get_string_simple] , [ have_libusb=yes] )
187+ LIBUSB=""
186188if test "x$have_libusb" = xyes; then
187189 case $target in
188190 *-*-darwin*)
@@ -196,7 +198,7 @@ if test "x$have_libusb" = xyes; then
196198 AC_CHECK_HEADERS ( [ usb.h] )
197199 AC_CHECK_HEADERS ( [ lusb0_usb.h] )
198200fi
199- AC_SUBST ( LIBUSB , $LIBUSB )
201+ AC_SUBST ( [ LIBUSB] )
200202
201203AC_ARG_ENABLE (
202204 [ libusb_1_0] ,
@@ -205,13 +207,15 @@ AC_ARG_ENABLE(
205207 [ case "${enableval}" in
206208 yes) enabled_libusb_1_0=yes ;;
207209 no) enabled_libusb_1_0=no ;;
208- *) AC_MSG_ERROR ( bad value ${enableval} for enable-libusb_1_0 option ) ;;
210+ *) AC_MSG_ERROR ( [ bad value ${enableval} for enable-libusb_1_0 option] ) ;;
209211 esac] ,
210212 [ enabled_libusb_1_0=yes] )
211213
214+ have_libusb_1_0=no
212215AH_TEMPLATE ( [ HAVE_LIBUSB_1_0] ,
213216 [ Define if USB support is enabled via libusb 1.0] )
214217AC_CHECK_LIB ( [ usb-1.0] , [ libusb_init] , [ have_libusb_1_0=yes] )
218+ LIBUSB_1_0=""
215219if test "x$have_libusb_1_0" = xyes && test "x$enabled_libusb_1_0" = xyes; then
216220 case $target in
217221 *-*-darwin*)
@@ -245,11 +249,13 @@ if test "x$have_libusb_1_0" = xyes && test "x$enabled_libusb_1_0" = xyes; then
245249 AC_DEFINE ( [ HAVE_LIBUSB_1_0] )
246250 AC_CHECK_HEADERS ( [ libusb.h] )
247251fi
248- AC_SUBST ( LIBUSB_1_0 , $LIBUSB_1_0 )
252+ AC_SUBST ( [ LIBUSB_1_0] )
249253
250254AH_TEMPLATE ( [ HAVE_LIBHIDAPI] ,
251255 [ Define if HID support is enabled via libhidapi] )
252- AC_SEARCH_LIBS ( [ hid_init] , [ hidapi hidapi-libusb hidapi-hidraw] , [ have_libhidapi=yes] )
256+ AC_SEARCH_LIBS ( [ hid_init] , [ hidapi hidapi-libusb hidapi-hidraw] ,
257+ [ have_libhidapi=yes] , [ have_libhidapi=no] )
258+ LIBHIDAPI=""
253259if test "x$have_libhidapi" = xyes; then
254260 case $target in
255261 *-*-darwin*)
@@ -262,11 +268,13 @@ if test "x$have_libhidapi" = xyes; then
262268 AC_DEFINE ( [ HAVE_LIBHIDAPI] )
263269 AC_CHECK_HEADERS ( [ hidapi/hidapi.h] )
264270fi
265- AC_SUBST ( LIBHIDAPI , $LIBHIDAPI )
271+ AC_SUBST ( [ LIBHIDAPI] )
266272
267273AH_TEMPLATE ( [ HAVE_LIBSERIALPORT] ,
268274 [ Define if libserialport is found] )
269- AC_CHECK_LIB ( [ serialport] , [ sp_open] , [ have_libserialport=yes] )
275+ AC_CHECK_LIB ( [ serialport] , [ sp_open] ,
276+ [ have_libserialport=yes] , [ have_libserialport=no] )
277+ LIBSERIALPORT=""
270278if test "x$have_libserialport" = xyes; then
271279 case $target in
272280 *)
@@ -276,40 +284,50 @@ if test "x$have_libserialport" = xyes; then
276284 AC_DEFINE ( [ HAVE_LIBSERIALPORT] )
277285 AC_CHECK_HEADERS ( [ libserialport.h] )
278286fi
279- AC_SUBST ( LIBSERIALPORT , $LIBSERIALPORT )
287+ AC_SUBST ( [ LIBSERIALPORT] )
280288
281289AH_TEMPLATE ( [ HAVE_LIBFTDI1] ,
282290 [ Define if FTDI support is enabled via libftdi1] )
283291AH_TEMPLATE ( [ HAVE_LIBFTDI] ,
284292 [ Define if FTDI support is enabled via libftdi] )
285293AH_TEMPLATE ( [ HAVE_LIBFTDI_TYPE_232H] ,
286294 [ Define if libftdi supports FT232H, libftdi version >= 0.20] )
287- AC_CHECK_LIB ( [ ftdi1] , [ ftdi_new] , [ have_libftdi1=yes] , [ ] , [ $LIBUSB_1_0] )
288- AC_CHECK_LIB ( [ ftdi] , [ ftdi_usb_get_strings] , [ have_libftdi=yes] , [ ] , [ -lusb] )
295+ AC_CHECK_LIB ( [ ftdi1] , [ ftdi_new] ,
296+ [ have_libftdi1=yes] , [ have_libftdi1=no] , [ $LIBUSB_1_0] )
297+ AC_CHECK_LIB ( [ ftdi] , [ ftdi_usb_get_strings] ,
298+ [ have_libftdi=yes] , [ have_libftdi=no] , [ -lusb] )
299+ LIBFTDI=""
300+ LIBFTDI1=""
289301if test "x$have_libftdi1" = xyes; then
290302 LIBFTDI1="-lftdi1"
291303 AC_DEFINE ( [ HAVE_LIBFTDI1] )
292- AC_SUBST ( LIBFTDI1 , $LIBFTDI1 )
304+ AC_SUBST ( [ LIBFTDI1] )
293305 LIBS="${LIBS} ${LIBFTDI1}"
294- AC_CHECK_FUNCS ( ftdi_tcioflush )
306+ AC_CHECK_FUNCS ( [ ftdi_tcioflush] )
295307else
296308 if test "x$have_libftdi" = xyes; then
297309 LIBFTDI="-lftdi -lusb"
298310 AC_DEFINE ( [ HAVE_LIBFTDI] )
299- AC_SUBST ( LIBFTDI , $LIBFTDI )
300- AC_CHECK_DECL ( TYPE_232H ,[ have_libftdi_FT232H=yes] , [ ] , [ [ #include <ftdi.h>] ] )
311+ AC_SUBST ( [ LIBFTDI] )
312+ AC_CHECK_DECL ( [ TYPE_232H] ,
313+ [ have_libftdi_FT232H=yes] ,
314+ [ have_libftdi_FT232H=no] ,
315+ [ [ #include <ftdi.h>] ] )
301316 if test "x$have_libftdi_FT232H" = xyes; then
302317 AC_DEFINE ( [ HAVE_LIBFTDI_TYPE_232H] )
303318 fi
304319 fi
305320fi
321+
306322AC_CHECK_HEADERS ( [ pthread.h] )
307- # as there exits header file only pthread implementations for Windows, check if we have a library
308- AC_CHECK_LIB ( [ pthread] , [ pthread_create] , [ have_pthread=yes] )
323+ # as there exist header file only pthread implementations for Windows, check if we have a library
324+ AC_CHECK_LIB ( [ pthread] , [ pthread_create] , [ have_pthread=yes] , [ have_pthread=no] )
325+ LIBPTHREAD=""
309326if test "x$have_pthread" = xyes; then
310327 LIBPTHREAD="-lpthread"
311328fi
312- AC_SUBST ( LIBPTHREAD , $LIBPTHREAD )
329+ AC_SUBST ( [ LIBPTHREAD] )
330+
313331# Checks for header files.
314332AC_CHECK_HEADERS ( [ limits.h stdlib.h string.h] )
315333AC_CHECK_HEADERS ( [ fcntl.h sys/ioctl.h sys/time.h termios.h unistd.h] )
@@ -328,6 +346,8 @@ AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strt
328346
329347AC_MSG_CHECKING ( [ for a Win32 HID library] )
330348SAVED_LIBS="${LIBS}"
349+ LIBHID=""
350+ HIDINCLUDE=""
331351case $target in
332352 *-*-mingw32* | *-*-cygwin* | *-*-windows*)
333353 LIBHID="-lhid -lsetupapi"
359379 LIBHID=""
360380fi
361381LIBS="${SAVED_LIBS}"
362- AC_SUBST ( LIBHID , $LIBHID )
382+ AC_SUBST ( [ LIBHID] )
363383
364384# Check for types
365385
@@ -377,7 +397,7 @@ AC_ARG_ENABLE(
377397 [ case "${enableval}" in
378398 yes) versioned_doc=yes ;;
379399 no) versioned_doc=no ;;
380- *) AC_MSG_ERROR ( bad value ${enableval} for versioned-doc option ) ;;
400+ *) AC_MSG_ERROR ( [ bad value ${enableval} for versioned-doc option] ) ;;
381401 esac] ,
382402 [ versioned_doc=yes] )
383403
@@ -386,6 +406,7 @@ if test "x$versioned_doc" = "xyes"; then
386406else
387407 DOC_INST_DIR='$(DESTDIR)$(datadir)/doc/avrdude'
388408fi
409+ AC_SUBST ( [ DOC_INST_DIR] )
389410
390411AC_ARG_ENABLE (
391412 [ doc] ,
@@ -394,7 +415,7 @@ AC_ARG_ENABLE(
394415 [ case "${enableval}" in
395416 yes) enabled_doc=yes ;;
396417 no) enabled_doc=no ;;
397- *) AC_MSG_ERROR ( bad value ${enableval} for disable-doc option ) ;;
418+ *) AC_MSG_ERROR ( [ bad value ${enableval} for disable-doc option] ) ;;
398419 esac] ,
399420 [ enabled_doc=no] )
400421
@@ -405,18 +426,18 @@ AC_ARG_ENABLE(
405426 [ case "${enableval}" in
406427 yes) enabled_parport=yes ;;
407428 no) enabled_parport=no ;;
408- *) AC_MSG_ERROR ( bad value ${enableval} for enable-parport option ) ;;
429+ *) AC_MSG_ERROR ( [ bad value ${enableval} for enable-parport option] ) ;;
409430 esac] ,
410431 [ enabled_parport=no] )
411-
432+
412433AC_ARG_ENABLE (
413434 [ linuxgpio] ,
414435 AS_HELP_STRING ( [ --enable-linuxgpio] ,
415436 [ Enable the Linux sysfs GPIO interface programmer type] ) ,
416437 [ case "${enableval}" in
417438 yes) enabled_linuxgpio=yes ;;
418439 no) enabled_linuxgpio=no ;;
419- *) AC_MSG_ERROR ( bad value ${enableval} for enable-linuxgpio option ) ;;
440+ *) AC_MSG_ERROR ( [ bad value ${enableval} for enable-linuxgpio option] ) ;;
420441 esac] ,
421442 [ enabled_linuxgpio=no] )
422443
@@ -427,21 +448,18 @@ AC_ARG_ENABLE(
427448 [ case "${enableval}" in
428449 yes) enabled_linuxspi=yes ;;
429450 no) enabled_linuxspi=no ;;
430- *) AC_MSG_ERROR ( bad value ${enableval} for enable-linuxspi option ) ;;
451+ *) AC_MSG_ERROR ( [ bad value ${enableval} for enable-linuxspi option] ) ;;
431452 esac] ,
432453 [ enabled_linuxspi=no] )
433454
434- DIST_SUBDIRS_AC=' doc'
455+ AC_SUBST ( [ DIST_SUBDIRS_AC] , [ doc] )
435456
436457if test "x$enabled_doc" = xyes; then
437458 SUBDIRS_AC='doc'
438459else
439460 SUBDIRS_AC=''
440461fi
441-
442- AC_SUBST ( DOC_INST_DIR , $DOC_INST_DIR )
443- AC_SUBST ( SUBDIRS_AC , $SUBDIRS_AC )
444- AC_SUBST ( DIST_SUBDIRS_AC , $DIST_SUBDIRS_AC )
462+ AC_SUBST ( [ SUBDIRS_AC] )
445463
446464
447465# Find the parallel serial device files based on target system
@@ -492,15 +510,15 @@ if test "x$enabled_parport" = xyes; then
492510 else
493511 AC_MSG_RESULT ( [ $DEFAULT_PAR_PORT] )
494512 fi
495- AC_SUBST ( DEFAULT_PAR_PORT , $DEFAULT_PAR_PORT )
513+ AC_SUBST ( [ DEFAULT_PAR_PORT] )
496514fi
497515
498516AC_MSG_CHECKING ( [ for serial device] )
499517AC_MSG_RESULT ( [ $DEFAULT_SER_PORT] )
500- AC_SUBST ( DEFAULT_SER_PORT , $DEFAULT_SER_PORT )
518+ AC_SUBST ( [ DEFAULT_SER_PORT] )
501519
502520if test "x$enabled_parport" = xyes; then
503- AC_DEFINE ( HAVE_PARPORT , 1 , [ parallel port access enabled] )
521+ AC_DEFINE ( [ HAVE_PARPORT] , [ 1 ] , [ parallel port access enabled] )
504522 confsubst="-e /^@HAVE_PARPORT_/d"
505523else
506524 confsubst="-e /^@HAVE_PARPORT_BEGIN@/,/^@HAVE_PARPORT_END@/d"
@@ -515,26 +533,27 @@ if test "x$enabled_linuxgpio" = xyes; then
515533 else
516534 AC_MSG_RESULT ( [ $DEFAULT_LINUXGPIO_PORT] )
517535 fi
518- AC_SUBST ( DEFAULT_LINUXGPIO_PORT , $DEFAULT_LINUXGPIO_PORT )
536+ AC_SUBST ( [ DEFAULT_LINUXGPIO_PORT] )
519537fi
520538
521539if test "x$enabled_linuxgpio" = xyes; then
522- AC_DEFINE ( HAVE_LINUXGPIO , 1 , [ Linux sysfs GPIO support enabled] )
540+ AC_DEFINE ( [ HAVE_LINUXGPIO] , [ 1 ] , [ Linux sysfs GPIO support enabled] )
523541 confsubst="$confsubst -e /^@HAVE_LINUXGPIO_/d"
524542else
525543 confsubst="$confsubst -e /^@HAVE_LINUXGPIO_BEGIN@/,/^@HAVE_LINUXGPIO_END@/d"
526544fi
527545
528546
529547if test "x$enabled_linuxspi" = xyes; then
530- AC_DEFINE ( HAVE_LINUXSPI , 1 , [ Linux SPI support enabled] )
548+ AC_DEFINE ( [ HAVE_LINUXSPI] , [ 1 ] , [ Linux SPI support enabled] )
531549 confsubst="$confsubst -e /^@HAVE_LINUXSPI_/d"
532550else
533551 confsubst="$confsubst -e /^@HAVE_LINUXSPI_BEGIN@/,/^@HAVE_LINUXSPI_END@/d"
534552fi
535553
536554
537555# If we are compiling with gcc, enable all warnings and make warnings errors.
556+ ENABLE_WARNINGS=""
538557if test "x$GCC" = xyes; then
539558 ENABLE_WARNINGS="-Wall -Wextra -Wno-unused-parameter"
540559
@@ -559,7 +578,7 @@ if test "x$GCC" = xyes; then
559578 ENABLE_WARNINGS="$ENABLE_WARNINGS -Wno-pointer-sign"
560579 fi
561580fi
562- AC_SUBST ( ENABLE_WARNINGS , $ENABLE_WARNINGS )
581+ AC_SUBST ( [ ENABLE_WARNINGS] )
563582
564583# See if we need to drop into the windows subdir.
565584case $target in
0 commit comments