From 1079bc1acf65eb9cbbc8126831e498b14278d360 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 13 Oct 2021 00:23:44 +0200 Subject: [PATCH 01/11] Replace obsolete AC_TRY_LINK with AC_LINK_IFELSE --- libgphoto2_port/configure.ac | 10 ++++-- libgphoto2_port/gphoto-m4/gp-va-copy.m4 | 47 ++++++++++++++----------- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index 9dd7fcbaac..0ab43c9ec5 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -307,7 +307,10 @@ if $try_ttylock; then AC_CHECK_HEADER([lockdev.h]) AC_CHECK_HEADER([ttylock.h], [dnl lockdev_result="no" - AC_TRY_LINK([#include ],[ttylocked ("/dev/foo");],[ + AC_LINK_IFELSE([dnl + AC_LANG_PROGRAM([[#include + ]], [[ttylocked("/dev/foo");]]) + ], [dnl lockdev_result="no" AC_DEFINE([HAVE_TTYLOCK], [1], [Define if you have ttylock based tty locking.]) @@ -315,7 +318,10 @@ if $try_ttylock; then try_lockdev=false, save_LIBS="$LIBS" LIBS="$LIBS -llockdev" - AC_TRY_LINK([#include ],[ttylocked ("/dev/foo");],[ + AC_LINK_IFELSE([dnl + AC_LANG_PROGRAM([[#include + ]], [[ttylocked ("/dev/foo");]]) + ], [dnl lockdev_result="yes" AC_DEFINE([HAVE_TTYLOCK], [1], [Define if you have ttylock based tty locking.]) diff --git a/libgphoto2_port/gphoto-m4/gp-va-copy.m4 b/libgphoto2_port/gphoto-m4/gp-va-copy.m4 index 0ae17f39a0..2a7714ddab 100644 --- a/libgphoto2_port/gphoto-m4/gp-va-copy.m4 +++ b/libgphoto2_port/gphoto-m4/gp-va-copy.m4 @@ -23,38 +23,43 @@ dnl #endif dnl AC_DEFUN([GP_VA_COPY],[dnl dnl -AC_CHECK_HEADER([stdarg.h],[],[ +AC_CHECK_HEADER([stdarg.h], [], [dnl AC_MSG_ERROR([ Building $PACKAGE_NAME requires . ]) ]) dnl have_va_copy=no -AC_TRY_LINK([ - #include -],[ - va_list a,b; - va_copy(a,b); -],[ - have_va_copy="va_copy" -],[ - AC_TRY_LINK([ - #include - ],[ - va_list a,b; - __va_copy(a,b); - ],[ - have_va_copy="__va_copy" - AC_DEFINE([va_copy],[__va_copy],[__va_copy() was the originally proposed name]) - ]) +AS_VAR_IF([have_va_copy], [no], [dnl + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[#include ]], [[ + va_list a,b; + va_copy(a,b); + ]]) + ], [dnl + have_va_copy="va_copy" + ]) +]) +AS_VAR_IF([have_va_copy], [no], [dnl + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[#include ]], [[ + va_list a,b; + __va_copy(a,b); + ]]) + ], [dnl + have_va_copy="__va_copy" + AC_DEFINE([va_copy], [__va_copy], + [__va_copy() was the originally proposed name]) + ]) ]) dnl AC_MSG_CHECKING([for va_copy() or replacement]) AC_MSG_RESULT([$have_va_copy]) dnl -if test "x$have_va_copy" != "xno"; then - AC_DEFINE([HAVE_VA_COPY],1,[Whether we have the va_copy() function]) -fi +AS_VAR_IF([have_va_copy], [no], [], [dnl + AC_DEFINE([HAVE_VA_COPY], [1], + [Whether we have the va_copy() function]) +]) ])dnl dnl dnl From a394a887ab227416e84e5357dcc0348391c62f4f Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 13 Oct 2021 00:24:45 +0200 Subject: [PATCH 02/11] Replace obsolete AC_TRY_LINK_FUNC with AC_LINK_IFELSE(...) --- libgphoto2_port/gphoto-m4/gp-check-library.m4 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libgphoto2_port/gphoto-m4/gp-check-library.m4 b/libgphoto2_port/gphoto-m4/gp-check-library.m4 index 9232bc4829..3ec51d6294 100644 --- a/libgphoto2_port/gphoto-m4/gp-check-library.m4 +++ b/libgphoto2_port/gphoto-m4/gp-check-library.m4 @@ -346,7 +346,8 @@ if test "x${[userdef_][$1]}" = "xno" && test "x${[have_][$1]}" = "xyes"; then AC_MSG_CHECKING([for function ][$5][ in ][$2]) LIBS_save="$LIBS" LIBS="${[$1]_LIBS}" - AC_TRY_LINK_FUNC([$5],[],[have_][$1][=no]) + AC_LINK_IFELSE([AC_LANG_CALL([], [$5])], + [], [have_][$1][=no]) LIBS="$LIBS_save" AC_MSG_RESULT([${[have_][$1]}]) fi From 6aff0a57407a04590a3c82c82a2945c323142b33 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 13 Oct 2021 00:25:19 +0200 Subject: [PATCH 03/11] Replace obsolete AC_TRY_COMPILE with AC_COMPILE_IFELSE --- libgphoto2_port/configure.ac | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index 0ab43c9ec5..b5db1a32d7 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -196,14 +196,26 @@ dnl Checks for library functions. AC_CHECK_FUNCS([setmntent endmntent strerror snprintf vsnprintf flock]) dnl Check if TIOCM_RTS is included in one of several possible files -AC_TRY_COMPILE([#include ], [int foo = TIOCM_RTS;], - AC_DEFINE([HAVE_RTS_IOCTL], [1], [Define if you have TIOCM_RTS.])) -AC_TRY_COMPILE([#include ], [int foo = TIOCM_RTS;], - AC_DEFINE([HAVE_RTS_IOCTL], [1], [Define if you have TIOCM_RTS.])) -AC_TRY_COMPILE([#include ], [int foo = TIOCM_RTS;], - AC_DEFINE([HAVE_RTS_IOCTL], [1], [Define if you have TIOCM_TRS.])) -AC_TRY_COMPILE([#include ], [int foo = TIOCM_RTS;], - AC_DEFINE([HAVE_RTS_IOCTL], [1], [Define if you have TIOCM_TRS.])) +gp_found_tiocm_rts=no +AC_DEFUN([GP_TRY_TIOCM_RTS], [dnl + AS_VAR_IF([gp_found_tiocm_rts], [no], [dnl + AC_COMPILE_IFELSE([dnl + AC_LANG_PROGRAM([[#include <$1>]], [[ + int foo = TIOCM_RTS; + ]]) + ], [dnl + gp_found_tiocm_rts=yes + ]) + ]) +])dnl +GP_TRY_TIOCM_RTS([termios.h]) +GP_TRY_TIOCM_RTS([termio.h]) +GP_TRY_TIOCM_RTS([ioctl-types.h]) +GP_TRY_TIOCM_RTS([sys/ioctl.h]) +AS_VAR_IF([gp_found_tiocm_rts], [yes], [dnl + AC_DEFINE([HAVE_RTS_IOCTL], [1], + [Define if you have TIOCM_TRS.]) +]) # Check for va_copy() GP_VA_COPY From 3d7882f96e8974e0bb905f0b9fd6b1ecda4cc203 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Sun, 7 Nov 2021 12:12:51 +0100 Subject: [PATCH 04/11] Use same AC_LANG invocation in both configure.ac files --- configure.ac | 8 +++++--- libgphoto2_port/configure.ac | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 090b754851..4dfe0d86b6 100644 --- a/configure.ac +++ b/configure.ac @@ -50,6 +50,11 @@ dnl libtool 2011-10-18 2.4.2 AM_SILENT_RULES([no]) +dnl Every compile example will be using the C language unless +dnl something else is said explicitly. +AC_LANG([C]) + + dnl Flag all GP_ strings in result as error unless specifically allowed. m4_pattern_forbid([^_?GP_])dnl @@ -211,9 +216,6 @@ dnl GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Wno-stringop-truncation]) ])dnl GP_WITH_EMPTY_CONFDEFS_H -dnl Every compile example after here will be using the C language -AC_LANG([C]) - dnl --------------------------------------------------------------------------- dnl Turn on (almost) all warnings when using gcc diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index b5db1a32d7..fcc74d39dc 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -23,6 +23,8 @@ AM_INIT_AUTOMAKE([ AM_SILENT_RULES([no]) +dnl Every compile example will be using the C language unless +dnl something else is said explicitly. AC_LANG([C]) From 9398825c39e479aae7a7f93b2065b2b3ef68cbcc Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 13 Oct 2021 00:34:40 +0200 Subject: [PATCH 05/11] Use AS_VAR_IF and AS_IF as often as possible --- configure.ac | 31 +++++----- libgphoto2_port/configure.ac | 70 ++++++++++++----------- libgphoto2_port/gphoto-m4/gp-byteorder.m4 | 4 +- 3 files changed, 56 insertions(+), 49 deletions(-) diff --git a/configure.ac b/configure.ac index 4dfe0d86b6..74974ac10f 100644 --- a/configure.ac +++ b/configure.ac @@ -220,10 +220,10 @@ dnl GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Wno-stringop-truncation]) dnl --------------------------------------------------------------------------- dnl Turn on (almost) all warnings when using gcc dnl --------------------------------------------------------------------------- -if test "x$GCC" = "xyes"; then +AS_VAR_IF([GCC], [yes], [dnl AC_SUBST([NO_UNUSED_CFLAGS], [-Wno-unused]) -fi -AM_CONDITIONAL([HAVE_GCC], [test "x$GCC" = "xyes"]) +]) +AM_CONDITIONAL([HAVE_GCC], [test "x$GCC" = xyes]) # Activate internal code AM_CPPFLAGS="$AM_CPPFLAGS -D_GPHOTO2_INTERNAL_CODE" @@ -346,7 +346,7 @@ AC_SUBST([LIBWS232_LIBS]) AC_ARG_WITH([ws232], [AS_HELP_STRING([--without-ws232], [Build without ws2_32 library (default: no)])]) -AS_IF([test "x$with_ws232" != "xno"], [dnl +AS_VAR_IF([with_ws232], [no], [], [dnl AC_CHECK_LIB([ws2_32], [WSAStartup], [dnl AC_CHECK_HEADER([winsock.h], [dnl AC_DEFINE([HAVE_LIBWS232], [1], @@ -480,9 +480,11 @@ dnl --------------------------------------------------------------------------- AC_SUBST([PACKAGE_TARNAME]) -if test "x${utilsdir}" = "x"; then utilsdir="\${libdir}/\${PACKAGE_TARNAME}"; fi -AC_ARG_VAR([utilsdir],[Directory where utilities like print-camera-list will be installed]) -AC_SUBST([utilsdir]) +AC_ARG_VAR([utilsdir], + [Directory where utilities like print-camera-list will be installed]) +AS_VAR_IF([utilsdir], [], [dnl + utilsdir="\${libdir}/\${PACKAGE_TARNAME}" +]) GP_UDEV([true]) @@ -602,8 +604,11 @@ GPKG_CHECK_LINUX()dnl Check whether to package for a linux system dnl -------------------------------------------------------------------- dnl guess directory to install *.pc into dnl -------------------------------------------------------------------- -pkgconfigdir='${libdir}/pkgconfig' -AC_SUBST([pkgconfigdir]) +AC_ARG_VAR([pkgconfigdir], + [where to install pkg-config *.pc files to]) +AS_VAR_IF([pkgconfigdir], [], [dnl + pkgconfigdir='${libdir}/pkgconfig' +]) dnl --------------------------------------------------------------------------- @@ -645,16 +650,16 @@ CPPFLAGS="$CPPFLAGS_save" dnl --------------------------------------------------------------------------- dnl Configure subprojects dnl --------------------------------------------------------------------------- -if test -d "$srcdir/libgphoto2_port"; then +AS_IF([test -d "$srcdir/libgphoto2_port"], [dnl AC_CONFIG_SUBDIRS([libgphoto2_port]) -else +], [dnl AC_MSG_ERROR([ ****************************************************** *** Hey, where have you hidden my libgphoto2_port? *** *** I needed that! *** ****************************************************** ]) -fi +]) # --------------------------------------------------------------------------- @@ -686,7 +691,7 @@ AC_CONFIG_FILES([ ]) AC_OUTPUT -AS_IF([test "x$CDPATH" != "x"], [dnl +AS_VAR_IF([CDPATH], [], [], [dnl AC_MSG_WARN([ #=========================================================# diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index fcc74d39dc..609bdd1dbc 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -142,9 +142,9 @@ AC_CHECK_FUNC([gettext], [gettext_without_libintl=true]) # we don't have to check for gettext in libintl. Otherwise # we may even require libintl. dnl AC_CHECK_LIB(intl, gettext, [LIBS="$LIBS -lintl"]) -if test "x$gettext_without_libintl" != xtrue && test "x$USE_NLS" = xyes; then +AS_IF([test "x$gettext_without_libintl" != xtrue && test "x$USE_NLS" = xyes], [dnl AC_CHECK_LIB([intl], [gettext], [INTLLIBS="$INTLLIBS -lintl"]) -fi +]) dnl --------------------------------------------------------------------------- @@ -268,35 +268,31 @@ try_ttylock=true try_lockdev=true try_resmgr=true -if test "$ac_cv_header_sgtty_h" = "no" -then +AS_VAR_IF([ac_cv_header_sgtty_h], [no], [dnl have_serial=false serial_msg=no -fi +]) AC_ARG_ENABLE([serial], [AS_HELP_STRING([--disable-serial], [do not compile in SERIAL support])], [dnl - if test x$enableval = xno; then + AS_VAR_IF([enableval], [no], [dnl have_serial=false serial_msg=no try_ttylock=false try_lockdev=false try_resmgr=false - fi + ]) ]) -if $have_serial; then +AS_IF([$have_serial], [dnl IOLIB_LIST="$IOLIB_LIST serial" AC_DEFINE([HAVE_SERIAL], [1], [Whether you have serial support enabled]) -fi +]) GP_CONFIG_MSG([Serial ports]) GP_CONFIG_MSG([Serial support],[$serial_msg]) -SERIAL_LIBS="" -if $have_serial; then - dnl ----------------------------------------- dnl Serial port locking: We try to use either dnl (1) ttylock.h @@ -308,16 +304,20 @@ AC_ARG_ENABLE([$1], [AS_HELP_STRING([--disable-][$1], [do not use ][$1][ library])dnl ], [dnl - if test x$enableval = xno; then - try_[$1]=false - fi + AS_VAR_IF([enableval], [no], [dnl + try_[$1]=false + ]) ]) ])dnl + +SERIAL_LIBS="" +AS_IF([$have_serial], [dnl + GP_SERLOCK([ttylock])dnl GP_SERLOCK([lockdev])dnl ttylock_msg=no -if $try_ttylock; then +AS_IF([$try_ttylock], [dnl AC_CHECK_HEADER([lockdev.h]) AC_CHECK_HEADER([ttylock.h], [dnl lockdev_result="no" @@ -351,11 +351,11 @@ if $try_ttylock; then # include #endif ]) -fi +]) GP_CONFIG_MSG([ttylock locking],[${ttylock_msg}]) lockdev_msg=no -if $try_lockdev; then +AS_IF([$try_lockdev], [dnl AC_CHECK_LIB([lockdev], [dev_lock], [dnl AC_CHECK_HEADER([lockdev.h], [dnl AC_DEFINE([HAVE_LOCKDEV], [1], @@ -364,10 +364,10 @@ if $try_lockdev; then SERIAL_LIBS=-llockdev ]) ]) -fi +]) GP_CONFIG_MSG([lockdev locking],[${lockdev_msg}]) -fi # have_serial +])dnl $have_serial AC_SUBST([SERIAL_LIBS]) @@ -441,18 +441,20 @@ GP_CHECK_LIBRARY([LIBUSB],[libusb],[>= 0.1.5], IOLIB_LIST="$IOLIB_LIST usb" ;; *-linux*) - if test "x$have_LIBUSB1" != xyes; then + AS_VAR_IF([have_LIBUSB1], [yes], [dnl + GP_CONFIG_MSG([libusb0 support], + [detected, but disabled (libusb1 support is enabled)]) + ], [dnl IOLIB_LIST="$IOLIB_LIST usb usbdiskdirect usbscsi" - else - GP_CONFIG_MSG([libusb0 support],[detected, but disabled (libusb1 support is enabled)]) - fi + ]) ;; *) - if test "x$have_LIBUSB1" != xyes; then + AS_VAR_IF([have_LIBUSB1], [yes], [dnl + GP_CONFIG_MSG([libusb0 support], + [detected, but disabled (libusb1 support is enabled)]) + ], [dnl IOLIB_LIST="$IOLIB_LIST usb" - else - GP_CONFIG_MSG([libusb0 support],[detected, but disabled (libusb1 support is enabled)]) - fi + ]) ;; esac ], [], @@ -470,9 +472,9 @@ AC_ARG_ENABLE([disk], [enable_disk=yes]) dnl disk port also works everywhere, but it's not really necessary -if test "x$enable_disk" = "xyes"; then +AS_VAR_IF([enable_disk], [yes], [dnl IOLIB_LIST="$IOLIB_LIST disk" -fi +]) AC_ARG_ENABLE([vusb], [AS_HELP_STRING([--enable-vusb], @@ -484,9 +486,9 @@ AC_ARG_ENABLE([vusb], ) dnl disk port also works everywhere, but it's not really necessary -if test "x$enable_vusb" = "xyes"; then +AS_VAR_IF([enable_vusb], [yes], [dnl IOLIB_LIST="$IOLIB_LIST vusb" -fi +]) AC_ARG_ENABLE([ptpip], [AS_HELP_STRING([--disable-ptpip], @@ -566,10 +568,10 @@ GP_BUILD_GTK_DOCS()dnl dnl --------------------------------------------------------------------------- dnl Turn on all warnings when using gcc dnl --------------------------------------------------------------------------- -if test "$GCC" = "yes"; then +AS_VAR_IF([GCC], [yes], [dnl CFLAGS="$CFLAGS -Wall" CFLAGS="$CFLAGS -Wmissing-declarations -Wmissing-prototypes" -fi +]) # Activate internal code AM_CPPFLAGS="$AM_CPPFLAGS -D_GPHOTO2_INTERNAL_CODE" diff --git a/libgphoto2_port/gphoto-m4/gp-byteorder.m4 b/libgphoto2_port/gphoto-m4/gp-byteorder.m4 index d7810d68b7..630df655c8 100644 --- a/libgphoto2_port/gphoto-m4/gp-byteorder.m4 +++ b/libgphoto2_port/gphoto-m4/gp-byteorder.m4 @@ -46,9 +46,9 @@ fi # We're only interested in the target CPU, but it's not always set effective_target="$target" -if test "x$effective_target" = xNONE || test "x$effective_target" = x ; then +AS_IF([test "x$effective_target" = xNONE || test "x$effective_target" = x], [dnl effective_target="$host" -fi +]) AC_SUBST(effective_target) m4_pattern_allow([GP_BYTEORDER_H])dnl From 5eff4c218043d5480d736a15406d0fd0f0640aea Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 20:54:59 +0200 Subject: [PATCH 06/11] GP_CONFIG_MSG args with spaces or on multiple lines Improves readability --- configure.ac | 23 ++++++++++--------- libgphoto2_port/configure.ac | 17 +++++++------- libgphoto2_port/gphoto-m4/gp-check-library.m4 | 4 ++-- libgphoto2_port/gphoto-m4/gp-check-popt.m4 | 4 ++-- libgphoto2_port/gphoto-m4/gp-config-msg.m4 | 12 +++++----- libgphoto2_port/gphoto-m4/gp-documentation.m4 | 2 +- 6 files changed, 32 insertions(+), 30 deletions(-) diff --git a/configure.ac b/configure.ac index 74974ac10f..e777103748 100644 --- a/configure.ac +++ b/configure.ac @@ -59,10 +59,6 @@ dnl Flag all GP_ strings in result as error unless specifically allowed. m4_pattern_forbid([^_?GP_])dnl -GP_CHECK_SHELL_ENVIRONMENT -GP_CONFIG_MSG([Build]) -GP_CONFIG_MSG([Source code location],[${srcdir}]) - dnl --------------------------------------------------------------------------- dnl Advanced information about versioning: dnl * "Writing shared libraries" by Mike Hearn @@ -105,6 +101,11 @@ AC_SUBST([LIBGPHOTO2_VERSION_INFO], [$LIBGPHOTO2_CURRENT:$LIBGPHOTO2_REVISION:$LIBGPHOTO2_AGE]) +GP_CHECK_SHELL_ENVIRONMENT +GP_CONFIG_MSG([Build]) +GP_CONFIG_MSG([Source code location], [${srcdir}]) + + dnl --------------------------------------------------------------------------- dnl Checks for programs. dnl --------------------------------------------------------------------------- @@ -265,9 +266,9 @@ GP_LIBLTDL # report on compiler/libtool setup -GP_CONFIG_MSG([Compiler],[${CC}]) -GP_CONFIG_MSG([libltdl includes],[$LTDLINCL]) -GP_CONFIG_MSG([libltdl library],[$LIBLTDL]) +GP_CONFIG_MSG([Compiler], [${CC}]) +GP_CONFIG_MSG([libltdl includes], [$LTDLINCL]) +GP_CONFIG_MSG([libltdl library], [$LIBLTDL]) AC_DEFINE_UNQUOTED([HAVE_CC], ["$CC"], [The C compiler we are using]) @@ -356,7 +357,7 @@ AS_VAR_IF([with_ws232], [no], [], [dnl ]) ]) ]) -GP_CONFIG_MSG([Winsocket support (for PTP/IP)],[${libws232_msg}]) +GP_CONFIG_MSG([Winsocket support (for PTP/IP)], [${libws232_msg}]) dnl --------------------------------------------------------------------------- dnl check for libxml2 @@ -366,14 +367,14 @@ GP_CHECK_LIBRARY([LIBXML2],[libxml-2.0],[>= 2.0], [default-on], [http://xmlsoft.org] ) -GP_CONFIG_MSG([XML support for Olympus E series],[${have_LIBXML2}]) +GP_CONFIG_MSG([XML support for Olympus E series], [${have_LIBXML2}]) GP_CHECK_LIBRARY([LIBCURL],[libcurl],[>= 7.1], [curl/curl.h],[curl_easy_init],[],[], [default-on], [https://www.curl.org] ) -GP_CONFIG_MSG([CURL support for Lumix Wifi],[${have_LIBCURL}]) +GP_CONFIG_MSG([CURL support for Lumix Wifi], [${have_LIBCURL}]) dnl --------------------------------------------------------------------------- dnl check for libgd @@ -384,7 +385,7 @@ GP_CHECK_LIBRARY([LIBGD],[gdlib],[>= 2.0],[gd.h],[gdImageCreateTrueColor],[ LIBGD_LIBS="-lgd $LIBGD_LIBS" ],[],[default-on],[http://www.libgd.org/]) -GP_CONFIG_MSG([libGD conversion support],[${have_LIBGD}]) +GP_CONFIG_MSG([libGD conversion support], [${have_LIBGD}]) dnl --------------------------------------------------------------------------- dnl Checks for header files. diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index 609bdd1dbc..025cb8867b 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -104,10 +104,10 @@ GP_LIBLTDL # report on compiler/libtool setup GP_CONFIG_MSG([Build]) -GP_CONFIG_MSG([Source directory],[${srcdir}]) -GP_CONFIG_MSG([Compiler],[${CC}]) -GP_CONFIG_MSG([libltdl includes],[$LTDLINCL]) -GP_CONFIG_MSG([libltdl library],[$LIBLTDL]) +GP_CONFIG_MSG([Source directory], [${srcdir}]) +GP_CONFIG_MSG([Compiler], [${CC}]) +GP_CONFIG_MSG([libltdl includes], [$LTDLINCL]) +GP_CONFIG_MSG([libltdl library], [$LIBLTDL]) AC_DEFINE_UNQUOTED([HAVE_CC], ["$CC"], [The C compiler we're using]) @@ -291,7 +291,7 @@ AS_IF([$have_serial], [dnl [Whether you have serial support enabled]) ]) GP_CONFIG_MSG([Serial ports]) -GP_CONFIG_MSG([Serial support],[$serial_msg]) +GP_CONFIG_MSG([Serial support], [$serial_msg]) dnl ----------------------------------------- dnl Serial port locking: We try to use either @@ -352,7 +352,7 @@ AS_IF([$try_ttylock], [dnl #endif ]) ]) -GP_CONFIG_MSG([ttylock locking],[${ttylock_msg}]) +GP_CONFIG_MSG([ttylock locking], [${ttylock_msg}]) lockdev_msg=no AS_IF([$try_lockdev], [dnl @@ -365,7 +365,7 @@ AS_IF([$try_lockdev], [dnl ]) ]) ]) -GP_CONFIG_MSG([lockdev locking],[${lockdev_msg}]) +GP_CONFIG_MSG([lockdev locking], [${lockdev_msg}]) ])dnl $have_serial @@ -481,7 +481,8 @@ AC_ARG_ENABLE([vusb], [enable the 'vusb' virtual USB port driver])], [], [dnl enable_vusb=no - GP_CONFIG_MSG([virtual USB support],[disabled, no virtual PTP test camera]) + GP_CONFIG_MSG([virtual USB support], + [disabled, no virtual PTP test camera]) ] ) diff --git a/libgphoto2_port/gphoto-m4/gp-check-library.m4 b/libgphoto2_port/gphoto-m4/gp-check-library.m4 index 3ec51d6294..7bc64284d1 100644 --- a/libgphoto2_port/gphoto-m4/gp-check-library.m4 +++ b/libgphoto2_port/gphoto-m4/gp-check-library.m4 @@ -405,14 +405,14 @@ fi AM_CONDITIONAL([HAVE_][$1], [test "x$have_[$1]" = "xyes"]) if test "x$have_[$1]" = "xyes"; then AC_DEFINE([HAVE_][$1], 1, [whether we compile with ][$2][ support]) - GP_CONFIG_MSG([$2],[yes])dnl + GP_CONFIG_MSG([$2], [yes])dnl AC_MSG_CHECKING([$2][ library flags]) AC_MSG_RESULT(["${[$1][_LIBS]}"]) AC_MSG_CHECKING([$2][ cpp flags]) AC_MSG_RESULT(["${[$1][_CFLAGS]}"]) else [REQUIREMENTS_FOR_][$1][=] - GP_CONFIG_MSG([$2],[no])dnl + GP_CONFIG_MSG([$2], [no])dnl fi dnl AC_SUBST is done implicitly by AC_ARG_VAR above. dnl AC_SUBST([$1][_LIBS]) diff --git a/libgphoto2_port/gphoto-m4/gp-check-popt.m4 b/libgphoto2_port/gphoto-m4/gp-check-popt.m4 index a8b3718f28..5ae1a68877 100644 --- a/libgphoto2_port/gphoto-m4/gp-check-popt.m4 +++ b/libgphoto2_port/gphoto-m4/gp-check-popt.m4 @@ -231,8 +231,8 @@ AC_MSG_RESULT([${have_popt}]) GP_CONFIG_MSG([use popt library], [${have_popt}]) if test "$have_popt" = "yes"; then AC_DEFINE([HAVE_POPT],[1],[whether the popt library is available]) - GP_CONFIG_MSG([popt libs],[${POPT_LIBS}]) - GP_CONFIG_MSG([popt cppflags],[${POPT_CFLAGS}]) + GP_CONFIG_MSG([popt libs], [${POPT_LIBS}]) + GP_CONFIG_MSG([popt cppflags], [${POPT_CFLAGS}]) fi AM_CONDITIONAL([HAVE_POPT],[test "$have_popt" = "yes"]) ])dnl diff --git a/libgphoto2_port/gphoto-m4/gp-config-msg.m4 b/libgphoto2_port/gphoto-m4/gp-config-msg.m4 index c81d88af49..612adbfaac 100644 --- a/libgphoto2_port/gphoto-m4/gp-config-msg.m4 +++ b/libgphoto2_port/gphoto-m4/gp-config-msg.m4 @@ -12,7 +12,7 @@ dnl explicitly set the LHS width to the given value dnl dnl GP_CONFIG_MSG dnl empty output line -dnl GP_CONFIG_MSG([LHS],[RHS]) +dnl GP_CONFIG_MSG([LHS], [RHS]) dnl formatted output line "LHS: RHS" dnl dnl GP_CONFIG_OUTPUT @@ -23,11 +23,11 @@ dnl dnl Example usage: dnl dnl GP_CONFIG_INIT -dnl GP_CONFIG_MSG([Source code location],[${srcdir}]) -dnl GP_CONFIG_MSG([Compiler],[${CC}]) +dnl GP_CONFIG_MSG([Source code location], [${srcdir}]) +dnl GP_CONFIG_MSG([Compiler], [${CC}]) dnl GP_CONFIG_MSG -dnl GP_CONFIG_MSG([Feature foo],[${foo}]) -dnl GP_CONFIG_MSG([Location of bar],[${bar}]) +dnl GP_CONFIG_MSG([Feature foo], [${foo}]) +dnl GP_CONFIG_MSG([Location of bar], [${bar}]) dnl [...] dnl AC_OUTPUT dnl GP_CONFIG_OUTPUT @@ -86,7 +86,7 @@ if test "x$subdirs" != "x"; then _subdirs="$_subdirs $ssd" fi done - GP_CONFIG_MSG([Subprojects],[${_subdirs}])dnl + GP_CONFIG_MSG([Subprojects], [${_subdirs}])dnl fi ])dnl dnl diff --git a/libgphoto2_port/gphoto-m4/gp-documentation.m4 b/libgphoto2_port/gphoto-m4/gp-documentation.m4 index 45f44b344f..8177670d47 100644 --- a/libgphoto2_port/gphoto-m4/gp-documentation.m4 +++ b/libgphoto2_port/gphoto-m4/gp-documentation.m4 @@ -36,7 +36,7 @@ if $try_gtkdoc; then fi fi AM_CONDITIONAL([ENABLE_GTK_DOC], [$have_gtkdoc]) -GP_CONFIG_MSG([build API docs with gtk-doc],[$gtkdoc_msg]) +GP_CONFIG_MSG([build API docs with gtk-doc], [$gtkdoc_msg]) apidocdir="${htmldir}/api" AC_SUBST([apidocdir]) From 17f224f1ea94d64f3704743741fb4c9499519032 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 20:57:38 +0200 Subject: [PATCH 07/11] GP_CHECK_LIBRARY arguments with spacing Consistent spacing between Autoconf macro arguments (a space after the comma) improves readability. --- configure.ac | 31 +++++++++---------- libgphoto2_port/configure.ac | 17 +++++----- libgphoto2_port/gphoto-m4/gp-check-library.m4 | 10 +++--- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/configure.ac b/configure.ac index e777103748..93647928bf 100644 --- a/configure.ac +++ b/configure.ac @@ -362,29 +362,26 @@ GP_CONFIG_MSG([Winsocket support (for PTP/IP)], [${libws232_msg}]) dnl --------------------------------------------------------------------------- dnl check for libxml2 dnl --------------------------------------------------------------------------- -GP_CHECK_LIBRARY([LIBXML2],[libxml-2.0],[>= 2.0], - [libxml/parser.h],[xmlFirstElementChild],[],[], - [default-on], - [http://xmlsoft.org] -) +GP_CHECK_LIBRARY([LIBXML2], [libxml-2.0], [>= 2.0], + [libxml/parser.h], [xmlFirstElementChild], [], [], + [default-on], + [http://xmlsoft.org]) GP_CONFIG_MSG([XML support for Olympus E series], [${have_LIBXML2}]) -GP_CHECK_LIBRARY([LIBCURL],[libcurl],[>= 7.1], - [curl/curl.h],[curl_easy_init],[],[], - [default-on], - [https://www.curl.org] -) +GP_CHECK_LIBRARY([LIBCURL], [libcurl], [>= 7.1], + [curl/curl.h], [curl_easy_init], [], [], + [default-on], + [https://www.curl.org]) GP_CONFIG_MSG([CURL support for Lumix Wifi], [${have_LIBCURL}]) dnl --------------------------------------------------------------------------- dnl check for libgd dnl they call it "gdlib" ... confusing. dnl --------------------------------------------------------------------------- -GP_CHECK_LIBRARY([LIBGD],[gdlib],[>= 2.0],[gd.h],[gdImageCreateTrueColor],[ +GP_CHECK_LIBRARY([LIBGD], [gdlib], [>= 2.0], [gd.h], [gdImageCreateTrueColor], [dnl # gdlib-config --libs upstream does not include -lgd, but only the dependencies LIBGD_LIBS="-lgd $LIBGD_LIBS" - -],[],[default-on],[http://www.libgd.org/]) +], [], [default-on], [http://www.libgd.org/]) GP_CONFIG_MSG([libGD conversion support], [${have_LIBGD}]) dnl --------------------------------------------------------------------------- @@ -615,12 +612,12 @@ AS_VAR_IF([pkgconfigdir], [], [dnl dnl --------------------------------------------------------------------------- dnl libexif: The CameraFilesystem can use libexif for extracting thumbnails dnl out of EXIF data. Similarly, it can extract the mtime of -dnl a file. +dnl a file. dnl libexif is available from dnl http://www.sourceforge.net/projects/libexif dnl --------------------------------------------------------------------------- -GP_CHECK_LIBRARY([LIBEXIF],[libexif],[>= 0.6.13], - [libexif/exif-data.h],[exif_data_new],[ +GP_CHECK_LIBRARY([LIBEXIF], [libexif], [>= 0.6.13], + [libexif/exif-data.h], [exif_data_new], [dnl AC_MSG_CHECKING([whether we use a version of libexif with ExifData.ifd[[]]]) # Check for libexif version dnl FIXME: Use AC_CHECK_MEMBER? @@ -645,7 +642,7 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ AC_MSG_RESULT([no]) ]) CPPFLAGS="$CPPFLAGS_save" -],[],[default-on],[http://www.sourceforge.net/projects/libexif])dnl +], [], [default-on], [https://github.com/libexif/libexif])dnl dnl --------------------------------------------------------------------------- diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index 025cb8867b..f2927bf5c5 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -225,12 +225,12 @@ GP_VA_COPY dnl --------------------------------------------------------------------------- dnl libexif: The virtual usb camera driver can use libexif for extracting thumbnails dnl out of EXIF data. Similarly, it can extract the mtime of -dnl a file. +dnl a file. dnl libexif is available from dnl http://www.sourceforge.net/projects/libexif dnl --------------------------------------------------------------------------- -GP_CHECK_LIBRARY([LIBEXIF],[libexif],[>= 0.6.13], - [libexif/exif-data.h],[exif_data_new],[ +GP_CHECK_LIBRARY([LIBEXIF], [libexif], [>= 0.6.13], + [libexif/exif-data.h], [exif_data_new], [dnl AC_MSG_CHECKING([whether we use a version of libexif with ExifData.ifd[[]]]) # Check for libexif version dnl FIXME: Use AC_CHECK_MEMBER? @@ -255,7 +255,7 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ AC_MSG_RESULT([no]) ]) CPPFLAGS="$CPPFLAGS_save" -],[],[default-on],[http://www.sourceforge.net/projects/libexif])dnl +], [], [default-on], [https://github.com/libexif/libexif])dnl @@ -385,8 +385,8 @@ dnl --------------------------------------------------------------------------- dnl libusb1 dnl --------------------------------------------------------------------------- GP_CONFIG_MSG([USB ports]) -GP_CHECK_LIBRARY([LIBUSB1],[libusb-1.0],[>= 1.0.0], - [libusb.h],[libusb_init],[ +GP_CHECK_LIBRARY([LIBUSB1], [libusb-1.0], [>= 1.0.0], + [libusb.h], [libusb_init], [dnl case "$host" in *-linux*) IOLIB_LIST="$IOLIB_LIST usb1 usbdiskdirect usbscsi" @@ -432,9 +432,10 @@ GP_CHECK_LIBRARY([LIBUSB1],[libusb-1.0],[>= 1.0.0], [default-on], [http://libusb.sourceforge.net/] ) + # We select the old libusb 0 only if we are not doing libusb1 -GP_CHECK_LIBRARY([LIBUSB],[libusb],[>= 0.1.5], - [usb.h],[usb_open],[ +GP_CHECK_LIBRARY([LIBUSB], [libusb], [>= 0.1.5], + [usb.h], [usb_open], [dnl case "$host" in *-*-mingw* | *-*-cygwin* | *-*-msvc* ) dnl Windows itself has usb.h we mis-detect, in that case remove access to the other usb.h diff --git a/libgphoto2_port/gphoto-m4/gp-check-library.m4 b/libgphoto2_port/gphoto-m4/gp-check-library.m4 index 7bc64284d1..161342ac1b 100644 --- a/libgphoto2_port/gphoto-m4/gp-check-library.m4 +++ b/libgphoto2_port/gphoto-m4/gp-check-library.m4 @@ -1,13 +1,13 @@ # gp-check-library.m4 - generic library check -*- Autoconf -*- -# serial 14 +# serial 15 dnl | Increment the above serial number every time you edit this file. dnl | When it finds multiple m4 files with the same name, dnl | aclocal will use the one with the highest serial. dnl -dnl @synopsis GP_CHECK_LIBRARY([VARNAMEPART],[libname],[VERSION-REQUIREMENT], -dnl [headername],[functionname], -dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], -dnl [OPTIONAL-REQUIRED-ETC],[WHERE-TO-GET-IT]) +dnl @synopsis GP_CHECK_LIBRARY([VARNAMEPART], [libname], [VERSION-REQUIREMENT], +dnl [headername], [functionname], +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +dnl [OPTIONAL-REQUIRED-ETC], [WHERE-TO-GET-IT]) dnl dnl Checks for the presence of a certain library. dnl From 07f7e39ccbe86c114c2b11aa451d42f4104d4515 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 21:02:30 +0200 Subject: [PATCH 08/11] AC_CHECK_HEADERS: use indented multi line argument Put one header file per line in the the argument to AC_CHECK_HEADERS(). This improves readability, makes diffs easier to read, allows for easier sorting, etc. --- configure.ac | 21 +++++++++++++++++++-- libgphoto2_port/configure.ac | 34 +++++++++++++++++++++++++++++----- 2 files changed, 48 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 93647928bf..8c3e0cabd7 100644 --- a/configure.ac +++ b/configure.ac @@ -389,7 +389,19 @@ dnl Checks for header files. dnl --------------------------------------------------------------------------- AC_HEADER_DIRENT AC_HEADER_STDC -AC_CHECK_HEADERS([sys/param.h sys/mman.h sys/select.h locale.h memory.h getopt.h unistd.h mcheck.h limits.h sys/time.h langinfo.h]) +AC_CHECK_HEADERS([m4_normalize([ + sys/param.h + sys/mman.h + sys/select.h + locale.h + memory.h + getopt.h + unistd.h + mcheck.h + limits.h + sys/time.h + langinfo.h +])]) dnl If sys/mman.h is present, check whether mmap requires the mman dnl library (see camlibs/st2205/st2205.c st2205_malloc_page_aligned()). @@ -439,7 +451,12 @@ tm.tm_gmtoff; AC_MSG_RESULT([no]) ]) -AC_CHECK_HEADERS([sys/mount.h sys/statvfs.h sys/user.h sys/vfs.h], [], [], [ +AC_CHECK_HEADERS([m4_normalize([ + sys/mount.h + sys/statvfs.h + sys/user.h + sys/vfs.h +])], [], [], [dnl #include #if HAVE_SYS_PARAM_H # include diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index f2927bf5c5..756688e5b5 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -156,11 +156,35 @@ AC_HEADER_STDC AC_C_INLINE([]) AC_C_CONST([]) -AC_CHECK_HEADERS([stdlib.h unistd.h stdio.h fcntl.h errno.h sys/time.h \ - sys/param.h sys/select.h termios.h sgetty.h ttold.h ioctl-types.h \ - fcntl.h sgtty.h sys/ioctl.h sys/time.h termio.h unistd.h \ - endian.h byteswap.h asm/io.h mntent.h sys/mntent.h sys/mnttab.h \ - scsi/sg.h limits.h sys/file.h]) +AC_CHECK_HEADERS([m4_normalize([ + stdlib.h + unistd.h + stdio.h + fcntl.h + errno.h + sys/time.h + sys/param.h + sys/select.h + termios.h + sgetty.h + ttold.h + ioctl-types.h + fcntl.h + sgtty.h + sys/ioctl.h + sys/time.h + termio.h + unistd.h + endian.h + byteswap.h + asm/io.h + mntent.h + sys/mntent.h + sys/mnttab.h + scsi/sg.h + limits.h + sys/file.h +])]) dnl FIXME: Provide regex.h with the corresponding object code for dnl platforms which do not have it, e.g. Windows. From f3cd6443d3760fcd745178f4fbdc553acaeecab4 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 21:34:29 +0200 Subject: [PATCH 09/11] AC_CHECK_FUNCS: use indented multi line argument Put one function name per line in the the argument to AC_CHECK_FUNCS(). This improves readability, makes diffs easier to read, allows for easier sorting, etc. --- configure.ac | 20 +++++++++++++++++++- libgphoto2_port/configure.ac | 10 ++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 8c3e0cabd7..b010d59d6e 100644 --- a/configure.ac +++ b/configure.ac @@ -428,7 +428,25 @@ dnl Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T dnl Checks for library functions. -AC_CHECK_FUNCS([getenv getopt getopt_long mkdir setenv strdup strncpy strcpy snprintf sprintf vsnprintf gmtime_r statvfs localtime_r lstat inet_aton rand_r]) +AC_CHECK_FUNCS([m4_normalize([ + getenv + getopt + getopt_long + mkdir + setenv + strdup + strncpy + strcpy + snprintf + sprintf + vsnprintf + gmtime_r + statvfs + localtime_r + lstat + inet_aton + rand_r +])]) dnl Find out how to get struct tm AC_STRUCT_TM diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index 756688e5b5..e5f1d37983 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -217,9 +217,15 @@ mt.mnt_mountp; ]) - dnl Checks for library functions. -AC_CHECK_FUNCS([setmntent endmntent strerror snprintf vsnprintf flock]) +AC_CHECK_FUNCS([m4_normalize([ + setmntent + endmntent + strerror + snprintf + vsnprintf + flock +])]) dnl Check if TIOCM_RTS is included in one of several possible files gp_found_tiocm_rts=no From 3f098a6eeb5b3019dbe478f95201615a0c907b20 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 21:55:16 +0200 Subject: [PATCH 10/11] AC_CHECK_(FUNCS|HEADERS): sort arguments removing duplicates --- configure.ac | 34 ++++++++++++++-------------- libgphoto2_port/configure.ac | 43 +++++++++++++++++------------------- 2 files changed, 37 insertions(+), 40 deletions(-) diff --git a/configure.ac b/configure.ac index b010d59d6e..55ddce2b98 100644 --- a/configure.ac +++ b/configure.ac @@ -390,17 +390,17 @@ dnl --------------------------------------------------------------------------- AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS([m4_normalize([ - sys/param.h - sys/mman.h - sys/select.h - locale.h - memory.h getopt.h - unistd.h - mcheck.h + langinfo.h limits.h + locale.h + mcheck.h + memory.h + sys/mman.h + sys/param.h + sys/select.h sys/time.h - langinfo.h + unistd.h ])]) dnl If sys/mman.h is present, check whether mmap requires the mman @@ -432,20 +432,20 @@ AC_CHECK_FUNCS([m4_normalize([ getenv getopt getopt_long + gmtime_r + inet_aton + localtime_r + lstat mkdir + rand_r setenv - strdup - strncpy - strcpy snprintf sprintf - vsnprintf - gmtime_r statvfs - localtime_r - lstat - inet_aton - rand_r + strcpy + strdup + strncpy + vsnprintf ])]) dnl Find out how to get struct tm diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index e5f1d37983..ddb160d387 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -157,33 +157,30 @@ AC_C_INLINE([]) AC_C_CONST([]) AC_CHECK_HEADERS([m4_normalize([ - stdlib.h - unistd.h - stdio.h - fcntl.h + asm/io.h + byteswap.h + endian.h errno.h - sys/time.h - sys/param.h - sys/select.h - termios.h - sgetty.h - ttold.h - ioctl-types.h fcntl.h + ioctl-types.h + limits.h + mntent.h + scsi/sg.h + sgetty.h sgtty.h + stdio.h + stdlib.h + sys/file.h sys/ioctl.h + sys/mntent.h + sys/mnttab.h + sys/param.h + sys/select.h sys/time.h termio.h + termios.h + ttold.h unistd.h - endian.h - byteswap.h - asm/io.h - mntent.h - sys/mntent.h - sys/mnttab.h - scsi/sg.h - limits.h - sys/file.h ])]) dnl FIXME: Provide regex.h with the corresponding object code for @@ -219,12 +216,12 @@ mt.mnt_mountp; dnl Checks for library functions. AC_CHECK_FUNCS([m4_normalize([ - setmntent endmntent - strerror + flock + setmntent snprintf + strerror vsnprintf - flock ])]) dnl Check if TIOCM_RTS is included in one of several possible files From 7cef7e5cbf7789552573c836de3b5894afb89e48 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 19 Oct 2021 07:43:12 +0200 Subject: [PATCH 11/11] Define location of libgphoto2(_port)?.la as variable Using one variable throughout the whole buildsystem to point to the built libgphoto2.la and libgphoto2_port.la library files makes the Makefile.am lines shorter right now, and also makes it easier to move the library file locations later. --- camlibs/Makefile.am | 4 ++-- configure.ac | 10 ++++++++++ examples/Makefile.am | 5 +++-- libgphoto2/Makefile.am | 2 +- libgphoto2_port/Makefile.am | 4 ++-- libgphoto2_port/configure.ac | 8 ++++++++ libgphoto2_port/tests/Makefile.am | 4 ++-- packaging/generic/Makefile.am | 4 ++-- tests/Makefile.am | 24 ++++++++++++------------ 9 files changed, 42 insertions(+), 23 deletions(-) diff --git a/camlibs/Makefile.am b/camlibs/Makefile.am index 01a289cfa0..dcb27f2e08 100644 --- a/camlibs/Makefile.am +++ b/camlibs/Makefile.am @@ -73,8 +73,8 @@ camlib_ldflags += -export-symbols '$(top_srcdir)/camlibs/camlib.sym' camlib_ldflags += -rpath '$(camlibdir)' camlib_libadd = -camlib_libadd += $(top_builddir)/libgphoto2/libgphoto2.la -camlib_libadd += $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la +camlib_libadd += $(libgphoto2_la) +camlib_libadd += $(libgphoto2_port_la) camlib_cflags = diff --git a/configure.ac b/configure.ac index 55ddce2b98..121e4e17d2 100644 --- a/configure.ac +++ b/configure.ac @@ -680,6 +680,16 @@ CPPFLAGS="$CPPFLAGS_save" ], [], [default-on], [https://github.com/libexif/libexif])dnl +dnl --------------------------------------------------------------------------- +dnl Make it easier to possibly move the libraries around +dnl --------------------------------------------------------------------------- + +AC_SUBST([libgphoto2_port_la], + ['${top_builddir}/libgphoto2_port/libgphoto2_port/libgphoto2_port.la']) +AC_SUBST([libgphoto2_la], + ['${top_builddir}/libgphoto2/libgphoto2.la']) + + dnl --------------------------------------------------------------------------- dnl Configure subprojects dnl --------------------------------------------------------------------------- diff --git a/examples/Makefile.am b/examples/Makefile.am index 43a4f49cf8..0b0a0bcb13 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -35,8 +35,9 @@ best_iso_SOURCES = best-iso.c sample_justfocus_SOURCES = samples.h sample-justfocus.c context.c focus.c # sample_libfuzz_SOURCES = samples.h sample-libfuzz.c context.c autodetect.c -LDADD = $(top_builddir)/libgphoto2/libgphoto2.la \ - $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la \ +LDADD = \ + $(libgphoto2_la) \ + $(libgphoto2_port_la) \ $(LIBLTDL) \ $(LIBEXIF_LIBS) \ $(INTLLIBS) diff --git a/libgphoto2/Makefile.am b/libgphoto2/Makefile.am index a3328d56d8..2836e05274 100644 --- a/libgphoto2/Makefile.am +++ b/libgphoto2/Makefile.am @@ -53,7 +53,7 @@ libgphoto2_la_LDFLAGS += -export-symbols $(srcdir)/libgphoto2.sym libgphoto2_la_LDFLAGS += -version-info @LIBGPHOTO2_VERSION_INFO@ -libgphoto2_la_LIBADD += $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la +libgphoto2_la_LIBADD += $(libgphoto2_port_la) # The libtool docs describe these params, but they don't build. # "-dlopen" self \ diff --git a/libgphoto2_port/Makefile.am b/libgphoto2_port/Makefile.am index 8f783057fb..ecc531e728 100644 --- a/libgphoto2_port/Makefile.am +++ b/libgphoto2_port/Makefile.am @@ -52,12 +52,12 @@ iolib_LTLIBRARIES = $(IOLIB_LTLIST) ######################################################################## # Define the compile/link/etc. flags common to all iolibs in one place, # i.e. here. -iolib_dependencies = $(top_srcdir)/iolib.sym +iolib_dependencies = $(top_srcdir)/iolib.sym $(libgphoto2_port_la) iolib_ldflags = -module -no-undefined -avoid-version \ -export-dynamic \ -export-symbols $(top_srcdir)/iolib.sym \ -rpath '$(iolibdir)' -iolib_libadd = $(top_builddir)/libgphoto2_port/libgphoto2_port.la +iolib_libadd = $(libgphoto2_port_la) AM_CPPFLAGS += -I$(top_srcdir) diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index ddb160d387..9867432bc7 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -615,6 +615,14 @@ AC_SUBST([AM_CXXFLAGS]) AC_SUBST([AM_LDFLAGS]) +dnl --------------------------------------------------------------------------- +dnl Make it easier to possibly move the libraries around +dnl --------------------------------------------------------------------------- + +AC_SUBST([libgphoto2_port_la], + ['${top_builddir}/libgphoto2_port/libgphoto2_port.la']) + + # --------------------------------------------------------------------------- # Create output files # --------------------------------------------------------------------------- diff --git a/libgphoto2_port/tests/Makefile.am b/libgphoto2_port/tests/Makefile.am index 7b89036453..a682e24b0a 100644 --- a/libgphoto2_port/tests/Makefile.am +++ b/libgphoto2_port/tests/Makefile.am @@ -18,7 +18,7 @@ AM_CPPFLAGS += -I$(top_srcdir) noinst_PROGRAMS += test-gp-port test_gp_port_CPPFLAGS = $(AM_CPPFLAGS) $(LTDLINCL) $(CPPFLAGS) test_gp_port_SOURCES = test-gp-port.c -test_gp_port_LDADD = $(top_builddir)/libgphoto2_port/libgphoto2_port.la +test_gp_port_LDADD = $(libgphoto2_port_la) test_gp_port_LDADD += $(LIBLTDL) $(INTLLIBS) TESTS += test-port-list @@ -27,7 +27,7 @@ check_PROGRAMS += test-port-list noinst_PROGRAMS += test-port-list test_port_list_CPPFLAGS = $(AM_CPPFLAGS) $(LTDLINCL) $(CPPFLAGS) test_port_list_SOURCES = test-port-list.c -test_port_list_LDADD = $(top_builddir)/libgphoto2_port/libgphoto2_port.la +test_port_list_LDADD = $(libgphoto2_port_la) test_port_list_LDADD += $(LIBLTDL) $(INTLLIBS) include $(top_srcdir)/installcheck.mk diff --git a/packaging/generic/Makefile.am b/packaging/generic/Makefile.am index 0b547a23be..2e9482d98c 100644 --- a/packaging/generic/Makefile.am +++ b/packaging/generic/Makefile.am @@ -8,7 +8,7 @@ AM_CPPFLAGS += -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/libgphoto2_por print_camera_list_SOURCES = print-camera-list.c print_camera_list_LDADD = \ - $(top_builddir)/libgphoto2/libgphoto2.la \ - $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la \ + $(libgphoto2_la) \ + $(libgphoto2_port_la) \ $(LIBLTDL) \ $(LIBEXIF_LIBS) diff --git a/tests/Makefile.am b/tests/Makefile.am index d87bc3d61e..5e5a51c291 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -46,8 +46,8 @@ TESTS += test-endian check_PROGRAMS += test-endian test_endian_SOURCES = test-endian.c test_endian_LDADD = \ - $(top_builddir)/libgphoto2/libgphoto2.la \ - $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la \ + $(libgphoto2_la) \ + $(libgphoto2_port_la) \ $(LIBLTDL) \ $(LIBEXIF_LIBS) \ $(INTLLIBS) @@ -57,8 +57,8 @@ test_endian_LDADD = \ noinst_PROGRAMS += print-libgphoto2-version print_libgphoto2_version_SOURCES = print-libgphoto2-version.c print_libgphoto2_version_LDADD = -print_libgphoto2_version_LDADD += $(top_builddir)/libgphoto2/libgphoto2.la -print_libgphoto2_version_LDADD += $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la +print_libgphoto2_version_LDADD += $(libgphoto2_la) +print_libgphoto2_version_LDADD += $(libgphoto2_port_la) print_libgphoto2_version_LDADD += $(LIBLTDL) print_libgphoto2_version_LDADD += $(LIBEXIF_LIBS) print_libgphoto2_version_LDADD += $(INTLLIBS) @@ -68,8 +68,8 @@ print_libgphoto2_version_LDADD += $(INTLLIBS) noinst_PROGRAMS += test-gphoto2 test_gphoto2_SOURCES = test-gphoto2.c test_gphoto2_LDADD = \ - $(top_builddir)/libgphoto2/libgphoto2.la \ - $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la \ + $(libgphoto2_la) \ + $(libgphoto2_port_la) \ $(LIBLTDL) \ $(LIBEXIF_LIBS) \ $(INTLLIBS) @@ -79,8 +79,8 @@ test_gphoto2_LDADD = \ noinst_PROGRAMS += test-filesys test_filesys_SOURCES = test-filesys.c test_filesys_LDADD = \ - $(top_builddir)/libgphoto2/libgphoto2.la \ - $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la \ + $(libgphoto2_la) \ + $(libgphoto2_port_la) \ $(LIBLTDL) \ $(LIBEXIF_LIBS) \ $(INTLLIBS) @@ -92,8 +92,8 @@ INSTALL_TESTS += test-camera-list check_PROGRAMS += test-camera-list test_camera_list_SOURCES = test-camera-list.c test_camera_list_LDADD = \ - $(top_builddir)/libgphoto2/libgphoto2.la \ - $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la \ + $(libgphoto2_la) \ + $(libgphoto2_port_la) \ $(LIBLTDL) \ $(LIBEXIF_LIBS) \ $(INTLLIBS) @@ -102,8 +102,8 @@ test_camera_list_LDADD = \ TESTS += test-init-localedir check_PROGRAMS += test-init-localedir test_init_localedir_LDADD = -test_init_localedir_LDADD += $(top_builddir)/libgphoto2/libgphoto2.la -test_init_localedir_LDADD += $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la +test_init_localedir_LDADD += $(libgphoto2_la) +test_init_localedir_LDADD += $(libgphoto2_port_la) test_init_localedir_LDADD += $(LIBLTDL) test_init_localedir_LDADD += $(LIBEXIF_LIBS) test_init_localedir_LDADD += $(INTLLIBS)