From 379c170da727c595ccb7ead713da9205166d04a4 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 26 Oct 2021 00:55:28 +0200 Subject: [PATCH 01/37] Make the compiler warnings work with clang as well Make the compiler warnings work with clang in addition to gcc. This came up then the pedantic build tests failed on FreeBSD 13. To achieve this, we add -Werror=unknown-warning-option to the CFLAGS for clang to abort immediately on encountering an unknown warning option. This means we now only add warnings which the compiler (both clang and gcc) actually supports. As configure tests that compiling is possible for each warning flag, this should not introduce compatibility issues where builds which used to work now do not. However, you can always opt to not use the generated CFLAGS by setting CFLAGS to empty when running your build like make all check CFLAGS= --- configure.ac | 64 +++++++++++++++++++++---- gphoto-m4/gp-pedantic-compiler-flags.m4 | 19 ++++++-- 2 files changed, 69 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 05a8320f5c..8db64d8451 100644 --- a/configure.ac +++ b/configure.ac @@ -112,12 +112,61 @@ GP_PEDANTIC_COMPILER_FLAGS([CXX11], [C++], [-std=c++11]) GP_PEDANTIC_COMPILER_FLAGS([CXX14], [C++], [-std=c++14]) GP_PEDANTIC_COMPILER_FLAGS([CXX17], [C++], [-std=c++17]) -GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS],[-Wall]) -GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS],[-Wextra]) -GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS],[-Wno-unused-parameter]) -GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS],[-Wno-format-overflow]) -GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS],[-Wno-format-truncation]) -GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS],[-Wno-stringop-truncation]) +dnl -------------------------------------------------------------------- +dnl The goals here are twofold: +dnl +dnl * Produce as many compiler warnings as possible to find +dnl potential problems in our own code. +dnl +dnl * Make sure our API header files are as broadly compatible as +dnl possible. +dnl +dnl We want our library and driver code to compile with the lowest +dnl possible number of warnings, and the pedantic compilation tests to +dnl compile with zero warnings (-Werror) so we do not limit the users +dnl of our API in their use of compiler warnings. +dnl +dnl If, for some reason, you need to build without all these compiler +dnl warnings, run the build while setting CFLAGS to an empty string: +dnl +dnl $ make all check CFLAGS= +dnl -------------------------------------------------------------------- + +dnl * gcc exits non-zero when it encounters an unknown warning option +dnl * clang by default ignores unknown warning option +dnl * clang with -Werror=unknown-warning-option will exit non-zero +dnl when it encounters an unknown warning option +GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Werror=unknown-warning-option]) + +GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Wall]) +GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Wextra]) +GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Weverything]) + +dnl We used to have these two defined for GCC instead of the whole -Wextra +dnl GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Wmissing-declarations]) +dnl GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Wmissing-prototypes]) + +dnl clang finds the underscores in all the "struct _Foo" definitions +dnl which means they fall into the reserved category. Before we can +dnl think about renaming those idenifiers, we need to verify they are +dnl not part of our public API. +GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Wno-error=reserved-identifier]) + +dnl clang finds "/** comments using \deprecated */" without a +dnl corresponding __attribute__(( deprecated )). We need a good header +dnl file defining such compiler and standard library specific +dnl attributes purely as C preprocessor macros without configure +dnl involvement before we can change anything about this in the public +dnl API's include files. +GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Wno-error=documentation-deprecated-sync]) + +dnl We used to have these four... no idea why, though. Stop reporting +dnl unused parameters for now, as those are VERY numerous and not much +dnl of a security risk, unlike the format and string warnings. +GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Wno-unused-parameter]) +dnl GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Wno-format-overflow]) +dnl GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Wno-format-truncation]) +dnl GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Wno-stringop-truncation]) dnl Every compile example after here will be using the C language AC_LANG([C]) @@ -127,9 +176,6 @@ dnl --------------------------------------------------------------------------- dnl Turn on (almost) all warnings when using gcc dnl --------------------------------------------------------------------------- if test "x$GCC" = "xyes"; then - # CFLAGS="$CFLAGS --std=c99 -Wall -Wextra -Werror -pedantic" - CFLAGS="$CFLAGS -Wall -Wmissing-declarations -Wmissing-prototypes" - LDFLAGS="$LDFLAGS" AC_SUBST([NO_UNUSED_CFLAGS], [-Wno-unused]) fi AM_CONDITIONAL([HAVE_GCC], [test "x$GCC" = "xyes"]) diff --git a/gphoto-m4/gp-pedantic-compiler-flags.m4 b/gphoto-m4/gp-pedantic-compiler-flags.m4 index b84aa0b51a..11afa8982e 100644 --- a/gphoto-m4/gp-pedantic-compiler-flags.m4 +++ b/gphoto-m4/gp-pedantic-compiler-flags.m4 @@ -7,12 +7,16 @@ dnl #################################################################### dnl GP_CONDITIONAL_COMPILE_FLAGS(FLAG_VAR, FLAGS) dnl #################################################################### AC_DEFUN([GP_CONDITIONAL_COMPILE_FLAGS], [dnl +dnl # BEGIN $0($@) -AS_VAR_IF([$1], [], [dnl - $1="$2" -], [dnl - $1="[$]{$1} $2" -]) +dnl +m4_case([$1], + [CFLAGS], [AC_LANG_PUSH([C])], + [CXXFLAGS], [AC_LANG_PUSH([C++])], + [m4_fatal([wrong compiler flag])])dnl +dnl +saved_$1="${$1}" +AS_VAR_IF([$1], [], [$1="$2"], [$1="[$]{$1} $2"]) AC_MSG_CHECKING([whether $1="[$]$1" compiles]) AC_COMPILE_IFELSE([m4_case([$1], [CFLAGS], [dnl AC_LANG_SOURCE([[ @@ -47,7 +51,12 @@ int main(int argc, char *argv[]) : "Added flag $2 to $1 and it does not work" AC_MSG_RESULT([no]) gp_have_pedantic_compiler=no + $1="$saved_$1" ]) +m4_case([$1], + [CFLAGS], [AC_LANG_POP([C])], + [CXXFLAGS], [AC_LANG_POP([C++])], + [m4_fatal([wrong compiler flag])])dnl # END $0($@) ])dnl dnl From 9fcbbd6443e027e1422060d2b166cf2ecc1a6296 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 26 Oct 2021 12:20:22 +0200 Subject: [PATCH 02/37] tests: Remove old pedantic compilation tests These did not work with C++ on FreeBSD 13 anyway, due to c++98 not working there, which the old pedantic compilation just assumed was working without testing it in configure. The new pedantic compilation tests offer a multitude of language standards including c++98, but only tries building the pedantic compilation tests for those language standards for which configure has shown that building programs is possible at all. --- tests/Makefile.am | 52 +---------------------------------------------- 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index fdccf9a401..7c26b343e9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -92,57 +92,7 @@ test_camera_list_LDADD = \ ######################################################################## -# Old pedantic compilation test -######################################################################## - -if HAVE_GCC -PEDANTIC_CFLAGS = -std=c99 -pedantic-errors -W -Wall -Wextra -Werror -PEDANTIC_CXXFLAGS = -std=c++98 -pedantic-errors -W -Wall -Wextra -Werror -else -PEDANTIC_CFLAGS = -PEDANTIC_CXXFLAGS = -endif - -TESTS += test-pedantic-c -check_PROGRAMS += test-pedantic-c -test_pedantic_c_SOURCES = test-pedantic-compilation.c -test_pedantic_c_CPPFLAGS = \ - $(AM_CPPFLAGS) $(CPPFLAGS) \ - -U_GPHOTO2_INTERNAL_CODE -test_pedantic_c_CFLAGS = \ - $(AM_CFLAGS) $(PEDANTIC_CFLAGS) $(CFLAGS) \ - -U_GPHOTO2_INTERNAL_CODE -test_pedantic_c_LDADD = \ - $(top_builddir)/libgphoto2/libgphoto2.la \ - $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la \ - $(LIBLTDL) \ - $(LIBEXIF_LIBS) \ - $(INTLLIBS) - - -if HAVE_CXX -check_PROGRAMS += test-pedantic-cxx -TESTS += test-pedantic-cxx -else -EXTRA_PROGRAMS += test-pedantic-cxx -endif -test_pedantic_cxx_SOURCES = test-pedantic-compilation.cxx -test_pedantic_cxx_CPPFLAGS = \ - $(AM_CPPFLAGS) $(CPPFLAGS) \ - -U_GPHOTO2_INTERNAL_CODE -test_pedantic_cxx_CXXFLAGS = \ - $(AM_CXXFLAGS) $(PEDANTIC_CXXFLAGS) $(CXXFLAGS) \ - -U_GPHOTO2_INTERNAL_CODE -test_pedantic_cxx_LDADD = \ - $(top_builddir)/libgphoto2/libgphoto2.la \ - $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la \ - $(LIBLTDL) \ - $(LIBEXIF_LIBS) \ - $(INTLLIBS) - - -######################################################################## -# Test pendantic compilation for multiple language standard +# Test pedantic compilation for multiple language standard ######################################################################## generic_pedantic_cppflags = From d87169a24a90fa9930a823b25a4426812688279e Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 27 Oct 2021 00:52:24 +0200 Subject: [PATCH 03/37] tests: Always define programs, conditionally test them Always define the test programs, but only conditionally test them. This makes certain they can be build, the sources are added to the dist tarball, etc. --- tests/Makefile.am | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 7c26b343e9..f3a615b94a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -102,88 +102,87 @@ generic_pedantic_cppflags += -I$(top_srcdir) if GP_HAVE_PEDANTIC_FLAGS_C90 TESTS += test-pedantic-c90 check_PROGRAMS += test-pedantic-c90 +endif +EXTRA_PROGRAMS += test-pedantic-c90 test_pedantic_c90_SOURCES = test-pedantic-compilation.c test_pedantic_c90_CPPFLAGS = $(generic_pedantic_cppflags) test_pedantic_c90_CFLAGS = $(GP_PEDANTIC_CFLAGS_C90) test_pedantic_c90_LDADD = test_pedantic_c90_LDFLAGS = -endif if GP_HAVE_PEDANTIC_FLAGS_C99 TESTS += test-pedantic-c99 check_PROGRAMS += test-pedantic-c99 +endif +EXTRA_PROGRAMS += test-pedantic-c99 test_pedantic_c99_SOURCES = test-pedantic-compilation.c test_pedantic_c99_CPPFLAGS = $(generic_pedantic_cppflags) test_pedantic_c99_CFLAGS = $(GP_PEDANTIC_CFLAGS_C99) test_pedantic_c99_LDADD = test_pedantic_c99_LDFLAGS = -endif if GP_HAVE_PEDANTIC_FLAGS_C11 TESTS += test-pedantic-c11 check_PROGRAMS += test-pedantic-c11 +endif +EXTRA_PROGRAMS += test-pedantic-c11 test_pedantic_c11_SOURCES = test-pedantic-compilation.c test_pedantic_c11_CPPFLAGS = $(generic_pedantic_cppflags) test_pedantic_c11_CFLAGS = $(GP_PEDANTIC_CFLAGS_C11) test_pedantic_c11_LDADD = test_pedantic_c11_LDFLAGS = -endif -if GP_HAVE_PEDANTIC_FLAGS_CXX98 if HAVE_CXX +if GP_HAVE_PEDANTIC_FLAGS_CXX98 TESTS += test-pedantic-cxx98 check_PROGRAMS += test-pedantic-cxx98 -else -EXTRA_PROGRAMS += test-pedantic-cxx98 endif +endif +EXTRA_PROGRAMS += test-pedantic-cxx98 test_pedantic_cxx98_SOURCES = test-pedantic-compilation.cxx test_pedantic_cxx98_CPPFLAGS = $(generic_pedantic_cppflags) test_pedantic_cxx98_CXXFLAGS = $(GP_PEDANTIC_CXXFLAGS_CXX98) test_pedantic_cxx98_LDADD = test_pedantic_cxx98_LDFLAGS = -endif -if GP_HAVE_PEDANTIC_FLAGS_CXX11 if HAVE_CXX +if GP_HAVE_PEDANTIC_FLAGS_CXX11 TESTS += test-pedantic-cxx11 check_PROGRAMS += test-pedantic-cxx11 -else -EXTRA_PROGRAMS += test-pedantic-cxx11 endif +endif +EXTRA_PROGRAMS += test-pedantic-cxx11 test_pedantic_cxx11_SOURCES = test-pedantic-compilation.cxx test_pedantic_cxx11_CPPFLAGS = $(generic_pedantic_cppflags) test_pedantic_cxx11_CXXFLAGS = $(GP_PEDANTIC_CXXFLAGS_CXX11) test_pedantic_cxx11_LDADD = test_pedantic_cxx11_LDFLAGS = -endif -if GP_HAVE_PEDANTIC_FLAGS_CXX14 if HAVE_CXX +if GP_HAVE_PEDANTIC_FLAGS_CXX14 TESTS += test-pedantic-cxx14 check_PROGRAMS += test-pedantic-cxx14 -else -EXTRA_PROGRAMS += test-pedantic-cxx14 endif +endif +EXTRA_PROGRAMS += test-pedantic-cxx14 test_pedantic_cxx14_SOURCES = test-pedantic-compilation.cxx test_pedantic_cxx14_CPPFLAGS = $(generic_pedantic_cppflags) test_pedantic_cxx14_CXXFLAGS = $(GP_PEDANTIC_CXXFLAGS_CXX14) test_pedantic_cxx14_LDADD = test_pedantic_cxx14_LDFLAGS = -endif -if GP_HAVE_PEDANTIC_FLAGS_CXX17 if HAVE_CXX +if GP_HAVE_PEDANTIC_FLAGS_CXX17 TESTS += test-pedantic-cxx17 check_PROGRAMS += test-pedantic-cxx17 -else -EXTRA_PROGRAMS += test-pedantic-cxx17 endif +endif +EXTRA_PROGRAMS += test-pedantic-cxx17 test_pedantic_cxx17_SOURCES = test-pedantic-compilation.cxx test_pedantic_cxx17_CPPFLAGS = $(generic_pedantic_cppflags) test_pedantic_cxx17_CXXFLAGS = $(GP_PEDANTIC_CXXFLAGS_CXX17) test_pedantic_cxx17_LDADD = test_pedantic_cxx17_LDFLAGS = -endif ######################################################################## From 0fc843a4178e0b39b80131121ed561c8e187c0b2 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 27 Oct 2021 00:54:44 +0200 Subject: [PATCH 04/37] tests: add pedantic compile test for -std=c++20 Add a pedantic compile test for c++20 in addtion to the existing ones for c++98, c++11, c++14, and c++17. --- configure.ac | 1 + tests/Makefile.am | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/configure.ac b/configure.ac index 8db64d8451..c95e14abdc 100644 --- a/configure.ac +++ b/configure.ac @@ -111,6 +111,7 @@ GP_PEDANTIC_COMPILER_FLAGS([CXX98], [C++], [-std=c++98]) GP_PEDANTIC_COMPILER_FLAGS([CXX11], [C++], [-std=c++11]) GP_PEDANTIC_COMPILER_FLAGS([CXX14], [C++], [-std=c++14]) GP_PEDANTIC_COMPILER_FLAGS([CXX17], [C++], [-std=c++17]) +GP_PEDANTIC_COMPILER_FLAGS([CXX20], [C++], [-std=c++20]) dnl -------------------------------------------------------------------- dnl The goals here are twofold: diff --git a/tests/Makefile.am b/tests/Makefile.am index f3a615b94a..e808ae1bf2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -184,6 +184,19 @@ test_pedantic_cxx17_CXXFLAGS = $(GP_PEDANTIC_CXXFLAGS_CXX17) test_pedantic_cxx17_LDADD = test_pedantic_cxx17_LDFLAGS = +if HAVE_CXX +if GP_HAVE_PEDANTIC_FLAGS_CXX20 +TESTS += test-pedantic-cxx20 +check_PROGRAMS += test-pedantic-cxx20 +endif +endif +EXTRA_PROGRAMS += test-pedantic-cxx20 +test_pedantic_cxx20_SOURCES = test-pedantic-compilation.cxx +test_pedantic_cxx20_CPPFLAGS = $(generic_pedantic_cppflags) +test_pedantic_cxx20_CXXFLAGS = $(GP_PEDANTIC_CXXFLAGS_CXX20) +test_pedantic_cxx20_LDADD = +test_pedantic_cxx20_LDFLAGS = + ######################################################################## # Implement the checks for the installed library From 698ab00fa7ce3b61a83ea6cb86ee47f6736c8acf Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Mon, 18 Oct 2021 20:53:12 +0200 Subject: [PATCH 05/37] Use m4_pattern_forbid to find unnoticed GP_ strings Use m4_pattern_forbid to find unnoticed GP_ strings in the configure and config.status scripts. --- configure.ac | 5 +++++ gphoto-m4/gp-gettext-hack.m4 | 1 + gphoto-m4/gp-set.m4 | 5 +++-- libgphoto2_port/configure.ac | 5 +++++ libgphoto2_port/gphoto-m4/gp-gettext-hack.m4 | 1 + 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index c95e14abdc..cf265e63d8 100644 --- a/configure.ac +++ b/configure.ac @@ -25,6 +25,11 @@ AM_INIT_AUTOMAKE([-Wall foreign 1.9 dist-bzip2 dist-xz check-news subdir-objects m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])]) AM_SILENT_RULES([no]) + +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}]) diff --git a/gphoto-m4/gp-gettext-hack.m4 b/gphoto-m4/gp-gettext-hack.m4 index 940e287de9..01ca927422 100644 --- a/gphoto-m4/gp-gettext-hack.m4 +++ b/gphoto-m4/gp-gettext-hack.m4 @@ -33,6 +33,7 @@ m4_ifval([$4],[ if test -n "$PACKAGE_BUGREPORT"; then sed_mb="${PACKAGE_BUGREPORT}" else + m4_pattern_allow([GP_GETTEXT_HACK])dnl AC_MSG_ERROR([ *** Your configure.{ac,in} is wrong. *** Either define PACKAGE_BUGREPORT (by using the 4-parameter AC INIT syntax) diff --git a/gphoto-m4/gp-set.m4 b/gphoto-m4/gp-set.m4 index 56be8bc57a..444d71f764 100644 --- a/gphoto-m4/gp-set.m4 +++ b/gphoto-m4/gp-set.m4 @@ -338,17 +338,18 @@ cat>confset_res_23.txt< confset_diff_23.txt], [dnl AS_IF([${CMP} confset_diff_23.txt confset_res_23.txt > /dev/null 2>&1], [dnl AC_MSG_RESULT([yes]) rm -f confset_a.txt confset_b.txt confset_diff_23.txt confset_res_23.txt ], [dnl AC_MSG_RESULT([no (wrong result)]) - AC_MSG_ERROR([comm -23 must work for GP_SET difference calculations]) + AC_MSG_ERROR([comm -23 must work for GP_SET_xyz difference calculations]) ]) ], [dnl AC_MSG_RESULT([no (does not run)]) - AC_MSG_ERROR([comm -23 must work for GP_SET difference calculations]) + AC_MSG_ERROR([comm -23 must work for GP_SET_xyz difference calculations]) ]) dnl This functions uses the shell builtin 'shift', so it needs to store dnl the original $1 and $2 in local variables. diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index ea469d5dbe..dcea2ce65f 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -20,6 +20,11 @@ AC_LANG(C) m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])]) AM_SILENT_RULES([no]) + +dnl Flag all GP_ strings in result as error unless specifically allowed. +m4_pattern_forbid([^_?GP_])dnl + + dnl --------------------------------------------------------------------------- dnl Advanced information about versioning: dnl * "Writing shared libraries" by Mike Hearn diff --git a/libgphoto2_port/gphoto-m4/gp-gettext-hack.m4 b/libgphoto2_port/gphoto-m4/gp-gettext-hack.m4 index 940e287de9..01ca927422 100644 --- a/libgphoto2_port/gphoto-m4/gp-gettext-hack.m4 +++ b/libgphoto2_port/gphoto-m4/gp-gettext-hack.m4 @@ -33,6 +33,7 @@ m4_ifval([$4],[ if test -n "$PACKAGE_BUGREPORT"; then sed_mb="${PACKAGE_BUGREPORT}" else + m4_pattern_allow([GP_GETTEXT_HACK])dnl AC_MSG_ERROR([ *** Your configure.{ac,in} is wrong. *** Either define PACKAGE_BUGREPORT (by using the 4-parameter AC INIT syntax) From 2d833eadbd6d54f334e2f232454cec364f7587da Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Mon, 18 Oct 2021 04:08:06 +0200 Subject: [PATCH 06/37] Update libltdl checks (GP_LIBLTDL) We still do not use LTDL_INIT() as LTDL_INIT insists on us shipping libltdl sources in our release tarballs and we still do not like shipping 3rd party sources. This now checks locations other than the default include and linker paths, so that configure should find libltdl by itself now on e.g. FreeBSD. --- configure.ac | 6 +- gphoto-m4/gp-libltdl.m4 | 135 +++++++++++++++++------- libgphoto2_port/configure.ac | 6 +- libgphoto2_port/gphoto-m4/gp-libltdl.m4 | 135 +++++++++++++++++------- 4 files changed, 198 insertions(+), 84 deletions(-) diff --git a/configure.ac b/configure.ac index cf265e63d8..c1c5fa4216 100644 --- a/configure.ac +++ b/configure.ac @@ -217,10 +217,8 @@ AC_LIBTOOL_DLOPEN AC_PROG_LIBTOOL dnl We are using our own libltdl checks instead of AC_WITH_LTDL -dnl because we do not want to ship our own copy of libltdl any more. -dnl Not shipping libltdl makes it possible to ditch our own autogen.sh -dnl and relying on standard autoconf's "autoreconf". -GP_LIB_LTDL +dnl because we do not want to ship our own copy of libltdl. +GP_LIBLTDL # report on compiler/libtool setup diff --git a/gphoto-m4/gp-libltdl.m4 b/gphoto-m4/gp-libltdl.m4 index 2a37c93054..adb8d1af35 100644 --- a/gphoto-m4/gp-libltdl.m4 +++ b/gphoto-m4/gp-libltdl.m4 @@ -1,59 +1,118 @@ dnl Written by Hans Ulrich Niedermann dnl LDFLAGS vs LIBS fix by Dan Nicholson -dnl +dnl +dnl #################################################################### +dnl GP_LIBLTDL +dnl #################################################################### +dnl dnl We are using our own libltdl checks instead of AC_WITH_LTDL -dnl because we do not want to ship our own copy of libltdl any more. -dnl Not shipping libltdl makes it possible to ditch our own autogen.sh -dnl and relying on standard autoconf's "autoreconf". +dnl because we do not want to ship our own copy of libltdl. dnl dnl Look for external libltdl, not shipping internal libltdl. -AC_DEFUN([GP_LIB_LTDL],[dnl -AC_ARG_VAR([LTDLINCL],[CFLAGS for compiling with libltdl]) -AC_ARG_VAR([LIBLTDL],[LIBS to add for linking against libltdl]) -if test "x${LTDLINCL}${LIBLTDL}" = "x"; then -AC_CHECK_HEADER([ltdl.h], -[dnl -AC_CHECK_LIB([ltdl], [lt_dlinit],[dnl -LTDLINCL="" -LIBLTDL="-lltdl" -AC_DEFINE([HAVE_LTDL],[1],[Whether libltdl (of libtool fame) is present]) -],[dnl +AC_DEFUN([GP_LIBLTDL], [dnl +AC_ARG_VAR([LTDLINCL], [CFLAGS for compiling with libltdl]) +AC_ARG_VAR([LIBLTDL], [LIBS to add for linking against libltdl]) +dnl +have_libltdl=no +AC_MSG_CHECKING([for libltdl]) +AS_IF([test "x${LTDLINCL}${LIBLTDL}" != x], [dnl + AC_MSG_RESULT([variables given explicitly]) + + AC_MSG_CHECKING([LTDLINCL (given explicitly)]) + AC_MSG_RESULT([${LTDLINCL}]) + AC_MSG_CHECKING([LIBLTDL (given explictly)]) + AC_MSG_RESULT([${LIBLTDL}]) + + GP_LINK_LIBLTDL_IFELSE([dnl + have_libltdl=yes + ], [dnl + GP_MSG_ERROR_LIBLTDL + ]) +], [dnl + AC_MSG_RESULT([autodetecting]) + + AS_VAR_IF([have_libltdl], [no], [dnl Try default location + LTDLINCL="" + LIBLTDL="-lltdl" + GP_LINK_LIBLTDL_IFELSE([ + have_libltdl=yes + ], [dnl + AS_UNSET([LTDLINCL]) + AS_UNSET([LIBLTDL]) + ]) + ]) + + dnl FreeBSD packages install to /usr/local + dnl NetBSD packages install to /usr/pkg + for gp_prefix in /usr/local /usr/pkg; do + AS_VAR_IF([have_libltdl], [no], [dnl + LTDLINCL="-I${gp_prefix}/include" + LIBLTDL="-L${gp_prefix}/lib -lltdl" + GP_LINK_LIBLTDL_IFELSE([ + have_libltdl=yes + ], [dnl + AS_UNSET([LTDLINCL]) + AS_UNSET([LIBLTDL]) + ]) + ]) + done + + AS_VAR_IF([have_libltdl], [yes], [dnl + AC_MSG_CHECKING([LTDLINCL (autodetected)]) + AC_MSG_RESULT([${LTDLINCL}]) + AC_MSG_CHECKING([LIBLTDL (autodetected)]) + AC_MSG_RESULT([${LIBLTDL}]) + ], [dnl + GP_MSG_ERROR_LIBLTDL + ]) +]) +])dnl +dnl +dnl +dnl #################################################################### +dnl GP_MSG_ERROR_LIBLTDL +dnl #################################################################### +dnl +dnl Print the error message when libltdl has not been found to work. +dnl +AC_DEFUN([GP_MSG_ERROR_LIBLTDL], [dnl AC_MSG_ERROR([ -$PACKAGE requires the ltdl library, included with libtool +${PACKAGE} requires libltdl (a part of libtool) Please make sure that the proper development package is installed -(libltdl-dev, libtool-ltdl-devel, etc.) -])[]dnl -])dnl +(may be called libltdl-dev, libtool-ltdl-devel, libltdl, etc.) and if +the autodetection fails, that the LTDLINCL and LIBLTDL variables are +set properly on the configure command line. ]) -else - AC_MSG_CHECKING([for libltdl flags]) - AC_MSG_RESULT([set explicitly: ${LTDLINCL} ${LIBLTDL}]) -fi -AC_SUBST([LTDLINCL]) -AC_SUBST([LIBLTDL]) +])dnl +dnl +dnl +dnl #################################################################### +dnl GP_LINK_LIBLTDL_IFELSE +dnl #################################################################### dnl dnl Make sure we can actually compile and link against libltdl +dnl +AC_DEFUN([GP_LINK_LIBLTDL_IFELSE], [dnl AC_LANG_PUSH([C]) -AC_MSG_CHECKING([that we can compile and link with libltdl]) saved_CPPFLAGS="$CPPFLAGS" saved_LIBS="$LIBS" CPPFLAGS="$CPPFLAGS $LTDLINCL" LIBS="$LIBS $LIBLTDL" -AC_LINK_IFELSE([AC_LANG_PROGRAM([dnl +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include /* for NULL */ #include /* for lt_* */ -],[dnl -int ret = lt_dlforeachfile("/usr/lib:/usr/local/lib", NULL, NULL); -])], [AC_MSG_RESULT([yes])], [dnl -AC_MSG_RESULT([no]) -AC_MSG_ERROR([cannot compile and link against libltdl -${PACKAGE_TARNAME} requires libltdl (the libtool dl* library), -but cannot compile and link against it. -Aborting. -]) -]) +]], [[ + int ret = lt_dlforeachfile("/usr/lib:/usr/local/lib", NULL, NULL); + (void) ret; +]])], [$1], [$2]) CPPFLAGS="$saved_CPPFLAGS" LIBS="$saved_LIBS" -AC_LANG_POP +AC_LANG_POP([C]) ])dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index dcea2ce65f..2fe797c1bf 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -89,10 +89,8 @@ AC_LIBTOOL_DLOPEN AC_PROG_LIBTOOL dnl We are using our own libltdl checks instead of AC_WITH_LTDL -dnl because we do not want to ship our own copy of libltdl any more. -dnl Not shipping libltdl makes it possible to ditch our own autogen.sh -dnl and relying on standard autoconf's "autoreconf". -GP_LIB_LTDL +dnl because we do not want to ship our own copy of libltdl. +GP_LIBLTDL # report on compiler/libtool setup diff --git a/libgphoto2_port/gphoto-m4/gp-libltdl.m4 b/libgphoto2_port/gphoto-m4/gp-libltdl.m4 index 2a37c93054..adb8d1af35 100644 --- a/libgphoto2_port/gphoto-m4/gp-libltdl.m4 +++ b/libgphoto2_port/gphoto-m4/gp-libltdl.m4 @@ -1,59 +1,118 @@ dnl Written by Hans Ulrich Niedermann dnl LDFLAGS vs LIBS fix by Dan Nicholson -dnl +dnl +dnl #################################################################### +dnl GP_LIBLTDL +dnl #################################################################### +dnl dnl We are using our own libltdl checks instead of AC_WITH_LTDL -dnl because we do not want to ship our own copy of libltdl any more. -dnl Not shipping libltdl makes it possible to ditch our own autogen.sh -dnl and relying on standard autoconf's "autoreconf". +dnl because we do not want to ship our own copy of libltdl. dnl dnl Look for external libltdl, not shipping internal libltdl. -AC_DEFUN([GP_LIB_LTDL],[dnl -AC_ARG_VAR([LTDLINCL],[CFLAGS for compiling with libltdl]) -AC_ARG_VAR([LIBLTDL],[LIBS to add for linking against libltdl]) -if test "x${LTDLINCL}${LIBLTDL}" = "x"; then -AC_CHECK_HEADER([ltdl.h], -[dnl -AC_CHECK_LIB([ltdl], [lt_dlinit],[dnl -LTDLINCL="" -LIBLTDL="-lltdl" -AC_DEFINE([HAVE_LTDL],[1],[Whether libltdl (of libtool fame) is present]) -],[dnl +AC_DEFUN([GP_LIBLTDL], [dnl +AC_ARG_VAR([LTDLINCL], [CFLAGS for compiling with libltdl]) +AC_ARG_VAR([LIBLTDL], [LIBS to add for linking against libltdl]) +dnl +have_libltdl=no +AC_MSG_CHECKING([for libltdl]) +AS_IF([test "x${LTDLINCL}${LIBLTDL}" != x], [dnl + AC_MSG_RESULT([variables given explicitly]) + + AC_MSG_CHECKING([LTDLINCL (given explicitly)]) + AC_MSG_RESULT([${LTDLINCL}]) + AC_MSG_CHECKING([LIBLTDL (given explictly)]) + AC_MSG_RESULT([${LIBLTDL}]) + + GP_LINK_LIBLTDL_IFELSE([dnl + have_libltdl=yes + ], [dnl + GP_MSG_ERROR_LIBLTDL + ]) +], [dnl + AC_MSG_RESULT([autodetecting]) + + AS_VAR_IF([have_libltdl], [no], [dnl Try default location + LTDLINCL="" + LIBLTDL="-lltdl" + GP_LINK_LIBLTDL_IFELSE([ + have_libltdl=yes + ], [dnl + AS_UNSET([LTDLINCL]) + AS_UNSET([LIBLTDL]) + ]) + ]) + + dnl FreeBSD packages install to /usr/local + dnl NetBSD packages install to /usr/pkg + for gp_prefix in /usr/local /usr/pkg; do + AS_VAR_IF([have_libltdl], [no], [dnl + LTDLINCL="-I${gp_prefix}/include" + LIBLTDL="-L${gp_prefix}/lib -lltdl" + GP_LINK_LIBLTDL_IFELSE([ + have_libltdl=yes + ], [dnl + AS_UNSET([LTDLINCL]) + AS_UNSET([LIBLTDL]) + ]) + ]) + done + + AS_VAR_IF([have_libltdl], [yes], [dnl + AC_MSG_CHECKING([LTDLINCL (autodetected)]) + AC_MSG_RESULT([${LTDLINCL}]) + AC_MSG_CHECKING([LIBLTDL (autodetected)]) + AC_MSG_RESULT([${LIBLTDL}]) + ], [dnl + GP_MSG_ERROR_LIBLTDL + ]) +]) +])dnl +dnl +dnl +dnl #################################################################### +dnl GP_MSG_ERROR_LIBLTDL +dnl #################################################################### +dnl +dnl Print the error message when libltdl has not been found to work. +dnl +AC_DEFUN([GP_MSG_ERROR_LIBLTDL], [dnl AC_MSG_ERROR([ -$PACKAGE requires the ltdl library, included with libtool +${PACKAGE} requires libltdl (a part of libtool) Please make sure that the proper development package is installed -(libltdl-dev, libtool-ltdl-devel, etc.) -])[]dnl -])dnl +(may be called libltdl-dev, libtool-ltdl-devel, libltdl, etc.) and if +the autodetection fails, that the LTDLINCL and LIBLTDL variables are +set properly on the configure command line. ]) -else - AC_MSG_CHECKING([for libltdl flags]) - AC_MSG_RESULT([set explicitly: ${LTDLINCL} ${LIBLTDL}]) -fi -AC_SUBST([LTDLINCL]) -AC_SUBST([LIBLTDL]) +])dnl +dnl +dnl +dnl #################################################################### +dnl GP_LINK_LIBLTDL_IFELSE +dnl #################################################################### dnl dnl Make sure we can actually compile and link against libltdl +dnl +AC_DEFUN([GP_LINK_LIBLTDL_IFELSE], [dnl AC_LANG_PUSH([C]) -AC_MSG_CHECKING([that we can compile and link with libltdl]) saved_CPPFLAGS="$CPPFLAGS" saved_LIBS="$LIBS" CPPFLAGS="$CPPFLAGS $LTDLINCL" LIBS="$LIBS $LIBLTDL" -AC_LINK_IFELSE([AC_LANG_PROGRAM([dnl +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include /* for NULL */ #include /* for lt_* */ -],[dnl -int ret = lt_dlforeachfile("/usr/lib:/usr/local/lib", NULL, NULL); -])], [AC_MSG_RESULT([yes])], [dnl -AC_MSG_RESULT([no]) -AC_MSG_ERROR([cannot compile and link against libltdl -${PACKAGE_TARNAME} requires libltdl (the libtool dl* library), -but cannot compile and link against it. -Aborting. -]) -]) +]], [[ + int ret = lt_dlforeachfile("/usr/lib:/usr/local/lib", NULL, NULL); + (void) ret; +]])], [$1], [$2]) CPPFLAGS="$saved_CPPFLAGS" LIBS="$saved_LIBS" -AC_LANG_POP +AC_LANG_POP([C]) ])dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: From ba5455a9bd006be6b23c4078a8a40cc6e74fee1f Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Mon, 25 Oct 2021 21:41:17 +0200 Subject: [PATCH 07/37] Update the checks for jpeg-turbo libjpeg Update the checks for jpeg-turbo libjpeg to try libjpeg.pc with PKG_CHECK_MODULES first, and also to allow explicitly set LIBJPEG_CFLAGS and LIBJPEG_LIBS. The old mechanism did not allow specifying the location of libjpeg at all. It only allowed either disabling libjpeg or using libjpeg from the default include and linker paths. So this also changes the places in the Makefiles where we used to add @LIBJPEG@ to the linker to both link with $(LIBJPEG_LIBS) and compile with $(LIBJPEG_CFLAGS). The new configure logic keeps --without-jpeg to force- disable libjpeg, but updates the detection of libjpeg to first try the LIBJPEG_* variables if given, otherwise try PKG_CHECK_MODULES for libjpeg, and only then falls back to the old way of just trying the default include and link locations for libjpeg. Also, this mentions more information in the configure summary if not building with libjpeg, and it makes sure to call libjpeg "jpeg-turbo libjpeg" to help people with finding the proper system package to install. This is the first time we make it possible to build with jpeg-turbo libjpeg on e.g. FreeBSD. --- camlibs/ax203/Makefile-files | 4 +- camlibs/jl2005c/Makefile-files | 3 +- camlibs/ptp2/Makefile-files | 4 +- camlibs/sipix/Makefile-files | 3 +- configure.ac | 20 +---- gphoto-m4/Makefile-files | 1 + gphoto-m4/gp-libjpeg.m4 | 139 +++++++++++++++++++++++++++++++++ 7 files changed, 152 insertions(+), 22 deletions(-) create mode 100644 gphoto-m4/gp-libjpeg.m4 diff --git a/camlibs/ax203/Makefile-files b/camlibs/ax203/Makefile-files index e95b2b564f..14cd0be7d6 100644 --- a/camlibs/ax203/Makefile-files +++ b/camlibs/ax203/Makefile-files @@ -8,5 +8,5 @@ EXTRA_LTLIBRARIES += ax203.la ax203_la_SOURCES = ax203/library.c ax203/ax203.c ax203/ax203.h ax203/ax203_decode_yuv.c ax203/ax203_decode_yuv_delta.c ax203/ax203_compress_jpeg.c ax203/jpeg_memsrcdest.h ax203/jpeg_memsrcdest.c ax203/tinyjpeg.c ax203/tinyjpeg.h ax203/tinyjpeg-internal.h ax203/jidctflt.c ax203_la_LDFLAGS = $(camlib_ldflags) ax203_la_DEPENDENCIES = $(camlib_dependencies) -ax203_la_LIBADD = $(camlib_libadd) @LIBGD_LIBS@ @LIBJPEG@ -ax203_la_CFLAGS = @LIBGD_CFLAGS@ +ax203_la_LIBADD = $(camlib_libadd) @LIBGD_LIBS@ $(LIBJPEG_LIBS) +ax203_la_CFLAGS = @LIBGD_CFLAGS@ $(LIBJPEG_CFLAGS) diff --git a/camlibs/jl2005c/Makefile-files b/camlibs/jl2005c/Makefile-files index e3f58974b1..74693e38e4 100644 --- a/camlibs/jl2005c/Makefile-files +++ b/camlibs/jl2005c/Makefile-files @@ -16,4 +16,5 @@ jl2005c_la_SOURCES = jl2005c/library.c\ jl2005c/img_enhance.h jl2005c_la_LDFLAGS = $(camlib_ldflags) jl2005c_la_DEPENDENCIES = $(camlib_dependencies) -jl2005c_la_LIBADD = $(camlib_libadd) @LIBJPEG@ +jl2005c_la_LIBADD = $(camlib_libadd) $(LIBJPEG_LIBS) +jl2005c_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBJPEG_CFLAGS) diff --git a/camlibs/ptp2/Makefile-files b/camlibs/ptp2/Makefile-files index 2211bfcdc4..56c8854534 100644 --- a/camlibs/ptp2/Makefile-files +++ b/camlibs/ptp2/Makefile-files @@ -6,7 +6,7 @@ camlibdoc_DATA += ptp2/README.ptp2 EXTRA_LTLIBRARIES += ptp2.la -ptp2_la_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS) $(LIBXML2_CFLAGS) +ptp2_la_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS) $(LIBXML2_CFLAGS) $(LIBJPEG_CFLAGS) ptp2_la_CFLAGS = $(AM_CFLAGS) $(CFLAGS) $(LIBXML2_CFLAGS) -Wshadow ptp2_la_SOURCES = \ ptp2/ptp.c ptp2/ptp.h ptp2/chdk_ptp.h ptp2/chdk_live_view.h \ @@ -17,4 +17,4 @@ ptp2_la_SOURCES = \ ptp2/chdk.c ptp2/fujiptpip.c ptp2/ptpip-private.h ptp2_la_LDFLAGS = $(camlib_ldflags) ptp2_la_DEPENDENCIES = $(camlib_dependencies) -ptp2_la_LIBADD = $(camlib_libadd) $(LTLIBICONV) $(LIBXML2_LIBS) @LIBJPEG@ @LIBWS232@ +ptp2_la_LIBADD = $(camlib_libadd) $(LTLIBICONV) $(LIBXML2_LIBS) $(LIBJPEG_LIBS) @LIBWS232@ diff --git a/camlibs/sipix/Makefile-files b/camlibs/sipix/Makefile-files index 8010fcd035..3fa51087e6 100644 --- a/camlibs/sipix/Makefile-files +++ b/camlibs/sipix/Makefile-files @@ -17,7 +17,8 @@ EXTRA_LTLIBRARIES += sipix_blink2.la sipix_blink2_la_SOURCES = sipix/blink2.c sipix_blink2_la_LDFLAGS = $(camlib_ldflags) sipix_blink2_la_DEPENDENCIES = $(camlib_dependencies) -sipix_blink2_la_LIBADD = $(camlib_libadd) @LIBJPEG@ +sipix_blink2_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBJPEG_CFLAGS) +sipix_blink2_la_LIBADD = $(camlib_libadd) $(LIBJPEG_LIBS) EXTRA_LTLIBRARIES += sipix_web2.la diff --git a/configure.ac b/configure.ac index c1c5fa4216..d750ec6943 100644 --- a/configure.ac +++ b/configure.ac @@ -307,22 +307,10 @@ dnl AC_MSG_ERROR([gp-set.m4 testsuite done.]) dnl --------------------------------------------------------------------------- -dnl check for libjpeg -dnl --------------------------------------------------------------------------- -LIBJPEG="" -libjpeg_msg="no" -AC_SUBST(LIBJPEG) -AC_ARG_WITH([jpeg], AS_HELP_STRING([--without-jpeg], [Build without jpeg library (default: no)])) -AS_IF([test "x$with_jpeg" != "xno"], [ - AC_CHECK_LIB(jpeg,jpeg_start_decompress,[ - AC_CHECK_HEADER(jpeglib.h,[ - AC_DEFINE(HAVE_LIBJPEG,1,[define if we found LIBJPEG and its headers]) - LIBJPEG="-ljpeg" - libjpeg_msg="yes" - ]) - ]) -]) -GP_CONFIG_MSG([JPEG mangling support],[${libjpeg_msg}]) +dnl libjpeg (from libjpeg-turbo) +dnl --------------------------------------------------------------------------- +GP_LIBJPEG + dnl --------------------------------------------------------------------------- dnl check for ws2_32 diff --git a/gphoto-m4/Makefile-files b/gphoto-m4/Makefile-files index 2a89dd2d87..70fc5439a5 100644 --- a/gphoto-m4/Makefile-files +++ b/gphoto-m4/Makefile-files @@ -14,6 +14,7 @@ EXTRA_DIST += %reldir%/gp-documentation.m4 EXTRA_DIST += %reldir%/gp-driverdir.m4 EXTRA_DIST += %reldir%/gp-gettext-hack.m4 EXTRA_DIST += %reldir%/gp-internal-docs.m4 +EXTRA_DIST += %reldir%/gp-libjpeg.m4 EXTRA_DIST += %reldir%/gp-libltdl.m4 EXTRA_DIST += %reldir%/gp-manual-docbook-xml.m4 EXTRA_DIST += %reldir%/gp-manual-documentation.m4 diff --git a/gphoto-m4/gp-libjpeg.m4 b/gphoto-m4/gp-libjpeg.m4 new file mode 100644 index 0000000000..41abf41689 --- /dev/null +++ b/gphoto-m4/gp-libjpeg.m4 @@ -0,0 +1,139 @@ +dnl #################################################################### +dnl GP_LIBJPEG +dnl #################################################################### +dnl +dnl * If --without-jpeg or --with-jpeg=no is given, build without +dnl libjpeg support. +dnl * If not explicitly disabled by --without-jpeg, autodetect libjpeg. +dnl * If any of LIBJPEG_(CFLAGS|LIBS) is explicitly given, try +dnl compile+link using that. +dnl * If compile+link works, use that. +dnl * If compile+link fails, abort with error message. +dnl * If none of LIBJPEG_(CFLAGS|LIBS) are explicitly given, try +dnl pkg-config to find libjpeg.pc. +dnl * If libjpeg.pc has been found, try compile+link. +dnl * If compile+link works, use that. +dnl * If compile+link fails, build without libjpeg. +dnl * If libjpeg.pc has not been found, try default location. +dnl * If compile+link works, use that. +dnl * If compile+link fails, build without libjpeg. +dnl +AC_DEFUN([GP_LIBJPEG], [dnl +dnl +AC_MSG_CHECKING([whether to build with jpeg-turbo libjpeg]) +AC_ARG_WITH([jpeg], [dnl + AS_HELP_STRING([--without-jpeg], + [Build without libjpeg (default: with libjpeg)]) +], [dnl just keep the with-jpeg however it is given + AS_VAR_IF([with_jpeg], [no], [], [dnl + AC_MSG_ERROR([ +Unhandled value given to --with-jpeg / --without-jpeg: '$with_jpeg' +]) + ]) +], [dnl + with_jpeg=autodetect +]) +AC_MSG_RESULT([$with_jpeg]) +dnl +AS_VAR_IF([with_jpeg], [no], [dnl Not using libjpeg, so no checks are needed + # libjpeg explictly disabled from command line + GP_CONFIG_MSG([JPEG mangling support], + [no (disabled by --without-jpeg)]) +], [dnl + have_libjpeg=no + + AC_MSG_CHECKING([for jpeg-turbo libjpeg via variables]) + AS_IF([test "x$LIBJPEG_LIBS$LIBJPEG_CFLAGS" != x], [dnl + GP_LINK_LIBJPEG_IFELSE([ + AC_MSG_RESULT([found and works]) + have_libjpeg=yes + ], [dnl + AC_MSG_RESULT([found but fails to link]) + AC_MSG_ERROR([ +libjpeg not found despite LIBJPEG_CFLAGS and/or LIBJPEG_LIBS being set. +]) + ]) + ], [dnl + AC_MSG_RESULT([no]) + ]) + + AS_VAR_IF([have_libjpeg], [no], [dnl + PKG_CHECK_MODULES([LIBJPEG], [libjpeg], [dnl + AC_MSG_CHECKING([linking with jpeg-turbo libjpeg works]) + GP_LINK_LIBJPEG_IFELSE([dnl + have_libjpeg=yes + AC_MSG_RESULT([yes]) + ], [dnl + AC_MSG_RESULT([no]) + ]) + ], [dnl + LIBJPEG_LIBS="-ljpeg" + AC_MSG_CHECKING([for jpeg-turbo libjpeg at default location]) + GP_LINK_LIBJPEG_IFELSE([dnl + have_libjpeg=yes + AC_MSG_RESULT([yes]) + ], [dnl + AC_MSG_RESULT([no]) + AS_UNSET([LIBJPEG_LIBS]) + ]) + ]) + ]) + + AS_VAR_IF([have_libjpeg], [no], [dnl + GP_CONFIG_MSG([JPEG mangling support], + [${have_libjpeg} (requires jpeg-turbo libjpeg)]) + ], [dnl + AC_DEFINE([HAVE_LIBJPEG], [1], + [define if building with jpeg-turbo libjpeg]) + GP_CONFIG_MSG([JPEG mangling support], + [${have_libjpeg}]) + ]) +]) +])dnl +dnl +dnl +dnl #################################################################### +dnl GP_LINK_LIBJPEG_IFELSE([if-true], [if-false]) +dnl Make sure we can actually compile and link against libjpeg. +dnl #################################################################### +dnl +AC_DEFUN([GP_LINK_LIBJPEG_IFELSE], [dnl +AC_LANG_PUSH([C]) +saved_CPPFLAGS="$CPPFLAGS" +saved_LIBS="$LIBS" +CPPFLAGS="$CPPFLAGS $LIBJPEG_CFLAGS" +LIBS="$LIBS $LIBJPEG_LIBS" +AC_LINK_IFELSE([AC_LANG_SOURCE([[ +#include +#include +#include +/* jpeglib.h fails to include all required system headers, so jpeglib.h + * must be included after stddef.h (size_t) and stdio.h (FILE). + */ +#include + +int main(int argc, char **argv) +{ + j_decompress_ptr cinfo = NULL; + (void) argc; + (void) argv; + /* Running this will give a segfault */ + if (jpeg_start_decompress(cinfo)) { + printf("true\n"); + } else { + printf("false\n"); + } + return 0; +} +]])], [$1], [$2]) +CPPFLAGS="$saved_CPPFLAGS" +LIBS="$saved_LIBS" +AC_LANG_POP([C]) +])dnl +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: From 1e34445c91596ec9501015e14db8b86aaf4be64d Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 19:47:54 +0200 Subject: [PATCH 08/37] AC_INIT change to arguments on multiple lines This makes changes easier to read in diffs. --- configure.ac | 5 ++++- libgphoto2_port/configure.ac | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index d750ec6943..e5a723a8eb 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,10 @@ dnl NOTE: Be version style _higher_ than the last release. dnl So lastversion.X.trunk for instance. Bump X if necessary. dnl ******* THE NEXT RELEASE VERSION MUST BE 2.5.28 at least or higher! -AC_INIT([libgphoto2 photo camera library], [2.5.27.1], [gphoto-devel@lists.sourceforge.net], [libgphoto2]) +AC_INIT([libgphoto2 photo camera library], + [2.5.27.1], + [gphoto-devel@lists.sourceforge.net], + [libgphoto2]) AC_CONFIG_SRCDIR([libgphoto2/gphoto2-version.c]) AC_CONFIG_HEADERS([config.h]) diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index 2fe797c1bf..13021c2af9 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -1,6 +1,11 @@ dnl Process this file with autoreconf to produce a configure script. AC_PREREQ(2.62) -AC_INIT([libgphoto2 port access library], [0.12.0], [gphoto-devel@lists.sourceforge.net], [libgphoto2_port]) + +AC_INIT([libgphoto2 port access library], + [0.12.0], + [gphoto-devel@lists.sourceforge.net], + [libgphoto2_port]) + AC_CONFIG_SRCDIR([libgphoto2_port/gphoto2-port-version.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([auto-m4]) From 24f474659706af956d04fa0e3b94dbc9e5affddf Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 19:05:44 +0200 Subject: [PATCH 09/37] AM_INIT_AUTOMAKE change to indented multi-line form This makes it easier to see and merge changes. --- configure.ac | 10 +++++++++- libgphoto2_port/configure.ac | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index e5a723a8eb..0fdd13901c 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,15 @@ dnl The generated Makefile rule fails to remove the absolute part at dnl the beginning of the /path/to/buildroot/PACKAGE-VERSION/foo/bar dnl before determining the string length. However, the only relevant dnl string to determine the length of would be PACKAGE-VERSION/foo/bar -AM_INIT_AUTOMAKE([-Wall foreign 1.9 dist-bzip2 dist-xz check-news subdir-objects]) +AM_INIT_AUTOMAKE([ + -Wall + foreign + 1.9 + dist-bzip2 + dist-xz + check-news + subdir-objects +]) # Use the silent-rules feature when possible. diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index 13021c2af9..bcd49b16f9 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -17,7 +17,14 @@ dnl The generated Makefile rule fails to remove the absolute part at dnl the beginning of the /path/to/buildroot/PACKAGE-VERSION/foo/bar dnl before determining the string length. However, the only relevant dnl string to determine the length of would be PACKAGE-VERSION/foo/bar -AM_INIT_AUTOMAKE([-Wall gnu 1.9 dist-bzip2 check-news subdir-objects]) +AM_INIT_AUTOMAKE([ + -Wall + gnu + 1.9 + dist-bzip2 + check-news + subdir-objects +]) AC_LANG(C) From b60acf5e44196834eeb8c8be60148835c455dd7d Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 19:48:40 +0200 Subject: [PATCH 10/37] AC_CONFIG_FILES change to indented multi-line form --- configure.ac | 36 ++++++++++++++++++------------------ libgphoto2_port/configure.ac | 18 +++++++++--------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/configure.ac b/configure.ac index 0fdd13901c..088a63897c 100644 --- a/configure.ac +++ b/configure.ac @@ -689,24 +689,24 @@ GP_SET_CLEAN_FILES # Create output files # --------------------------------------------------------------------------- AC_CONFIG_FILES([ -Makefile -gphoto2-config -camlibs/Makefile -camlibs/canon/doc/Makefile -camlibs/konica/localization/Makefile -gphoto-m4/Makefile -libgphoto2/Makefile -libgphoto2.pc -libgphoto2-uninstalled.pc -examples/Makefile -tests/Makefile -packaging/Makefile -packaging/generic/Makefile -po/Makefile.in -doc/Makefile -doc/Doxyfile -doc/Doxyfile-internals -doc/api/Makefile + Makefile + gphoto2-config + camlibs/Makefile + camlibs/canon/doc/Makefile + camlibs/konica/localization/Makefile + gphoto-m4/Makefile + libgphoto2/Makefile + libgphoto2.pc + libgphoto2-uninstalled.pc + examples/Makefile + tests/Makefile + packaging/Makefile + packaging/generic/Makefile + po/Makefile.in + doc/Makefile + doc/Doxyfile + doc/Doxyfile-internals + doc/api/Makefile ]) AC_OUTPUT diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index bcd49b16f9..0e26e9e31e 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -564,15 +564,15 @@ AC_SUBST([AM_LDFLAGS]) # Create output files # --------------------------------------------------------------------------- AC_CONFIG_FILES([ -Makefile -po/Makefile.in -libgphoto2_port/Makefile -libgphoto2_port.pc -libgphoto2_port-uninstalled.pc -gphoto2-port-config -tests/Makefile -doc/Makefile -gphoto-m4/Makefile + Makefile + po/Makefile.in + libgphoto2_port/Makefile + libgphoto2_port.pc + libgphoto2_port-uninstalled.pc + gphoto2-port-config + tests/Makefile + doc/Makefile + gphoto-m4/Makefile ]) AC_OUTPUT From 5d5b5c6359f166a59d005a8fb2512a5f26ac5c01 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 20:11:55 +0200 Subject: [PATCH 11/37] m4 quote all macro arguments Occasionally, not quoting macro arguments leads to weird problems. So we try to consistently quote the arguments to avoid these kinds of problems. --- configure.ac | 54 +++++++------ libgphoto2_port/configure.ac | 143 ++++++++++++++++++++--------------- 2 files changed, 110 insertions(+), 87 deletions(-) diff --git a/configure.ac b/configure.ac index 088a63897c..64a8028a65 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ dnl Process this file with autoreconf to produce a configure script. -AC_PREREQ(2.62) +AC_PREREQ([2.62]) dnl NOTE: Be version style _higher_ than the last release. dnl So lastversion.X.trunk for instance. Bump X if necessary. @@ -237,7 +237,8 @@ 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]) +AC_DEFINE_UNQUOTED([HAVE_CC], ["$CC"], + [The C compiler we are using]) dnl --------------------------------------------------------------------------- @@ -291,23 +292,24 @@ AC_COMPILE_IFELSE([dnl asm(".symver f2, f@@VER2"); ]],[])dnl ],[ - AC_DEFINE([HAVE_ASM_SYMVERS],1,[Define if there is asm .symver support.]) + AC_DEFINE([HAVE_ASM_SYMVERS], [1], + [Define if there is asm .symver support.]) VERSIONMAPLDFLAGS="-Wl,--version-script=\$(srcdir)/libgphoto2.ver" - AC_MSG_RESULT(yes) + AC_MSG_RESULT([yes]) ],[ VERSIONMAPLDFLAGS="" - AC_MSG_RESULT(no) + AC_MSG_RESULT([no]) ]) -AC_SUBST(VERSIONMAPLDFLAGS) +AC_SUBST([VERSIONMAPLDFLAGS]) dnl --------------------------------------------------------------------------- dnl FIXME: What is this good for? dnl Replace `main' with a function in -libs: dnl --------------------------------------------------------------------------- -AC_CHECK_LIB(ibs, main) +AC_CHECK_LIB([ibs], [main]) dnl we use some libm functions in some drivers, so just add -lm -AC_CHECK_LIB(m, sqrt) +AC_CHECK_LIB([m], [sqrt]) dnl --------------------------------------------------------------------------- @@ -328,12 +330,15 @@ dnl check for ws2_32 dnl --------------------------------------------------------------------------- LIBWS232="" libws232_msg="no" -AC_SUBST(LIBWS232) -AC_ARG_WITH([ws232], AS_HELP_STRING([--without-ws232], [Build without ws2_32 library (default: no)])) -AS_IF([test "x$with_ws232" != "xno"], [ - AC_CHECK_LIB(ws2_32,WSAStartup,[ - AC_CHECK_HEADER(winsock.h,[ - AC_DEFINE(HAVE_LIBWS232,1,[define if we found LIBWS232 and its headers]) +AC_SUBST([LIBWS232]) +AC_ARG_WITH([ws232], + [AS_HELP_STRING([--without-ws232], + [Build without ws2_32 library (default: no)])]) +AS_IF([test "x$with_ws232" != "xno"], [dnl + AC_CHECK_LIB([ws2_32], [WSAStartup], [dnl + AC_CHECK_HEADER([winsock.h], [dnl + AC_DEFINE([HAVE_LIBWS232], [1], + [define if we found LIBWS232 and its headers]) LIBWS232="-lws2_32" libws232_msg="yes" ]) @@ -422,21 +427,22 @@ AC_LANG_PROGRAM([[ struct tm tm; tm.tm_gmtoff; ]])dnl -],[ -AC_DEFINE(HAVE_TM_GMTOFF,1,whether struct tm has tm_gmtoff field) -AC_MSG_RESULT(yes) -],[ -AC_MSG_RESULT(no) +], [dnl + AC_DEFINE([HAVE_TM_GMTOFF], [1], + [whether struct tm has tm_gmtoff field]) + AC_MSG_RESULT([yes]) +], [dnl + AC_MSG_RESULT([no]) ]) -AC_CHECK_HEADERS([sys/mount.h sys/statvfs.h sys/user.h sys/vfs.h],,,[ +AC_CHECK_HEADERS([sys/mount.h sys/statvfs.h sys/user.h sys/vfs.h], [], [], [ #include #if HAVE_SYS_PARAM_H # include #endif ]) -AC_CHECK_MEMBERS([struct statvfs.f_blocks],,,[ +AC_CHECK_MEMBERS([struct statvfs.f_blocks], [], [], [ #ifdef HAVE_SYS_STATVFS_H # include #endif @@ -653,11 +659,11 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ ExifContent *ec0, *ec1; ec0 = &ed.ifd[0]; ec1 = &ed.ifd[1]; -]])], [ - AC_DEFINE([HAVE_LIBEXIF_IFD],1, +]])], [dnl + AC_DEFINE([HAVE_LIBEXIF_IFD], [1], [whether we use a version of libexif with ExifData.ifd[[]]]) AC_MSG_RESULT([yes]) -], [ +], [dnl AC_MSG_RESULT([no]) ]) CPPFLAGS="$CPPFLAGS_save" diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index 0e26e9e31e..b29166bc35 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -1,5 +1,5 @@ dnl Process this file with autoreconf to produce a configure script. -AC_PREREQ(2.62) +AC_PREREQ([2.62]) AC_INIT([libgphoto2 port access library], [0.12.0], @@ -26,7 +26,7 @@ AM_INIT_AUTOMAKE([ subdir-objects ]) -AC_LANG(C) +AC_LANG([C]) # Use the silent-rules feature when possible. m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])]) @@ -112,7 +112,8 @@ 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]) +AC_DEFINE_UNQUOTED([HAVE_CC], ["$CC"], + [The C compiler we're using]) AM_CPPFLAGS="" @@ -149,14 +150,14 @@ GP_GETTEXT_FLAGS() AC_SUBST([localedir],["\$(datadir)/locale"]) AM_CPPFLAGS="$AM_CPPFLAGS -DLOCALEDIR=\\\"${localedir}\\\"" -AC_CHECK_FUNC(gettext, gettext_without_libintl=true) +AC_CHECK_FUNC([gettext], [gettext_without_libintl=true]) # same trick as with libdl in libgphoto2: # if gettext() doesn't require linking against libintl, # 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 - AC_CHECK_LIB(intl, gettext, [INTLLIBS="$INTLLIBS -lintl"]) + AC_CHECK_LIB([intl], [gettext], [INTLLIBS="$INTLLIBS -lintl"]) fi @@ -169,17 +170,19 @@ 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 \ +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) - -dnl FIXME: Provide regex.h with the corresponding object code for + 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. AC_CHECK_HEADER([regex.h], - [AC_DEFINE([HAVE_REGEX],1,[whether we have regex.h])],[]) -AC_CHECK_LIB([regex],[regexec]) + [AC_DEFINE([HAVE_REGEX], [1], + [whether we have regex.h])], + []) +AC_CHECK_LIB([regex], [regexec]) AC_MSG_CHECKING([for asm .symver support]) AC_COMPILE_IFELSE([dnl @@ -190,16 +193,17 @@ AC_COMPILE_IFELSE([dnl void f2() {} asm(".symver f1, f@VER1"); asm(".symver f2, f@@VER2"); - ]],[])dnl -],[ - AC_DEFINE([HAVE_ASM_SYMVERS],1,[Define if there is asm .symver support.]) + ]], [[]])dnl +], [dnl + AC_DEFINE([HAVE_ASM_SYMVERS], [1], + [Define if there is asm .symver support.]) VERSIONMAPLDFLAGS="-Wl,--version-script=\$(srcdir)/libgphoto2_port.ver" - AC_MSG_RESULT(yes) -],[ + AC_MSG_RESULT([yes]) +], [dnl VERSIONMAPLDFLAGS="" - AC_MSG_RESULT(no) + AC_MSG_RESULT([no]) ]) -AC_SUBST(VERSIONMAPLDFLAGS) +AC_SUBST([VERSIONMAPLDFLAGS]) dnl Check for mnt_mountp in struct mnttab AC_MSG_CHECKING([for mnt_mountp in struct mnttab]) @@ -213,27 +217,28 @@ AC_LANG_PROGRAM([[ struct mnttab mt; mt.mnt_mountp; ]])dnl -],[ -AC_DEFINE(HAVE_MNTTAB,1,whether struct mnttag has mnt_mountp field) -AC_MSG_RESULT(yes) -],[ -AC_MSG_RESULT(no) +], [dnl + AC_DEFINE([HAVE_MNTTAB], [1], + [whether struct mnttag has mnt_mountp field]) + AC_MSG_RESULT([yes]) +], [dnl + AC_MSG_RESULT([no]) ]) dnl Checks for library functions. -AC_CHECK_FUNCS(setmntent endmntent strerror snprintf vsnprintf flock) +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_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_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_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.])) + AC_DEFINE([HAVE_RTS_IOCTL], [1], [Define if you have TIOCM_TRS.])) # Check for va_copy() GP_VA_COPY @@ -263,11 +268,11 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ ExifContent *ec0, *ec1; ec0 = &ed.ifd[0]; ec1 = &ed.ifd[1]; -]])], [ - AC_DEFINE([HAVE_LIBEXIF_IFD],1, +]])], [dnl + AC_DEFINE([HAVE_LIBEXIF_IFD], [1], [whether we use a version of libexif with ExifData.ifd[[]]]) AC_MSG_RESULT([yes]) -], [ +], [dnl AC_MSG_RESULT([no]) ]) CPPFLAGS="$CPPFLAGS_save" @@ -293,7 +298,7 @@ fi AC_ARG_ENABLE([serial], [AS_HELP_STRING([--disable-serial], [do not compile in SERIAL support])], -[ +[dnl if test x$enableval = xno; then have_serial=false serial_msg=no @@ -304,7 +309,8 @@ AC_ARG_ENABLE([serial], ]) if $have_serial; then IOLIB_LIST="$IOLIB_LIST serial" - AC_DEFINE([HAVE_SERIAL],1,[Whether you have serial support enabled]) + AC_DEFINE([HAVE_SERIAL], [1], + [Whether you have serial support enabled]) fi GP_CONFIG_MSG([Serial ports]) GP_CONFIG_MSG([Serial support],[$serial_msg]) @@ -322,7 +328,7 @@ AC_DEFUN([GP_SERLOCK],[dnl AC_ARG_ENABLE([$1], [AS_HELP_STRING([--disable-][$1], [do not use ][$1][ library]) -],[ +], [dnl if test x$enableval = xno; then try_[$1]=false fi @@ -334,18 +340,20 @@ GP_SERLOCK([lockdev])dnl ttylock_msg=no if $try_ttylock; then AC_CHECK_HEADER([lockdev.h]) - AC_CHECK_HEADER([ttylock.h],[ + AC_CHECK_HEADER([ttylock.h], [dnl lockdev_result="no" AC_TRY_LINK([#include ],[ttylocked ("/dev/foo");],[ lockdev_result="no" - AC_DEFINE(HAVE_TTYLOCK,1,[Define if you have ttylock based tty locking.]) + AC_DEFINE([HAVE_TTYLOCK], [1], + [Define if you have ttylock based tty locking.]) ttylock_msg=yes try_lockdev=false, save_LIBS="$LIBS" LIBS="$LIBS -llockdev" AC_TRY_LINK([#include ],[ttylocked ("/dev/foo");],[ lockdev_result="yes" - AC_DEFINE(HAVE_TTYLOCK,1,[Define if you have ttylock based tty locking.]) + AC_DEFINE([HAVE_TTYLOCK], [1], + [Define if you have ttylock based tty locking.]) ttylock_msg=yes try_lockdev=false SERIAL_LIBS=-llockdev @@ -354,7 +362,7 @@ if $try_ttylock; then ]) AC_MSG_CHECKING([if ttylock needs lockdev]) AC_MSG_RESULT([${lockdev_result}]) - ],[],[#ifdef HAVE_LOCKDEV_H + ], [], [#ifdef HAVE_LOCKDEV_H # include #endif ]) @@ -363,9 +371,10 @@ GP_CONFIG_MSG([ttylock locking],[${ttylock_msg}]) lockdev_msg=no if $try_lockdev; then - AC_CHECK_LIB(lockdev, dev_lock,[ - AC_CHECK_HEADER(lockdev.h,[ - AC_DEFINE(HAVE_LOCKDEV,1,[Define if you have dev_lock/lockdev based locking.]) + AC_CHECK_LIB([lockdev], [dev_lock], [dnl + AC_CHECK_HEADER([lockdev.h], [dnl + AC_DEFINE([HAVE_LOCKDEV], [1], + [Define if you have dev_lock/lockdev based locking.]) lockdev_msg=yes SERIAL_LIBS=-llockdev ]) @@ -385,7 +394,7 @@ dnl --------------------------------------------------------------------------- dnl libpthread is dynamically linked by libusb, which is dynamically loaded dnl but newer Linux systems need it on startup, not later. So link libgphoto2_port dnl against libpthread -AC_CHECK_LIB(pthread, pthread_create) +AC_CHECK_LIB([pthread], [pthread_create]) dnl --------------------------------------------------------------------------- dnl libusb1 @@ -406,12 +415,12 @@ GP_CHECK_LIBRARY([LIBUSB1],[libusb-1.0],[>= 1.0.0], # note that the library is not always named libusb-1.0.so , e.g. on freebsd it is not. save_LIBS="$LIBS" LIBS="$LIBS $LIBUSB1_LIBS" - AC_CHECK_FUNC(libusb_strerror, [ - AC_DEFINE(HAVE_LIBUSB_STRERROR,1,[Define if libusb-1.0 has libusb_strerror]) + AC_CHECK_FUNC([libusb_strerror], [dnl + AC_DEFINE([HAVE_LIBUSB_STRERROR], [1], + [Define if libusb-1.0 has libusb_strerror]) ]) LIBS="$save_LIBS" - -],[], +], [], [default-on], [http://libusb.sourceforge.net/] ) @@ -438,7 +447,7 @@ GP_CHECK_LIBRARY([LIBUSB],[libusb],[>= 0.1.5], fi ;; esac -],[], +], [], [default-on], [http://libusb.sourceforge.net/] ) @@ -447,8 +456,10 @@ GP_UDEV([test "x$have_LIBUSB" = xyes || test "x$have_LIBUSB1" = xyes]) AC_ARG_ENABLE([disk], - AS_HELP_STRING([--disable-disk], [disable the 'disk' port driver]), - ,enable_disk=yes) + [AS_HELP_STRING([--disable-disk], + [disable the 'disk' port driver])], + [], + [enable_disk=yes]) dnl disk port also works everywhere, but it's not really necessary if test "x$enable_disk" = "xyes"; then @@ -456,8 +467,9 @@ if test "x$enable_disk" = "xyes"; then fi AC_ARG_ENABLE([vusb], - AS_HELP_STRING([--enable-vusb], [enable the 'vusb' virtual USB port driver]), - ,[ + [AS_HELP_STRING([--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]) ] @@ -469,12 +481,15 @@ if test "x$enable_vusb" = "xyes"; then fi AC_ARG_ENABLE([ptpip], - AS_HELP_STRING([--disable-ptpip], [disable the 'ptpip' port driver for TCP/IP connected PTP cameras]), - ,enable_ptpip=yes) + [AS_HELP_STRING([--disable-ptpip], + [disable the 'ptpip' port driver for TCP/IP connected PTP cameras])], + [], [dnl + enable_ptpip=yes +]) dnl ptpip - works 'everywhere' with TCP/IP stack. -if test "x$enable_ptpip" = "xyes"; then +AS_VAR_IF([enable_ptpip], [yes], [dnl IOLIB_LIST="$IOLIB_LIST ptpip" -fi +]) # ---------------------------------------------------------------------- # Define IOLIB stuff @@ -514,20 +529,22 @@ AC_SUBST([pkgconfigdir]) dnl ---------------------------------------------------------------------- dnl GNU regex? dnl ---------------------------------------------------------------------- -AC_CHECK_FUNC(re_compile_pattern, - AC_DEFINE(HAVE_GNU_REGEX,1,[Define if you have GNU regex.]) -) +AC_CHECK_FUNC([re_compile_pattern], + [AC_DEFINE([HAVE_GNU_REGEX], [1], + [Define if you have GNU regex.])]) dnl ---------------------------------------------------------------------- dnl disable debugging if requested dnl ---------------------------------------------------------------------- AC_ARG_ENABLE([debug], - AS_HELP_STRING([--disable-debug],[do not include debugging code]), -[ - if test "$enableval" = "no"; then - AC_DEFINE(DISABLE_DEBUGGING,1,[Define if you want to disabled debugging.]) - fi + [AS_HELP_STRING([--disable-debug], + [do not include debugging code])], + [dnl + AS_VAR_IF([enableval], [no], [dnl + AC_DEFINE([DISABLE_DEBUGGING], [1], + [Define if you want to disabled debugging.]) + ]) ]) From c6ffccfbdd04f48e8e6617b752ef1779edbc2b54 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Fri, 22 Oct 2021 03:21:07 +0200 Subject: [PATCH 12/37] Use the same gettext setup This puts AM_PO_SUBDIRS before AM_GNU_GETTEXT to fix the error: `po-directories' is already registered with AC_CONFIG_COMMANDS. and puts the -DLOCALEDIR together with the gettext setup. --- configure.ac | 6 +++--- libgphoto2_port/configure.ac | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 64a8028a65..5a0e1ac2b2 100644 --- a/configure.ac +++ b/configure.ac @@ -266,6 +266,9 @@ AM_GNU_GETTEXT([external]) AM_ICONV() GP_GETTEXT_FLAGS() +AC_SUBST([localedir],["\$(datadir)/locale"]) +AM_CPPFLAGS="$AM_CPPFLAGS -DLOCALEDIR=\\\"${localedir}\\\"" + dnl FIXME: We have to make sure this works first dnl AC_CHECK_FUNC(gettext, gettext_without_libintl=true) # same trick as with libdl: @@ -276,9 +279,6 @@ dnl if test "x$gettext_without_libintl" != xtrue && test "x$USE_NLS" = xyes; the dnl AC_CHECK_LIB([intl], [gettext], [INTLLIBS="$INTLLIBS -lintl"]) dnl fi -AC_SUBST([localedir],["\$(datadir)/locale"]) -AM_CPPFLAGS="$AM_CPPFLAGS -DLOCALEDIR=\\\"${localedir}\\\"" - AC_SYS_LARGEFILE AC_MSG_CHECKING([for asm .symver support]) diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index b29166bc35..acbc2b1711 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -136,14 +136,14 @@ dnl AC_SUBST(BUILD_INCLUDED_LIBINTL) dnl USE_INCLUDED_LIBINTL=no dnl AC_SUBST(USE_INCLUDED_LIBINTL) +ALL_LINGUAS="cs da de es eu fi fr it ja nl pl pt_BR ru sk sr sv uk vi zh_CN zh_TW" GP_GETTEXT_HACK([GETTEXT_PACKAGE_LIBGPHOTO2_PORT], [${PACKAGE}-${LIBGPHOTO2_PORT_CURRENT_MIN}], [Lutz Mueller and others], [${MAIL_GPHOTO_TRANSLATION}]) -ALL_LINGUAS="cs da de es eu fi fr it ja nl pl pt_BR ru sk sr sv uk vi zh_CN zh_TW" +AM_PO_SUBDIRS() AM_GNU_GETTEXT_VERSION([0.14.1]) AM_GNU_GETTEXT([external]) -AM_PO_SUBDIRS() AM_ICONV() GP_GETTEXT_FLAGS() From 1cf0d9fa31649a41dc762091e16d4f8d6a62f894 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Fri, 22 Oct 2021 03:31:47 +0200 Subject: [PATCH 13/37] Use LINGUAS files instead of ALL_LINGUAS variable # Conflicts: # libgphoto2_port/configure.ac --- configure.ac | 1 - libgphoto2_port/configure.ac | 1 - libgphoto2_port/po/LINGUAS | 23 +++++++++++++++++++++++ po/LINGUAS | 19 +++++++++++++++++++ 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 libgphoto2_port/po/LINGUAS create mode 100644 po/LINGUAS diff --git a/configure.ac b/configure.ac index 5a0e1ac2b2..a28f4b1d7e 100644 --- a/configure.ac +++ b/configure.ac @@ -255,7 +255,6 @@ dnl --------------------------------------------------------------------------- dnl i18n support (including some hacks) dnl --------------------------------------------------------------------------- -ALL_LINGUAS="cs da de es eu fr hu it ja nl pl ru sv uk vi zh_CN" GP_GETTEXT_HACK([GETTEXT_PACKAGE_LIBGPHOTO2], [${PACKAGE}-${LIBGPHOTO2_CURRENT_MIN}], [The gPhoto Team], diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index acbc2b1711..e689da476c 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -136,7 +136,6 @@ dnl AC_SUBST(BUILD_INCLUDED_LIBINTL) dnl USE_INCLUDED_LIBINTL=no dnl AC_SUBST(USE_INCLUDED_LIBINTL) -ALL_LINGUAS="cs da de es eu fi fr it ja nl pl pt_BR ru sk sr sv uk vi zh_CN zh_TW" GP_GETTEXT_HACK([GETTEXT_PACKAGE_LIBGPHOTO2_PORT], [${PACKAGE}-${LIBGPHOTO2_PORT_CURRENT_MIN}], [Lutz Mueller and others], diff --git a/libgphoto2_port/po/LINGUAS b/libgphoto2_port/po/LINGUAS new file mode 100644 index 0000000000..c46ddd5368 --- /dev/null +++ b/libgphoto2_port/po/LINGUAS @@ -0,0 +1,23 @@ +# Set of available translations +cs +da +de +# en@boldquot +# en@quot +es +eu +fi +fr +it +ja +nl +pl +pt_BR +ru +sk +sr +sv +uk +vi +zh_CN +zh_TW diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000000..7827e7e1a7 --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1,19 @@ +# Set of available translations +cs +da +de +# en@boldquot +# en@quot +es +eu +fr +hu +it +ja +nl +pl +ru +sv +uk +vi +zh_CN From f6f82a34ab2bb6d2a19199c48746e3397e29a54e Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 20:58:01 +0200 Subject: [PATCH 14/37] remove old libtool/libltdl comments --- configure.ac | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/configure.ac b/configure.ac index a28f4b1d7e..d68277f248 100644 --- a/configure.ac +++ b/configure.ac @@ -451,40 +451,6 @@ dnl Create a header file containing NetBSD-style byte swapping macros AC_NEED_BYTEORDER_H([libgphoto2/gphoto2-endian.h]) -dnl --------------------------------------------------------------------------- -dnl Old libtool stuff left here for reference purposes. For now. -dnl dnl --------------------------------------------------------------------------- -dnl dnl Check for libtool: lt_dlforeachfile has been introduced in -dnl dnl libtool-1.4. However, there are still systems out -dnl dnl there running libtool-1.3. For those, we will need -dnl dnl dlopen. Note that on some systems (e.g. FreeBSD) -dnl dnl -ldl isn't needed. -dnl dnl --------------------------------------------------------------------------- -dnl AC_PROG_LIBTOOL -dnl have_ltdl=false -dnl ltdl_msg="no" -dnl try_ltdl=false -dnl AC_ARG_WITH(ltdl, [ --with-ltdl Use ltdl],[ -dnl if test x$withval = xyes; then -dnl try_ltdl=true -dnl fi]) -dnl if $try_ltdl; then -dnl AC_CHECK_LIB(ltdl, lt_dlforeachfile,[ -dnl AC_CHECK_HEADER(ltdl.h,[ -dnl AC_DEFINE(HAVE_LTDL,1,[whether we use libltdl]) -dnl LTDL_LIBS="-lltdl" -dnl ltdl_msg="yes" -dnl have_ltdl=true])]) -dnl fi -dnl if ! $have_ltdl; then -dnl AC_CHECK_FUNC(dlopen,,[ -dnl AC_CHECK_LIB(dl, dlopen,[LTDL_LIBS="-ldl"],[AC_ERROR([ -dnl *** Could not determine how to handle -dnl *** shared libraries!])])]) -dnl fi -dnl AC_SUBST(LTDL_LIBS) - - dnl should be obsolete (we're not using grep and tr any more) dnl dnl Solaris hack for grep and tr dnl [ From 41fd7f31bda37afd283721e3d000eb02a18d6c7b Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Fri, 22 Oct 2021 02:02:49 +0200 Subject: [PATCH 15/37] make gphoto-m4 directories identical Make the two gphoto-m4 directories identical in preparation for using just one of them. --- gphoto-m4/Makefile-files | 4 + libgphoto2_port/gphoto-m4/Makefile-files | 5 + libgphoto2_port/gphoto-m4/gp-camlibs.m4 | 548 ++++++++++--- libgphoto2_port/gphoto-m4/gp-libjpeg.m4 | 139 ++++ .../gphoto-m4/gp-pedantic-compiler-flags.m4 | 131 +++ libgphoto2_port/gphoto-m4/gp-progs.m4 | 114 +++ libgphoto2_port/gphoto-m4/gp-set.m4 | 753 ++++++++++++++++++ libgphoto2_port/gphoto-m4/gp-sleep.m4 | 28 + 8 files changed, 1607 insertions(+), 115 deletions(-) create mode 100644 libgphoto2_port/gphoto-m4/gp-libjpeg.m4 create mode 100644 libgphoto2_port/gphoto-m4/gp-pedantic-compiler-flags.m4 create mode 100644 libgphoto2_port/gphoto-m4/gp-progs.m4 create mode 100644 libgphoto2_port/gphoto-m4/gp-set.m4 create mode 100644 libgphoto2_port/gphoto-m4/gp-sleep.m4 diff --git a/gphoto-m4/Makefile-files b/gphoto-m4/Makefile-files index 70fc5439a5..2ae6002e22 100644 --- a/gphoto-m4/Makefile-files +++ b/gphoto-m4/Makefile-files @@ -24,7 +24,11 @@ EXTRA_DIST += %reldir%/gp-manual-gtk-doc.m4 EXTRA_DIST += %reldir%/gp-manual-pstoimg.m4 EXTRA_DIST += %reldir%/gp-manual-w3m.m4 EXTRA_DIST += %reldir%/gp-packaging.m4 +EXTRA_DIST += %reldir%/gp-pedantic-compiler-flags.m4 +EXTRA_DIST += %reldir%/gp-progs.m4 EXTRA_DIST += %reldir%/gp-references.m4 +EXTRA_DIST += %reldir%/gp-set.m4 +EXTRA_DIST += %reldir%/gp-sleep.m4 EXTRA_DIST += %reldir%/gp-subpackage.m4 EXTRA_DIST += %reldir%/gp-udev.m4 EXTRA_DIST += %reldir%/gp-va-copy.m4 diff --git a/libgphoto2_port/gphoto-m4/Makefile-files b/libgphoto2_port/gphoto-m4/Makefile-files index 2a89dd2d87..2ae6002e22 100644 --- a/libgphoto2_port/gphoto-m4/Makefile-files +++ b/libgphoto2_port/gphoto-m4/Makefile-files @@ -14,6 +14,7 @@ EXTRA_DIST += %reldir%/gp-documentation.m4 EXTRA_DIST += %reldir%/gp-driverdir.m4 EXTRA_DIST += %reldir%/gp-gettext-hack.m4 EXTRA_DIST += %reldir%/gp-internal-docs.m4 +EXTRA_DIST += %reldir%/gp-libjpeg.m4 EXTRA_DIST += %reldir%/gp-libltdl.m4 EXTRA_DIST += %reldir%/gp-manual-docbook-xml.m4 EXTRA_DIST += %reldir%/gp-manual-documentation.m4 @@ -23,7 +24,11 @@ EXTRA_DIST += %reldir%/gp-manual-gtk-doc.m4 EXTRA_DIST += %reldir%/gp-manual-pstoimg.m4 EXTRA_DIST += %reldir%/gp-manual-w3m.m4 EXTRA_DIST += %reldir%/gp-packaging.m4 +EXTRA_DIST += %reldir%/gp-pedantic-compiler-flags.m4 +EXTRA_DIST += %reldir%/gp-progs.m4 EXTRA_DIST += %reldir%/gp-references.m4 +EXTRA_DIST += %reldir%/gp-set.m4 +EXTRA_DIST += %reldir%/gp-sleep.m4 EXTRA_DIST += %reldir%/gp-subpackage.m4 EXTRA_DIST += %reldir%/gp-udev.m4 EXTRA_DIST += %reldir%/gp-va-copy.m4 diff --git a/libgphoto2_port/gphoto-m4/gp-camlibs.m4 b/libgphoto2_port/gphoto-m4/gp-camlibs.m4 index 47219fe96c..a6b14ac189 100644 --- a/libgphoto2_port/gphoto-m4/gp-camlibs.m4 +++ b/libgphoto2_port/gphoto-m4/gp-camlibs.m4 @@ -1,168 +1,486 @@ +dnl #################################################################### +dnl dnl GP_CAMLIB & Co. dnl +dnl #################################################################### +dnl dnl Redundancy free definition of libgphoto2 camlibs. dnl dnl Removes the redundancy from the camlib lists, and executes -dnl additional consistency checks, e.g. to ensure that subdirectories -dnl actually exist. +dnl additional consistency checks on the build system. +dnl +dnl Every camlib belongs to one of the following (disjunct) sets of +dnl camlibs: +dnl +dnl * the 'standard' set dnl -dnl You can mark camlibs as unlisted, i.e. they won't be listed -dnl explicitly but still be recognized. +dnl The set of camlibs which is most likely to support the most +dnl cameras. This is the default when --with-camlibs=... is not +dnl given. This used to be called 'all', even though it +dnl definitively does not comprise all camlibs. +dnl +dnl * the 'outdated' set +dnl +dnl These cameras are outdated in some way. The cameras may have +dnl fallen out of use, the camlib might have been superseded by +dnl another one, or other reasons. Not built by default. +dnl +dnl * the 'unlisted' set +dnl +dnl These camlibs will not be listed by './configure --help', but +dnl they can still be added to the set of camlibs to be built. dnl dnl Example usage: dnl dnl GP_CAMLIB([canon]) dnl GP_CAMLIB([casio]) dnl [...] +dnl AM_COND_IF([HAVE_LIBCURL], [dnl +dnl AM_COND_IF([HAVE_LIBXML2], [dnl +dnl GP_CAMLIB([lumix])dnl +dnl ]) +dnl ]) +dnl [...] dnl GP_CAMLIB([ptp],[unlisted]) dnl GP_CAMLIB([ptp2]) dnl [...] dnl GP_CAMLIB([toshiba]) -dnl GP_CAMLIBS_DEFINE([camlibs]) +dnl GP_CAMLIBS_DEFINE() dnl -dnl The camlibs basedir parameter of GP_CAMLIBS_DEFINE is optional. dnl dnl #################################################################### +dnl Implementation remarks +dnl #################################################################### +dnl +dnl Note that at this time, the set names are hard coded, but could be +dnl moved to a m4 time automatic set of set names at a later time. +dnl +dnl A few notes on macro and variable naming: +dnl +dnl * GP_* are the macros to be called from configure.ac +dnl * GP_CAMLIBS_* are also shell variables exported to configure.ac +dnl shell code and Makefile.am files +dnl * gp_m4_* are the macros used inside those macros as m4 variables +dnl * gp_sh_* are the shell variables used inside the GP_ shell code +dnl * The old, inconsistent names of the as untouched variables +dnl exported to configure.ac and Makefile.am are still inconsistent. +dnl dnl -AC_DEFUN([GP_CAMLIBS_INIT],[dnl +dnl #################################################################### +dnl Forbid everything first, allow specific variable names later +dnl #################################################################### +m4_pattern_forbid([GP_CAMLIBS_])dnl +m4_pattern_forbid([GP_CAMLIB_])dnl +dnl +dnl +dnl #################################################################### +dnl _GP_CAMLIBS_INIT +dnl Called internally when required. +dnl #################################################################### +AC_DEFUN_ONCE([_GP_CAMLIBS_INIT],[dnl +dnl # BEGIN $0($@) AC_BEFORE([$0],[GP_CAMLIB])dnl -m4_define_default([gp_camlib_srcdir], [camlibs])dnl -m4_define_default([gp_camlibs], [])dnl -m4_define_default([gp_camlibs_unlisted], [])dnl +AC_REQUIRE([AC_PROG_GREP])dnl +AC_REQUIRE([AC_PROG_SED])dnl +AC_REQUIRE([GP_PROG_CMP])dnl +AC_REQUIRE([GP_PROG_SORT])dnl +AC_REQUIRE([GP_PROG_TR])dnl +AC_REQUIRE([GP_PROG_UNIQ])dnl +m4_foreach_w([var], [everything standard unlisted outdated], [dnl + m4_set_empty([gp_m4s_camlib_set_]var, [], [dnl + m4_errprintn([Error: non-empty set gp_m4s_camlib_set_]var[ already defined])dnl + m4_exit(1)dnl + ])dnl +])dnl +GP_SET_DEFINE([camlib-set-standard])dnl +GP_SET_DEFINE([camlib-set-unlisted])dnl +GP_SET_DEFINE([camlib-set-outdated])dnl +dnl # END $0($@) ])dnl dnl -dnl #################################################################### dnl +dnl #################################################################### +dnl GP_CAMLIB([mycamlib]) +dnl GP_CAMLIB([mycamlib], [outdated]) +dnl Add the camlib 'mycamlib' to the "standard" set of camlibs or +dnl the "outdated" set of camlibs, respectively. +dnl #################################################################### +m4_pattern_forbid([GP_CAMLIB])dnl AC_DEFUN([GP_CAMLIB],[dnl -AC_REQUIRE([GP_CAMLIBS_INIT])dnl +dnl # BEGIN $0($@) +AC_REQUIRE([_GP_CAMLIBS_INIT])dnl AC_BEFORE([$0],[GP_CAMLIBS_DEFINE])dnl -m4_if([$2],[unlisted],[dnl -# $0($1,$2) -m4_append([gp_camlibs_unlisted], [$1], [ ])dnl -],[$#],[1],[dnl -# $0($1) -m4_append([gp_camlibs], [$1], [ ])dnl -],[dnl -m4_errprint(__file__:__line__:[ Error: -*** Illegal parameter 2 to $0: `$2' -*** Valid values are: undefined or [unlisted] -])dnl +m4_case([$#],[2],[dnl + m4_case([$2], [unlisted], [dnl + GP_SET_ADD([camlib-set-unlisted], [$1]) + m4_set_add([gp_m4s_camlib_set_unlisted], [$1])dnl + ], [outdated], [dnl + GP_SET_ADD([camlib-set-outdated], [$1]) + m4_set_add([gp_m4s_camlib_set_outdated], [$1])dnl + ], [dnl + m4_errprintn(__file__:__line__:[ Error: Wrong second argument to GP_CAMLIB])dnl + m4_exit(1)dnl + ])dnl +], [1], [dnl + GP_SET_ADD([camlib-set-standard], [$1]) + m4_set_add([gp_m4s_camlib_set_standard], [$1])dnl +], [dnl + m4_errprintn(__file__:__line__:[ Error: Wrong number of arguments to GP_CAMLIB])dnl + m4_exit(1)dnl +])dnl m4_case $# +m4_set_add([gp_m4s_camlib_set_everything], [$1], [], [dnl +m4_errprintn(__file__:__line__:[Duplicate declaration of camlib $1])dnl m4_exit(1)dnl ])dnl -])dnl +dnl # END $0($@) +])dnl AC_DEFUN GP_CAMLIB dnl -dnl #################################################################### dnl +dnl #################################################################### +dnl GP_CAMLIBS_WARNING +dnl Print warning about building a non-"standard" set of camlibs. +dnl #################################################################### AC_DEFUN([GP_CAMLIBS_WARNING],[dnl AC_MSG_WARN([ -# Caution: You have chosen to build a non-standard set of camlibs. -# You may have disabled the camlib required for your camera, or -# enabled a camlib that does *not* work, and overrides the camlib -# that does work. Consequently, -# YOUR CAMERA MAY NOT WORK! -# -# Many cameras of several brands are supported by a camlib with a -# name different from the name of the camera brand or model. If you -# are unsure, please -# * enable at least the "ptp2" camlib -# * or even better, just build "all" camlibs. + #=====================================================================# + # Caution: You have chosen to build a non-standard set of camlibs. # + # You may have disabled the camlib required for your camera, # + # or enabled a camlib which does *not* work and overrides # + # the camlib which *does* work. Consequently, # + # YOUR CAMERA MAY NOT WORK! # + # # + # Many cameras of several brands are supported by a camlib with a # + # name different from the name of the camera brand or model. If you # + # are unsure, please # + # * enable at least the 'ptp2' camlib # + # * or even better, just build the standard set of camlibs. # + #=====================================================================# ]) -sleep 2 +GP_SLEEP([5]) ]) dnl +dnl dnl #################################################################### +dnl GP_CAMLIBS_CONDITIONAL_WARNING +dnl Call GP_CAMLIBS_WARNING when required. +dnl #################################################################### +AC_DEFUN([GP_CAMLIBS_CONDITIONAL_WARNING], [dnl +AS_VAR_IF([gp_sh_with_camlibs], [standard], [dnl +], [dnl +GP_CAMLIBS_WARNING +]) +])dnl dnl +dnl +dnl #################################################################### +dnl GP_CAMLIBS_DEFINE +dnl Determine the set of camlibs to build from the --with-camlibs +dnl parameter, and set the build variables accordingly. +dnl #################################################################### AC_DEFUN([GP_CAMLIBS_DEFINE],[dnl -AC_REQUIRE([GP_CAMLIBS_INIT])dnl -m4_pattern_allow([m4_strip])dnl -m4_ifval([$1],[m4_define([gp_camlib_srcdir],[$1])])dnl -dnl for camlib in m4_strip(gp_camlibs) m4_strip(gp_camlibs_unlisted) -dnl do -dnl if test -d "$srcdir/m4_strip(gp_camlib_srcdir)/$camlib"; then :; else -dnl AC_MSG_ERROR([ -dnl * Fatal: -dnl * Source subdirectory for camlib \`$camlib' not found in -dnl * directory \`$srcdir/m4_strip(gp_camlib_srcdir)/' -dnl ]) -dnl fi -dnl done -AC_MSG_CHECKING([which camlibs to compile]) +# BEGIN $0($@) +AC_REQUIRE([_GP_CAMLIBS_INIT])dnl +AC_REQUIRE([GP_PROG_EXPR])dnl + +dnl GP_SET_MSG([camlib-set-standard]) +dnl GP_SET_MSG([camlib-set-outdated]) +dnl GP_SET_MSG([camlib-set-unlisted]) + +dnl Convert sets defined at m4 time (i.e. autoreconf time) +dnl into the same format as the sh time (i.e. configure time) +dnl defined sets. +m4_foreach_w([var], [everything standard outdated unlisted], [dnl +GP_SET_DEFINE([m4-camlib-set-]var) +GP_SET_ADD_ALL([m4-camlib-set-]var[]m4_set_listc([gp_m4s_camlib_set_]var)) +])dnl + +dnl GP_SET_MSG([m4-camlib-set-standard]) +dnl GP_SET_MSG([m4-camlib-set-unlisted]) +dnl GP_SET_MSG([m4-camlib-set-outdated]) + +GP_SET_DEFINE([camlib-set-everything])dnl +GP_SET_UNION([camlib-set-everything], [camlib-set-standard], [camlib-set-outdated], [camlib-set-unlisted]) + +dnl GP_SET_MSG([camlib-set-everything]) +dnl GP_SET_MSG([m4-camlib-set-everything]) + dnl Yes, that help output won't be all that pretty, but we at least dnl do not have to edit it by hand. AC_ARG_WITH([camlibs],[AS_HELP_STRING( [--with-camlibs=], [Compile camera drivers (camlibs) in . ]dnl - [Drivers may be separated with commas. ]dnl + [Camlibs may be separated with commas. ]dnl [CAUTION: DRIVER NAMES AND CAMERA NAMES MAY DIFFER. ]dnl - ['all' is the default and compiles all camlibs. ]dnl - [Possible camlibs are: ]dnl - m4_strip(gp_camlibs))], - [camlibs="$withval"], - [camlibs="all"])dnl -dnl -ALL_DEFINED_CAMLIBS="m4_strip(gp_camlibs) m4_strip(gp_camlibs_unlisted)" -ALL_DEFAULT_CAMLIBS="m4_strip(gp_camlibs)" -BUILD_THESE_CAMLIBS_BASE="" -if test "$camlibs" = "all"; then - BUILD_THESE_CAMLIBS_BASE="$ALL_DEFAULT_CAMLIBS" - AC_MSG_RESULT([all]) -else - # If the string starts with "all,", we start with the default list - # and add the explicitly defined ones later - if echo "$camlibs" | grep "^all," > /dev/null; then - BUILD_THESE_CAMLIBS_BASE="$ALL_DEFAULT_CAMLIBS" - camlibs="$(echo "$camlibs" | sed 's/^all,//')" - fi - # camlibs=$(echo $camlibs | sed 's/,/ /g') - IFS_save="$IFS" - IFS=",$IFS" - # Walk through enumeration of camlibs given by user and add them to list - # of camlibs to build if we know them. - for camlib in ${camlibs}; do - IFS="$IFS_save" - found=false - for from_all_camlib in ${ALL_DEFINED_CAMLIBS}; do - if test "$camlib" = "$from_all_camlib"; then - if test "x$BUILD_THESE_CAMLIBS_BASE" = "x"; then - BUILD_THESE_CAMLIBS_BASE="$camlib" - else - BUILD_THESE_CAMLIBS_BASE="$BUILD_THESE_CAMLIBS_BASE $camlib" - fi - found=: - break - fi - done - if $found; then :; else - AC_MSG_ERROR([Unknown camlib $camlib!]) - fi - done - if test "x$BUILD_THESE_CAMLIBS_BASE" = "xcanon" ; then - # Gentoo mode... if user just said "canon", add "ptp2" ... should save support requests. - BUILD_THESE_CAMLIBS_BASE="$BUILD_THESE_CAMLIBS_BASE ptp2" - camlibs="$camlibs ptp2" - AC_MSG_WARN([ - "You have just selected the old canon driver. However most current Canons\n" - "are supported by the PTP2 driver.\n" - "Autoselecting ptp2 driver too to avoid support requests.\n" + ['standard' is the default is a standard set of camlibs: ]dnl + m4_set_contents(gp_m4s_camlib_set_standard, [ ]). + ['outdated' is a set of camlibs for very old cameras: ]dnl + m4_set_contents(gp_m4s_camlib_set_outdated, [ ]).dnl + [You can add or remove camlibs or camlib sets by appending ]dnl + [them to the list with a + or - sign in front.])], + [gp_sh_with_camlibs="${withval}"], + [gp_sh_with_camlibs="standard"])dnl + +dnl For backwards compatibility, accept --with-camlibs='all' and +dnl interpret it as --with-camlibs='standard'. +AS_VAR_IF([gp_sh_with_camlibs], [all], [dnl + gp_sh_with_camlibs="standard" +])dnl + +dnl Gentoo mode... if user just requested "canon", +dnl add "ptp2" to save support requests. +AS_VAR_IF([gp_sh_with_camlibs], [canon], [dnl + gp_sh_with_camlibs="${gp_sh_with_camlibs} ptp2" + AC_MSG_WARN([ + + #==============================================================# + # You have selected only the old 'canon' driver. However, most # + # current Canon camera models require the 'ptp2' driver. # + # # + # Autoselecting the 'ptp2' driver in addition to the 'canon' # + # driver to prevent unnecessary support requests. # + #==============================================================# + GP_SLEEP([5]) +])])dnl + +dnl set -x + +AC_MSG_CHECKING([with-camlibs requested]) +AS_VAR_IF([gp_sh_with_camlibs], [standard], [dnl + AC_MSG_RESULT([standard set]) +], [dnl + gp_sh_with_camlibs="$(AS_ECHO(["${gp_sh_with_camlibs}"]) | ${TR} ',' ' ')" + AC_MSG_RESULT([${gp_sh_with_camlibs}]) +]) + +dnl AC_MSG_CHECKING([for nothing]) +dnl AC_MSG_RESULT([nihil]) + +dnl Iterate over the list of given camlibs. +dnl +dnl Replace 'standard', 'outdated', 'unlisted', and 'everything' with +dnl the respective set of camlibs, and make sure any camlibs specified +dnl explicitly are actually valid defined camlibs. +GP_SET_DEFINE([m4-camlib-set]) +GP_SET_DEFINE([camlib-set]) +for gp_camlib in ${gp_sh_with_camlibs} +do + case "X$gp_camlib" in #( + X-*) + operator=remove + gp_camlib="$(AS_ECHO(["Y${gp_camlib}"]) | ${SED} 's/^Y.//')" + ;; #( + X+*) + operator=add + gp_camlib="$(AS_ECHO(["Y${gp_camlib}"]) | ${SED} 's/^Y.//')" + ;; #( + X[[A-Za-z0-9]]*) + operator=add + ;; #( + *) + AC_MSG_ERROR([Invalid name given for camlib set or camlib: '${gp_camlib}']) + ;; + esac + dnl AC_MSG_CHECKING([with-camlibs operator]) + dnl AC_MSG_RESULT([${operator}]) + dnl AC_MSG_CHECKING([with-camlibs camlib]) + dnl AC_MSG_RESULT([${gp_camlib}]) + + dnl Convert deprecated "all" parameter to "standard". + case "$gp_camlib" in #( + all) + AC_MSG_WARN([ + + #=============================================================# + # You have used 'all' in the argument to the configure script # + # --with-camlibs= parameter. 'all' is a deprecated name for # + # the 'standard' camlib set. # + # # + # Please change your call to the configure script to use # + # 'standard' instead. # + #=============================================================# +]) + GP_SLEEP([5]) + gp_camlib="standard" + ;; + esac + + dnl Now gp_camlib contains the camlib string, and operator 'add' or 'remove'. + case "$operator" in #( + add) + case "$gp_camlib" in #( + standard) + GP_SET_UNION([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-standard]) + GP_SET_UNION([camlib-set], [camlib-set], [camlib-set-standard]) + ;; #( + outdated) + GP_SET_UNION([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-outdated]) + GP_SET_UNION([camlib-set], [camlib-set], [camlib-set-outdated]) + ;; #( + unlisted) + GP_SET_UNION([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-unlisted]) + GP_SET_UNION([camlib-set], [camlib-set], [camlib-set-unlisted]) + ;; #( + everything) + GP_SET_UNION([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-everything]) + GP_SET_UNION([camlib-set], [camlib-set], [camlib-set-everything]) + ;; #( + *) + GP_SET_CONTAINS_IFELSE([m4-camlib-set-everything], ["${gp_camlib}"], [dnl + GP_SET_ADD([m4-camlib-set], ["$gp_camlib"]) + GP_SET_ADD([camlib-set], ["$gp_camlib"]) + ], [dnl + AC_MSG_ERROR([Unknown camlib found in --with-camlibs: '${gp_camlib}']) + ]) + ;; + esac + ;; #( + remove) + case "$gp_camlib" in #( + standard) + GP_SET_DIFFERENCE([camlib-set], [camlib-set], [camlib-set-standard]) + GP_SET_DIFFERENCE([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-standard]) + ;; #( + outdated) + GP_SET_DIFFERENCE([camlib-set], [camlib-set], [camlib-set-outdated]) + GP_SET_DIFFERENCE([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-outdated]) + ;; #( + unlisted) + GP_SET_DIFFERENCE([camlib-set], [camlib-set], [camlib-set-unlisted]) + GP_SET_DIFFERENCE([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-unlisted]) + ;; #( + everything) + GP_SET_DIFFERENCE([camlib-set], [camlib-set], [camlib-set-everything]) + GP_SET_DIFFERENCE([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-everything]) + ;; #( + *) + GP_SET_CONTAINS_IFELSE([m4-camlib-set-everything], ["${gp_camlib}"], [dnl + GP_SET_REMOVE([camlib-set], ["$gp_camlib"]) + GP_SET_CONTAINS_IFELSE([m4-camlib-set], ["$gp_camlib"], [dnl + GP_SET_REMOVE([m4-camlib-set], ["$gp_camlib"]) + ], [dnl + AC_MSG_WARN([Removing camlib ${gp_camlib} from m4-camlib-set which does not contain ${gp_camlib}]) ]) - fi - IFS="$IFS_save" - AC_MSG_RESULT([$camlibs]) - GP_CAMLIBS_WARNING - AC_DEFINE_UNQUOTED([INCOMPLETE_CAMLIB_SET], ["$BUILD_THESE_CAMLIBS_BASE"], - [Whether the set of camlibs built is incomplete]) -fi -BUILD_THESE_CAMLIBS="" -for f in $BUILD_THESE_CAMLIBS_BASE + ], [dnl + AC_MSG_ERROR([Unknown camlib found in --with-camlibs: '${gp_camlib}']) + ]) + ;; + esac + ;; + esac +done +AS_UNSET([gp_camlib]) +AC_MSG_CHECKING([with-camlibs parsing]) +AC_MSG_RESULT([finished]) + +dnl GP_SET_MSG([m4-camlib-set]) +dnl GP_SET_MSG([camlib-set]) + +dnl Camlibs requested, but cannot be built. +GP_SET_DEFINE([camlib-set-diff-skipping]) +GP_SET_DIFFERENCE([camlib-set-diff-skipping], [m4-camlib-set], [camlib-set]) +GP_SET_MSG([camlib-set-diff-skipping]) + +dnl Camlibs added over the standard set +GP_SET_DEFINE([camlib-set-diff-over-standard]) +GP_SET_DIFFERENCE([camlib-set-diff-over-standard], [camlib-set], [camlib-set-standard]) +GP_SET_MSG([camlib-set-diff-over-standard]) + +dnl Camlibs missing from the standard set +GP_SET_DEFINE([camlib-set-diff-from-standard]) +GP_SET_DIFFERENCE([camlib-set-diff-from-standard], [camlib-set-standard], [camlib-set]) +GP_SET_MSG([camlib-set-diff-from-standard]) + +GP_SET_DEBUG_MSG([camlib-set-diff-skipping]) +GP_SET_DEBUG_MSG([camlib-set-diff-from-standard]) +GP_SET_DEBUG_MSG([camlib-set-diff-over-standard]) + +GP_SET_SPACE_VAR([camlib-set-diff-skipping], [gp_camlib_set_skipping])dnl + +dnl We could use the cardinality of the difference sets to determine +dnl how far we are from the standard set. If we do not differ too +dnl much, we can still show the camlib set as "standard plus these +dnl minus those skipping that" instead of just listing the camlib +dnl names. + +dnl gp_camlibs_from_standard="$(GP_SET_CARDINALITY([camlib-set-diff-from-standard]))" +dnl AC_MSG_CHECKING([camlibs removed from standard set]) +dnl AC_MSG_RESULT([${gp_camlibs_from_standard}]) + +dnl gp_camlibs_over_standard="$(GP_SET_CARDINALITY([camlib-set-diff-over-standard]))" +dnl AC_MSG_CHECKING([camlibs added over standard set]) +dnl AC_MSG_RESULT([${gp_camlibs_over_standard}]) + +dnl gp_camlibs_non_standard="$(${EXPR} ${gp_camlibs_from_standard} + ${gp_camlibs_over_standard})" +dnl AC_MSG_CHECKING([total number of camlibs differing from standard set]) +dnl AC_MSG_RESULT([${gp_camlibs_non_standard}]) + +AC_MSG_CHECKING([whether skipping some requested camlibs]) +AS_IF([test "x$gp_camlib_set_skipping" = "x"], [dnl + AC_MSG_RESULT([no]) +], [dnl + AC_MSG_RESULT([yes (${gp_camlib_set_skipping})]) + AC_DEFINE_UNQUOTED([GP_CAMLIB_SET_SKIPPING], ["${gp_camlib_set_skipping}"], + [If defined, the camlibs which are skipped due to missing dependencies]) + AC_MSG_WARN([ + + #=========================================================# + # We are skipping building one or more camlibs, probably # + # due to missing dependencies. Check the dependencies if # + # you insist on building these camlibs. # + #=========================================================# +]) + GP_SLEEP([5]) +]) + +GP_SET_SPACE_VAR([camlib-set], [gp_camlib_set]) +AC_MSG_CHECKING([camlib set to build in detail]) +AC_MSG_RESULT([${gp_camlib_set}]) + +GP_CAMLIBS_CONDITIONAL_WARNING + +dnl Whether user has requested a non-standard set of camlibs +GP_SET_EQUAL_IFELSE([camlib-set], [camlib-set-standard], [dnl + AS_IF([test "x$gp_camlib_set_skipping" = "x"], [dnl + GP_CONFIG_MSG([Camlibs], + [standard set (${gp_camlib_set})]) + ], [dnl + GP_CONFIG_MSG([Camlibs], + [standard set (${gp_camlib_set} SKIPPING ${gp_camlib_set_skipping})]) + ]) +], [dnl + AS_IF([test "x$gp_camlib_set_skipping" = "x"], [dnl + GP_CONFIG_MSG([Camlibs], + [non-standard set (${gp_camlib_set})]) + ], [dnl + GP_CONFIG_MSG([Camlibs], + [non-standard set (${gp_camlib_set} SKIPPING ${gp_camlib_set_skipping})]) + ]) + m4_pattern_allow([GP_CAMLIB_SET_IS_NONSTANDARD])dnl + AC_DEFINE_UNQUOTED([GP_CAMLIB_SET_IS_NONSTANDARD], [1], + [define when the camlib set to buidl is non-standard]) +])dnl + +m4_pattern_allow([GP_CAMLIB_SET])dnl +AC_DEFINE_UNQUOTED([GP_CAMLIB_SET], ["${gp_camlib_set}"], + [The actually defined set of camlibs to build]) + +AS_UNSET([GP_CAMLIB_SET]) +for f in ${gp_camlib_set} do - BUILD_THESE_CAMLIBS="${BUILD_THESE_CAMLIBS}${BUILD_THESE_CAMLIBS+ }${f}.la" + GP_CAMLIB_SET="${GP_CAMLIB_SET}${GP_CAMLIB_SET+ }${f}.la" done -AC_SUBST([BUILD_THESE_CAMLIBS]) -AC_SUBST([ALL_DEFINED_CAMLIBS]) -AC_SUBST([ALL_DEFAULT_CAMLIBS]) +AS_UNSET([f]) +AC_SUBST([GP_CAMLIB_SET]) + +m4_pattern_allow([GP_CAMLIB_SET_EVERYTHING])dnl +AC_SUBST([GP_CAMLIB_SET_EVERYTHING], + ["m4_set_contents([gp_m4s_camlib_set_everything], [ ])"]) + +# END $0($@) ])dnl dnl +dnl dnl #################################################################### dnl dnl Local Variables: diff --git a/libgphoto2_port/gphoto-m4/gp-libjpeg.m4 b/libgphoto2_port/gphoto-m4/gp-libjpeg.m4 new file mode 100644 index 0000000000..41abf41689 --- /dev/null +++ b/libgphoto2_port/gphoto-m4/gp-libjpeg.m4 @@ -0,0 +1,139 @@ +dnl #################################################################### +dnl GP_LIBJPEG +dnl #################################################################### +dnl +dnl * If --without-jpeg or --with-jpeg=no is given, build without +dnl libjpeg support. +dnl * If not explicitly disabled by --without-jpeg, autodetect libjpeg. +dnl * If any of LIBJPEG_(CFLAGS|LIBS) is explicitly given, try +dnl compile+link using that. +dnl * If compile+link works, use that. +dnl * If compile+link fails, abort with error message. +dnl * If none of LIBJPEG_(CFLAGS|LIBS) are explicitly given, try +dnl pkg-config to find libjpeg.pc. +dnl * If libjpeg.pc has been found, try compile+link. +dnl * If compile+link works, use that. +dnl * If compile+link fails, build without libjpeg. +dnl * If libjpeg.pc has not been found, try default location. +dnl * If compile+link works, use that. +dnl * If compile+link fails, build without libjpeg. +dnl +AC_DEFUN([GP_LIBJPEG], [dnl +dnl +AC_MSG_CHECKING([whether to build with jpeg-turbo libjpeg]) +AC_ARG_WITH([jpeg], [dnl + AS_HELP_STRING([--without-jpeg], + [Build without libjpeg (default: with libjpeg)]) +], [dnl just keep the with-jpeg however it is given + AS_VAR_IF([with_jpeg], [no], [], [dnl + AC_MSG_ERROR([ +Unhandled value given to --with-jpeg / --without-jpeg: '$with_jpeg' +]) + ]) +], [dnl + with_jpeg=autodetect +]) +AC_MSG_RESULT([$with_jpeg]) +dnl +AS_VAR_IF([with_jpeg], [no], [dnl Not using libjpeg, so no checks are needed + # libjpeg explictly disabled from command line + GP_CONFIG_MSG([JPEG mangling support], + [no (disabled by --without-jpeg)]) +], [dnl + have_libjpeg=no + + AC_MSG_CHECKING([for jpeg-turbo libjpeg via variables]) + AS_IF([test "x$LIBJPEG_LIBS$LIBJPEG_CFLAGS" != x], [dnl + GP_LINK_LIBJPEG_IFELSE([ + AC_MSG_RESULT([found and works]) + have_libjpeg=yes + ], [dnl + AC_MSG_RESULT([found but fails to link]) + AC_MSG_ERROR([ +libjpeg not found despite LIBJPEG_CFLAGS and/or LIBJPEG_LIBS being set. +]) + ]) + ], [dnl + AC_MSG_RESULT([no]) + ]) + + AS_VAR_IF([have_libjpeg], [no], [dnl + PKG_CHECK_MODULES([LIBJPEG], [libjpeg], [dnl + AC_MSG_CHECKING([linking with jpeg-turbo libjpeg works]) + GP_LINK_LIBJPEG_IFELSE([dnl + have_libjpeg=yes + AC_MSG_RESULT([yes]) + ], [dnl + AC_MSG_RESULT([no]) + ]) + ], [dnl + LIBJPEG_LIBS="-ljpeg" + AC_MSG_CHECKING([for jpeg-turbo libjpeg at default location]) + GP_LINK_LIBJPEG_IFELSE([dnl + have_libjpeg=yes + AC_MSG_RESULT([yes]) + ], [dnl + AC_MSG_RESULT([no]) + AS_UNSET([LIBJPEG_LIBS]) + ]) + ]) + ]) + + AS_VAR_IF([have_libjpeg], [no], [dnl + GP_CONFIG_MSG([JPEG mangling support], + [${have_libjpeg} (requires jpeg-turbo libjpeg)]) + ], [dnl + AC_DEFINE([HAVE_LIBJPEG], [1], + [define if building with jpeg-turbo libjpeg]) + GP_CONFIG_MSG([JPEG mangling support], + [${have_libjpeg}]) + ]) +]) +])dnl +dnl +dnl +dnl #################################################################### +dnl GP_LINK_LIBJPEG_IFELSE([if-true], [if-false]) +dnl Make sure we can actually compile and link against libjpeg. +dnl #################################################################### +dnl +AC_DEFUN([GP_LINK_LIBJPEG_IFELSE], [dnl +AC_LANG_PUSH([C]) +saved_CPPFLAGS="$CPPFLAGS" +saved_LIBS="$LIBS" +CPPFLAGS="$CPPFLAGS $LIBJPEG_CFLAGS" +LIBS="$LIBS $LIBJPEG_LIBS" +AC_LINK_IFELSE([AC_LANG_SOURCE([[ +#include +#include +#include +/* jpeglib.h fails to include all required system headers, so jpeglib.h + * must be included after stddef.h (size_t) and stdio.h (FILE). + */ +#include + +int main(int argc, char **argv) +{ + j_decompress_ptr cinfo = NULL; + (void) argc; + (void) argv; + /* Running this will give a segfault */ + if (jpeg_start_decompress(cinfo)) { + printf("true\n"); + } else { + printf("false\n"); + } + return 0; +} +]])], [$1], [$2]) +CPPFLAGS="$saved_CPPFLAGS" +LIBS="$saved_LIBS" +AC_LANG_POP([C]) +])dnl +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-pedantic-compiler-flags.m4 b/libgphoto2_port/gphoto-m4/gp-pedantic-compiler-flags.m4 new file mode 100644 index 0000000000..11afa8982e --- /dev/null +++ b/libgphoto2_port/gphoto-m4/gp-pedantic-compiler-flags.m4 @@ -0,0 +1,131 @@ +dnl #################################################################### +dnl GP_PEDANTIC_COMPILER_FLAGS & Co. +dnl #################################################################### +dnl +dnl +dnl #################################################################### +dnl GP_CONDITIONAL_COMPILE_FLAGS(FLAG_VAR, FLAGS) +dnl #################################################################### +AC_DEFUN([GP_CONDITIONAL_COMPILE_FLAGS], [dnl +dnl +# BEGIN $0($@) +dnl +m4_case([$1], + [CFLAGS], [AC_LANG_PUSH([C])], + [CXXFLAGS], [AC_LANG_PUSH([C++])], + [m4_fatal([wrong compiler flag])])dnl +dnl +saved_$1="${$1}" +AS_VAR_IF([$1], [], [$1="$2"], [$1="[$]{$1} $2"]) +AC_MSG_CHECKING([whether $1="[$]$1" compiles]) +AC_COMPILE_IFELSE([m4_case([$1], [CFLAGS], [dnl +AC_LANG_SOURCE([[ +#include +int main(int argc, char *argv[]) +{ + int i; + /* Use argc and argv to prevent warning about unused function params */ + for (i=0; i +int main(int argc, char *argv[]) +{ + int i; + /* Use argc and argv to prevent warning about unused function params */ + for (i=0; igp-empty-file-a +:>gp-empty-file-b +AS_IF([diff -u gp-empty-file-a gp-empty-file-b], [dnl + AC_MSG_RESULT([yes]) + DIFF_MAYBE_U="${DIFF} -u" +], [dnl + AC_MSG_RESULT([no]) + DIFF_MAYBE_U="${DIFF}" +]) +rm -f gp-empty-file-a gp-empty-file-b +AC_SUBST([DIFF_MAYBE_U]) +])dnl +dnl +dnl +dnl #################################################################### +dnl +dnl #################################################################### +m4_pattern_forbid([GP_PROG_EXPR])dnl +AC_DEFUN_ONCE([GP_PROG_EXPR],[dnl +AC_ARG_VAR([EXPR], [expr expression evaluation command])dnl +AC_PATH_PROG([EXPR], [expr])dnl +])dnl +dnl +dnl +dnl #################################################################### +dnl +dnl #################################################################### +m4_pattern_forbid([GP_PROG_SLEEP])dnl +AC_DEFUN_ONCE([GP_PROG_SLEEP],[dnl +AC_ARG_VAR([SLEEP], [sleep delay command])dnl +AC_MSG_CHECKING([whether to sleep]) +AS_VAR_IF([SLEEP], [no], [dnl + AC_MSG_RESULT([no]) +], [dnl + AC_MSG_RESULT([yes]) + AC_PATH_PROG([SLEEP], [sleep])dnl +])dnl +])dnl +dnl +dnl +dnl #################################################################### +dnl +dnl #################################################################### +m4_pattern_forbid([GP_PROG_SORT])dnl +AC_DEFUN_ONCE([GP_PROG_SORT],[dnl +AC_ARG_VAR([SORT], [sort text file line sorting command])dnl +AC_PATH_PROG([SORT], [sort])dnl +])dnl +dnl +dnl +dnl #################################################################### +dnl +dnl #################################################################### +m4_pattern_forbid([^GP_PROG_TR\(])dnl +m4_pattern_forbid([^GP_PROG_TR$])dnl +AC_DEFUN_ONCE([GP_PROG_TR],[dnl +AC_ARG_VAR([TR], [tr string character translation command])dnl +AC_PATH_PROG([TR], [tr])dnl +])dnl +dnl +dnl +dnl #################################################################### +dnl +dnl #################################################################### +m4_pattern_forbid([^GP_PROG_UNIQ\(])dnl +m4_pattern_forbid([^GP_PROG_UNIQ$])dnl +AC_DEFUN_ONCE([GP_PROG_UNIQ],[dnl +AC_ARG_VAR([UNIQ], [uniq sorted file uniquification command])dnl +AC_PATH_PROG([UNIQ], [uniq])dnl +])dnl +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-set.m4 b/libgphoto2_port/gphoto-m4/gp-set.m4 new file mode 100644 index 0000000000..444d71f764 --- /dev/null +++ b/libgphoto2_port/gphoto-m4/gp-set.m4 @@ -0,0 +1,753 @@ +dnl ###################################################################### +dnl Set operations using shell +dnl ###################################################################### +dnl +dnl This implements a set of set operations ('set' in the sense of +dnl 'set theory') as shell code for use at configure time. At m4 time +dnl (aka autoreconf time), there already exists a set of m4_set_* +dnl macros, but we cannot use those for user specified and +dnl autodetected changes at configure time. +dnl +dnl Not all set operations are implemented, but a few basic ones we +dnl need for gp-camlibs.m4 are. +dnl +dnl * Basic definitions: +dnl +dnl * GP_SET_DEFINE +dnl * GP_SET_UNDEFINE +dnl +dnl * Operations on sets: +dnl +dnl * GP_SET_ADD +dnl * GP_SET_ADD_ALL +dnl * GP_SET_REMOVE +dnl +dnl * GP_SET_CARDINALITY +dnl * GP_SET_DIFFERENCE +dnl * GP_SET_UNION +dnl +dnl * GP_SET_FOREACH +dnl +dnl * Conditionals: +dnl +dnl * GP_SET_CONTAINS_IFELSE +dnl * GP_SET_EMPTY_IFELSE +dnl * GP_SET_EQUAL_IFELSE +dnl +dnl * GP_SET_CLEAN_FILES +dnl +dnl * Internals and debugging help: +dnl +dnl * GP_SET_CANONICALIZE +dnl * GP_SET_DUMP_ALL +dnl * GP_SET_TESTSUITE +dnl +dnl * Fill shell variables with set contents: +dnl +dnl * GP_SET_DEBUG_VAR +dnl * GP_SET_SPACE_VAR +dnl +dnl * Output AC_MSG_* for GP_SET_* sets: +dnl +dnl * GP_SET_DEBUG_MSG +dnl * GP_SET_MSG_DEBUG_RESULT +dnl +dnl * GP_SET_SPACE_MSG +dnl * GP_SET_MSG_SPACE_RESULT +dnl +dnl ###################################################################### +dnl Remarks on usage and implementation of GP_SET_* +dnl +dnl * Sets are stored in text files, one element per line. An empty +dnl file is an empty set, and empty lines mean empty elements. +dnl Non-empty files not ending with a newline are undefined behaviour. +dnl +dnl * At this time, GP_SET_* macros work with set elements +dnl consisting of a limited set of characters, but the storage +dnl format allows for a future code cleanup to allow for handling +dnl more arbitrarily called elements. +dnl +dnl * Set names given to GP_SET_ macros must be defined at m4 +dnl (autoreconf) time, not at sh (configure) time. +dnl +dnl * Every set must be declared before use with GP_SET_DEFINE so we +dnl can create an empty file for them and keep track of the name of +dnl that file for cleaning up later. +dnl +dnl * Use GP_SET_CLEAN_FILES after your last set operations to remove +dnl all left over set files. +dnl +dnl * Set text files may contain set elements in any order, and in +dnl any number. There is no difference between a set text file +dnl containing the same line seven times and one which only contains +dnl it one time. +dnl +dnl * Some set operations require or work better on sorted files, so +dnl sometimes the implementation sorts the set text files. If you +dnl need a set text file sorted for some another reason, use +dnl GP_SET_CANONICALIZE([set-name]). +dnl +dnl * Some set GP_SET_* operations are implemented using shell +dnl functions to reduce the size of the emitted sh code. The goal +dnl is for the shell functions to be as compatible with different +dnl shells as possible, but if necessary, we can revert to avoiding +dnl shell functions and just emitting the same sh code 40 times. +dnl +dnl +dnl ###################################################################### +dnl +dnl FIXME: Do we need a sh-based replacement for ${COMM} if it is not present? +dnl FIXME: Do we need to stop using shell functions? +dnl +dnl +dnl ###################################################################### +dnl Try catching unexpanded macros in the output. +dnl ###################################################################### +m4_pattern_forbid([GP_SET_])dnl +m4_pattern_forbid([_GP_SET_])dnl +dnl +dnl +dnl ###################################################################### +dnl _GP_SET_INIT +dnl Called internally before any set operation. +dnl ###################################################################### +AC_DEFUN_ONCE([_GP_SET_INIT], [dnl +AC_REQUIRE([AC_PROG_GREP])dnl +AC_REQUIRE([GP_PROG_SORT])dnl +AC_REQUIRE([GP_PROG_UNIQ])dnl +m4_set_empty([gp_set_all_sets], [], [dnl + m4_set_foreach([gp_set_all_sets], [elt], [dnl + m4_errprintn(__file__: __line__:[ Set gp_set_all_sets contains element ]elt)dnl + ])dnl + m4_errprintn(__file__:__line__:[ Error: gp_set_all_sets already defined])dnl + dnl m4_exit(1)dnl +])dnl +])dnl +dnl +dnl +dnl ###################################################################### +dnl _GP_SET_FILENAME([set_name]) +dnl _GP_SET_FILENAME([set_name], [extra-extension]) +dnl Convert set name to set file name. If present, add the given +dnl extra-extension to the file name in some position. +dnl ###################################################################### +AC_DEFUN([_GP_SET_FILENAME], [dnl +[gp-set-file--][$1]m4_if([$2],[],[],[.$2])])dnl +dnl +dnl +dnl ###################################################################### +dnl _GP_SET_CHECK_INIT +dnl Implement the gp_set_shfn_check() shell function which checks that the +dnl given set exists and is in general working order. +dnl ###################################################################### +AC_DEFUN_ONCE([_GP_SET_CHECK_INIT], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +gp_set_shfn_check () +{ + if test -f "[$]1"; then :; else + AC_MSG_ERROR(["Error: set [$]1 has not been defined yet"]) + fi +} # gp_set_shfn_check +])dnl +dnl +dnl +dnl ###################################################################### +dnl _GP_SET_CHECK([set_name]) +dnl Check that the given set exists and is in general working order. +dnl Works by calling the gp_set_shfn_check() shell function. +dnl ###################################################################### +AC_DEFUN([_GP_SET_CHECK], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +AC_REQUIRE([_GP_SET_CHECK_INIT])dnl +gp_set_shfn_check "_GP_SET_FILENAME([$1])" +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_DUMP_ALL +dnl Dump all sets to stdout. Intended for helping with debugging. +dnl ###################################################################### +AC_DEFUN([GP_SET_DUMP_ALL], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +for setfile in gp-set-file--* +do + AS_ECHO(["Set file: ${setfile}"]) + ${SED} 's/^/ * <>/' "${setfile}" +done +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_DEFINE([set_name]) +dnl Declare a set of given name, initializing it to an empty set. +dnl Not a shell function, as the emitted shell code is shorter than +dnl calling a shell function. +dnl ###################################################################### +AC_DEFUN([GP_SET_DEFINE], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +m4_set_add([gp_set_all_sets], [$1])dnl +: > "_GP_SET_FILENAME([$1])" +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_UNDEFINE([set_name]) +dnl Undefine a set of given name, removing its file. +dnl Not a shell function, as the emitted shell code is shorter than +dnl calling a shell function. +dnl ###################################################################### +AC_DEFUN([GP_SET_UNDEFINE], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +_GP_SET_CHECK([$1])dnl +rm -f "_GP_SET_FILENAME([$1])" +])dnl +dnl +dnl +dnl ###################################################################### +dnl _GP_SET_ADD_INIT +dnl Implement the gp_set_shfn_set_add() shell function which adds a given +dnl element to a given set. +dnl ###################################################################### +AC_DEFUN_ONCE([_GP_SET_ADD_INIT], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +AC_REQUIRE([_GP_SET_CHECK_INIT])dnl +gp_set_shfn_set_add () +{ + gp_set_shfn_check "[$]1" + AS_ECHO(["[$]2"]) >> "[$]1" +} # gp_set_shfn_set_add +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_ADD([set_name], [element]) +dnl Add the given element to the given set. Implemented by calling the +dnl gp_set_shfn_set_add() shell function. +dnl Note: Unlike m4_set_add, this does not handle IF-UNIQ and IF-DUP +dnl macro parameters. +dnl ###################################################################### +AC_DEFUN([GP_SET_ADD], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +AC_REQUIRE([_GP_SET_ADD_INIT])dnl +gp_set_shfn_set_add "_GP_SET_FILENAME([$1])" "$2" +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_ADD_ALL([set_name], [element]...) +dnl Add the given elements to the given set, similar to m4_set_add_all. +dnl This can be very useful for initializing a GP_SET_* set from a +dnl m4_set_* in one go. +dnl Not a shell function, as the emitted shell code is shorter than +dnl calling a shell function. +dnl ###################################################################### +AC_DEFUN([GP_SET_ADD_ALL], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +_GP_SET_CHECK([$1])dnl +cat>>"_GP_SET_FILENAME([$1])"< "[$]1.tmp" + mv -f "[$]1.tmp" "[$]1" +} # gp_set_shfn_remove +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_REMOVE([set_name], [element]) +dnl Remove a given element from a given set. +dnl Calls the gp_set_shfn_remove() shell function for the actual work. +dnl ###################################################################### +AC_DEFUN([GP_SET_REMOVE], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +AC_REQUIRE([_GP_SET_REMOVE_INIT])dnl +gp_set_shfn_remove "_GP_SET_FILENAME([$1])" "$2" +])dnl +dnl +dnl +dnl ###################################################################### +dnl _GP_SET_UNION_INIT +dnl Define the gp_set_shfn_union() shell function which defines a +dnl result set as the union of 0 or more sets. +dnl ###################################################################### +AC_DEFUN_ONCE([_GP_SET_UNION_INIT], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +dnl This functions uses the shell builtin 'shift', so it needs to store +dnl the original $1 in a local variable. +gp_set_shfn_union () +{ + local result_fname="[$]1" + gp_set_shfn_check "[$]result_fname" + if shift; then + cat "[$]@" > "[$]{result_fname}.tmp" + mv -f "[$]{result_fname}.tmp" "[$]{result_fname}" + fi +} # gp_set_shfn_union +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_UNION([result_set], [setname]...) +dnl Define result_set as the union of 0 or more setnames. +dnl Calls the gp_set_shfn_union() shell function for the actual work. +dnl ###################################################################### +AC_DEFUN([GP_SET_UNION], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +AC_REQUIRE([_GP_SET_UNION_INIT])dnl +m4_set_add([gp_set_all_sets], [$1])dnl +gp_set_shfn_union m4_foreach([setname], [$@], [ "_GP_SET_FILENAME(setname)"]) +])dnl +dnl +dnl +dnl ###################################################################### +dnl _GP_SET_DIFFERENCE_INIT([result_set_fname], [set_fname]...) +dnl This uses comm(1), which is a POSIX command. We can always +dnl re-implement comm(1) with a lot of speed penalties in a bunch +dnl of nested sh loops if we run into a system which does not have +dnl comm(1) installed or where comm(1) does not work. +dnl ###################################################################### +AC_DEFUN_ONCE([_GP_SET_DIFFERENCE_INIT], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +AC_REQUIRE([_GP_SET_CHECK_INIT])dnl +AC_REQUIRE([_GP_SET_CANONICALIZE_INIT])dnl +AC_REQUIRE([GP_PROG_COMM])dnl +cat>confset_a.txt<confset_b.txt<confset_res_23.txt< confset_diff_23.txt], [dnl + AS_IF([${CMP} confset_diff_23.txt confset_res_23.txt > /dev/null 2>&1], [dnl + AC_MSG_RESULT([yes]) + rm -f confset_a.txt confset_b.txt confset_diff_23.txt confset_res_23.txt + ], [dnl + AC_MSG_RESULT([no (wrong result)]) + AC_MSG_ERROR([comm -23 must work for GP_SET_xyz difference calculations]) + ]) +], [dnl + AC_MSG_RESULT([no (does not run)]) + AC_MSG_ERROR([comm -23 must work for GP_SET_xyz difference calculations]) +]) +dnl This functions uses the shell builtin 'shift', so it needs to store +dnl the original $1 and $2 in local variables. +gp_set_shfn_difference () +{ + local result_fname="[$]1" + gp_set_shfn_check "[$]result_fname" + if shift; then + gp_set_shfn_canonicalize "[$]1" + cat "[$]1" > "[$]result_fname" + if shift; then + for gp_s + do + gp_set_shfn_canonicalize "[$]gp_s" + ${COMM} -23 "[$]{result_fname}" "[$]gp_s" > "[$]{result_fname}.tmp" + mv -f "[$]{result_fname}.tmp" "[$]{result_fname}" + done + fi + fi +} # gp_set_shfn_difference +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_DIFFERENCE([result_set], [setname]...) +dnl Define result_set as the first setname with the element of all +dnl the other sets removed from it. +dnl ###################################################################### +AC_DEFUN([GP_SET_DIFFERENCE], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +AC_REQUIRE([_GP_SET_DIFFERENCE_INIT])dnl +m4_set_add([gp_set_all_sets], [$1])dnl +gp_set_shfn_difference m4_foreach([setname], [$@], [ "_GP_SET_FILENAME(setname)"]) +])dnl +dnl +dnl +dnl ###################################################################### +dnl _GP_SET_CARDINALITY_INIT +dnl Define gp_set_shfn_cardinality() shell function which writes +dnl set cardinality to stdout. +dnl ###################################################################### +AC_DEFUN_ONCE([_GP_SET_CARDINALITY_INIT], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +gp_set_shfn_cardinality () +{ + gp_set_shfn_check "[$]1" + wc -l < "[$]1" +} # gp_set_shfn_cardinality +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_CARDINALITY([set_name]) +dnl Write set cardinality to stdout. +dnl ###################################################################### +AC_DEFUN([GP_SET_CARDINALITY], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +AC_REQUIRE([_GP_SET_CARDINALITY_INIT])dnl +gp_set_shfn_cardinality "_GP_SET_FILENAME([$1])"])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_EMPTY_IFELSE([set_name], [if-empty], [if-not-empty]) +dnl Run if-empty block or if-not-empty block, depending on whether +dnl the named set is empty or not. +dnl ###################################################################### +AC_DEFUN([GP_SET_EMPTY_IFELSE], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +_GP_SET_CHECK([$1])dnl +AS_IF([test "0" -eq "$(wc -l < "_GP_SET_FILENAME([$1])")"], m4_shift($@)) +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_EQUAL_IFELSE([set_a], [set_b], [if-equal], [if-not-equal]) +dnl When set_a and set_b are equal, run the if-equal block. Otherwise, +dnl run the if-not-equal block. +dnl ###################################################################### +AC_DEFUN([GP_SET_EQUAL_IFELSE], [dnl +gp_set_shfn_canonicalize "_GP_SET_FILENAME([$1])" +gp_set_shfn_canonicalize "_GP_SET_FILENAME([$2])" +AS_IF([${CMP} "_GP_SET_FILENAME([$1])" "_GP_SET_FILENAME([$2])" > /dev/null 2>&1], + m4_shift2($@)) +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_CONTAINS_IFELSE([set_name], [element], [yes-block], [no-block]) +dnl If set_name contains element, run the yes-block. Otherwise, +dnl run the no-block. +dnl ###################################################################### +AC_DEFUN([GP_SET_CONTAINS_IFELSE], [dnl +_GP_SET_CHECK([$1])dnl +AS_IF([test "0" -lt "$(${GREP} -c "^$2\$" < "_GP_SET_FILENAME([$1])")"], + m4_shift2($@)) +])dnl +dnl +dnl +dnl ###################################################################### +dnl _GP_SET_DEBUG_VAR_INIT +dnl Define gp_set_shfn_debug_var() shell function which sets a shell +dnl variable to a string representing a human readable form for of +dnl the given set. +dnl ###################################################################### +AC_DEFUN_ONCE([_GP_SET_DEBUG_VAR_INIT], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +gp_set_shfn_debug_var () +{ + gp_set_shfn_check "[$]1" + gp_set_shfn_canonicalize "[$]1" + local element + local gp_set_is_first=: + local gp_set_saved_ifs="$IFS" + IFS="" + while read element + do + if "$gp_set_is_first" + then + eval "[$]2=\"{ \"" + gp_set_is_first=false + else + eval "[$]2=\"\${[$]2}, \"" + fi + if test "x$element" = "x" + then + eval "[$]2=\"\${[$]2}''\"" + else + eval "[$]2=\"\${[$]2}'\$element'\"" + fi + done < "[$]1" + IFS="$gp_set_saved_ifs" + if "$gp_set_is_first" + then + eval "[$]2=\"{ }\"" + else + eval "[$]2=\"\${[$]2} }\"" + fi +} # gp_set_shfn_debug_var +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_DEBUG_VAR([set_name], [shell_var_name]) +dnl Set shell variable shell_var_name to a string representing a human +dnl readable for of the given set. +dnl ###################################################################### +AC_DEFUN([GP_SET_DEBUG_VAR], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +AC_REQUIRE([_GP_SET_DEBUG_VAR_INIT])dnl +gp_set_shfn_debug_var "_GP_SET_FILENAME([$1])" "$2" +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_DEBUG_MSG([set-name]) +dnl For a given set, expand to a simple pair of AC_MSG_CHECKING and +dnl AC_MSG_RESULT showing the GP_SET_DEBUG_VAR, mostly to help with +dnl debugging. +dnl ###################################################################### +AC_DEFUN([GP_SET_DEBUG_MSG], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +AC_MSG_CHECKING([value of set ]$1) +GP_SET_MSG_DEBUG_RESULT([$1]) +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_SPACE_MSG([set-name]) +dnl For a given set, expand to a simple pair of AC_MSG_CHECKING and +dnl AC_MSG_RESULT showing the GP_SET_SPACE_VAR, both to help with +dnl debugging gp-set.m4 and possibly for produnction use. +dnl ###################################################################### +AC_DEFUN([GP_SET_MSG], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +AC_MSG_CHECKING([value of set ]$1) +GP_SET_MSG_RESULT([$1]) +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_SPACE_VAR([set-name], [var-name]) +dnl ###################################################################### +AC_DEFUN([GP_SET_SPACE_VAR], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +$2="" +GP_SET_FOREACH([$1], [element], [dnl +AS_IF([test "x[$]$2" = "x"], [dnl + $2="[$]element" +], [dnl + $2="[$]$2 [$]element" +]) +]) +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_MSG_RESULT([set-name]) +dnl Shortcut for setting a shell variable to a space separated list of +dnl elements, and then expanding to AC_MSG_RESULT([$shellvar]). +dnl ###################################################################### +AC_DEFUN([GP_SET_MSG_RESULT], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +GP_SET_SPACE_VAR([$1], [gp_set_msg_result_var])dnl +AC_MSG_RESULT([${gp_set_msg_result_var}]) +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_MSG_DEBUG_RESULT([set-name]) +dnl Shortcut for setting a shell variable to a human readable list of +dnl elements, and then expanding to AC_MSG_RESULT([$shellvar]). +dnl ###################################################################### +AC_DEFUN([GP_SET_MSG_DEBUG_RESULT], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +GP_SET_DEBUG_VAR([$1], [gp_set_msg_result_var])dnl +AC_MSG_RESULT([${gp_set_msg_result_var}]) +])dnl +dnl +dnl +dnl ###################################################################### +dnl _GP_SET_CANONICALIZE_INIT +dnl Implement the gp_set_shfn_canonicalize() shell function. +dnl ###################################################################### +AC_DEFUN_ONCE([_GP_SET_CANONICALIZE_INIT], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +gp_set_shfn_canonicalize () +{ + gp_set_shfn_check "[$]1" + ( set -e + [$]{SORT} < "[$]1" | [$]{UNIQ} > "[$]1.tmp" + mv -f "[$]1.tmp" "[$]1"; ) +} # gp_set_shfn_canonicalize +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_CANONICALIZE([set_name]) +dnl Convert the set file for set_name into a canonical form. +dnl +dnl Implementation detail: Sorts the lines, and makes them unique. +dnl ###################################################################### +AC_DEFUN([GP_SET_CANONICALIZE], [dnl +AC_REQUIRE([_GP_SET_INIT])dnl +AC_REQUIRE([_GP_SET_CANONICALIZE_INIT])dnl +gp_set_shfn_canonicalize "_GP_SET_FILENAME([$1])" +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_FOREACH([set_name], [shell-var], [shell-block]) +dnl For each element in set_name, run the shell-block with the given +dnl shell variable set to every element in turn. +dnl ###################################################################### +AC_DEFUN([GP_SET_FOREACH], [dnl +_GP_SET_CHECK([$1])dnl +gp_set_saved_ifs="$IFS" +IFS="" +while read $2 +do + IFS="$gp_set_saved_ifs" + $3 +done < "_GP_SET_FILENAME([$1])" +IFS="$gp_set_saved_ifs" +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_CLEAN_FILES +dnl Remove all the files used for storing sets. Invoke this macro near +dnl the end of configure.ac after you have finished doing anything with +dnl GP_SET_* sets. +dnl ###################################################################### +AC_DEFUN([GP_SET_CLEAN_FILES], [dnl +AC_BEFORE([_GP_SET_INIT], [$0])dnl +AC_BEFORE([GP_SET_DEFINE], [$0])dnl +AC_BEFORE([GP_SET_UNDEFINE], [$0])dnl +AC_BEFORE([GP_SET_ADD], [$0])dnl +AC_BEFORE([GP_SET_ADD_ALL], [$0])dnl +AC_BEFORE([GP_SET_REMOVE], [$0])dnl +AC_BEFORE([GP_SET_EMPTY_IFELSE], [$0])dnl +AC_BEFORE([GP_SET_EQUAL_IFELSE], [$0])dnl +AC_BEFORE([GP_SET_CONTAINS_IFELSE], [$0])dnl +AC_BEFORE([GP_SET_DEBUG_VAR], [$0])dnl +AC_BEFORE([GP_SET_SPACE_VAR], [$0])dnl +dnl +dnl GP_SET_DUMP_ALL()dnl +dnl +dnl m4_set_foreach([gp_set_all_sets], [set_name], [dnl +dnl AS_ECHO(["Set defined somewhere: set_name"]) +dnl ])dnl +dnl +[rm -f]m4_set_foreach([gp_set_all_sets], [setname], + [ "_GP_SET_FILENAME(setname)"])dnl +])dnl +dnl +dnl +dnl ###################################################################### +dnl GP_SET_TESTSUITE() +dnl Does a number of tests for the GP_SET_* macros. +dnl +dnl Should be mostly useful while debugging gp-set.m4 itself. +dnl ###################################################################### +AC_DEFUN([GP_SET_TESTSUITE], [dnl +# BEGIN $0 +_GP_SET_INIT + +GP_SET_DEFINE([foo]) +GP_SET_DEFINE([bar]) +GP_SET_DEFINE([foobar]) +GP_SET_DEFINE([everything]) + +GP_SET_DEBUG_MSG([foo]) + +GP_SET_DEFINE([bax]) +GP_SET_UNDEFINE([bax]) + +GP_SET_UNDEFINE([bar]) +GP_SET_DEFINE([bar]) + +dnl GP_SET_ADD([moo], [meh]) +GP_SET_ADD_ALL([everything], [foo], [bar], [bar ], [bla]) + +GP_SET_DUMP_ALL + +m4_set_add_all([m4testset], [a], [b c], [d e], [f], [g]) +AC_MSG_CHECKING([for value of m4 testset]) +AC_MSG_RESULT([m4_set_contents([m4testset], [, ])]) + +GP_SET_ADD_ALL([everything]m4_set_listc([m4testset])) + +GP_SET_DUMP_ALL + +GP_SET_ADD([foo], [barfoo]) +GP_SET_ADD([foo], [foobar]) +GP_SET_ADD([foo], [fox]) +GP_SET_ADD([foo], [fux]) +GP_SET_ADD([foo], [fox]) +GP_SET_ADD([foo], []) +GP_SET_ADD([foo], [fox]) +GP_SET_ADD([foo], [barfoo]) +GP_SET_ADD([foo], [ barfoo]) +GP_SET_ADD([foo], ["barfoo "]) +GP_SET_ADD([foo], []) +GP_SET_REMOVE([foo], [fox]) +GP_SET_ADD([foo], [barfoo]) + +GP_SET_ADD([foobar], [bar]) +GP_SET_ADD([foobar], [foobar]) +GP_SET_ADD([foobar], [barfoo]) + +GP_SET_DEBUG_MSG([foo]) + +GP_SET_MSG([bar]) +GP_SET_MSG([foo]) +GP_SET_MSG([foobar]) +GP_SET_MSG([everything]) + +GP_SET_DEFINE([union]) +GP_SET_UNION([union], [foo], [bar], [foobar]) +AC_MSG_CHECKING([value of union of foo bar foobar]) +GP_SET_MSG_RESULT([union]) + +GP_SET_DEFINE([difference]) +GP_SET_DIFFERENCE([difference], [foo], [bar], [foobar]) +GP_SET_MSG([difference]) + +AC_MSG_CHECKING([whether sets foo and bar are equal]) +GP_SET_EQUAL_IFELSE([foo], [bar], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) + +AC_MSG_CHECKING([whether set foo is empty]) +GP_SET_EMPTY_IFELSE([foo], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) + +AC_MSG_CHECKING([whether set bar is empty]) +GP_SET_EMPTY_IFELSE([bar], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) + +AC_MSG_CHECKING([whether set foo contains element bar]) +GP_SET_CONTAINS_IFELSE([foo], [bar], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) + +AC_MSG_CHECKING([whether set foobar contains element bar]) +GP_SET_CONTAINS_IFELSE([foobar], [bar], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) + +GP_SET_FOREACH([foobar], [gp_set_var], [dnl + AC_MSG_CHECKING([foobar element]) + AC_MSG_RESULT([${gp_set_var}]) +])dnl +GP_SET_FOREACH([foobar], [gp_set_var], [dnl + AS_ECHO([" * element ${gp_set_var}"]) +])dnl +GP_SET_FOREACH([foobar], [gp_set_var], [echo " * ELEMENT ${gp_set_var}"])dnl +AS_ECHO(["Moo."]) + +GP_SET_DUMP_ALL +# END $0 +])dnl +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-sleep.m4 b/libgphoto2_port/gphoto-m4/gp-sleep.m4 new file mode 100644 index 0000000000..2c40148924 --- /dev/null +++ b/libgphoto2_port/gphoto-m4/gp-sleep.m4 @@ -0,0 +1,28 @@ +dnl #################################################################### +dnl GP_SLEEP(delay_in_whole_seconds) +dnl If the SLEEP variable is set to "no" or empty or is unset, +dnl do not sleep. +dnl If the SLEEP variable is set to something else, run that something +dnl else with the given delay value. +dnl #################################################################### +AC_DEFUN_ONCE([_GP_SLEEP_INIT], [dnl +AC_REQUIRE([GP_PROG_SLEEP])dnl +AS_IF([test "x$SLEEP" != "x" && test "x$SLEEP" != "xno"], [dnl +gp_sleep=[$]SLEEP +], [dnl +gp_sleep=: +]) +])dnl +dnl +dnl +AC_DEFUN([GP_SLEEP], [dnl +AC_REQUIRE([_GP_SLEEP_INIT])dnl +$gp_sleep $1 +])dnl +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: From 7307300111ebbb41ac27b034a00449a49b068f8f Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Fri, 22 Oct 2021 04:19:03 +0200 Subject: [PATCH 16/37] Only use a single gphoto-m4/ subdir Only use a single gphoto-m4/ subdir - namely that in libgphoto2_port/gphoto-m4/. This prevents us from needing to synchronize the *.m4 files. We can do that by switching from recursive make for the gphoto-m4 subdirectories to using include path/to/gphoto-m4/Makefile-files from both the top-level Makefile.am and libgphoto2_port/Makefile.am using %reldir% (introduced in automake 1.14). --- Makefile.am | 10 +- configure.ac | 1 - gphoto-m4/Makefile-files | 34 -- gphoto-m4/Makefile.am | 7 - gphoto-m4/README.md | 140 ----- gphoto-m4/gp-byteorder.m4 | 450 -------------- gphoto-m4/gp-camlibs.m4 | 488 --------------- gphoto-m4/gp-check-doxygen.m4 | 21 - gphoto-m4/gp-check-library.m4 | 463 --------------- gphoto-m4/gp-check-popt.m4 | 241 -------- gphoto-m4/gp-check-shell-environment.m4 | 48 -- gphoto-m4/gp-config-msg.m4 | 102 ---- gphoto-m4/gp-documentation.m4 | 113 ---- gphoto-m4/gp-driverdir.m4 | 79 --- gphoto-m4/gp-gettext-hack.m4 | 82 --- gphoto-m4/gp-internal-docs.m4 | 29 - gphoto-m4/gp-libjpeg.m4 | 139 ----- gphoto-m4/gp-libltdl.m4 | 118 ---- gphoto-m4/gp-manual-docbook-xml.m4 | 46 -- gphoto-m4/gp-manual-documentation.m4 | 329 ----------- gphoto-m4/gp-manual-fig2dev.m4 | 40 -- gphoto-m4/gp-manual-graphviz.m4 | 49 -- gphoto-m4/gp-manual-gtk-doc.m4 | 24 - gphoto-m4/gp-manual-pstoimg.m4 | 36 -- gphoto-m4/gp-manual-w3m.m4 | 45 -- gphoto-m4/gp-packaging.m4 | 59 -- gphoto-m4/gp-pedantic-compiler-flags.m4 | 131 ----- gphoto-m4/gp-progs.m4 | 114 ---- gphoto-m4/gp-references.m4 | 48 -- gphoto-m4/gp-set.m4 | 753 ------------------------ gphoto-m4/gp-sleep.m4 | 28 - gphoto-m4/gp-subpackage.m4 | 5 - gphoto-m4/gp-udev.m4 | 9 - gphoto-m4/gp-va-copy.m4 | 57 -- gphoto-m4/gphoto-m4-sync | 551 ----------------- libgphoto2_port/Makefile.am | 4 +- libgphoto2_port/configure.ac | 1 - 37 files changed, 9 insertions(+), 4885 deletions(-) delete mode 100644 gphoto-m4/Makefile-files delete mode 100644 gphoto-m4/Makefile.am delete mode 100644 gphoto-m4/README.md delete mode 100644 gphoto-m4/gp-byteorder.m4 delete mode 100644 gphoto-m4/gp-camlibs.m4 delete mode 100644 gphoto-m4/gp-check-doxygen.m4 delete mode 100644 gphoto-m4/gp-check-library.m4 delete mode 100644 gphoto-m4/gp-check-popt.m4 delete mode 100644 gphoto-m4/gp-check-shell-environment.m4 delete mode 100644 gphoto-m4/gp-config-msg.m4 delete mode 100644 gphoto-m4/gp-documentation.m4 delete mode 100644 gphoto-m4/gp-driverdir.m4 delete mode 100644 gphoto-m4/gp-gettext-hack.m4 delete mode 100644 gphoto-m4/gp-internal-docs.m4 delete mode 100644 gphoto-m4/gp-libjpeg.m4 delete mode 100644 gphoto-m4/gp-libltdl.m4 delete mode 100644 gphoto-m4/gp-manual-docbook-xml.m4 delete mode 100644 gphoto-m4/gp-manual-documentation.m4 delete mode 100644 gphoto-m4/gp-manual-fig2dev.m4 delete mode 100644 gphoto-m4/gp-manual-graphviz.m4 delete mode 100644 gphoto-m4/gp-manual-gtk-doc.m4 delete mode 100644 gphoto-m4/gp-manual-pstoimg.m4 delete mode 100644 gphoto-m4/gp-manual-w3m.m4 delete mode 100644 gphoto-m4/gp-packaging.m4 delete mode 100644 gphoto-m4/gp-pedantic-compiler-flags.m4 delete mode 100644 gphoto-m4/gp-progs.m4 delete mode 100644 gphoto-m4/gp-references.m4 delete mode 100644 gphoto-m4/gp-set.m4 delete mode 100644 gphoto-m4/gp-sleep.m4 delete mode 100644 gphoto-m4/gp-subpackage.m4 delete mode 100644 gphoto-m4/gp-udev.m4 delete mode 100644 gphoto-m4/gp-va-copy.m4 delete mode 100755 gphoto-m4/gphoto-m4-sync diff --git a/Makefile.am b/Makefile.am index b0ccbe075e..52050e2c58 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,8 +8,8 @@ bin_SCRIPTS = gphoto2-config EXTRA_DIST = MAINTAINERS TESTERS installcheck.mk EXTRA_DIST += HACKING.md SECURITY.md -# Note: @subdirs@ lists all the directories from AC_CONFIG_SUBDIRS() -SUBDIRS = @subdirs@ libgphoto2 camlibs tests examples po packaging doc gphoto-m4 +# Note: $(subdirs) lists all the directories from AC_CONFIG_SUBDIRS() +SUBDIRS = $(subdirs) libgphoto2 camlibs tests examples po packaging doc EXTRA_DIST += libgphoto2.pc.in pkgconfig_DATA = libgphoto2.pc @@ -106,7 +106,9 @@ update-po: ######################################################################## # The following default options for aclocal and automake -# are required in the top level Makefile.am for the automatic +# are required in the top level Makefile.am for the automatic # re-building of the build system files. -ACLOCAL_AMFLAGS = -I auto-m4 -I gphoto-m4 +ACLOCAL_AMFLAGS = -I auto-m4 -I libgphoto2_port/gphoto-m4 + +include libgphoto2_port/gphoto-m4/Makefile-files diff --git a/configure.ac b/configure.ac index d68277f248..115cc9f1d8 100644 --- a/configure.ac +++ b/configure.ac @@ -665,7 +665,6 @@ AC_CONFIG_FILES([ camlibs/Makefile camlibs/canon/doc/Makefile camlibs/konica/localization/Makefile - gphoto-m4/Makefile libgphoto2/Makefile libgphoto2.pc libgphoto2-uninstalled.pc diff --git a/gphoto-m4/Makefile-files b/gphoto-m4/Makefile-files deleted file mode 100644 index 2ae6002e22..0000000000 --- a/gphoto-m4/Makefile-files +++ /dev/null @@ -1,34 +0,0 @@ -# -*- Makefile -*- - -EXTRA_DIST += %reldir%/README.md -EXTRA_DIST += %reldir%/gphoto-m4-sync - -EXTRA_DIST += %reldir%/gp-byteorder.m4 -EXTRA_DIST += %reldir%/gp-camlibs.m4 -EXTRA_DIST += %reldir%/gp-check-doxygen.m4 -EXTRA_DIST += %reldir%/gp-check-library.m4 -EXTRA_DIST += %reldir%/gp-check-popt.m4 -EXTRA_DIST += %reldir%/gp-check-shell-environment.m4 -EXTRA_DIST += %reldir%/gp-config-msg.m4 -EXTRA_DIST += %reldir%/gp-documentation.m4 -EXTRA_DIST += %reldir%/gp-driverdir.m4 -EXTRA_DIST += %reldir%/gp-gettext-hack.m4 -EXTRA_DIST += %reldir%/gp-internal-docs.m4 -EXTRA_DIST += %reldir%/gp-libjpeg.m4 -EXTRA_DIST += %reldir%/gp-libltdl.m4 -EXTRA_DIST += %reldir%/gp-manual-docbook-xml.m4 -EXTRA_DIST += %reldir%/gp-manual-documentation.m4 -EXTRA_DIST += %reldir%/gp-manual-fig2dev.m4 -EXTRA_DIST += %reldir%/gp-manual-graphviz.m4 -EXTRA_DIST += %reldir%/gp-manual-gtk-doc.m4 -EXTRA_DIST += %reldir%/gp-manual-pstoimg.m4 -EXTRA_DIST += %reldir%/gp-manual-w3m.m4 -EXTRA_DIST += %reldir%/gp-packaging.m4 -EXTRA_DIST += %reldir%/gp-pedantic-compiler-flags.m4 -EXTRA_DIST += %reldir%/gp-progs.m4 -EXTRA_DIST += %reldir%/gp-references.m4 -EXTRA_DIST += %reldir%/gp-set.m4 -EXTRA_DIST += %reldir%/gp-sleep.m4 -EXTRA_DIST += %reldir%/gp-subpackage.m4 -EXTRA_DIST += %reldir%/gp-udev.m4 -EXTRA_DIST += %reldir%/gp-va-copy.m4 diff --git a/gphoto-m4/Makefile.am b/gphoto-m4/Makefile.am deleted file mode 100644 index b69097e769..0000000000 --- a/gphoto-m4/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -# This is the compatibility Makefile.am - you are probably better off -# just including the Makefile-files directly from your top-level -# Makefile.am. - -EXTRA_DIST = - -include Makefile-files diff --git a/gphoto-m4/README.md b/gphoto-m4/README.md deleted file mode 100644 index b756b23fd8..0000000000 --- a/gphoto-m4/README.md +++ /dev/null @@ -1,140 +0,0 @@ -gphoto-m4 -========= - -`gphoto-m4` is the gPhoto projects' collection of m4 macros for use -with the autoconf/automake based build systems. - -It has been designed to be used in - - * `gphoto2` - * `libgphoto2` - * `libgphoto2_port` (located in `libgphoto2/`) - * `gtkam` - -Some macros are re-used ones from `libexif`. - -Since the gPhoto project moved from SVN to git, we have not figured -out yet how to properly include the `gphoto-m4` files into the -respective software's `gphoto-m4/` subdirectory (either `git subtree` -or `git submodule` come to mind). - -So for the time being, we manually update and synchronize the files. - - -Use of `gphoto-m4` after the switch to git from SVN ---------------------------------------------------- - -Since the gPhoto project moved from SVN to git, we have not figured -out yet how to properly include the `gphoto-m4` files into the -respective software's `gphoto-m4/` subdirectory. The options are: - - 1. Manually update (and hopefully synchronize) the files. - - Advantages: - - * No special commands needed for users or developers. - - Disadvantages: - - * The manual work for the maintainers is exhausting and error - prone. - - 2. Use `git submodule`. - - Advantages: - - * Defined mechanism for syncing and updating the `gphoto-m4/*` - files. - - Disadvantages: - - * Requires special git commands from everybody (users, - developers, and maintainers) all the time (e.g. `git clone - --recursive` instead of `git clone`). - - This is the showstopper for `git submodule`. - - 3. Use `git subtree`. - - Advantages: - - * Defined mechanism for syncing and updating the `gphoto-m4/*` - files. - - * Requires no special git commands from users or developers. - - * Not even people actually messing with the files in - `gphoto-m4/*` strictly need special commands. - - Only the maintainers who do the syncing and updating of the - `gphoto-m4/*` files need the special commands. - - Disadvantages: - - * Requires special knowledge of special commands instead of - just copying files around. The concept is less complex than - copying files round, but it does require special commands. - - * No rebasing possible across pulls to `gphoto-m4/`. Not really - necessary anyway, though. - - * Pushes of changes to from, say, `gphoto2/gphoto-m4` to - upstream `gphoto-m4` create a lot of commit history noise in - the `gphoto-m4` repository by including the complete history - of the `gphoto2` repository. - - Note this cannot be avoided by using `git subtree split`: - That is executed internally by `git subtree push`. - - So it appears that using `git subtree push` will push all - projects' commit history into the `gphoto-m4` repo. - - That is if not a showstopper, then at least very ugly. - -For the time being, we manually update and synchronize the files. - - -Manually syncing and updating files ------------------------------------ - -This section has not been written yet. - - -Using `git submodule` ---------------------- - -This section has not been written yet. - - -Using `git subtree` -------------------- - - -### Using `gphoto-m4` as git subtree ### - -This section describes how to use `gphoto-m4` when it has been set up -as a `git subtree` (e.g. in `gphoto2` and `libgphoto2`). - -Add a remote for `gphoto-m4`: - - git remote add origin-gphoto-m4 git@github.com:gphoto/gphoto-m4.git - -Pull changes to origin-gphoto-m4 into local `gphoto-m4`: - - git subtree pull --prefix gphoto-m4 origin-gphoto-m4 master --squash - -Now we can push local changes to 'gphoto-m4/*' back to -`origin-gphoto-m4` as follows: - - git subtree push --prefix gphoto-m4 origin-gphoto-m4 master - -FIXME: Add more typical uses cases. - - -### Setting up `gphoto-m4` as git subtree ### - -This section describes how we initially set up `gphoto-m4` as a git -subtree for `gphoto2`. This is only required once by one person, then -never needs to be done by anybody else ever again. - - git subtree add --prefix gphoto-m4 origin-gphoto-m4 master --squash diff --git a/gphoto-m4/gp-byteorder.m4 b/gphoto-m4/gp-byteorder.m4 deleted file mode 100644 index 95d7435bf3..0000000000 --- a/gphoto-m4/gp-byteorder.m4 +++ /dev/null @@ -1,450 +0,0 @@ -dnl AC_NEED_BYTEORDER_H ( HEADER-TO-GENERATE ) -dnl Originally written by Dan Fandrich -dnl My contribution is hereby placed into the public domain. -dnl No warranty is expressed or implied. -dnl -dnl Create a header file that guarantees that byte swapping macros of the -dnl ntohl variety as well as the extended types included in OpenBSD and -dnl NetBSD such as le32toh are defined. If possible, the standard ntohl -dnl are overloaded as they are optimized for the given platform, but when -dnl this is not possible (e.g. on a big-endian machine) they are defined -dnl in this file. - -dnl Look for a symbol in a header file -dnl AC_HAVE_SYMBOL ( IDENTIFIER, HEADER-FILE, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND ) -AC_DEFUN([AC_HAVE_SYMBOL], -[ -AC_MSG_CHECKING(for $1 in $2) -AC_EGREP_CPP([symbol is present|\<$1\>],[ -#include <$2> -#ifdef $1 - symbol is present -#endif - ], -[AC_MSG_RESULT(yes) -$3 -], -[AC_MSG_RESULT(no) -$4 -])]) - - -dnl Create a header file that defines extended byte swapping macros -AC_DEFUN([AC_NEED_BYTEORDER_H], -[ -ac_dir=`AS_DIRNAME(["$1"])` -if test "$ac_dir" != "$1" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && AS_MKDIR_P(["$ac_dir"]) -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 - effective_target="$host" -fi -AC_SUBST(effective_target) - -cat > "$1" << EOF -/* This file is generated automatically by configure */ -/* It is valid only for the system type ${effective_target} */ - -#ifndef __BYTEORDER_H -#define __BYTEORDER_H - -EOF - -dnl First, do an endian check -AC_C_BIGENDIAN - -dnl Look for NetBSD-style extended byte swapping macros -AC_HAVE_SYMBOL(le32toh,machine/endian.h, - [HAVE_LE32TOH=1 - cat >> "$1" << EOF -/* extended byte swapping macros are already available */ -#include - -EOF], - -[ - -dnl Look for standard byte swapping macros -AC_HAVE_SYMBOL(ntohl,arpa/inet.h, - [cat >> "$1" << EOF -/* ntohl and relatives live here */ -#include -#define __HAVE_NTOHL - -EOF], - - [AC_HAVE_SYMBOL(ntohl,netinet/in.h, - [cat >> "$1" << EOF -/* ntohl and relatives live here */ -#include -#define __HAVE_NTOHL - -EOF],true)]) -]) - -dnl Look for generic byte swapping macros - -dnl OpenBSD -AC_HAVE_SYMBOL(swap32,machine/endian.h, - [cat >> "$1" << EOF -/* swap32 and swap16 are defined in machine/endian.h */ - -EOF], - - [ -dnl Linux GLIBC - AC_HAVE_SYMBOL(bswap_32,byteswap.h, - [cat >> "$1" << EOF -/* Define generic byte swapping functions */ -#include -#define swap16(x) bswap_16(x) -#define swap32(x) bswap_32(x) -#define swap64(x) bswap_64(x) - -EOF], - - [ -dnl NetBSD - AC_HAVE_SYMBOL(bswap32,machine/endian.h, - dnl We're already including machine/endian.h if this test succeeds - [cat >> "$1" << EOF -/* Define generic byte swapping functions */ -EOF - if test "$HAVE_LE32TOH" != "1"; then - echo '#include '>> "$1" - fi -cat >> "$1" << EOF -#define swap16(x) bswap16(x) -#define swap32(x) bswap32(x) -#define swap64(x) bswap64(x) - -EOF], - - [ -dnl FreeBSD - AC_HAVE_SYMBOL(__byte_swap_long,sys/types.h, - [cat >> "$1" << EOF -/* Define generic byte swapping functions */ -#include -#define swap16(x) __byte_swap_word(x) -#define swap32(x) __byte_swap_long(x) -/* No optimized 64 bit byte swapping macro is available */ -#define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\ - ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\ - ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\ - ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\ - ((x) >> 8) & 0x00000000ff000000ULL | \\ - ((x) >> 24) & 0x0000000000ff0000ULL | \\ - ((x) >> 40) & 0x000000000000ff00ULL | \\ - ((x) >> 56) & 0x00000000000000ffULL)) - -EOF], - - [ -dnl OS X - AC_HAVE_SYMBOL(NXSwapLong,machine/byte_order.h, - [cat >> "$1" << EOF -/* Define generic byte swapping functions */ -#include -#define swap16(x) NXSwapShort(x) -#define swap32(x) NXSwapLong(x) -#define swap64(x) NXSwapLongLong(x) - -EOF], - [ - if test $ac_cv_c_bigendian = yes; then - cat >> "$1" << EOF -/* No other byte swapping functions are available on this big-endian system */ -#define swap16(x) ((uint16_t)(((x) << 8) | ((uint16_t)(x) >> 8))) -#define swap32(x) ((uint32_t)(((uint32_t)(x) << 24) & 0xff000000UL | \\ - ((uint32_t)(x) << 8) & 0x00ff0000UL | \\ - ((x) >> 8) & 0x0000ff00UL | \\ - ((x) >> 24) & 0x000000ffUL)) -#define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\ - ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\ - ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\ - ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\ - ((x) >> 8) & 0x00000000ff000000ULL | \\ - ((x) >> 24) & 0x0000000000ff0000ULL | \\ - ((x) >> 40) & 0x000000000000ff00ULL | \\ - ((x) >> 56) & 0x00000000000000ffULL)) - -EOF - else - cat >> "$1" << EOF -/* Use these as generic byteswapping macros on this little endian system */ -/* on windows we might not have ntohs / ntohl without including winsock.dll, - * so use generic macros */ -#ifdef __HAVE_NTOHL -# define swap16(x) htons(x) -# define swap32(x) htonl(x) -#else -# define swap16(x) ((uint16_t)(((x) << 8) | ((uint16_t)(x) >> 8))) -# define swap32(x) ((uint32_t)((((uint32_t)(x) << 24) & 0xff000000UL) | \\ - (((uint32_t)(x) << 8) & 0x00ff0000UL) | \\ - (((x) >> 8) & 0x0000ff00UL) | \\ - (((x) >> 24) & 0x000000ffUL))) -#endif -/* No optimized 64 bit byte swapping macro is available */ -#define swap64(x) ((uint64_t)((((uint64_t)(x) << 56) & 0xff00000000000000ULL) | \\ - (((uint64_t)(x) << 40) & 0x00ff000000000000ULL) | \\ - (((uint64_t)(x) << 24) & 0x0000ff0000000000ULL) | \\ - (((uint64_t)(x) << 8) & 0x000000ff00000000ULL) | \\ - (((x) >> 8) & 0x00000000ff000000ULL) | \\ - (((x) >> 24) & 0x0000000000ff0000ULL) | \\ - (((x) >> 40) & 0x000000000000ff00ULL) | \\ - (((x) >> 56) & 0x00000000000000ffULL))) - -EOF - fi -]) - ]) - ]) - ]) -]) - - -[ -if test "$HAVE_LE32TOH" != "1"; then - cat >> "$1" << EOF -/* The byte swapping macros have the form: */ -/* EENN[a]toh or htoEENN[a] where EE is be (big endian) or */ -/* le (little-endian), NN is 16 or 32 (number of bits) and a, */ -/* if present, indicates that the endian side is a pointer to an */ -/* array of uint8_t bytes instead of an integer of the specified length. */ -/* h refers to the host's ordering method. */ - -/* So, to convert a 32-bit integer stored in a buffer in little-endian */ -/* format into a uint32_t usable on this machine, you could use: */ -/* uint32_t value = le32atoh(&buf[3]); */ -/* To put that value back into the buffer, you could use: */ -/* htole32a(&buf[3], value); */ - -/* Define aliases for the standard byte swapping macros */ -/* Arguments to these macros must be properly aligned on natural word */ -/* boundaries in order to work properly on all architectures */ -#ifndef htobe16 -# ifdef __HAVE_NTOHL -# define htobe16(x) htons(x) -# else -# ifdef WORDS_BIGENDIAN -# define htobe16(x) (x) -# else -# define htobe16(x) swap16(x) -# endif -# endif -#endif -#ifndef htobe32 -# ifdef __HAVE_NTOHL -# define htobe32(x) htonl(x) -# else -# ifdef WORDS_BIGENDIAN -# define htobe32(x) (x) -# else -# define htobe32(x) swap32(x) -# endif -# endif -#endif -#ifndef be16toh -# define be16toh(x) htobe16(x) -#endif -#ifndef be32toh -# define be32toh(x) htobe32(x) -#endif - -#define HTOBE16(x) (x) = htobe16(x) -#define HTOBE32(x) (x) = htobe32(x) -#define BE32TOH(x) (x) = be32toh(x) -#define BE16TOH(x) (x) = be16toh(x) - -EOF - - if test $ac_cv_c_bigendian = yes; then - cat >> "$1" << EOF -/* Define our own extended byte swapping macros for big-endian machines */ -#ifndef htole16 -# define htole16(x) swap16(x) -#endif -#ifndef htole32 -# define htole32(x) swap32(x) -#endif -#ifndef htole64 -# define htole64(x) swap64(x) -#endif -#ifndef le16toh -# define le16toh(x) swap16(x) -#endif -#ifndef le32toh -# define le32toh(x) swap32(x) -#endif -#ifndef le64toh -# define le64toh(x) swap64(x) -#endif - -#ifndef htobe64 -# define htobe64(x) (x) -#endif -#ifndef be64toh -# define be64toh(x) (x) -#endif - -#define HTOLE16(x) (x) = htole16(x) -#define HTOLE32(x) (x) = htole32(x) -#define HTOLE64(x) (x) = htole64(x) -#define LE16TOH(x) (x) = le16toh(x) -#define LE32TOH(x) (x) = le32toh(x) -#define LE64TOH(x) (x) = le64toh(x) - -#define HTOBE64(x) (void) (x) -#define BE64TOH(x) (void) (x) - -EOF - else - cat >> "$1" << EOF -/* On little endian machines, these macros are null */ -#ifndef htole16 -# define htole16(x) (x) -#endif -#ifndef htole32 -# define htole32(x) (x) -#endif -#ifndef htole64 -# define htole64(x) (x) -#endif -#ifndef le16toh -# define le16toh(x) (x) -#endif -#ifndef le32toh -# define le32toh(x) (x) -#endif -#ifndef le64toh -# define le64toh(x) (x) -#endif - -#define HTOLE16(x) (void) (x) -#define HTOLE32(x) (void) (x) -#define HTOLE64(x) (void) (x) -#define LE16TOH(x) (void) (x) -#define LE32TOH(x) (void) (x) -#define LE64TOH(x) (void) (x) - -/* These don't have standard aliases */ -#ifndef htobe64 -# define htobe64(x) swap64(x) -#endif -#ifndef be64toh -# define be64toh(x) swap64(x) -#endif - -#define HTOBE64(x) (x) = htobe64(x) -#define BE64TOH(x) (x) = be64toh(x) - -EOF - fi -fi - -cat >> "$1" << EOF -/* Define the C99 standard length-specific integer types */ -#include - -EOF - -case "${effective_target}" in - i[3456]86-*) - cat >> "$1" << EOF -/* Here are some macros to create integers from a byte array */ -/* These are used to get and put integers from/into a uint8_t array */ -/* with a specific endianness. This is the most portable way to generate */ -/* and read messages to a network or serial device. Each member of a */ -/* packet structure must be handled separately. */ - -/* The i386 and compatibles can handle unaligned memory access, */ -/* so use the optimized macros above to do this job */ -#ifndef be16atoh -# define be16atoh(x) be16toh(*(uint16_t*)(x)) -#endif -#ifndef be32atoh -# define be32atoh(x) be32toh(*(uint32_t*)(x)) -#endif -#ifndef be64atoh -# define be64atoh(x) be64toh(*(uint64_t*)(x)) -#endif -#ifndef le16atoh -# define le16atoh(x) le16toh(*(uint16_t*)(x)) -#endif -#ifndef le32atoh -# define le32atoh(x) le32toh(*(uint32_t*)(x)) -#endif -#ifndef le64atoh -# define le64atoh(x) le64toh(*(uint64_t*)(x)) -#endif - -#ifndef htob16a -# define htobe16a(a,x) *(uint16_t*)(a) = htobe16(x) -#endif -#ifndef htobe32a -# define htobe32a(a,x) *(uint32_t*)(a) = htobe32(x) -#endif -#ifndef htobe64a -# define htobe64a(a,x) *(uint64_t*)(a) = htobe64(x) -#endif -#ifndef htole16a -# define htole16a(a,x) *(uint16_t*)(a) = htole16(x) -#endif -#ifndef htole32a -# define htole32a(a,x) *(uint32_t*)(a) = htole32(x) -#endif -#ifndef htole64a -# define htole64a(a,x) *(uint64_t*)(a) = htole64(x) -#endif - -EOF - ;; - - *) - cat >> "$1" << EOF -/* Here are some macros to create integers from a byte array */ -/* These are used to get and put integers from/into a uint8_t array */ -/* with a specific endianness. This is the most portable way to generate */ -/* and read messages to a network or serial device. Each member of a */ -/* packet structure must be handled separately. */ - -/* Non-optimized but portable macros */ -#define be16atoh(x) ((uint16_t)(((x)[0]<<8)|(x)[1])) -#define be32atoh(x) ((uint32_t)(((x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3])) -#define be64atoh_x(x,off,shift) (((uint64_t)((x)[off]))<>8), (a)[1]=(uint8_t)(x) -#define htobe32a(a,x) (a)[0]=(uint8_t)((x)>>24), (a)[1]=(uint8_t)((x)>>16), \\ - (a)[2]=(uint8_t)((x)>>8), (a)[3]=(uint8_t)(x) -#define htobe64a(a,x) (a)[0]=(uint8_t)((x)>>56), (a)[1]=(uint8_t)((x)>>48), \\ - (a)[2]=(uint8_t)((x)>>40), (a)[3]=(uint8_t)((x)>>32), \\ - (a)[4]=(uint8_t)((x)>>24), (a)[5]=(uint8_t)((x)>>16), \\ - (a)[6]=(uint8_t)((x)>>8), (a)[7]=(uint8_t)(x) -#define htole16a(a,x) (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) -#define htole32a(a,x) (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\ - (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) -#define htole64a(a,x) (a)[7]=(uint8_t)((x)>>56), (a)[6]=(uint8_t)((x)>>48), \\ - (a)[5]=(uint8_t)((x)>>40), (a)[4]=(uint8_t)((x)>>32), \\ - (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\ - (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) - -EOF - ;; -esac -] - -cat >> "$1" << EOF -#endif /*__BYTEORDER_H*/ -EOF]) diff --git a/gphoto-m4/gp-camlibs.m4 b/gphoto-m4/gp-camlibs.m4 deleted file mode 100644 index a6b14ac189..0000000000 --- a/gphoto-m4/gp-camlibs.m4 +++ /dev/null @@ -1,488 +0,0 @@ -dnl #################################################################### -dnl -dnl GP_CAMLIB & Co. -dnl -dnl #################################################################### -dnl -dnl Redundancy free definition of libgphoto2 camlibs. -dnl -dnl Removes the redundancy from the camlib lists, and executes -dnl additional consistency checks on the build system. -dnl -dnl Every camlib belongs to one of the following (disjunct) sets of -dnl camlibs: -dnl -dnl * the 'standard' set -dnl -dnl The set of camlibs which is most likely to support the most -dnl cameras. This is the default when --with-camlibs=... is not -dnl given. This used to be called 'all', even though it -dnl definitively does not comprise all camlibs. -dnl -dnl * the 'outdated' set -dnl -dnl These cameras are outdated in some way. The cameras may have -dnl fallen out of use, the camlib might have been superseded by -dnl another one, or other reasons. Not built by default. -dnl -dnl * the 'unlisted' set -dnl -dnl These camlibs will not be listed by './configure --help', but -dnl they can still be added to the set of camlibs to be built. -dnl -dnl Example usage: -dnl -dnl GP_CAMLIB([canon]) -dnl GP_CAMLIB([casio]) -dnl [...] -dnl AM_COND_IF([HAVE_LIBCURL], [dnl -dnl AM_COND_IF([HAVE_LIBXML2], [dnl -dnl GP_CAMLIB([lumix])dnl -dnl ]) -dnl ]) -dnl [...] -dnl GP_CAMLIB([ptp],[unlisted]) -dnl GP_CAMLIB([ptp2]) -dnl [...] -dnl GP_CAMLIB([toshiba]) -dnl GP_CAMLIBS_DEFINE() -dnl -dnl -dnl #################################################################### -dnl Implementation remarks -dnl #################################################################### -dnl -dnl Note that at this time, the set names are hard coded, but could be -dnl moved to a m4 time automatic set of set names at a later time. -dnl -dnl A few notes on macro and variable naming: -dnl -dnl * GP_* are the macros to be called from configure.ac -dnl * GP_CAMLIBS_* are also shell variables exported to configure.ac -dnl shell code and Makefile.am files -dnl * gp_m4_* are the macros used inside those macros as m4 variables -dnl * gp_sh_* are the shell variables used inside the GP_ shell code -dnl * The old, inconsistent names of the as untouched variables -dnl exported to configure.ac and Makefile.am are still inconsistent. -dnl -dnl -dnl #################################################################### -dnl Forbid everything first, allow specific variable names later -dnl #################################################################### -m4_pattern_forbid([GP_CAMLIBS_])dnl -m4_pattern_forbid([GP_CAMLIB_])dnl -dnl -dnl -dnl #################################################################### -dnl _GP_CAMLIBS_INIT -dnl Called internally when required. -dnl #################################################################### -AC_DEFUN_ONCE([_GP_CAMLIBS_INIT],[dnl -dnl # BEGIN $0($@) -AC_BEFORE([$0],[GP_CAMLIB])dnl -AC_REQUIRE([AC_PROG_GREP])dnl -AC_REQUIRE([AC_PROG_SED])dnl -AC_REQUIRE([GP_PROG_CMP])dnl -AC_REQUIRE([GP_PROG_SORT])dnl -AC_REQUIRE([GP_PROG_TR])dnl -AC_REQUIRE([GP_PROG_UNIQ])dnl -m4_foreach_w([var], [everything standard unlisted outdated], [dnl - m4_set_empty([gp_m4s_camlib_set_]var, [], [dnl - m4_errprintn([Error: non-empty set gp_m4s_camlib_set_]var[ already defined])dnl - m4_exit(1)dnl - ])dnl -])dnl -GP_SET_DEFINE([camlib-set-standard])dnl -GP_SET_DEFINE([camlib-set-unlisted])dnl -GP_SET_DEFINE([camlib-set-outdated])dnl -dnl # END $0($@) -])dnl -dnl -dnl -dnl #################################################################### -dnl GP_CAMLIB([mycamlib]) -dnl GP_CAMLIB([mycamlib], [outdated]) -dnl Add the camlib 'mycamlib' to the "standard" set of camlibs or -dnl the "outdated" set of camlibs, respectively. -dnl #################################################################### -m4_pattern_forbid([GP_CAMLIB])dnl -AC_DEFUN([GP_CAMLIB],[dnl -dnl # BEGIN $0($@) -AC_REQUIRE([_GP_CAMLIBS_INIT])dnl -AC_BEFORE([$0],[GP_CAMLIBS_DEFINE])dnl -m4_case([$#],[2],[dnl - m4_case([$2], [unlisted], [dnl - GP_SET_ADD([camlib-set-unlisted], [$1]) - m4_set_add([gp_m4s_camlib_set_unlisted], [$1])dnl - ], [outdated], [dnl - GP_SET_ADD([camlib-set-outdated], [$1]) - m4_set_add([gp_m4s_camlib_set_outdated], [$1])dnl - ], [dnl - m4_errprintn(__file__:__line__:[ Error: Wrong second argument to GP_CAMLIB])dnl - m4_exit(1)dnl - ])dnl -], [1], [dnl - GP_SET_ADD([camlib-set-standard], [$1]) - m4_set_add([gp_m4s_camlib_set_standard], [$1])dnl -], [dnl - m4_errprintn(__file__:__line__:[ Error: Wrong number of arguments to GP_CAMLIB])dnl - m4_exit(1)dnl -])dnl m4_case $# -m4_set_add([gp_m4s_camlib_set_everything], [$1], [], [dnl -m4_errprintn(__file__:__line__:[Duplicate declaration of camlib $1])dnl -m4_exit(1)dnl -])dnl -dnl # END $0($@) -])dnl AC_DEFUN GP_CAMLIB -dnl -dnl -dnl #################################################################### -dnl GP_CAMLIBS_WARNING -dnl Print warning about building a non-"standard" set of camlibs. -dnl #################################################################### -AC_DEFUN([GP_CAMLIBS_WARNING],[dnl -AC_MSG_WARN([ - - #=====================================================================# - # Caution: You have chosen to build a non-standard set of camlibs. # - # You may have disabled the camlib required for your camera, # - # or enabled a camlib which does *not* work and overrides # - # the camlib which *does* work. Consequently, # - # YOUR CAMERA MAY NOT WORK! # - # # - # Many cameras of several brands are supported by a camlib with a # - # name different from the name of the camera brand or model. If you # - # are unsure, please # - # * enable at least the 'ptp2' camlib # - # * or even better, just build the standard set of camlibs. # - #=====================================================================# -]) -GP_SLEEP([5]) -]) -dnl -dnl -dnl #################################################################### -dnl GP_CAMLIBS_CONDITIONAL_WARNING -dnl Call GP_CAMLIBS_WARNING when required. -dnl #################################################################### -AC_DEFUN([GP_CAMLIBS_CONDITIONAL_WARNING], [dnl -AS_VAR_IF([gp_sh_with_camlibs], [standard], [dnl -], [dnl -GP_CAMLIBS_WARNING -]) -])dnl -dnl -dnl -dnl #################################################################### -dnl GP_CAMLIBS_DEFINE -dnl Determine the set of camlibs to build from the --with-camlibs -dnl parameter, and set the build variables accordingly. -dnl #################################################################### -AC_DEFUN([GP_CAMLIBS_DEFINE],[dnl -# BEGIN $0($@) -AC_REQUIRE([_GP_CAMLIBS_INIT])dnl -AC_REQUIRE([GP_PROG_EXPR])dnl - -dnl GP_SET_MSG([camlib-set-standard]) -dnl GP_SET_MSG([camlib-set-outdated]) -dnl GP_SET_MSG([camlib-set-unlisted]) - -dnl Convert sets defined at m4 time (i.e. autoreconf time) -dnl into the same format as the sh time (i.e. configure time) -dnl defined sets. -m4_foreach_w([var], [everything standard outdated unlisted], [dnl -GP_SET_DEFINE([m4-camlib-set-]var) -GP_SET_ADD_ALL([m4-camlib-set-]var[]m4_set_listc([gp_m4s_camlib_set_]var)) -])dnl - -dnl GP_SET_MSG([m4-camlib-set-standard]) -dnl GP_SET_MSG([m4-camlib-set-unlisted]) -dnl GP_SET_MSG([m4-camlib-set-outdated]) - -GP_SET_DEFINE([camlib-set-everything])dnl -GP_SET_UNION([camlib-set-everything], [camlib-set-standard], [camlib-set-outdated], [camlib-set-unlisted]) - -dnl GP_SET_MSG([camlib-set-everything]) -dnl GP_SET_MSG([m4-camlib-set-everything]) - -dnl Yes, that help output won't be all that pretty, but we at least -dnl do not have to edit it by hand. -AC_ARG_WITH([camlibs],[AS_HELP_STRING( - [--with-camlibs=], - [Compile camera drivers (camlibs) in . ]dnl - [Camlibs may be separated with commas. ]dnl - [CAUTION: DRIVER NAMES AND CAMERA NAMES MAY DIFFER. ]dnl - ['standard' is the default is a standard set of camlibs: ]dnl - m4_set_contents(gp_m4s_camlib_set_standard, [ ]). - ['outdated' is a set of camlibs for very old cameras: ]dnl - m4_set_contents(gp_m4s_camlib_set_outdated, [ ]).dnl - [You can add or remove camlibs or camlib sets by appending ]dnl - [them to the list with a + or - sign in front.])], - [gp_sh_with_camlibs="${withval}"], - [gp_sh_with_camlibs="standard"])dnl - -dnl For backwards compatibility, accept --with-camlibs='all' and -dnl interpret it as --with-camlibs='standard'. -AS_VAR_IF([gp_sh_with_camlibs], [all], [dnl - gp_sh_with_camlibs="standard" -])dnl - -dnl Gentoo mode... if user just requested "canon", -dnl add "ptp2" to save support requests. -AS_VAR_IF([gp_sh_with_camlibs], [canon], [dnl - gp_sh_with_camlibs="${gp_sh_with_camlibs} ptp2" - AC_MSG_WARN([ - - #==============================================================# - # You have selected only the old 'canon' driver. However, most # - # current Canon camera models require the 'ptp2' driver. # - # # - # Autoselecting the 'ptp2' driver in addition to the 'canon' # - # driver to prevent unnecessary support requests. # - #==============================================================# - GP_SLEEP([5]) -])])dnl - -dnl set -x - -AC_MSG_CHECKING([with-camlibs requested]) -AS_VAR_IF([gp_sh_with_camlibs], [standard], [dnl - AC_MSG_RESULT([standard set]) -], [dnl - gp_sh_with_camlibs="$(AS_ECHO(["${gp_sh_with_camlibs}"]) | ${TR} ',' ' ')" - AC_MSG_RESULT([${gp_sh_with_camlibs}]) -]) - -dnl AC_MSG_CHECKING([for nothing]) -dnl AC_MSG_RESULT([nihil]) - -dnl Iterate over the list of given camlibs. -dnl -dnl Replace 'standard', 'outdated', 'unlisted', and 'everything' with -dnl the respective set of camlibs, and make sure any camlibs specified -dnl explicitly are actually valid defined camlibs. -GP_SET_DEFINE([m4-camlib-set]) -GP_SET_DEFINE([camlib-set]) -for gp_camlib in ${gp_sh_with_camlibs} -do - case "X$gp_camlib" in #( - X-*) - operator=remove - gp_camlib="$(AS_ECHO(["Y${gp_camlib}"]) | ${SED} 's/^Y.//')" - ;; #( - X+*) - operator=add - gp_camlib="$(AS_ECHO(["Y${gp_camlib}"]) | ${SED} 's/^Y.//')" - ;; #( - X[[A-Za-z0-9]]*) - operator=add - ;; #( - *) - AC_MSG_ERROR([Invalid name given for camlib set or camlib: '${gp_camlib}']) - ;; - esac - dnl AC_MSG_CHECKING([with-camlibs operator]) - dnl AC_MSG_RESULT([${operator}]) - dnl AC_MSG_CHECKING([with-camlibs camlib]) - dnl AC_MSG_RESULT([${gp_camlib}]) - - dnl Convert deprecated "all" parameter to "standard". - case "$gp_camlib" in #( - all) - AC_MSG_WARN([ - - #=============================================================# - # You have used 'all' in the argument to the configure script # - # --with-camlibs= parameter. 'all' is a deprecated name for # - # the 'standard' camlib set. # - # # - # Please change your call to the configure script to use # - # 'standard' instead. # - #=============================================================# -]) - GP_SLEEP([5]) - gp_camlib="standard" - ;; - esac - - dnl Now gp_camlib contains the camlib string, and operator 'add' or 'remove'. - case "$operator" in #( - add) - case "$gp_camlib" in #( - standard) - GP_SET_UNION([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-standard]) - GP_SET_UNION([camlib-set], [camlib-set], [camlib-set-standard]) - ;; #( - outdated) - GP_SET_UNION([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-outdated]) - GP_SET_UNION([camlib-set], [camlib-set], [camlib-set-outdated]) - ;; #( - unlisted) - GP_SET_UNION([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-unlisted]) - GP_SET_UNION([camlib-set], [camlib-set], [camlib-set-unlisted]) - ;; #( - everything) - GP_SET_UNION([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-everything]) - GP_SET_UNION([camlib-set], [camlib-set], [camlib-set-everything]) - ;; #( - *) - GP_SET_CONTAINS_IFELSE([m4-camlib-set-everything], ["${gp_camlib}"], [dnl - GP_SET_ADD([m4-camlib-set], ["$gp_camlib"]) - GP_SET_ADD([camlib-set], ["$gp_camlib"]) - ], [dnl - AC_MSG_ERROR([Unknown camlib found in --with-camlibs: '${gp_camlib}']) - ]) - ;; - esac - ;; #( - remove) - case "$gp_camlib" in #( - standard) - GP_SET_DIFFERENCE([camlib-set], [camlib-set], [camlib-set-standard]) - GP_SET_DIFFERENCE([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-standard]) - ;; #( - outdated) - GP_SET_DIFFERENCE([camlib-set], [camlib-set], [camlib-set-outdated]) - GP_SET_DIFFERENCE([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-outdated]) - ;; #( - unlisted) - GP_SET_DIFFERENCE([camlib-set], [camlib-set], [camlib-set-unlisted]) - GP_SET_DIFFERENCE([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-unlisted]) - ;; #( - everything) - GP_SET_DIFFERENCE([camlib-set], [camlib-set], [camlib-set-everything]) - GP_SET_DIFFERENCE([m4-camlib-set], [m4-camlib-set], [m4-camlib-set-everything]) - ;; #( - *) - GP_SET_CONTAINS_IFELSE([m4-camlib-set-everything], ["${gp_camlib}"], [dnl - GP_SET_REMOVE([camlib-set], ["$gp_camlib"]) - GP_SET_CONTAINS_IFELSE([m4-camlib-set], ["$gp_camlib"], [dnl - GP_SET_REMOVE([m4-camlib-set], ["$gp_camlib"]) - ], [dnl - AC_MSG_WARN([Removing camlib ${gp_camlib} from m4-camlib-set which does not contain ${gp_camlib}]) - ]) - ], [dnl - AC_MSG_ERROR([Unknown camlib found in --with-camlibs: '${gp_camlib}']) - ]) - ;; - esac - ;; - esac -done -AS_UNSET([gp_camlib]) -AC_MSG_CHECKING([with-camlibs parsing]) -AC_MSG_RESULT([finished]) - -dnl GP_SET_MSG([m4-camlib-set]) -dnl GP_SET_MSG([camlib-set]) - -dnl Camlibs requested, but cannot be built. -GP_SET_DEFINE([camlib-set-diff-skipping]) -GP_SET_DIFFERENCE([camlib-set-diff-skipping], [m4-camlib-set], [camlib-set]) -GP_SET_MSG([camlib-set-diff-skipping]) - -dnl Camlibs added over the standard set -GP_SET_DEFINE([camlib-set-diff-over-standard]) -GP_SET_DIFFERENCE([camlib-set-diff-over-standard], [camlib-set], [camlib-set-standard]) -GP_SET_MSG([camlib-set-diff-over-standard]) - -dnl Camlibs missing from the standard set -GP_SET_DEFINE([camlib-set-diff-from-standard]) -GP_SET_DIFFERENCE([camlib-set-diff-from-standard], [camlib-set-standard], [camlib-set]) -GP_SET_MSG([camlib-set-diff-from-standard]) - -GP_SET_DEBUG_MSG([camlib-set-diff-skipping]) -GP_SET_DEBUG_MSG([camlib-set-diff-from-standard]) -GP_SET_DEBUG_MSG([camlib-set-diff-over-standard]) - -GP_SET_SPACE_VAR([camlib-set-diff-skipping], [gp_camlib_set_skipping])dnl - -dnl We could use the cardinality of the difference sets to determine -dnl how far we are from the standard set. If we do not differ too -dnl much, we can still show the camlib set as "standard plus these -dnl minus those skipping that" instead of just listing the camlib -dnl names. - -dnl gp_camlibs_from_standard="$(GP_SET_CARDINALITY([camlib-set-diff-from-standard]))" -dnl AC_MSG_CHECKING([camlibs removed from standard set]) -dnl AC_MSG_RESULT([${gp_camlibs_from_standard}]) - -dnl gp_camlibs_over_standard="$(GP_SET_CARDINALITY([camlib-set-diff-over-standard]))" -dnl AC_MSG_CHECKING([camlibs added over standard set]) -dnl AC_MSG_RESULT([${gp_camlibs_over_standard}]) - -dnl gp_camlibs_non_standard="$(${EXPR} ${gp_camlibs_from_standard} + ${gp_camlibs_over_standard})" -dnl AC_MSG_CHECKING([total number of camlibs differing from standard set]) -dnl AC_MSG_RESULT([${gp_camlibs_non_standard}]) - -AC_MSG_CHECKING([whether skipping some requested camlibs]) -AS_IF([test "x$gp_camlib_set_skipping" = "x"], [dnl - AC_MSG_RESULT([no]) -], [dnl - AC_MSG_RESULT([yes (${gp_camlib_set_skipping})]) - AC_DEFINE_UNQUOTED([GP_CAMLIB_SET_SKIPPING], ["${gp_camlib_set_skipping}"], - [If defined, the camlibs which are skipped due to missing dependencies]) - AC_MSG_WARN([ - - #=========================================================# - # We are skipping building one or more camlibs, probably # - # due to missing dependencies. Check the dependencies if # - # you insist on building these camlibs. # - #=========================================================# -]) - GP_SLEEP([5]) -]) - -GP_SET_SPACE_VAR([camlib-set], [gp_camlib_set]) -AC_MSG_CHECKING([camlib set to build in detail]) -AC_MSG_RESULT([${gp_camlib_set}]) - -GP_CAMLIBS_CONDITIONAL_WARNING - -dnl Whether user has requested a non-standard set of camlibs -GP_SET_EQUAL_IFELSE([camlib-set], [camlib-set-standard], [dnl - AS_IF([test "x$gp_camlib_set_skipping" = "x"], [dnl - GP_CONFIG_MSG([Camlibs], - [standard set (${gp_camlib_set})]) - ], [dnl - GP_CONFIG_MSG([Camlibs], - [standard set (${gp_camlib_set} SKIPPING ${gp_camlib_set_skipping})]) - ]) -], [dnl - AS_IF([test "x$gp_camlib_set_skipping" = "x"], [dnl - GP_CONFIG_MSG([Camlibs], - [non-standard set (${gp_camlib_set})]) - ], [dnl - GP_CONFIG_MSG([Camlibs], - [non-standard set (${gp_camlib_set} SKIPPING ${gp_camlib_set_skipping})]) - ]) - m4_pattern_allow([GP_CAMLIB_SET_IS_NONSTANDARD])dnl - AC_DEFINE_UNQUOTED([GP_CAMLIB_SET_IS_NONSTANDARD], [1], - [define when the camlib set to buidl is non-standard]) -])dnl - -m4_pattern_allow([GP_CAMLIB_SET])dnl -AC_DEFINE_UNQUOTED([GP_CAMLIB_SET], ["${gp_camlib_set}"], - [The actually defined set of camlibs to build]) - -AS_UNSET([GP_CAMLIB_SET]) -for f in ${gp_camlib_set} -do - GP_CAMLIB_SET="${GP_CAMLIB_SET}${GP_CAMLIB_SET+ }${f}.la" -done -AS_UNSET([f]) -AC_SUBST([GP_CAMLIB_SET]) - -m4_pattern_allow([GP_CAMLIB_SET_EVERYTHING])dnl -AC_SUBST([GP_CAMLIB_SET_EVERYTHING], - ["m4_set_contents([gp_m4s_camlib_set_everything], [ ])"]) - -# END $0($@) -])dnl -dnl -dnl -dnl #################################################################### -dnl -dnl Local Variables: -dnl mode: autoconf -dnl End: diff --git a/gphoto-m4/gp-check-doxygen.m4 b/gphoto-m4/gp-check-doxygen.m4 deleted file mode 100644 index 482ba1e649..0000000000 --- a/gphoto-m4/gp-check-doxygen.m4 +++ /dev/null @@ -1,21 +0,0 @@ -dnl doxygen related stuff -dnl look for tools -dnl define substitutions for Doxyfile.in -AC_DEFUN([GP_CHECK_DOXYGEN],[dnl -AC_REQUIRE([GP_CHECK_DOC_DIR])dnl -AC_PATH_PROG([DOT], [dot], [false]) -AC_PATH_PROG([DOXYGEN], [doxygen], [false]) -AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$DOXYGEN" != "xfalse"]) -AM_CONDITIONAL([HAVE_DOT], [test "x$DOT" != "xfalse"]) -if test "x$DOT" != "xfalse"; then - AC_SUBST([HAVE_DOT],[YES]) -else - AC_SUBST([HAVE_DOT],[NO]) -fi -AC_SUBST([HTML_APIDOC_DIR], ["${PACKAGE_TARNAME}-api.html"]) -AC_SUBST([DOXYGEN_OUTPUT_DIR], [doxygen-output]) -AC_SUBST([HTML_APIDOC_INTERNALS_DIR], ["${PACKAGE_TARNAME}-internals.html"]) -])dnl - - - diff --git a/gphoto-m4/gp-check-library.m4 b/gphoto-m4/gp-check-library.m4 deleted file mode 100644 index ee9ef004bb..0000000000 --- a/gphoto-m4/gp-check-library.m4 +++ /dev/null @@ -1,463 +0,0 @@ -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 -dnl Parameters: -dnl -dnl VARNAMEPART partial variable name for variable definitions -dnl libname name of library -dnl VERSION-REQUIREMENT check for the version using pkg-config. -dnl default: [] -dnl headername name of header file -dnl default: [] -dnl functionname name of function name in library -dnl default: [] -dnl ACTION-IF-FOUND shell action to execute if found -dnl default: [] -dnl ACTION-IF-NOT-FOUND shell action to execute if not found -dnl default: [] -dnl OPTIONAL-REQUIRED-ETC one of "mandatory", "default-on", "default-off" -dnl "disable-explicitly" -dnl default: [mandatory] -dnl WHERE-TO-GET-IT place where to find the library, e.g. a URL -dnl default: [] -dnl -dnl What the ACTION-IFs can do: -dnl -dnl * change the variable have_[$1] to "yes" or "no" and thus change -dnl the outcome of the test -dnl * execute additional checks to define more specific variables, e.g. -dnl for different API versions -dnl -dnl What the OPTIONAL-REQUIRED-ETC options mean: -dnl -dnl mandatory Absolute requirement, cannot be disabled. -dnl default-on If found, it is used. If not found, it is not used. -dnl default-off In case of --with-libfoo, detect it. Without -dnl --with-libfoo, do not look for and use it. -dnl disable-explicitly Required by default, but can be disabled by -dnl explicitly giving --without-libfoo. -dnl -dnl These results have happened after calling GP_CHECK_LIBRARY: -dnl -dnl AM_CONDITIONAL([HAVE_VARPREFIX],[ if found ]) -dnl AM_SUBST([have_VARPREFIX], [ "yes" if found, "no" if not found ]) -dnl AM_SUBST([VARPREFIX_CFLAGS],[ -I, -D and stuff ]) -dnl AM_SUBST([VARPREFIX_LIBS], [ /path/to/libname.la -L/path -lfoo ]) -dnl -dnl Parameters to ./configure which influence the GP_CHECK_LIBRARY results: -dnl -dnl * VARNAMEPART_LIBS=/foobar/arm-palmos/lib/libname.la -dnl VARNAMEPART_CFLAGS=-I/foobar/include -dnl * --without-libfoo -dnl * --with-libfoo=/usr/local -dnl * --with-libfoo-include-dir=/foobar/include -dnl * --with-libfoo-lib=/foobar/arm-palmos/lib -dnl * --with-libfoo=autodetect -dnl -dnl Examples: -dnl GP_CHECK_LIBRARY([LIBEXIF], [libexif])dnl -dnl GP_CHECK_LIBRARY([LIBEXIF], [libexif-gtk], [>= 0.3.3])dnl -dnl note the space! ^ -dnl -dnl Possible enhancements: -dnl -dnl * Derive VAR_PREFIX directly from libname -dnl This will change the calling conventions, so be aware of that. -dnl * Give names of a header file and function name and to a test -dnl compilation. -dnl -AC_DEFUN([_GP_CHECK_LIBRARY_SOEXT],[dnl -AC_MSG_CHECKING([for dynamic library extension]) -soext="" -case "$host" in - *linux*) soext=".so" ;; - *sunos*) soext=".so" ;; - *solaris*) soext=".so" ;; - *bsd*) soext=".so" ;; - *darwin*) soext=".dylib" ;; - *w32*) soext=".dll" ;; -esac -case "$host_os" in - gnu*) soext=".so" ;; -esac -if test "x$soext" = "x"; then - soext=".so" - AC_MSG_RESULT([${soext}]) - AC_MSG_WARN([ -Host system "${host}" not recognized, defaulting to "${soext}". -]) -else - AC_MSG_RESULT([${soext}]) -fi -])dnl -dnl -dnl -m4_ifndef([PKG_PROG_PKG_CONFIG], [dnl - m4_fatal([PKG_PROG_PKG_CONFIG not found, do you have pkg-config installed with pkg.m4?]) -]) -dnl -dnl -AC_DEFUN([_GP_CHECK_LIBRARY],[ -# ---------------------------------------------------------------------- -# [GP_CHECK_LIBRARY]([$1],[$2],[$3], -# [$4],[$5], -# [...],[...],[$8]) -m4_ifval([$9],[dnl -# $9 -])dnl -# ---------------------------------------------------------------------- -dnl -dnl -AC_REQUIRE([GP_CONFIG_MSG])dnl -AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_REQUIRE([_GP_CHECK_LIBRARY_SOEXT])dnl -# Use _CFLAGS and _LIBS given to configure. -# This makes it possible to set these vars in a configure script -# and AC_CONFIG_SUBDIRS this configure. -AC_ARG_VAR([$1][_CFLAGS], [CFLAGS for compiling with ][$2])dnl -AC_ARG_VAR([$1][_LIBS], [LIBS to add for linking against ][$2])dnl -dnl -AC_MSG_CHECKING([for ][$2][ to use]) -m4_ifval([$3],[REQUIREMENTS_FOR_][$1][="][$2][ $3]["], - [REQUIREMENTS_FOR_][$1][="][$2]["]) -userdef_[$1]=no -have_[$1]=no -if test "x${[$1][_LIBS]}" = "x" && test "x${[$1][_CFLAGS]}" = "x"; then - # define --with/--without argument - m4_if([$8], [default-off], - [m4_pushdef([gp_lib_arg],[--without-][$2])dnl - try_[$1]=no - ], - [m4_pushdef([gp_lib_arg],[--with-][$2])dnl - try_[$1]=auto - ])dnl - AC_ARG_WITH([$2],[AS_HELP_STRING([gp_lib_arg][=PREFIX],[where to find ][$2][, "no" or "auto"])],[try_][$1][="$withval"]) - if test "x${[try_][$1]}" = "xno"; then - [REQUIREMENTS_FOR_][$1][=] - fi - if test "x${[try_][$1]}" = "xauto"; then [try_][$1]=autodetect; fi - AC_MSG_RESULT([${try_][$1][}]) - m4_popdef([gp_lib_arg])dnl - if test "x${[try_][$1]}" = "xautodetect"; then - # OK, we have to autodetect. - # We start autodetection with the cleanest known method: pkg-config - if test "x${[have_][$1]}" = "xno"; then - # we need that line break after the PKG_CHECK_MODULES - m4_ifval([$3], - [PKG_CHECK_MODULES([$1],[$2][ $3],[have_][$1][=yes],[:])], - [PKG_CHECK_MODULES([$1],[$2], [have_][$1][=yes],[:])] - ) - fi - # If pkg-config didn't find anything, try the libfoo-config program - # certain known libraries ship with. - if test "x${[have_][$1]}" = "xno"; then - AC_MSG_CHECKING([$2][ config program]) - m4_pushdef([gp_lib_config],[m4_if([$2],[libusb],[libusb-config], - [$2],[libgphoto2],[gphoto2-config], - [$2],[libgphoto2_port],[gphoto2-port-config], - [$2],[gdlib],[gdlib-config], - [$2],[libxml-2.0],[xml2-config], - [none])])dnl - AC_MSG_RESULT([gp_lib_config]) - AC_PATH_PROG([$1][_CONFIG_PROG],[gp_lib_config]) - if test -n "${[$1][_CONFIG_PROG]}" && - test "${[$1][_CONFIG_PROG]}" != "none"; then - m4_ifval([$3],[ - AC_MSG_CHECKING([for ][$2][ version according to ][gp_lib_config]) - m4_pushdef([gp_lib_compop],[regexp([$3], [\(>=\|>\|<\|<=\|=\)[ \t]*.*], [\1])])dnl comparison operator - m4_if( gp_lib_compop,[>=],[_][$1][_COMPN="-lt"], - gp_lib_compop,[>], [_][$1][_COMPN="-le"], - gp_lib_compop,[<], [_][$1][_COMPN="-ge"], - gp_lib_compop,[<=],[_][$1][_COMPN="-gt"], - gp_lib_compop,[=], [_][$1][_COMPN="-ne"], - [m4_errprint(__file__:__line__:[ Error: -Illegal version comparison operator: `gp_lib_compop' -It must be one of ">=", ">", "<", "<=", "=". -])m4_exit(1)]) - m4_popdef([gp_lib_compop])dnl - # split requested version number using m4 regexps - _[$1]_REQ_1="regexp([$3], [\(>=\|>\|<\|<=\|=\)[ \t]*\([0-9]+\).*], [\2])" - _[$1]_REQ_2="regexp([$3], [\(>=\|>\|<\|<=\|=\)[ \t]*\([0-9]+\)\.\([0-9]+\).*], [\3])" - _[$1]_REQ_3="regexp([$3], [\(>=\|>\|<\|<=\|=\)[ \t]*\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\).*], [\4])" - _[$1]_REQ_4="regexp([$3], [\(>=\|>\|<\|<=\|=\)[ \t]*\([0-9]+\)\.\([0-9]+\)\.\([0-9]+\)\(.*\)], [\5])" - # split installed version number via shell and sed - _[$1]_VERSION="$("${[$1][_CONFIG_PROG]}" --version | sed 's/^.* //')" - _[$1]_VER_1="$(echo "${_[$1]_VERSION}" | sed 's/\([[0-9]]*\).*/\1/g')" - _[$1]_VER_2="$(echo "${_[$1]_VERSION}" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/g')" - _[$1]_VER_3="$(echo "${_[$1]_VERSION}" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/g')" - _[$1]_VER_4="$(echo "${_[$1]_VERSION}" | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)\(.*\)/\4/g')" - AC_MSG_RESULT([${_][$1][_VERSION}]) - _tmp=false - if test "${_[$1]_VER_1}" "${_[$1]_COMPN}" "${_[$1]_REQ_1}"; then _tmp=true; - elif test "${_[$1]_VER_2}" "${_[$1]_COMPN}" "${_[$1]_REQ_2}"; then _tmp=true; - elif test "${_[$1]_VER_3}" "${_[$1]_COMPN}" "${_[$1]_REQ_3}"; then _tmp=true; - elif test "x${_[$1]_VER_4}" = "x" && test "x${_[$1]_REQ_4}" != "x"; then _tmp=true; - elif test "${_[$1]_VER_4}" "${_[$1]_COMPN}" "${_[$1]_REQ_4}"; then _tmp=true; - fi - AC_MSG_CHECKING([if ][$2][ version is matching requirement ][$3]) - if "${_tmp}"; then - AC_MSG_RESULT([no]) - AC_MSG_ERROR([Version requirement ][$2][ ][$3][ not met. Found: ${_][$1][_VERSION}]) - else - AC_MSG_RESULT([yes]) - fi - ])dnl if version requirement given - AC_MSG_CHECKING([for ][$2][ parameters from ][gp_lib_config]) - [$1]_LIBS="$(${[$1][_CONFIG_PROG]} --libs || echo "*error*")" - [$1]_CFLAGS="$(${[$1][_CONFIG_PROG]} --cflags || echo "*error*")" - if test "x${[$1]_LIBS}" = "*error*" || - test "x${[$1]_CFLAGS}" = "*error*"; then - AC_MSG_RESULT([error]) - else - have_[$1]=yes - AC_MSG_RESULT([ok]) - fi - fi - m4_popdef([gp_lib_config])dnl - fi - m4_ifval([$3],[# Version requirement given, so we do not rely on probing.],[ - # Neither pkg-config, nor the libfoo-config program have found anything. - # So let's just probe the system. - AC_MSG_WARN([The `$2' library could not be found using pkg-config or its known config program. -No version checks will be performed if it is found using any other method.]) - if test "x${[have_][$1]}" = "xno"; then - ifs="$IFS" - IFS=":" # FIXME: for W32 and OS/2 we may need ";" here - for _libdir_ in \ - ${LD_LIBRARY_PATH} \ - "${libdir}" \ - "${prefix}/lib64" "${prefix}/lib" \ - /usr/lib64 /usr/lib \ - /usr/local/lib64 /usr/local/lib \ - /opt/lib64 /opt/lib - do - IFS="$ifs" - for _soext_ in .la ${soext} .a; do - if test -f "${_libdir_}/[$2]${_soext_}" - then - if test "x${_soext_}" = "x.la" || - test "x${_soext_}" = "x.a"; then - [$1]_LIBS="${_libdir_}/[$2]${_soext_}" - else - [$1]_LIBS="-L${_libdir_} -l$(echo "$2" | sed 's/^lib//')" - fi - break - fi - done - if test "x${[$1][_LIBS]}" != "x"; then - break - fi - done - IFS="$ifs" - if test "x${[$1][_LIBS]}" != "x"; then - have_[$1]=yes - fi - fi - ]) - elif test "x${[try_][$1]}" = "xno"; then - : - else - # We've been given a prefix to look in for library $2. - # We start looking for $2.la files first. - AC_MSG_CHECKING([for ][$2][.la file in ${[try_][$1]}]) - if test -f "${[try_][$1]}/lib/[$2].la"; then - [$1][_LIBS]="${[try_][$1]}/lib/[$2].la" - [$1][_CFLAGS]="-I${[try_][$1]}/include" - AC_MSG_RESULT([libtool file $][$1][_LIBS (good)]) - have_[$1]=yes - elif test -f "${[try_][$1]}/lib64/[$2].la"; then # HACK - [$1][_LIBS]="${[try_][$1]}/lib64/[$2].la" - [$1][_CFLAGS]="-I${[try_][$1]}/include" - AC_MSG_RESULT([libtool file $][$1][_LIBS (good)]) - have_[$1]=yes - else - AC_MSG_RESULT([wild guess that something is in $try_][$1]) - [$1][_LIBS]="-L${[try_][$1]}/lib -l$(echo "$2" | sed 's/^lib//')" - [$1][_CFLAGS]="-I${[try_][$1]}/include" - have_[$1]=yes - AC_MSG_WARN([ -* Warning: -* libtool file $2.la could not be found. -* We may be linking against the WRONG library. -]) - fi - fi -elif test "x${[$1][_LIBS]}" != "x" && test "x${[$1][_CFLAGS]}" != "x"; then - AC_MSG_RESULT([user-defined]) - userdef_[$1]=yes - have_[$1]=yes -else - AC_MSG_RESULT([broken call]) - AC_MSG_ERROR([ -* Fatal: -* When calling configure for ${PACKAGE_TARNAME} -* ${PACKAGE_NAME} -* either set both [$1][_LIBS] *and* [$1][_CFLAGS] -* or neither. -]) -fi -AC_SUBST([REQUIREMENTS_FOR_][$1]) -dnl -dnl ACTION-IF-FOUND -dnl -m4_ifval([$6],[dnl -if test "x${[have_][$1]}" = "xyes"; then -# ACTION-IF-FOUND -$6 -fi -])dnl -dnl -dnl ACTION-IF-NOT-FOUND -dnl -m4_ifval([$7],[dnl -if test "x${[have_][$1]}" = "xno"; then -# ACTION-IF-NOT-FOUND -$7 -fi -])dnl -dnl -dnl Run our own test compilation -dnl -m4_ifval([$4],[dnl -if test "x${[have_][$1]}" = "xyes"; then -dnl AC_MSG_CHECKING([whether ][$2][ test compile succeeds]) -dnl AC_MSG_RESULT([${[have_][$1]}]) -CPPFLAGS_save="$CPPFLAGS" -CPPFLAGS="${[$1]_CFLAGS}" -AC_CHECK_HEADER([$4],[have_][$1][=yes],[have_][$1][=no]) -CPPFLAGS="$CPPFLAGS_save" -fi -])dnl -dnl -dnl Run our own test link -dnl Does not work for libraries which be built after configure time, -dnl so we deactivate it for them (userdef_). -dnl -m4_ifval([$5],[dnl -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]) - LIBS="$LIBS_save" - AC_MSG_RESULT([${[have_][$1]}]) -fi -])dnl -dnl -dnl Abort configure script if mandatory, but not found -dnl -m4_if([$8],[mandatory],[ -if test "x${[have_][$1]}" = "xno"; then - AC_MSG_ERROR([ -PKG_CONFIG_PATH=${PKG_CONFIG_PATH} -[$1][_LIBS]=${[$1][_LIBS]} -[$1][_CFLAGS]=${[$1][_CFLAGS]} - -* Fatal: ${PACKAGE_NAME} requires $2 $3 to build. -* -* Possible solutions: -* - set PKG_CONFIG_PATH to adequate value -* - call configure with [$1][_LIBS]=.. and [$1][_CFLAGS]=.. -* - call configure with one of the --with-$2 parameters -][m4_ifval([$9],[dnl -* - get $2 and install it: -* $9],[dnl -* - get $2 and install it])]) -fi -])dnl -dnl -dnl Abort configure script if not found and not explicitly disabled -dnl -m4_if([$8],[disable-explicitly],[ -if test "x${[try_][$1]}" != "xno" && test "x${[have_][$1]}" = "xno"; then - AC_MSG_ERROR([ -PKG_CONFIG_PATH=${PKG_CONFIG_PATH} -[$1][_LIBS]=${[$1][_LIBS]} -[$1][_CFLAGS]=${[$1][_CFLAGS]} - -* Fatal: ${PACKAGE_NAME} by default requires $2 $3 to build. -* You must explicitly disable $2 to build ${PACKAGE_TARNAME} without it. -* -* Possible solutions: -* - call configure with --with-$2=no or --without-$2 -* - set PKG_CONFIG_PATH to adequate value -* - call configure with [$1][_LIBS]=.. and [$1][_CFLAGS]=.. -* - call configure with one of the --with-$2 parameters -][m4_ifval([$9],[dnl -* - get $2 and install it: -* $9],[dnl -* - get $2 and install it -])][m4_if([$2],[libusb],[dnl -* - if you have libusb >= 1.0 installed, you must also install -* either the libusb0 compat library or a libusb 0.x version -])]) -fi -])dnl -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 - 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 -fi -dnl AC_SUBST is done implicitly by AC_ARG_VAR above. -dnl AC_SUBST([$1][_LIBS]) -dnl AC_SUBST([$1][_CFLAGS]) -])dnl -dnl -dnl #################################################################### -dnl -AC_DEFUN([_GP_CHECK_LIBRARY_SYNTAX_ERROR],[dnl -m4_errprint(__file__:__line__:[ Error: -*** Calling $0 macro with old syntax -*** Aborting. -])dnl -m4_exit(1)dnl -])dnl -dnl -dnl #################################################################### -dnl -AC_DEFUN([GP_CHECK_LIBRARY],[dnl -m4_if([$4], [mandatory], [_GP_CHECK_LIBRARY_SYNTAX_ERROR($0)], - [$4], [default-enabled], [_GP_CHECK_LIBRARY_SYNTAX_ERROR($0)], - [$4], [default-disabled], [_GP_CHECK_LIBRARY_SYNTAX_ERROR($0)])dnl -m4_if([$8], [], [dnl - _GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[mandatory],[$9])], - [$8], [default-on], [dnl - _GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])], - [$8], [disable-explicitly], [dnl - _GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])], - [$8], [default-off], [dnl - _GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])], - [$8], [mandatory], [dnl - _GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])], - [m4_errprint(__file__:__line__:[ Error: -Illegal argument 6 to $0: `$6' -It must be one of "default-on", "default-off", "mandatory". -])m4_exit(1)])dnl -])dnl -dnl -m4_pattern_disallow([GP_CHECK_LIBRARY]) -m4_pattern_disallow([_GP_CHECK_LIBRARY]) -m4_pattern_disallow([_GP_CHECK_LIBRARY_SYNTAX_ERROR]) -m4_pattern_disallow([_GP_CHECK_LIBRARY_SOEXT]) -dnl -dnl #################################################################### -dnl -dnl Please do not remove this: -dnl filetype: 6e60b4f0-acb2-4cd5-8258-42014f92bd2c -dnl I use this to find all the different instances of this file which -dnl are supposed to be synchronized. -dnl -dnl Local Variables: -dnl mode: autoconf -dnl End: diff --git a/gphoto-m4/gp-check-popt.m4 b/gphoto-m4/gp-check-popt.m4 deleted file mode 100644 index 7b8b6aa8f6..0000000000 --- a/gphoto-m4/gp-check-popt.m4 +++ /dev/null @@ -1,241 +0,0 @@ -dnl @synopsis GP_CHECK_POPT(FLAG) -dnl -dnl Check whether libpopt is available. -dnl FLAG must be one of -dnl "mandatory" -dnl "default-enabled" -dnl "default-disabled" -dnl -AC_DEFUN([GP_CHECK_POPT],[ -# -# [GP_CHECK_POPT] -# -AC_REQUIRE([GP_CONFIG_MSG])dnl -m4_if([$1],[mandatory], [_GP_CHECK_POPT([mandatory])], - [$1],[default-enabled], [_GP_CHECK_POPT([disable])], - [$1],[default-disabled], [_GP_CHECK_POPT([enable])], - [m4_errprint(__file__:__line__:[ Error: -Illegal argument to $0: `$1' -Valid values are: mandatory, default-enabled, default-disabled -])m4_exit(1)])dnl -])dnl -dnl -AC_DEFUN([_GP_CHECK_POPT],[ -m4_if([$1],[mandatory],[ -try_popt=yes -require_popt=yes -],[ -try_popt=auto -require_popt=no -AC_ARG_ENABLE([popt], -[AS_HELP_STRING([--$1-popt],[Do not use popt])], -[ if test "x$enableval" = xno \ - || test "x$enableval" = xoff \ - || test "x$enableval" = xfalse; - then - try_popt=no - require_popt=no - elif test "x$enableval" = xyes \ - || test "x$enableval" = xon \ - || test "x$enableval" = xtrue - then - try_popt=yes - require_popt=yes - fi -])dnl -])dnl - -AC_MSG_CHECKING([whether popt is required]) -AC_MSG_RESULT([${require_popt}]) - -if test "$require_popt" != yes; then - AC_MSG_CHECKING([whether popt is requested]) - AC_MSG_RESULT([${try_popt}]) -fi - -dnl Implicit AC_SUBST -AC_ARG_VAR([POPT_CFLAGS],[cppflags to compile with libpopt])dnl -AC_ARG_VAR([POPT_LIBS],[location of libpopt to link against])dnl - -have_popt=no - -if test "x$POPT_CFLAGS" = "x" && test "x$POPT_LIBS" = "x"; then - - # try to find options to compile popt.h - CPPFLAGS_save="$CPPFLAGS" - popth_found=no - case "$MSYSTEM" in - MINGW32) - if test -n "/mingw32"; then - : - elif test -d "/mingw32/include"; then - CPPFLAGS="-I/mingw32/include ${CPPFLAGS}" - else - continue - fi - ac_cv_header_popt_h="" - unset ac_cv_header_popt_h - AC_CHECK_HEADER([popt.h], [popth_found=yes]) - ;; - MINGW64) - if test -n "${popt_prefix}"; then - : - elif test -d "/mingw64/include"; then - CPPFLAGS="-I/mingw64/include ${CPPFLAGS}" - else - continue - fi - ac_cv_header_popt_h="" - unset ac_cv_header_popt_h - AC_CHECK_HEADER([popt.h], [popth_found=yes]) - ;; - *) - for popt_prefix in "" /usr /usr/local - do - if test -n "${popt_prefix}"; then - : - elif test -d "${popt_prefix}/include"; then - CPPFLAGS="-I${popt_prefix}/include ${CPPFLAGS}" - else - continue - fi - ac_cv_header_popt_h="" - unset ac_cv_header_popt_h - AC_CHECK_HEADER([popt.h], [popth_found=yes]) - if test "$popth_found" = yes; then break; fi - done - ;; - esac - CPPFLAGS="$CPPFLAGS_save" - if test "$popth_found" = "yes"; then - if test "$popt_prefix" = ""; then - POPT_CFLAGS="" - else - POPT_CFLAGS="-I${popt_prefix}/include" - fi - elif test "$require_popt" = "yes"; then - AC_MSG_ERROR([ -* Cannot autodetect popt.h -* -* Set POPT_CFLAGS and POPT_LIBS correctly. -]) - fi - - # try to find options to link against popt - LDFLAGS_save="$LDFLAGS" - popt_links=no - case "$MSYSTEM" in - MINGW32) -# for ldir in "" lib; do - popt_libdir="/mingw32/lib" - if test "${popt_libdir}" = "/"; then - popt_libdir="" - elif test -d "${popt_libdir}"; then - LDFLAGS="-L${popt_libdir} ${LDFLAGS}" - else - continue - fi - # Avoid caching of results - ac_cv_lib_popt_poptStuffArgs="" - unset ac_cv_lib_popt_poptStuffArgs - AC_CHECK_LIB([popt], [poptStuffArgs], [popt_links=yes]) - ;; - MINGW64) - popt_libdir="/mingw64/lib" - if test "${popt_libdir}" = "/"; then - popt_libdir="" - elif test -d "${popt_libdir}"; then - LDFLAGS="-L${popt_libdir} ${LDFLAGS}" - else - continue - fi - # Avoid caching of results - ac_cv_lib_popt_poptStuffArgs="" - unset ac_cv_lib_popt_poptStuffArgs - AC_CHECK_LIB([popt], [poptStuffArgs], [popt_links=yes]) - ;; - *) - for popt_prefix in /usr "" /usr/local; do - # We could have "/usr" and "lib64" at the beginning of the - # lists. Then the first tested location would - # incidentally be the right one on 64bit systems, and - # thus work around a bug in libtool on 32bit systems: - # - # 32bit libtool doesn't know about 64bit systems, and so the - # compilation will fail when linking a 32bit library from - # /usr/lib to a 64bit binary. - # - # This hack has been confirmed to workwith a - # 32bit Debian Sarge and 64bit Fedora Core 3 system. - for ldir in lib64 "" lib; do - popt_libdir="${popt_prefix}/${ldir}" - if test "${popt_libdir}" = "/"; then - popt_libdir="" - elif test -d "${popt_libdir}"; then - LDFLAGS="-L${popt_libdir} ${LDFLAGS}" - else - continue - fi - # Avoid caching of results - ac_cv_lib_popt_poptStuffArgs="" - unset ac_cv_lib_popt_poptStuffArgs - AC_CHECK_LIB([popt], [poptStuffArgs], [popt_links=yes]) - if test "$popt_links" = yes; then break; fi - done - if test "$popt_links" = yes; then break; fi - done - ;; - esac - LDFLAGS="$LDFLAGS_save" - if test "$popt_links" = "yes"; then - if test "$popt_libdir" = ""; then - POPT_LIBS="-lpopt" - else - POPT_LIBS="-L${popt_libdir} -lpopt" - fi - have_popt=yes - elif test "$require_popt" = "yes"; then - AC_MSG_ERROR([ -* Cannot autodetect library directory containing popt -* -* Set POPT_CFLAGS and POPT_LIBS correctly. -]) - fi -elif test "x$POPT_CFLAGS" != "x" && test "x$POPT_LIBS" != "x"; then - # just use the user specified option - popt_msg="yes (user specified)" - have_popt=yes -else - AC_MSG_ERROR([ -* Fatal: Either set both POPT_CFLAGS and POPT_LIBS or neither. -]) -fi - -AC_MSG_CHECKING([if popt is functional]) -if test "$require_popt$have_popt" = "yesno"; then - AC_MSG_RESULT([no, but required]) - AC_MSG_ERROR([ -* popt library not found -* Fatal: ${PACKAGE_NAME} (${PACKAGE_TARNAME}) requires popt -* Please install it and/or set POPT_CFLAGS and POPT_LIBS. -]) -fi -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}]) -fi -AM_CONDITIONAL([HAVE_POPT],[test "$have_popt" = "yes"]) -])dnl -dnl -dnl Please do not remove this: -dnl filetype: 7595380e-eff3-49e5-90ab-e40f1d544639 -dnl I use this to find all the different instances of this file which -dnl are supposed to be synchronized. -dnl -dnl Local Variables: -dnl mode: autoconf -dnl End: diff --git a/gphoto-m4/gp-check-shell-environment.m4 b/gphoto-m4/gp-check-shell-environment.m4 deleted file mode 100644 index a3d6749b94..0000000000 --- a/gphoto-m4/gp-check-shell-environment.m4 +++ /dev/null @@ -1,48 +0,0 @@ -dnl @synopsis GP_CHECK_SHELL_ENVIRONMENT([SHOW-LOCALE-VARS]) -dnl -dnl Check that the shell environment is sane. -dnl -dnl If SHOW-LOCALE-VARS is set to [true], print all LC_* and LANG* -dnl variables at configure time. (WARNING: This is not portable!) -dnl -dnl -AC_DEFUN([GP_CHECK_SHELL_ENVIRONMENT], -[ -# make sure "cd" doesn't print anything on stdout -if test x"${CDPATH+set}" = xset -then - CDPATH=: - export CDPATH -fi - -# make sure $() command substitution works -AC_MSG_CHECKING([for POSIX sh \$() command substitution]) -if test "x$(pwd)" = "x`pwd`" && test "y$(echo "foobar")" = "y`echo foobar`" # '''' -then - AC_MSG_RESULT([yes]) -else - AC_MSG_RESULT([no]) - uname=`uname 2>&1` # '' - uname_a=`uname -a 2>&1` # '' - AC_MSG_ERROR([ - -* POSIX sh \$() command substitution does not work with this shell. -* -* You are running a very rare species of shell. Please report this -* sighting to <${PACKAGE_BUGREPORT}>: -* SHELL=${SHELL} -* uname=${uname} -* uname-a=${uname_a} -* Please also include your OS and version. -* -* Run this configure script using a better (i.e. POSIX compliant) shell. -]) -fi -dnl -m4_if([$1],[true],[dnl -printenv | grep -E '^(LC_|LANG)' -])dnl - -dnl -])dnl -dnl diff --git a/gphoto-m4/gp-config-msg.m4 b/gphoto-m4/gp-config-msg.m4 deleted file mode 100644 index cc1935182c..0000000000 --- a/gphoto-m4/gp-config-msg.m4 +++ /dev/null @@ -1,102 +0,0 @@ -dnl -dnl GP_CONFIG_INIT -dnl use default LHS width (called implicitly if not called explicitly) -dnl GP_CONFIG_INIT([WIDTH-OF-LHS]) -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 formatted output line "LHS: RHS" -dnl -dnl GP_CONFIG_OUTPUT -dnl print all the output messages we collected in the mean time -dnl -dnl Simple way to print a configuration summary at the end of ./configure. -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 -dnl GP_CONFIG_MSG([Feature foo],[${foo}]) -dnl GP_CONFIG_MSG([Location of bar],[${bar}]) -dnl [...] -dnl AC_OUTPUT -dnl GP_CONFIG_OUTPUT -dnl -dnl -AC_DEFUN([GP_CONFIG_INIT], -[dnl -AC_REQUIRE([GP_CHECK_SHELL_ENVIRONMENT]) -dnl the empty string must contain at least as many spaces as the substr length -dnl FIXME: let m4 determine that length -dnl (collect left parts in array and choose largest length) -m4_if([$1],[],[gp_config_len="30"],[gp_config_len="$1"]) -gp_config_empty="" -gp_config_len3="$(expr "$gp_config_len" - 3)" -n="$gp_config_len" -while test "$n" -gt 0; do - gp_config_empty="${gp_config_empty} " - n="$(expr "$n" - 1)" -done -gp_config_msg=" -Configuration (${PACKAGE_TARNAME} ${PACKAGE_VERSION}): -" -])dnl -dnl -dnl -AC_DEFUN([GP_CONFIG_MSG], -[AC_REQUIRE([GP_CONFIG_INIT])dnl -m4_if([$1],[],[ -gp_config_msg="${gp_config_msg} -" -],[$2],[],[ -gp_config_msg="${gp_config_msg} - [$1] -" -],[ -gp_config_msg_len="$(expr "[$1]" : '.*')" -if test "$gp_config_msg_len" -ge "$gp_config_len"; then - gp_config_msg_lhs="$(expr "[$1]" : "\(.\{0,${gp_config_len3}\}\)")..:" -else - gp_config_msg_lhs="$(expr "[$1]:${gp_config_empty}" : "\(.\{0,${gp_config_len}\}\)")" -fi -gp_config_msg="${gp_config_msg} ${gp_config_msg_lhs} [$2] -" -])])dnl -dnl -AC_DEFUN([GP_CONFIG_MSG_SUBDIRS],[dnl -# Message about configured subprojects -if test "x$subdirs" != "x"; then - GP_CONFIG_MSG()dnl - _subdirs="" - for sd in $subdirs; do - ssd="$(basename "$sd")" - if test "x$_subdirs" = "x"; then - _subdirs="$ssd"; - else - _subdirs="$_subdirs $ssd" - fi - done - GP_CONFIG_MSG([Subprojects],[${_subdirs}])dnl -fi -])dnl -dnl -AC_DEFUN([GP_CONFIG_OUTPUT], -[AC_REQUIRE([GP_CONFIG_INIT])dnl -AC_REQUIRE([GP_CONFIG_MSG])dnl -AC_REQUIRE([GP_CONFIG_MSG_SUBDIRS])dnl -echo "${gp_config_msg} -You may run \"make\" and \"make install\" now." -])dnl -dnl -dnl Please do not remove this: -dnl filetype: de774af3-dc3b-4b1d-b6f2-4aca35d3da16 -dnl I use this to find all the different instances of this file which -dnl are supposed to be synchronized. -dnl -dnl Local Variables: -dnl mode: autoconf -dnl End: diff --git a/gphoto-m4/gp-documentation.m4 b/gphoto-m4/gp-documentation.m4 deleted file mode 100644 index d2c46f8562..0000000000 --- a/gphoto-m4/gp-documentation.m4 +++ /dev/null @@ -1,113 +0,0 @@ -dnl -dnl check where to install documentation -dnl -dnl determines documentation "root directory", i.e. the directory -dnl where all documentation will be placed in -dnl - -AC_DEFUN([GP_CHECK_DOC_DIR], -[ -AC_BEFORE([$0], [GP_BUILD_GTK_DOCS])dnl -AC_BEFORE([$0], [GP_CHECK_DOXYGEN])dnl - -AC_ARG_WITH([doc-dir], -[AS_HELP_STRING([--with-doc-dir=PATH], -[Where to install docs [default=autodetect]])]) - -# check for the main ("root") documentation directory -AC_MSG_CHECKING([main docdir]) - -if test "x${with_doc_dir}" != "x" -then # docdir is given as parameter - docdir="${with_doc_dir}" - AC_MSG_RESULT([${docdir} (from parameter)]) -else # otherwise invent a docdir hopefully compatible with system policy - if test -d "/usr/share/doc" - then - maindocdir='${prefix}/share/doc' - AC_MSG_RESULT([${maindocdir} (FHS style)]) - elif test -d "/usr/doc" - then - maindocdir='${prefix}/doc' - AC_MSG_RESULT([${maindocdir} (old style)]) - else - maindocdir='${datadir}/doc' - AC_MSG_RESULT([${maindocdir} (default value)]) - fi - AC_MSG_CHECKING([package docdir]) - # check whether to include package version into documentation path - # FIXME: doesn't work properly. - if ls -d /usr/{share/,}doc/make-[0-9]* > /dev/null 2>&1 - then - docdir="${maindocdir}/${PACKAGE}-${VERSION}" - AC_MSG_RESULT([${docdir} (redhat style)]) - else - docdir="${maindocdir}/${PACKAGE}" - AC_MSG_RESULT([${docdir} (default style)]) - fi -fi - -AC_SUBST([docdir]) -])dnl - -dnl -dnl check whether to build docs and where to: -dnl -dnl * determine presence of prerequisites (only gtk-doc for now) -dnl * determine destination directory for HTML files -dnl - -AC_DEFUN([GP_BUILD_GTK_DOCS], -[ -# docdir has to be determined in advance -AC_REQUIRE([GP_CHECK_DOC_DIR]) - -# --------------------------------------------------------------------------- -# gtk-doc: We use gtk-doc for building our documentation. However, we -# require the user to explicitly request the build. -# --------------------------------------------------------------------------- -try_gtkdoc=false -gtkdoc_msg="no (not requested)" -have_gtkdoc=false -AC_ARG_ENABLE([docs], -[AS_HELP_STRING([--enable-docs], -[Use gtk-doc to build documentation [default=no]])],[ - if test x$enableval = xyes; then - try_gtkdoc=true - fi -]) -if $try_gtkdoc; then - AC_PATH_PROG([GTKDOC],[gtkdoc-mkdb]) - if test -n "${GTKDOC}"; then - have_gtkdoc=true - gtkdoc_msg="yes" - else - gtkdoc_msg="no (http://www.gtk.org/rdp/download.html)" - fi -fi -AM_CONDITIONAL([ENABLE_GTK_DOC], [$have_gtkdoc]) -GP_CONFIG_MSG([build API docs with gtk-doc],[$gtkdoc_msg]) - - -# --------------------------------------------------------------------------- -# Give the user the possibility to install html documentation in a -# user-defined location. -# --------------------------------------------------------------------------- -AC_ARG_WITH([html-dir], -[AS_HELP_STRING([--with-html-dir=PATH], -[Where to install html docs [default=autodetect]])]) - -AC_MSG_CHECKING([for html dir]) -if test "x${with_html_dir}" = "x" ; then - htmldir="${docdir}/html" - AC_MSG_RESULT([${htmldir} (default)]) -else - htmldir="${with_html_dir}" - AC_MSG_RESULT([${htmldir} (from parameter)]) -fi -AC_SUBST([htmldir]) -apidocdir="${htmldir}/api" -AC_SUBST([apidocdir]) - -])dnl - diff --git a/gphoto-m4/gp-driverdir.m4 b/gphoto-m4/gp-driverdir.m4 deleted file mode 100644 index 52895c085d..0000000000 --- a/gphoto-m4/gp-driverdir.m4 +++ /dev/null @@ -1,79 +0,0 @@ -dnl ################################################################### -dnl Driver directory (camlibdir or iolibdir) -dnl ################################################################### -dnl -dnl Usage: -dnl GP_DRIVERDIR([camlibdir], [CAMLIBS], [camlibs]) -dnl GP_DRIVERDIR([iolibdir], [IOLIBS], [iolibs]) -dnl -dnl ################################################################### -dnl -AC_DEFUN([GP_DRIVERDIR], [dnl -AC_MSG_CHECKING([where to install ][$3][ ($1)]) -AC_ARG_VAR([$1], - [where to install ][$3][ (default: ${libdir}/${PACKAGE_TARNAME}/${PACKAGE_VERSION})]) -AS_VAR_IF([$1], [], [dnl - $1="\${libdir}/${PACKAGE_TARNAME}/${PACKAGE_VERSION}" - AC_MSG_RESULT([${$1} (default)]) -], [dnl - AC_MSG_RESULT([${$1} (set explictly)]) -]) - -dnl If you see this after 2022-12-31, please remove the following -dnl section, uncomment the one after, and send a pull request. -AC_MSG_CHECKING([for deprecated --with-$1 argument]) -AC_ARG_WITH([$1], [AS_HELP_STRING( - [--with-][$1][=], - [deprecated (use ][$1][= variable instead)])dnl -], [dnl - AS_VAR_IF([$1], [], [dnl - $1="$withval" - AC_MSG_RESULT([${$1} (from DEPRECATED --with-$1)]) - ], [dnl - AS_VAR_IF([$1], ["$withval"], [dnl - # Nothing to do, $1 has already been set to this value. - ], [dnl - AC_MSG_RESULT([${withval} (differs from $1 value)]) - AC_MSG_ERROR([ -If both the $1= variable and the DEPRECATED --with-$1= argument -are used, their value MUST be the same. -]) - ]) - ]) -], [dnl - AC_MSG_RESULT([not used (very good)]) -]) - -dnl If you see this after 2022-12-31, please uncomment the following -dnl section, remove the previous one, and send a pull request. -dnl -dnl AC_ARG_WITH([$1], [AS_HELP_STRING([--with-][$1][=], -dnl [DEPRECATED (use camlibdir= variable instead)])dnl -dnl ], [dnl -dnl AC_MSG_ERROR([ -dnl The --with-$1= argument is DEPRECATED. -dnl -dnl Use the $1= variable instead. -dnl ]) -dnl ]) - -AC_SUBST([$1]) - -AC_ARG_VAR([DEFAULT_][$2], - [default location to look for ][$3][ at runtime (if not given, use ${$1})]) -AC_MSG_CHECKING([default location to look for $3]) -AS_VAR_IF([DEFAULT_][$2], [], [dnl - DEFAULT_$2="\${$1}" - AC_MSG_RESULT([value of $1 (default)]) -], [dnl - AC_MSG_RESULT([${DEFAULT_$2} (set explicitly)]) -]) -AM_CPPFLAGS="$AM_CPPFLAGS -D$2=\\\"${DEFAULT_$2}\\\"" -])dnl -dnl -dnl -dnl #################################################################### -dnl -dnl Local Variables: -dnl mode: autoconf -dnl End: diff --git a/gphoto-m4/gp-gettext-hack.m4 b/gphoto-m4/gp-gettext-hack.m4 deleted file mode 100644 index 01ca927422..0000000000 --- a/gphoto-m4/gp-gettext-hack.m4 +++ /dev/null @@ -1,82 +0,0 @@ -dnl -dnl GP_GETTEXT_HACK -dnl -dnl gettext hack, originally designed for libexif, libgphoto2, and Co. -dnl This creates a po/Makevars file with adequate values if the -dnl po/Makevars.template is present. -dnl -dnl Example usage: -dnl GP_GETTEXT_HACK([${PACKAGE_TARNAME}-${LIBFOO_CURRENT}], -dnl [Copyright Holder], -dnl [foo-translation@example.org]) -dnl ALL_LINGUAS="de es fr" -dnl AM_GNU_GETTEXT_VERSION([0.14.1]) -dnl AM_GNU_GETTEXT([external]) -dnl AM_PO_SUBDIRS() -dnl AM_ICONV() -dnl GP_GETTEXT_FLAGS -dnl -dnl You can leave out the GP_GETTEXT_HACK parameters if you want to, -dnl GP_GETTEXT_HACK will try fall back to sensible values in that case: -dnl -dnl -AC_DEFUN([GP_GETTEXT_HACK], [dnl -AC_BEFORE([$0], [AM_GNU_GETTEXT])dnl -AC_BEFORE([$0], [AM_GNU_GETTEXT_VERSION])dnl -m4_if([$2],[],[$1="${PACKAGE_TARNAME}"],[$1="$2"]) -AC_DEFINE_UNQUOTED([$1], ["${$1}"], - [The gettext domain we're using]) -AC_SUBST([$1]) -sed_cmds="s|^DOMAIN.*|DOMAIN = ${$1}|" -m4_if([$3],[],[],[sed_cmds="${sed_cmds};s|^COPYRIGHT_HOLDER.*|COPYRIGHT_HOLDER = $3|"]) -m4_ifval([$4],[ -if test -n "$PACKAGE_BUGREPORT"; then - sed_mb="${PACKAGE_BUGREPORT}" -else - m4_pattern_allow([GP_GETTEXT_HACK])dnl - AC_MSG_ERROR([ -*** Your configure.{ac,in} is wrong. -*** Either define PACKAGE_BUGREPORT (by using the 4-parameter AC INIT syntax) -*** or give [GP_GETTEXT_HACK] the third parameter. -*** -]) -fi -],[ -sed_mb="$4" -]) -sed_cmds="${sed_cmds};s|^MSGID_BUGS_ADDRESS.*|MSGID_BUGS_ADDRESS = ${sed_mb}|" -# Not so sure whether this hack is all *that* evil... -AC_MSG_CHECKING([for po/Makevars requiring hack]) -if test -f "${srcdir}/po/Makevars.template"; then - sed "$sed_cmds" < "${srcdir}/po/Makevars.template" > "${srcdir}/po/Makevars" - AC_MSG_RESULT([yes, done.]) -else - AC_MSG_RESULT([no]) -fi -])dnl -dnl -dnl -dnl -AC_DEFUN([GP_GETTEXT_FLAGS], -[ -AC_REQUIRE([AM_GNU_GETTEXT]) -AC_REQUIRE([GP_CONFIG_INIT]) -if test "x${BUILD_INCLUDED_LIBINTL}" = "xyes"; then - AM_CFLAGS="${AM_CFLAGS} -I\$(top_srcdir)/intl" -fi -GP_CONFIG_MSG([Use translations],[${USE_NLS}]) -if test "x$USE_NLS" = "xyes" && test "${BUILD_INCLUDED_LIBINTL}"; then - GP_CONFIG_MSG([Use included libintl],[${BUILD_INCLUDED_LIBINTL}]) -fi -])dnl -dnl -dnl - -dnl Please do not remove this: -dnl filetype: 71ff3941-a5ae-4677-a369-d7cb01f92c81 -dnl I use this to find all the different instances of this file which -dnl are supposed to be synchronized. - -dnl Local Variables: -dnl mode: autoconf -dnl End: diff --git a/gphoto-m4/gp-internal-docs.m4 b/gphoto-m4/gp-internal-docs.m4 deleted file mode 100644 index 8593620aa5..0000000000 --- a/gphoto-m4/gp-internal-docs.m4 +++ /dev/null @@ -1,29 +0,0 @@ -dnl -dnl -dnl -AC_DEFUN([GP_INTERNAL_DOCS],[dnl -# Whether to enable the internal docs build. -# -# This takes quite some time due to the generation of lots of call -# graphs, so it is disabled by default. -set_enable_internal_docs=no -AC_ARG_ENABLE([internal-docs], [dnl -AS_HELP_STRING([--enable-internal-docs], -[Build internal code docs if doxygen available])], [dnl -dnl If either --enable-foo nor --disable-foo were given, execute this. - if test "x$enableval" = xno \ - || test "x$enableval" = xoff \ - || test "x$enableval" = xfalse; - then - set_enable_internal_docs=no - elif test "x$enableval" = xyes \ - || test "x$enableval" = xon \ - || test "x$enableval" = xtrue - then - set_enable_internal_docs=yes - fi -]) -AC_MSG_CHECKING([whether to create internal code docs]) -AC_MSG_RESULT([${set_enable_internal_docs}]) -AM_CONDITIONAL([ENABLE_INTERNAL_DOCS], [test "x${set_enable_internal_docs}" = "xyes"]) -])dnl diff --git a/gphoto-m4/gp-libjpeg.m4 b/gphoto-m4/gp-libjpeg.m4 deleted file mode 100644 index 41abf41689..0000000000 --- a/gphoto-m4/gp-libjpeg.m4 +++ /dev/null @@ -1,139 +0,0 @@ -dnl #################################################################### -dnl GP_LIBJPEG -dnl #################################################################### -dnl -dnl * If --without-jpeg or --with-jpeg=no is given, build without -dnl libjpeg support. -dnl * If not explicitly disabled by --without-jpeg, autodetect libjpeg. -dnl * If any of LIBJPEG_(CFLAGS|LIBS) is explicitly given, try -dnl compile+link using that. -dnl * If compile+link works, use that. -dnl * If compile+link fails, abort with error message. -dnl * If none of LIBJPEG_(CFLAGS|LIBS) are explicitly given, try -dnl pkg-config to find libjpeg.pc. -dnl * If libjpeg.pc has been found, try compile+link. -dnl * If compile+link works, use that. -dnl * If compile+link fails, build without libjpeg. -dnl * If libjpeg.pc has not been found, try default location. -dnl * If compile+link works, use that. -dnl * If compile+link fails, build without libjpeg. -dnl -AC_DEFUN([GP_LIBJPEG], [dnl -dnl -AC_MSG_CHECKING([whether to build with jpeg-turbo libjpeg]) -AC_ARG_WITH([jpeg], [dnl - AS_HELP_STRING([--without-jpeg], - [Build without libjpeg (default: with libjpeg)]) -], [dnl just keep the with-jpeg however it is given - AS_VAR_IF([with_jpeg], [no], [], [dnl - AC_MSG_ERROR([ -Unhandled value given to --with-jpeg / --without-jpeg: '$with_jpeg' -]) - ]) -], [dnl - with_jpeg=autodetect -]) -AC_MSG_RESULT([$with_jpeg]) -dnl -AS_VAR_IF([with_jpeg], [no], [dnl Not using libjpeg, so no checks are needed - # libjpeg explictly disabled from command line - GP_CONFIG_MSG([JPEG mangling support], - [no (disabled by --without-jpeg)]) -], [dnl - have_libjpeg=no - - AC_MSG_CHECKING([for jpeg-turbo libjpeg via variables]) - AS_IF([test "x$LIBJPEG_LIBS$LIBJPEG_CFLAGS" != x], [dnl - GP_LINK_LIBJPEG_IFELSE([ - AC_MSG_RESULT([found and works]) - have_libjpeg=yes - ], [dnl - AC_MSG_RESULT([found but fails to link]) - AC_MSG_ERROR([ -libjpeg not found despite LIBJPEG_CFLAGS and/or LIBJPEG_LIBS being set. -]) - ]) - ], [dnl - AC_MSG_RESULT([no]) - ]) - - AS_VAR_IF([have_libjpeg], [no], [dnl - PKG_CHECK_MODULES([LIBJPEG], [libjpeg], [dnl - AC_MSG_CHECKING([linking with jpeg-turbo libjpeg works]) - GP_LINK_LIBJPEG_IFELSE([dnl - have_libjpeg=yes - AC_MSG_RESULT([yes]) - ], [dnl - AC_MSG_RESULT([no]) - ]) - ], [dnl - LIBJPEG_LIBS="-ljpeg" - AC_MSG_CHECKING([for jpeg-turbo libjpeg at default location]) - GP_LINK_LIBJPEG_IFELSE([dnl - have_libjpeg=yes - AC_MSG_RESULT([yes]) - ], [dnl - AC_MSG_RESULT([no]) - AS_UNSET([LIBJPEG_LIBS]) - ]) - ]) - ]) - - AS_VAR_IF([have_libjpeg], [no], [dnl - GP_CONFIG_MSG([JPEG mangling support], - [${have_libjpeg} (requires jpeg-turbo libjpeg)]) - ], [dnl - AC_DEFINE([HAVE_LIBJPEG], [1], - [define if building with jpeg-turbo libjpeg]) - GP_CONFIG_MSG([JPEG mangling support], - [${have_libjpeg}]) - ]) -]) -])dnl -dnl -dnl -dnl #################################################################### -dnl GP_LINK_LIBJPEG_IFELSE([if-true], [if-false]) -dnl Make sure we can actually compile and link against libjpeg. -dnl #################################################################### -dnl -AC_DEFUN([GP_LINK_LIBJPEG_IFELSE], [dnl -AC_LANG_PUSH([C]) -saved_CPPFLAGS="$CPPFLAGS" -saved_LIBS="$LIBS" -CPPFLAGS="$CPPFLAGS $LIBJPEG_CFLAGS" -LIBS="$LIBS $LIBJPEG_LIBS" -AC_LINK_IFELSE([AC_LANG_SOURCE([[ -#include -#include -#include -/* jpeglib.h fails to include all required system headers, so jpeglib.h - * must be included after stddef.h (size_t) and stdio.h (FILE). - */ -#include - -int main(int argc, char **argv) -{ - j_decompress_ptr cinfo = NULL; - (void) argc; - (void) argv; - /* Running this will give a segfault */ - if (jpeg_start_decompress(cinfo)) { - printf("true\n"); - } else { - printf("false\n"); - } - return 0; -} -]])], [$1], [$2]) -CPPFLAGS="$saved_CPPFLAGS" -LIBS="$saved_LIBS" -AC_LANG_POP([C]) -])dnl -dnl -dnl -dnl #################################################################### -dnl -dnl Local Variables: -dnl mode: autoconf -dnl End: diff --git a/gphoto-m4/gp-libltdl.m4 b/gphoto-m4/gp-libltdl.m4 deleted file mode 100644 index adb8d1af35..0000000000 --- a/gphoto-m4/gp-libltdl.m4 +++ /dev/null @@ -1,118 +0,0 @@ -dnl Written by Hans Ulrich Niedermann -dnl LDFLAGS vs LIBS fix by Dan Nicholson -dnl -dnl #################################################################### -dnl GP_LIBLTDL -dnl #################################################################### -dnl -dnl We are using our own libltdl checks instead of AC_WITH_LTDL -dnl because we do not want to ship our own copy of libltdl. -dnl -dnl Look for external libltdl, not shipping internal libltdl. -AC_DEFUN([GP_LIBLTDL], [dnl -AC_ARG_VAR([LTDLINCL], [CFLAGS for compiling with libltdl]) -AC_ARG_VAR([LIBLTDL], [LIBS to add for linking against libltdl]) -dnl -have_libltdl=no -AC_MSG_CHECKING([for libltdl]) -AS_IF([test "x${LTDLINCL}${LIBLTDL}" != x], [dnl - AC_MSG_RESULT([variables given explicitly]) - - AC_MSG_CHECKING([LTDLINCL (given explicitly)]) - AC_MSG_RESULT([${LTDLINCL}]) - AC_MSG_CHECKING([LIBLTDL (given explictly)]) - AC_MSG_RESULT([${LIBLTDL}]) - - GP_LINK_LIBLTDL_IFELSE([dnl - have_libltdl=yes - ], [dnl - GP_MSG_ERROR_LIBLTDL - ]) -], [dnl - AC_MSG_RESULT([autodetecting]) - - AS_VAR_IF([have_libltdl], [no], [dnl Try default location - LTDLINCL="" - LIBLTDL="-lltdl" - GP_LINK_LIBLTDL_IFELSE([ - have_libltdl=yes - ], [dnl - AS_UNSET([LTDLINCL]) - AS_UNSET([LIBLTDL]) - ]) - ]) - - dnl FreeBSD packages install to /usr/local - dnl NetBSD packages install to /usr/pkg - for gp_prefix in /usr/local /usr/pkg; do - AS_VAR_IF([have_libltdl], [no], [dnl - LTDLINCL="-I${gp_prefix}/include" - LIBLTDL="-L${gp_prefix}/lib -lltdl" - GP_LINK_LIBLTDL_IFELSE([ - have_libltdl=yes - ], [dnl - AS_UNSET([LTDLINCL]) - AS_UNSET([LIBLTDL]) - ]) - ]) - done - - AS_VAR_IF([have_libltdl], [yes], [dnl - AC_MSG_CHECKING([LTDLINCL (autodetected)]) - AC_MSG_RESULT([${LTDLINCL}]) - AC_MSG_CHECKING([LIBLTDL (autodetected)]) - AC_MSG_RESULT([${LIBLTDL}]) - ], [dnl - GP_MSG_ERROR_LIBLTDL - ]) -]) -])dnl -dnl -dnl -dnl #################################################################### -dnl GP_MSG_ERROR_LIBLTDL -dnl #################################################################### -dnl -dnl Print the error message when libltdl has not been found to work. -dnl -AC_DEFUN([GP_MSG_ERROR_LIBLTDL], [dnl -AC_MSG_ERROR([ -${PACKAGE} requires libltdl (a part of libtool) - -Please make sure that the proper development package is installed -(may be called libltdl-dev, libtool-ltdl-devel, libltdl, etc.) and if -the autodetection fails, that the LTDLINCL and LIBLTDL variables are -set properly on the configure command line. -]) -])dnl -dnl -dnl -dnl #################################################################### -dnl GP_LINK_LIBLTDL_IFELSE -dnl #################################################################### -dnl -dnl Make sure we can actually compile and link against libltdl -dnl -AC_DEFUN([GP_LINK_LIBLTDL_IFELSE], [dnl -AC_LANG_PUSH([C]) -saved_CPPFLAGS="$CPPFLAGS" -saved_LIBS="$LIBS" -CPPFLAGS="$CPPFLAGS $LTDLINCL" -LIBS="$LIBS $LIBLTDL" -AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include /* for NULL */ -#include /* for lt_* */ -]], [[ - int ret = lt_dlforeachfile("/usr/lib:/usr/local/lib", NULL, NULL); - (void) ret; -]])], [$1], [$2]) -CPPFLAGS="$saved_CPPFLAGS" -LIBS="$saved_LIBS" -AC_LANG_POP([C]) -])dnl -dnl -dnl #################################################################### -dnl -dnl Local Variables: -dnl mode: autoconf -dnl End: diff --git a/gphoto-m4/gp-manual-docbook-xml.m4 b/gphoto-m4/gp-manual-docbook-xml.m4 deleted file mode 100644 index bec00c7fd1..0000000000 --- a/gphoto-m4/gp-manual-docbook-xml.m4 +++ /dev/null @@ -1,46 +0,0 @@ -dnl ------------------------------------------------------------------------ -dnl try to find xmlto (required for generation of man pages and html docs) -dnl ------------------------------------------------------------------------ -AC_DEFUN([GP_CHECK_DOCBOOK_XML], -[ - -AC_MSG_CHECKING([for XML catalogs]) -XML_CATALOG_FILES="`find /etc/xml /usr/share/xml /usr/share/sgml -type f \( -iname 'catalog.xml' -or -iname 'catalog' \) -print 2> /dev/null | while read file; do echo -n "$file "; done`" -if test "x$XML_CATALOG_FILES" = "x" -then - AC_MSG_RESULT([none found.]) -else - AC_MSG_RESULT([found ${XML_CATALOG_FILES}]) -fi -AC_SUBST(XML_CATALOG_FILES) - -#XML_DEBUG_CATALOG=0 -#AC_SUBST(XML_DEBUG_CATALOG) - -manual_msg="no (http://cyberelk.net/tim/xmlto/)" -try_xmlto=true -have_xmlto=false -AC_ARG_WITH(xmlto, [ --without-xmlto Don't use xmlto],[ - if test x$withval = xno; then - try_xmlto=false - fi]) -if $try_xmlto; then - AC_PATH_PROG(XMLTO,xmlto) - if test -n "${XMLTO}"; then - have_xmlto=true - manual_msg="yes" - PURE_XMLTO="$XMLTO" - if true || test "x$XML_CATALOG_FILES" = "x"; then - unset XML_CATALOG_FILES - XMLTO="${XMLTO} -m \$(top_srcdir)/src/xsl/custom.xsl" - else - XMLTO="env XML_CATALOG_FILES=\"${XML_CATALOG_FILES}\" ${XMLTO} -m ${top_srcdir}/src/xsl/custom.xsl" - fi - else - # in case anybody runs $(XMLTO) somewhere, we return false - XMLTO=false - fi -fi - -AM_CONDITIONAL(XMLTO, $have_xmlto) -]) diff --git a/gphoto-m4/gp-manual-documentation.m4 b/gphoto-m4/gp-manual-documentation.m4 deleted file mode 100644 index 717b34ea52..0000000000 --- a/gphoto-m4/gp-manual-documentation.m4 +++ /dev/null @@ -1,329 +0,0 @@ -dnl -dnl check where to install documentation -dnl -dnl determines documentation "root directory", i.e. the directory -dnl where all documentation will be placed in -dnl - -AC_DEFUN([GP_CHECK_DOCDIR], -[ - -AC_ARG_WITH(doc-dir, [ --with-doc-dir=PATH Where to install docs [default=autodetect]])dnl - -# check for the main ("root") documentation directory -AC_MSG_CHECKING([main docdir]) - -if test "x${with_doc_dir}" != "x" -then # docdir is given as parameter - docdir="${with_doc_dir}" - AC_MSG_RESULT([${docdir} (from parameter)]) -else # otherwise invent a docdir hopefully compatible with system policy - if test -d "/usr/share/doc" - then - maindocdir='${prefix}/share/doc' - AC_MSG_RESULT([${maindocdir} (FHS style)]) - elif test -d "/usr/doc" - then - maindocdir='${prefix}/doc' - AC_MSG_RESULT([${maindocdir} (old style)]) - else - maindocdir='${datadir}/doc' - AC_MSG_RESULT([${maindocdir} (default value)]) - fi - AC_MSG_CHECKING(package docdir) - # check whether to include package version into documentation path - # FIXME: doesn't work properly. - if ls -d /usr/{share/,}doc/*-[[]0-9[]]* > /dev/null 2>&1 - then - docdir="${maindocdir}/${PACKAGE}-${VERSION}" - AC_MSG_RESULT([${docdir} (redhat style)]) - else - docdir="${maindocdir}/${PACKAGE}" - AC_MSG_RESULT([${docdir} (default style)]) - fi -fi - -AC_SUBST(docdir) - -])dnl - -dnl Solaris hack for grep and tr -AC_DEFUN([GP_CHECK_TR], -[ -if test -n "`echo $host_os | grep '[sS]olaris'`"; then - TR=/usr/xpg4/bin/tr - GREP=/usr/xpg4/bin/grep -else - TR=tr - GREP=grep -fi -]) - -dnl -dnl check whether to build docs and where to: -dnl -dnl * determine presence of prerequisites (only gtk-doc for now) -dnl * determine destination directory for HTML files -dnl - -AC_DEFUN([GP_BUILD_DOCS], -[ -# doc dir has to be determined in advance -AC_REQUIRE([GP_CHECK_DOCDIR]) -AC_REQUIRE([GP_CHECK_GTK_DOC]) -AC_REQUIRE([GP_CHECK_FIG2DEV]) -AC_REQUIRE([GP_CHECK_DOCBOOK_XML]) -AC_REQUIRE([GP_CHECK_TR]) -AC_REQUIRE([GP_CHECK_PSTOIMG]) -AC_REQUIRE([GP_CHECK_DOT]) -AC_REQUIRE([GP_CHECK_W3M]) - -gphoto2xml='$(top_srcdir)/src/gphoto2.xml' -AC_SUBST(gphoto2xml) - -dnl --------------------------------------------------------------------------- -dnl Give the user the possibility to install documentation in -dnl user-defined locations. -dnl --------------------------------------------------------------------------- -AC_ARG_WITH(html-dir, [ --with-html-dir=PATH Where to install html docs [default=autodetect]]) -AC_MSG_CHECKING([for html dir]) -if test "x${with_html_dir}" = "x" ; then - htmldir="${docdir}/html" - AC_MSG_RESULT([${htmldir} (default)]) -else - htmldir="${with_html_dir}" - AC_MSG_RESULT([${htmldir} (from parameter)]) -fi -AC_SUBST(htmldir) - -AC_ARG_WITH(xhtml-dir, [ --with-xhtml-dir=PATH Where to install xhtml docs [default=autodetect]]) -AC_MSG_CHECKING([for xhtml dir]) -if test "x${with_xhtml_dir}" = "x" ; then - xhtmldir="${docdir}/xhtml" - AC_MSG_RESULT([${xhtmldir} (default)]) -else - xhtmldir="${with_xhtml_dir}" - AC_MSG_RESULT([${xhtmldir} (from parameter)]) -fi -AC_SUBST(xhtmldir) - -AC_ARG_WITH(html-nochunks-dir, [ --with-html-nochunks-dir=PATH Where to install html-nochunks docs [default=autodetect]]) -AC_MSG_CHECKING([for html-nochunks dir]) -if test "x${with_html_nochunks_dir}" = "x" ; then - htmlnochunksdir="${docdir}/html-nochunks" - AC_MSG_RESULT([${htmlnochunksdir} (default)]) -else - htmlnochunksdir="${with_html_nochunks_dir}" - AC_MSG_RESULT([${htmlnochunksdir} (from parameter)]) -fi -AC_SUBST(htmlnochunksdir) - -AC_ARG_WITH(xhtml-nochunks-dir, [ --with-xhtml-nochunks-dir=PATH Where to install xhtml-nochunks docs [default=autodetect]]) -AC_MSG_CHECKING([for xhtml-nochunks dir]) -if test "x${with_xhtml_nochunks_dir}" = "x" ; then - xhtmlnochunksdir="${docdir}/xhtml-nochunks" - AC_MSG_RESULT([${xhtmlnochunksdir} (default)]) -else - xhtmlnochunksdir="${with_xhtml_nochunks_dir}" - AC_MSG_RESULT([${xhtmlnochunksdir} (from parameter)]) -fi -AC_SUBST(xhtmlnochunksdir) - -AC_ARG_WITH(xml-dir, [ --with-xml-dir=PATH Where to install xml docs [default=autodetect]]) -AC_MSG_CHECKING([for xml dir]) -if test "x${with_xml_dir}" = "x" ; then - xmldir="${docdir}/xml" - AC_MSG_RESULT([${xmldir} (default)]) -else - xmldir="${with_xml_dir}" - AC_MSG_RESULT([${xmldir} (from parameter)]) -fi -AC_SUBST(xmldir) -xmlcssdir="${xmldir}/css" -AC_SUBST(xmlcssdir) - -AC_ARG_WITH(txt-dir, [ --with-txt-dir=PATH Where to install txt docs [default=autodetect]]) -AC_MSG_CHECKING([for txt dir]) -if test "x${with_txt_dir}" = "x" ; then - txtdir="${docdir}/txt" - AC_MSG_RESULT([${txtdir} (default)]) -else - txtdir="${with_txt_dir}" - AC_MSG_RESULT([${txtdir} (from parameter)]) -fi -AC_SUBST(txtdir) - -AC_ARG_WITH(man-dir, [ --with-man-dir=PATH Where to install man docs [default=autodetect]]) -AC_MSG_CHECKING([for man dir]) -if test "x${with_man_dir}" = "x" ; then - manmandir="${docdir}/man" - AC_MSG_RESULT([${manmandir} (default)]) -else - manmandir="${with_man_dir}" - AC_MSG_RESULT([${manmandir} (from parameter)]) -fi -AC_SUBST(manmandir) - -AC_ARG_WITH(pdf-dir, [ --with-pdf-dir=PATH Where to install pdf docs [default=autodetect]]) -AC_MSG_CHECKING([for pdf dir]) -if test "x${with_pdf_dir}" = "x" ; then - pdfdir="${docdir}/pdf" - AC_MSG_RESULT([${pdfdir} (default)]) -else - pdfdir="${with_pdf_dir}" - AC_MSG_RESULT([${pdfdir} (from parameter)]) -fi -AC_SUBST(pdfdir) - -AC_ARG_WITH(ps-dir, [ --with-ps-dir=PATH Where to install ps docs [default=autodetect]]) -AC_MSG_CHECKING([for ps dir]) -if test "x${with_ps_dir}" = "x" ; then - psdir="${docdir}/ps" - AC_MSG_RESULT([${psdir} (default)]) -else - psdir="${with_ps_dir}" - AC_MSG_RESULT([${psdir} (from parameter)]) -fi -AC_SUBST(psdir) - -AC_ARG_WITH(figure-dir, [ --with-figure-dir=PATH Where to install figures [default=autodetect]]) -AC_MSG_CHECKING([for figure dir]) -if test "x${with_figure_dir}" = "x" ; then - figuredir="${docdir}/figures" - AC_MSG_RESULT([${figuredir} (default)]) -else - figuredir="${with_figure_dir}" - AC_MSG_RESULT([${figuredir} (from parameter)]) -fi -AC_SUBST(figuredir) - -AC_ARG_WITH(screenshots-dir, [ --with-screenshots-dir=PATH Where to install screenshotss [default=autodetect]]) -AC_MSG_CHECKING([for screenshots dir]) -if test "x${with_screenshots_dir}" = "x" ; then - screenshotsdir="${docdir}/screenshots" - AC_MSG_RESULT([${screenshotsdir} (default)]) -else - screenshotsdir="${with_screenshots_dir}" - AC_MSG_RESULT([${screenshotsdir} (from parameter)]) -fi -AC_SUBST(screenshotsdir) -screenshotsgtkamdir="${screenshotsdir}/gtkam" -AC_SUBST(screenshotsgtkamdir) - -doc_formats_list='man html txt ps pdf' - -# initialize have_xmlto* to false -for i in $doc_formats_list; do - d=`echo $i | $TR A-Z a-z` - eval "have_xmlto$d=false" -done - -AC_MSG_CHECKING(checking doc formats) -AC_ARG_WITH(doc_formats, - [ --with-doc-formats= create doc with format in ; ] - [ 'all' build all doc formats; ] - [ possible formats are: ] - [ man, html, ps, pdf ], - doc_formats="$withval", doc_formats="man html txt") - -if test "$doc_formats" = "all"; then - doc_formats=$doc_formats_list -else - doc_formats=`echo $doc_formats | sed 's/,/ /g'` -fi - -# set have_xmlto* to true if requested and possible -if $have_xmlto; then - for i in $doc_formats; do - if test -n "`echo $doc_formats_list | $GREP -E \"(^| )$i( |\$)\"`"; then - eval "have_xmlto$i=true" - else - AC_ERROR(Unknown doc format $i!) - fi - done - AC_MSG_RESULT($doc_formats) -else - AC_MSG_RESULT([deactivated (requires xmlto)]) -fi - -# Make sure that xmltopdf actually works -if $have_xmltopdf; then - AC_MSG_CHECKING([whether pdf creation works]) - oldcwd="$(pwd)" - top_srcdir() { echo "$srcdir"; } - mkdir test-pdf - cd test-pdf - cat>test-db.xml< - - - Foo Title - - - Foo Chapter - - Foo bar blah blah - . - - - -EOF - ${PURE_XMLTO} pdf -o . test-db.xml --searchpath .. - if test -s test-db.pdf; then - AC_MSG_RESULT([yes, look at $(pwd)/test-db.pdf to verify]) - else - if $have_xmltopdf; then - AC_MSG_ERROR([PDF creation requested, but failed. See $(pwd) ...]) - else - AC_MSG_RESULT([no, but not requested]) - fi - fi - cd "$oldcwd" - unset top_srcdir -fi - -AM_CONDITIONAL(XMLTOHTML,$have_xmltohtml) -AM_CONDITIONAL(XMLTOMAN,$have_xmltoman) -AM_CONDITIONAL(XMLTOTXT,$have_xmltotxt) -AM_CONDITIONAL(XMLTOTXT2,$have_xmltotxt && $have_w3m) -AM_CONDITIONAL(XMLTOPDF,$have_xmltopdf) -AM_CONDITIONAL(XMLTOPS,$have_xmltops) - -# create list of supported formats -AC_MSG_CHECKING([for manual formats to re-create]) -xxx="" -manual_html="" -manual_pdf="" -manual_ps="" -if $have_xmltohtml; then - xxx="${xxx} html" -fi -if $have_xmltoman; then - xxx="${xxx} man" -fi -if $have_xmltopdf; then - xxx="${xxx} pdf" -fi -if $have_xmltops; then - xxx="${xxx} ps" -fi -if $have_xmltotxt; then - xxx="${xxx} txt" -fi -AC_SUBST(manual_html) -AC_SUBST(manual_pdf) -AC_SUBST(manual_ps) -AC_MSG_RESULT($xxx) - -if test "x$xxx" != "x" -then - if $have_fig2dev; then - fig_out="" - else - fig_out="out" - fi - manual_msg="in (${xxx} ) formats with${fig_out} figures" -fi - -])dnl diff --git a/gphoto-m4/gp-manual-fig2dev.m4 b/gphoto-m4/gp-manual-fig2dev.m4 deleted file mode 100644 index c61f2b7fe2..0000000000 --- a/gphoto-m4/gp-manual-fig2dev.m4 +++ /dev/null @@ -1,40 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl fig2dev: This program is needed for processing images. If not found, -dnl documentation can still be built, but without figures. -dnl --------------------------------------------------------------------------- -AC_DEFUN([GP_CHECK_FIG2DEV], -[ - -try_fig2dev=true -have_fig2dev=false -AC_ARG_WITH(fig2dev, [ --without-fig2dev Don't use fig2dev],[ - if test "x$withval" = "xno"; then - try_fig2dev=false - fi]) -if $try_fig2dev; then - AC_PATH_PROG(FIG2DEV,fig2dev) - if test -n "${FIG2DEV}"; then - have_fig2dev=true - fi -fi -if $have_fig2dev; then - AC_SUBST(FIG2DEV) - ${FIG2DEV} -L ps > /dev/null < /dev/null < /dev/null - if test $? != 0 || test ! -f tesseract.png; then - have_pstoimg=false - AC_MSG_RESULT(no) - else - AC_MSG_RESULT(yes) - fi - rm -f tesseract.png -fi -AM_CONDITIONAL(ENABLE_PSTOIMG, $have_pstoimg) - -]) diff --git a/gphoto-m4/gp-manual-w3m.m4 b/gphoto-m4/gp-manual-w3m.m4 deleted file mode 100644 index e563d7b902..0000000000 --- a/gphoto-m4/gp-manual-w3m.m4 +++ /dev/null @@ -1,45 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl w3m: This program is needed for converting HTML to text. -dnl --------------------------------------------------------------------------- -AC_DEFUN([GP_CHECK_W3M], -[ - -try_w3m=true -have_w3m=false -AC_ARG_WITH(w3m, [ --without-w3m Don't use w3m],[ - if test "x$withval" = "xno"; then - try_w3m=false - fi]) -if $try_w3m; then - AC_PATH_PROG(W3M,w3m) - if test -n "${W3M}"; then - have_w3m=true - fi -fi -if $have_w3m; then - AC_MSG_CHECKING([whether ${W3M} works]) - cat > html2text-test.xxxhtml 2> /dev/null < - -<h1>HTML2TEXT Test</h1> - - -

This is a test.

- - -EOF - ${W3M} -T text/html -cols 78 -dump html2text-test.xxxhtml > html2text-test.txt - if test $? != 0 || test ! -f html2text-test.txt || test ! -s html2text-test.txt - then - have_w3m=false - AC_MSG_RESULT([no (see http://www.w3m.org/ or http://w3m.sourceforge.net/ ...)]) - W3M=false - AC_SUBST(W3M) - else - AC_MSG_RESULT([yes]) - AC_SUBST(W3M) - fi -fi -AM_CONDITIONAL([HAVE_W3M], [$have_w3m]) - -]) diff --git a/gphoto-m4/gp-packaging.m4 b/gphoto-m4/gp-packaging.m4 deleted file mode 100644 index 6ea9e04720..0000000000 --- a/gphoto-m4/gp-packaging.m4 +++ /dev/null @@ -1,59 +0,0 @@ -AC_DEFUN([GPKG_CHECK_LINUX], -[ - # effective_target has to be determined in advance - AC_REQUIRE([AC_NEED_BYTEORDER_H]) - - is_linux=false - case "$effective_target" in - *linux*) - is_linux=true - ;; - esac - AM_CONDITIONAL([HAVE_LINUX], ["$is_linux"]) - - # required for docdir - # FIXME: Implicit dependency - # AC_REQUIRE(GP_CHECK_DOC_DIR) - - AC_ARG_WITH([hotplug-doc-dir], - [AS_HELP_STRING([--with-hotplug-doc-dir=PATH], - [Where to install hotplug scripts as docs [default=autodetect]])]) - - if "$is_linux"; then - AC_MSG_CHECKING([for hotplug doc dir]) - if test "x${with_hotplug_doc_dir}" != "x" - then # given as parameter - hotplugdocdir="${with_hotplug_doc_dir}" - AC_MSG_RESULT([${hotplugdocdir} (from parameter)]) - else # start at docdir - hotplugdocdir="${docdir}/linux-hotplug" - AC_MSG_RESULT([${hotplugdocdir} (default)]) - fi - else - hotplugdocdir="" - fi - - AC_ARG_WITH([hotplug-usermap-dir], - [AS_HELP_STRING([--with-hotplug-usermap-dir=PATH], - [Where to install hotplug scripts as docs [default=autodetect]])]) - - if "$is_linux"; then - AC_MSG_CHECKING([for hotplug usermap dir]) - if test "x${with_hotplug_usermap_dir}" != "x" - then # given as parameter - hotplugusermapdir="${with_hotplug_usermap_dir}" - AC_MSG_RESULT([${hotplugusermapdir} (from parameter)]) - else # start at docdir - hotplugusermapdir="${docdir}/linux-hotplug" - AC_MSG_RESULT([${hotplugusermapdir} (default)]) - fi - else - hotplugusermapdir="" - fi - - # Let us hope that automake does not create "" directories - # on non-Linux systems now. - AC_SUBST([hotplugdocdir]) - AC_SUBST([hotplugusermapdir]) -]) - diff --git a/gphoto-m4/gp-pedantic-compiler-flags.m4 b/gphoto-m4/gp-pedantic-compiler-flags.m4 deleted file mode 100644 index 11afa8982e..0000000000 --- a/gphoto-m4/gp-pedantic-compiler-flags.m4 +++ /dev/null @@ -1,131 +0,0 @@ -dnl #################################################################### -dnl GP_PEDANTIC_COMPILER_FLAGS & Co. -dnl #################################################################### -dnl -dnl -dnl #################################################################### -dnl GP_CONDITIONAL_COMPILE_FLAGS(FLAG_VAR, FLAGS) -dnl #################################################################### -AC_DEFUN([GP_CONDITIONAL_COMPILE_FLAGS], [dnl -dnl -# BEGIN $0($@) -dnl -m4_case([$1], - [CFLAGS], [AC_LANG_PUSH([C])], - [CXXFLAGS], [AC_LANG_PUSH([C++])], - [m4_fatal([wrong compiler flag])])dnl -dnl -saved_$1="${$1}" -AS_VAR_IF([$1], [], [$1="$2"], [$1="[$]{$1} $2"]) -AC_MSG_CHECKING([whether $1="[$]$1" compiles]) -AC_COMPILE_IFELSE([m4_case([$1], [CFLAGS], [dnl -AC_LANG_SOURCE([[ -#include -int main(int argc, char *argv[]) -{ - int i; - /* Use argc and argv to prevent warning about unused function params */ - for (i=0; i -int main(int argc, char *argv[]) -{ - int i; - /* Use argc and argv to prevent warning about unused function params */ - for (i=0; igp-empty-file-a -:>gp-empty-file-b -AS_IF([diff -u gp-empty-file-a gp-empty-file-b], [dnl - AC_MSG_RESULT([yes]) - DIFF_MAYBE_U="${DIFF} -u" -], [dnl - AC_MSG_RESULT([no]) - DIFF_MAYBE_U="${DIFF}" -]) -rm -f gp-empty-file-a gp-empty-file-b -AC_SUBST([DIFF_MAYBE_U]) -])dnl -dnl -dnl -dnl #################################################################### -dnl -dnl #################################################################### -m4_pattern_forbid([GP_PROG_EXPR])dnl -AC_DEFUN_ONCE([GP_PROG_EXPR],[dnl -AC_ARG_VAR([EXPR], [expr expression evaluation command])dnl -AC_PATH_PROG([EXPR], [expr])dnl -])dnl -dnl -dnl -dnl #################################################################### -dnl -dnl #################################################################### -m4_pattern_forbid([GP_PROG_SLEEP])dnl -AC_DEFUN_ONCE([GP_PROG_SLEEP],[dnl -AC_ARG_VAR([SLEEP], [sleep delay command])dnl -AC_MSG_CHECKING([whether to sleep]) -AS_VAR_IF([SLEEP], [no], [dnl - AC_MSG_RESULT([no]) -], [dnl - AC_MSG_RESULT([yes]) - AC_PATH_PROG([SLEEP], [sleep])dnl -])dnl -])dnl -dnl -dnl -dnl #################################################################### -dnl -dnl #################################################################### -m4_pattern_forbid([GP_PROG_SORT])dnl -AC_DEFUN_ONCE([GP_PROG_SORT],[dnl -AC_ARG_VAR([SORT], [sort text file line sorting command])dnl -AC_PATH_PROG([SORT], [sort])dnl -])dnl -dnl -dnl -dnl #################################################################### -dnl -dnl #################################################################### -m4_pattern_forbid([^GP_PROG_TR\(])dnl -m4_pattern_forbid([^GP_PROG_TR$])dnl -AC_DEFUN_ONCE([GP_PROG_TR],[dnl -AC_ARG_VAR([TR], [tr string character translation command])dnl -AC_PATH_PROG([TR], [tr])dnl -])dnl -dnl -dnl -dnl #################################################################### -dnl -dnl #################################################################### -m4_pattern_forbid([^GP_PROG_UNIQ\(])dnl -m4_pattern_forbid([^GP_PROG_UNIQ$])dnl -AC_DEFUN_ONCE([GP_PROG_UNIQ],[dnl -AC_ARG_VAR([UNIQ], [uniq sorted file uniquification command])dnl -AC_PATH_PROG([UNIQ], [uniq])dnl -])dnl -dnl -dnl -dnl #################################################################### -dnl -dnl Local Variables: -dnl mode: autoconf -dnl End: diff --git a/gphoto-m4/gp-references.m4 b/gphoto-m4/gp-references.m4 deleted file mode 100644 index e468c83fe9..0000000000 --- a/gphoto-m4/gp-references.m4 +++ /dev/null @@ -1,48 +0,0 @@ -dnl -dnl Define external references -dnl -dnl Define once, use many times. -dnl No more URLs and Mail addresses in translated strings and stuff. -dnl - -AC_DEFUN([GP_REF],[ -AC_SUBST([$1],["$2"]) -AC_DEFINE_UNQUOTED([$1],["$2"],[$3]) -]) - -AC_DEFUN([GP_REFERENCES], -[ - -GP_REF( [URL_GPHOTO_HOME], - [http://www.gphoto.org/], - [gphoto project home page])dnl - -GP_REF( [URL_GPHOTO_PROJECT], - [https://github.com/gphoto], - [gphoto github project page]) - -GP_REF( [URL_DIGICAM_LIST], - [http://gphoto.org/proj/libgphoto2/support.php], - [camera list with support status]) - -GP_REF( [URL_JPHOTO_HOME], - [http://jphoto.sourceforge.net/], - [jphoto home page]) - -GP_REF( [URL_USB_MASSSTORAGE], - [http://www.linux-usb.org/USB-guide/x498.html], - [information about using USB mass storage]) - -GP_REF( [MAIL_GPHOTO_DEVEL], - [], - [gphoto development mailing list]) - -GP_REF( [MAIL_GPHOTO_USER], - [], - [gphoto user mailing list]) - -GP_REF( [MAIL_GPHOTO_TRANSLATION], - [], - [gphoto translation mailing list]) - -]) diff --git a/gphoto-m4/gp-set.m4 b/gphoto-m4/gp-set.m4 deleted file mode 100644 index 444d71f764..0000000000 --- a/gphoto-m4/gp-set.m4 +++ /dev/null @@ -1,753 +0,0 @@ -dnl ###################################################################### -dnl Set operations using shell -dnl ###################################################################### -dnl -dnl This implements a set of set operations ('set' in the sense of -dnl 'set theory') as shell code for use at configure time. At m4 time -dnl (aka autoreconf time), there already exists a set of m4_set_* -dnl macros, but we cannot use those for user specified and -dnl autodetected changes at configure time. -dnl -dnl Not all set operations are implemented, but a few basic ones we -dnl need for gp-camlibs.m4 are. -dnl -dnl * Basic definitions: -dnl -dnl * GP_SET_DEFINE -dnl * GP_SET_UNDEFINE -dnl -dnl * Operations on sets: -dnl -dnl * GP_SET_ADD -dnl * GP_SET_ADD_ALL -dnl * GP_SET_REMOVE -dnl -dnl * GP_SET_CARDINALITY -dnl * GP_SET_DIFFERENCE -dnl * GP_SET_UNION -dnl -dnl * GP_SET_FOREACH -dnl -dnl * Conditionals: -dnl -dnl * GP_SET_CONTAINS_IFELSE -dnl * GP_SET_EMPTY_IFELSE -dnl * GP_SET_EQUAL_IFELSE -dnl -dnl * GP_SET_CLEAN_FILES -dnl -dnl * Internals and debugging help: -dnl -dnl * GP_SET_CANONICALIZE -dnl * GP_SET_DUMP_ALL -dnl * GP_SET_TESTSUITE -dnl -dnl * Fill shell variables with set contents: -dnl -dnl * GP_SET_DEBUG_VAR -dnl * GP_SET_SPACE_VAR -dnl -dnl * Output AC_MSG_* for GP_SET_* sets: -dnl -dnl * GP_SET_DEBUG_MSG -dnl * GP_SET_MSG_DEBUG_RESULT -dnl -dnl * GP_SET_SPACE_MSG -dnl * GP_SET_MSG_SPACE_RESULT -dnl -dnl ###################################################################### -dnl Remarks on usage and implementation of GP_SET_* -dnl -dnl * Sets are stored in text files, one element per line. An empty -dnl file is an empty set, and empty lines mean empty elements. -dnl Non-empty files not ending with a newline are undefined behaviour. -dnl -dnl * At this time, GP_SET_* macros work with set elements -dnl consisting of a limited set of characters, but the storage -dnl format allows for a future code cleanup to allow for handling -dnl more arbitrarily called elements. -dnl -dnl * Set names given to GP_SET_ macros must be defined at m4 -dnl (autoreconf) time, not at sh (configure) time. -dnl -dnl * Every set must be declared before use with GP_SET_DEFINE so we -dnl can create an empty file for them and keep track of the name of -dnl that file for cleaning up later. -dnl -dnl * Use GP_SET_CLEAN_FILES after your last set operations to remove -dnl all left over set files. -dnl -dnl * Set text files may contain set elements in any order, and in -dnl any number. There is no difference between a set text file -dnl containing the same line seven times and one which only contains -dnl it one time. -dnl -dnl * Some set operations require or work better on sorted files, so -dnl sometimes the implementation sorts the set text files. If you -dnl need a set text file sorted for some another reason, use -dnl GP_SET_CANONICALIZE([set-name]). -dnl -dnl * Some set GP_SET_* operations are implemented using shell -dnl functions to reduce the size of the emitted sh code. The goal -dnl is for the shell functions to be as compatible with different -dnl shells as possible, but if necessary, we can revert to avoiding -dnl shell functions and just emitting the same sh code 40 times. -dnl -dnl -dnl ###################################################################### -dnl -dnl FIXME: Do we need a sh-based replacement for ${COMM} if it is not present? -dnl FIXME: Do we need to stop using shell functions? -dnl -dnl -dnl ###################################################################### -dnl Try catching unexpanded macros in the output. -dnl ###################################################################### -m4_pattern_forbid([GP_SET_])dnl -m4_pattern_forbid([_GP_SET_])dnl -dnl -dnl -dnl ###################################################################### -dnl _GP_SET_INIT -dnl Called internally before any set operation. -dnl ###################################################################### -AC_DEFUN_ONCE([_GP_SET_INIT], [dnl -AC_REQUIRE([AC_PROG_GREP])dnl -AC_REQUIRE([GP_PROG_SORT])dnl -AC_REQUIRE([GP_PROG_UNIQ])dnl -m4_set_empty([gp_set_all_sets], [], [dnl - m4_set_foreach([gp_set_all_sets], [elt], [dnl - m4_errprintn(__file__: __line__:[ Set gp_set_all_sets contains element ]elt)dnl - ])dnl - m4_errprintn(__file__:__line__:[ Error: gp_set_all_sets already defined])dnl - dnl m4_exit(1)dnl -])dnl -])dnl -dnl -dnl -dnl ###################################################################### -dnl _GP_SET_FILENAME([set_name]) -dnl _GP_SET_FILENAME([set_name], [extra-extension]) -dnl Convert set name to set file name. If present, add the given -dnl extra-extension to the file name in some position. -dnl ###################################################################### -AC_DEFUN([_GP_SET_FILENAME], [dnl -[gp-set-file--][$1]m4_if([$2],[],[],[.$2])])dnl -dnl -dnl -dnl ###################################################################### -dnl _GP_SET_CHECK_INIT -dnl Implement the gp_set_shfn_check() shell function which checks that the -dnl given set exists and is in general working order. -dnl ###################################################################### -AC_DEFUN_ONCE([_GP_SET_CHECK_INIT], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -gp_set_shfn_check () -{ - if test -f "[$]1"; then :; else - AC_MSG_ERROR(["Error: set [$]1 has not been defined yet"]) - fi -} # gp_set_shfn_check -])dnl -dnl -dnl -dnl ###################################################################### -dnl _GP_SET_CHECK([set_name]) -dnl Check that the given set exists and is in general working order. -dnl Works by calling the gp_set_shfn_check() shell function. -dnl ###################################################################### -AC_DEFUN([_GP_SET_CHECK], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -AC_REQUIRE([_GP_SET_CHECK_INIT])dnl -gp_set_shfn_check "_GP_SET_FILENAME([$1])" -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_DUMP_ALL -dnl Dump all sets to stdout. Intended for helping with debugging. -dnl ###################################################################### -AC_DEFUN([GP_SET_DUMP_ALL], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -for setfile in gp-set-file--* -do - AS_ECHO(["Set file: ${setfile}"]) - ${SED} 's/^/ * <>/' "${setfile}" -done -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_DEFINE([set_name]) -dnl Declare a set of given name, initializing it to an empty set. -dnl Not a shell function, as the emitted shell code is shorter than -dnl calling a shell function. -dnl ###################################################################### -AC_DEFUN([GP_SET_DEFINE], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -m4_set_add([gp_set_all_sets], [$1])dnl -: > "_GP_SET_FILENAME([$1])" -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_UNDEFINE([set_name]) -dnl Undefine a set of given name, removing its file. -dnl Not a shell function, as the emitted shell code is shorter than -dnl calling a shell function. -dnl ###################################################################### -AC_DEFUN([GP_SET_UNDEFINE], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -_GP_SET_CHECK([$1])dnl -rm -f "_GP_SET_FILENAME([$1])" -])dnl -dnl -dnl -dnl ###################################################################### -dnl _GP_SET_ADD_INIT -dnl Implement the gp_set_shfn_set_add() shell function which adds a given -dnl element to a given set. -dnl ###################################################################### -AC_DEFUN_ONCE([_GP_SET_ADD_INIT], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -AC_REQUIRE([_GP_SET_CHECK_INIT])dnl -gp_set_shfn_set_add () -{ - gp_set_shfn_check "[$]1" - AS_ECHO(["[$]2"]) >> "[$]1" -} # gp_set_shfn_set_add -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_ADD([set_name], [element]) -dnl Add the given element to the given set. Implemented by calling the -dnl gp_set_shfn_set_add() shell function. -dnl Note: Unlike m4_set_add, this does not handle IF-UNIQ and IF-DUP -dnl macro parameters. -dnl ###################################################################### -AC_DEFUN([GP_SET_ADD], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -AC_REQUIRE([_GP_SET_ADD_INIT])dnl -gp_set_shfn_set_add "_GP_SET_FILENAME([$1])" "$2" -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_ADD_ALL([set_name], [element]...) -dnl Add the given elements to the given set, similar to m4_set_add_all. -dnl This can be very useful for initializing a GP_SET_* set from a -dnl m4_set_* in one go. -dnl Not a shell function, as the emitted shell code is shorter than -dnl calling a shell function. -dnl ###################################################################### -AC_DEFUN([GP_SET_ADD_ALL], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -_GP_SET_CHECK([$1])dnl -cat>>"_GP_SET_FILENAME([$1])"< "[$]1.tmp" - mv -f "[$]1.tmp" "[$]1" -} # gp_set_shfn_remove -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_REMOVE([set_name], [element]) -dnl Remove a given element from a given set. -dnl Calls the gp_set_shfn_remove() shell function for the actual work. -dnl ###################################################################### -AC_DEFUN([GP_SET_REMOVE], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -AC_REQUIRE([_GP_SET_REMOVE_INIT])dnl -gp_set_shfn_remove "_GP_SET_FILENAME([$1])" "$2" -])dnl -dnl -dnl -dnl ###################################################################### -dnl _GP_SET_UNION_INIT -dnl Define the gp_set_shfn_union() shell function which defines a -dnl result set as the union of 0 or more sets. -dnl ###################################################################### -AC_DEFUN_ONCE([_GP_SET_UNION_INIT], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -dnl This functions uses the shell builtin 'shift', so it needs to store -dnl the original $1 in a local variable. -gp_set_shfn_union () -{ - local result_fname="[$]1" - gp_set_shfn_check "[$]result_fname" - if shift; then - cat "[$]@" > "[$]{result_fname}.tmp" - mv -f "[$]{result_fname}.tmp" "[$]{result_fname}" - fi -} # gp_set_shfn_union -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_UNION([result_set], [setname]...) -dnl Define result_set as the union of 0 or more setnames. -dnl Calls the gp_set_shfn_union() shell function for the actual work. -dnl ###################################################################### -AC_DEFUN([GP_SET_UNION], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -AC_REQUIRE([_GP_SET_UNION_INIT])dnl -m4_set_add([gp_set_all_sets], [$1])dnl -gp_set_shfn_union m4_foreach([setname], [$@], [ "_GP_SET_FILENAME(setname)"]) -])dnl -dnl -dnl -dnl ###################################################################### -dnl _GP_SET_DIFFERENCE_INIT([result_set_fname], [set_fname]...) -dnl This uses comm(1), which is a POSIX command. We can always -dnl re-implement comm(1) with a lot of speed penalties in a bunch -dnl of nested sh loops if we run into a system which does not have -dnl comm(1) installed or where comm(1) does not work. -dnl ###################################################################### -AC_DEFUN_ONCE([_GP_SET_DIFFERENCE_INIT], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -AC_REQUIRE([_GP_SET_CHECK_INIT])dnl -AC_REQUIRE([_GP_SET_CANONICALIZE_INIT])dnl -AC_REQUIRE([GP_PROG_COMM])dnl -cat>confset_a.txt<confset_b.txt<confset_res_23.txt< confset_diff_23.txt], [dnl - AS_IF([${CMP} confset_diff_23.txt confset_res_23.txt > /dev/null 2>&1], [dnl - AC_MSG_RESULT([yes]) - rm -f confset_a.txt confset_b.txt confset_diff_23.txt confset_res_23.txt - ], [dnl - AC_MSG_RESULT([no (wrong result)]) - AC_MSG_ERROR([comm -23 must work for GP_SET_xyz difference calculations]) - ]) -], [dnl - AC_MSG_RESULT([no (does not run)]) - AC_MSG_ERROR([comm -23 must work for GP_SET_xyz difference calculations]) -]) -dnl This functions uses the shell builtin 'shift', so it needs to store -dnl the original $1 and $2 in local variables. -gp_set_shfn_difference () -{ - local result_fname="[$]1" - gp_set_shfn_check "[$]result_fname" - if shift; then - gp_set_shfn_canonicalize "[$]1" - cat "[$]1" > "[$]result_fname" - if shift; then - for gp_s - do - gp_set_shfn_canonicalize "[$]gp_s" - ${COMM} -23 "[$]{result_fname}" "[$]gp_s" > "[$]{result_fname}.tmp" - mv -f "[$]{result_fname}.tmp" "[$]{result_fname}" - done - fi - fi -} # gp_set_shfn_difference -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_DIFFERENCE([result_set], [setname]...) -dnl Define result_set as the first setname with the element of all -dnl the other sets removed from it. -dnl ###################################################################### -AC_DEFUN([GP_SET_DIFFERENCE], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -AC_REQUIRE([_GP_SET_DIFFERENCE_INIT])dnl -m4_set_add([gp_set_all_sets], [$1])dnl -gp_set_shfn_difference m4_foreach([setname], [$@], [ "_GP_SET_FILENAME(setname)"]) -])dnl -dnl -dnl -dnl ###################################################################### -dnl _GP_SET_CARDINALITY_INIT -dnl Define gp_set_shfn_cardinality() shell function which writes -dnl set cardinality to stdout. -dnl ###################################################################### -AC_DEFUN_ONCE([_GP_SET_CARDINALITY_INIT], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -gp_set_shfn_cardinality () -{ - gp_set_shfn_check "[$]1" - wc -l < "[$]1" -} # gp_set_shfn_cardinality -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_CARDINALITY([set_name]) -dnl Write set cardinality to stdout. -dnl ###################################################################### -AC_DEFUN([GP_SET_CARDINALITY], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -AC_REQUIRE([_GP_SET_CARDINALITY_INIT])dnl -gp_set_shfn_cardinality "_GP_SET_FILENAME([$1])"])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_EMPTY_IFELSE([set_name], [if-empty], [if-not-empty]) -dnl Run if-empty block or if-not-empty block, depending on whether -dnl the named set is empty or not. -dnl ###################################################################### -AC_DEFUN([GP_SET_EMPTY_IFELSE], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -_GP_SET_CHECK([$1])dnl -AS_IF([test "0" -eq "$(wc -l < "_GP_SET_FILENAME([$1])")"], m4_shift($@)) -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_EQUAL_IFELSE([set_a], [set_b], [if-equal], [if-not-equal]) -dnl When set_a and set_b are equal, run the if-equal block. Otherwise, -dnl run the if-not-equal block. -dnl ###################################################################### -AC_DEFUN([GP_SET_EQUAL_IFELSE], [dnl -gp_set_shfn_canonicalize "_GP_SET_FILENAME([$1])" -gp_set_shfn_canonicalize "_GP_SET_FILENAME([$2])" -AS_IF([${CMP} "_GP_SET_FILENAME([$1])" "_GP_SET_FILENAME([$2])" > /dev/null 2>&1], - m4_shift2($@)) -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_CONTAINS_IFELSE([set_name], [element], [yes-block], [no-block]) -dnl If set_name contains element, run the yes-block. Otherwise, -dnl run the no-block. -dnl ###################################################################### -AC_DEFUN([GP_SET_CONTAINS_IFELSE], [dnl -_GP_SET_CHECK([$1])dnl -AS_IF([test "0" -lt "$(${GREP} -c "^$2\$" < "_GP_SET_FILENAME([$1])")"], - m4_shift2($@)) -])dnl -dnl -dnl -dnl ###################################################################### -dnl _GP_SET_DEBUG_VAR_INIT -dnl Define gp_set_shfn_debug_var() shell function which sets a shell -dnl variable to a string representing a human readable form for of -dnl the given set. -dnl ###################################################################### -AC_DEFUN_ONCE([_GP_SET_DEBUG_VAR_INIT], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -gp_set_shfn_debug_var () -{ - gp_set_shfn_check "[$]1" - gp_set_shfn_canonicalize "[$]1" - local element - local gp_set_is_first=: - local gp_set_saved_ifs="$IFS" - IFS="" - while read element - do - if "$gp_set_is_first" - then - eval "[$]2=\"{ \"" - gp_set_is_first=false - else - eval "[$]2=\"\${[$]2}, \"" - fi - if test "x$element" = "x" - then - eval "[$]2=\"\${[$]2}''\"" - else - eval "[$]2=\"\${[$]2}'\$element'\"" - fi - done < "[$]1" - IFS="$gp_set_saved_ifs" - if "$gp_set_is_first" - then - eval "[$]2=\"{ }\"" - else - eval "[$]2=\"\${[$]2} }\"" - fi -} # gp_set_shfn_debug_var -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_DEBUG_VAR([set_name], [shell_var_name]) -dnl Set shell variable shell_var_name to a string representing a human -dnl readable for of the given set. -dnl ###################################################################### -AC_DEFUN([GP_SET_DEBUG_VAR], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -AC_REQUIRE([_GP_SET_DEBUG_VAR_INIT])dnl -gp_set_shfn_debug_var "_GP_SET_FILENAME([$1])" "$2" -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_DEBUG_MSG([set-name]) -dnl For a given set, expand to a simple pair of AC_MSG_CHECKING and -dnl AC_MSG_RESULT showing the GP_SET_DEBUG_VAR, mostly to help with -dnl debugging. -dnl ###################################################################### -AC_DEFUN([GP_SET_DEBUG_MSG], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -AC_MSG_CHECKING([value of set ]$1) -GP_SET_MSG_DEBUG_RESULT([$1]) -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_SPACE_MSG([set-name]) -dnl For a given set, expand to a simple pair of AC_MSG_CHECKING and -dnl AC_MSG_RESULT showing the GP_SET_SPACE_VAR, both to help with -dnl debugging gp-set.m4 and possibly for produnction use. -dnl ###################################################################### -AC_DEFUN([GP_SET_MSG], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -AC_MSG_CHECKING([value of set ]$1) -GP_SET_MSG_RESULT([$1]) -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_SPACE_VAR([set-name], [var-name]) -dnl ###################################################################### -AC_DEFUN([GP_SET_SPACE_VAR], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -$2="" -GP_SET_FOREACH([$1], [element], [dnl -AS_IF([test "x[$]$2" = "x"], [dnl - $2="[$]element" -], [dnl - $2="[$]$2 [$]element" -]) -]) -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_MSG_RESULT([set-name]) -dnl Shortcut for setting a shell variable to a space separated list of -dnl elements, and then expanding to AC_MSG_RESULT([$shellvar]). -dnl ###################################################################### -AC_DEFUN([GP_SET_MSG_RESULT], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -GP_SET_SPACE_VAR([$1], [gp_set_msg_result_var])dnl -AC_MSG_RESULT([${gp_set_msg_result_var}]) -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_MSG_DEBUG_RESULT([set-name]) -dnl Shortcut for setting a shell variable to a human readable list of -dnl elements, and then expanding to AC_MSG_RESULT([$shellvar]). -dnl ###################################################################### -AC_DEFUN([GP_SET_MSG_DEBUG_RESULT], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -GP_SET_DEBUG_VAR([$1], [gp_set_msg_result_var])dnl -AC_MSG_RESULT([${gp_set_msg_result_var}]) -])dnl -dnl -dnl -dnl ###################################################################### -dnl _GP_SET_CANONICALIZE_INIT -dnl Implement the gp_set_shfn_canonicalize() shell function. -dnl ###################################################################### -AC_DEFUN_ONCE([_GP_SET_CANONICALIZE_INIT], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -gp_set_shfn_canonicalize () -{ - gp_set_shfn_check "[$]1" - ( set -e - [$]{SORT} < "[$]1" | [$]{UNIQ} > "[$]1.tmp" - mv -f "[$]1.tmp" "[$]1"; ) -} # gp_set_shfn_canonicalize -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_CANONICALIZE([set_name]) -dnl Convert the set file for set_name into a canonical form. -dnl -dnl Implementation detail: Sorts the lines, and makes them unique. -dnl ###################################################################### -AC_DEFUN([GP_SET_CANONICALIZE], [dnl -AC_REQUIRE([_GP_SET_INIT])dnl -AC_REQUIRE([_GP_SET_CANONICALIZE_INIT])dnl -gp_set_shfn_canonicalize "_GP_SET_FILENAME([$1])" -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_FOREACH([set_name], [shell-var], [shell-block]) -dnl For each element in set_name, run the shell-block with the given -dnl shell variable set to every element in turn. -dnl ###################################################################### -AC_DEFUN([GP_SET_FOREACH], [dnl -_GP_SET_CHECK([$1])dnl -gp_set_saved_ifs="$IFS" -IFS="" -while read $2 -do - IFS="$gp_set_saved_ifs" - $3 -done < "_GP_SET_FILENAME([$1])" -IFS="$gp_set_saved_ifs" -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_CLEAN_FILES -dnl Remove all the files used for storing sets. Invoke this macro near -dnl the end of configure.ac after you have finished doing anything with -dnl GP_SET_* sets. -dnl ###################################################################### -AC_DEFUN([GP_SET_CLEAN_FILES], [dnl -AC_BEFORE([_GP_SET_INIT], [$0])dnl -AC_BEFORE([GP_SET_DEFINE], [$0])dnl -AC_BEFORE([GP_SET_UNDEFINE], [$0])dnl -AC_BEFORE([GP_SET_ADD], [$0])dnl -AC_BEFORE([GP_SET_ADD_ALL], [$0])dnl -AC_BEFORE([GP_SET_REMOVE], [$0])dnl -AC_BEFORE([GP_SET_EMPTY_IFELSE], [$0])dnl -AC_BEFORE([GP_SET_EQUAL_IFELSE], [$0])dnl -AC_BEFORE([GP_SET_CONTAINS_IFELSE], [$0])dnl -AC_BEFORE([GP_SET_DEBUG_VAR], [$0])dnl -AC_BEFORE([GP_SET_SPACE_VAR], [$0])dnl -dnl -dnl GP_SET_DUMP_ALL()dnl -dnl -dnl m4_set_foreach([gp_set_all_sets], [set_name], [dnl -dnl AS_ECHO(["Set defined somewhere: set_name"]) -dnl ])dnl -dnl -[rm -f]m4_set_foreach([gp_set_all_sets], [setname], - [ "_GP_SET_FILENAME(setname)"])dnl -])dnl -dnl -dnl -dnl ###################################################################### -dnl GP_SET_TESTSUITE() -dnl Does a number of tests for the GP_SET_* macros. -dnl -dnl Should be mostly useful while debugging gp-set.m4 itself. -dnl ###################################################################### -AC_DEFUN([GP_SET_TESTSUITE], [dnl -# BEGIN $0 -_GP_SET_INIT - -GP_SET_DEFINE([foo]) -GP_SET_DEFINE([bar]) -GP_SET_DEFINE([foobar]) -GP_SET_DEFINE([everything]) - -GP_SET_DEBUG_MSG([foo]) - -GP_SET_DEFINE([bax]) -GP_SET_UNDEFINE([bax]) - -GP_SET_UNDEFINE([bar]) -GP_SET_DEFINE([bar]) - -dnl GP_SET_ADD([moo], [meh]) -GP_SET_ADD_ALL([everything], [foo], [bar], [bar ], [bla]) - -GP_SET_DUMP_ALL - -m4_set_add_all([m4testset], [a], [b c], [d e], [f], [g]) -AC_MSG_CHECKING([for value of m4 testset]) -AC_MSG_RESULT([m4_set_contents([m4testset], [, ])]) - -GP_SET_ADD_ALL([everything]m4_set_listc([m4testset])) - -GP_SET_DUMP_ALL - -GP_SET_ADD([foo], [barfoo]) -GP_SET_ADD([foo], [foobar]) -GP_SET_ADD([foo], [fox]) -GP_SET_ADD([foo], [fux]) -GP_SET_ADD([foo], [fox]) -GP_SET_ADD([foo], []) -GP_SET_ADD([foo], [fox]) -GP_SET_ADD([foo], [barfoo]) -GP_SET_ADD([foo], [ barfoo]) -GP_SET_ADD([foo], ["barfoo "]) -GP_SET_ADD([foo], []) -GP_SET_REMOVE([foo], [fox]) -GP_SET_ADD([foo], [barfoo]) - -GP_SET_ADD([foobar], [bar]) -GP_SET_ADD([foobar], [foobar]) -GP_SET_ADD([foobar], [barfoo]) - -GP_SET_DEBUG_MSG([foo]) - -GP_SET_MSG([bar]) -GP_SET_MSG([foo]) -GP_SET_MSG([foobar]) -GP_SET_MSG([everything]) - -GP_SET_DEFINE([union]) -GP_SET_UNION([union], [foo], [bar], [foobar]) -AC_MSG_CHECKING([value of union of foo bar foobar]) -GP_SET_MSG_RESULT([union]) - -GP_SET_DEFINE([difference]) -GP_SET_DIFFERENCE([difference], [foo], [bar], [foobar]) -GP_SET_MSG([difference]) - -AC_MSG_CHECKING([whether sets foo and bar are equal]) -GP_SET_EQUAL_IFELSE([foo], [bar], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) - -AC_MSG_CHECKING([whether set foo is empty]) -GP_SET_EMPTY_IFELSE([foo], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) - -AC_MSG_CHECKING([whether set bar is empty]) -GP_SET_EMPTY_IFELSE([bar], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) - -AC_MSG_CHECKING([whether set foo contains element bar]) -GP_SET_CONTAINS_IFELSE([foo], [bar], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) - -AC_MSG_CHECKING([whether set foobar contains element bar]) -GP_SET_CONTAINS_IFELSE([foobar], [bar], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) - -GP_SET_FOREACH([foobar], [gp_set_var], [dnl - AC_MSG_CHECKING([foobar element]) - AC_MSG_RESULT([${gp_set_var}]) -])dnl -GP_SET_FOREACH([foobar], [gp_set_var], [dnl - AS_ECHO([" * element ${gp_set_var}"]) -])dnl -GP_SET_FOREACH([foobar], [gp_set_var], [echo " * ELEMENT ${gp_set_var}"])dnl -AS_ECHO(["Moo."]) - -GP_SET_DUMP_ALL -# END $0 -])dnl -dnl -dnl -dnl #################################################################### -dnl -dnl Local Variables: -dnl mode: autoconf -dnl End: diff --git a/gphoto-m4/gp-sleep.m4 b/gphoto-m4/gp-sleep.m4 deleted file mode 100644 index 2c40148924..0000000000 --- a/gphoto-m4/gp-sleep.m4 +++ /dev/null @@ -1,28 +0,0 @@ -dnl #################################################################### -dnl GP_SLEEP(delay_in_whole_seconds) -dnl If the SLEEP variable is set to "no" or empty or is unset, -dnl do not sleep. -dnl If the SLEEP variable is set to something else, run that something -dnl else with the given delay value. -dnl #################################################################### -AC_DEFUN_ONCE([_GP_SLEEP_INIT], [dnl -AC_REQUIRE([GP_PROG_SLEEP])dnl -AS_IF([test "x$SLEEP" != "x" && test "x$SLEEP" != "xno"], [dnl -gp_sleep=[$]SLEEP -], [dnl -gp_sleep=: -]) -])dnl -dnl -dnl -AC_DEFUN([GP_SLEEP], [dnl -AC_REQUIRE([_GP_SLEEP_INIT])dnl -$gp_sleep $1 -])dnl -dnl -dnl -dnl #################################################################### -dnl -dnl Local Variables: -dnl mode: autoconf -dnl End: diff --git a/gphoto-m4/gp-subpackage.m4 b/gphoto-m4/gp-subpackage.m4 deleted file mode 100644 index afabd8b175..0000000000 --- a/gphoto-m4/gp-subpackage.m4 +++ /dev/null @@ -1,5 +0,0 @@ -AC_DEFUN([GP_SUBPACKAGE], -[ -AC_ARG_VAR([enable_subpackage_][$1], [enable subpackage ][$1][ (true or false)]) -test "x${[enable_subpackage_][$1]}" = "x" && [enable_subpackage_][$1]=true -])dnl diff --git a/gphoto-m4/gp-udev.m4 b/gphoto-m4/gp-udev.m4 deleted file mode 100644 index ef5ecb52cb..0000000000 --- a/gphoto-m4/gp-udev.m4 +++ /dev/null @@ -1,9 +0,0 @@ -dnl Determines whether UDEV code should be compiled. -dnl $1 contains shell code that returns 0 if all other prerequisites (like -dnl libusb) are available. -AC_DEFUN([GP_UDEV],[dnl -if test "x${udevscriptdir}" = "x"; then udevscriptdir="\${libdir}/udev"; fi -AC_ARG_VAR([udevscriptdir],[Directory where udev scripts like check-ptp-camera will be installed]) -AC_SUBST([udevscriptdir]) -AM_CONDITIONAL([HAVE_UDEV],[if echo "$host"|grep -i linux >/dev/null ; then $1; fi ]) -])dnl diff --git a/gphoto-m4/gp-va-copy.m4 b/gphoto-m4/gp-va-copy.m4 deleted file mode 100644 index 8b1ac85c76..0000000000 --- a/gphoto-m4/gp-va-copy.m4 +++ /dev/null @@ -1,57 +0,0 @@ -dnl @synopsis GP_VA_COPY -dnl -dnl Checks whether one of these compiles and links: -dnl 1. va_copy() -dnl 2. __va_copy() -dnl 3. fallback -dnl -dnl In case of 1 or 2, AC_DEFINE(HAVE_VA_COPY). -dnl In case of 2, AC_DEFINE(va_copy,__va_copy) -dnl -dnl In code, use it like this -dnl #ifdef HAVE_VA_COPY -dnl ... code with va_copy ... -dnl #else -dnl ... code without va_copy or with error ... -dnl #endif -dnl -AC_DEFUN([GP_VA_COPY],[dnl -dnl -AC_CHECK_HEADER([stdarg.h],[],[ - 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]) - ]) -]) -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 -])dnl -dnl -dnl -dnl Local Variables: -dnl mode: autoconf -dnl End: diff --git a/gphoto-m4/gphoto-m4-sync b/gphoto-m4/gphoto-m4-sync deleted file mode 100755 index f324d4dfc4..0000000000 --- a/gphoto-m4/gphoto-m4-sync +++ /dev/null @@ -1,551 +0,0 @@ -#!/usr/bin/env python3 -# -# Usage: gphoto-m4-sync [--diff] ... -# gphoto-m4-sync --help -# -# The gphoto-m4-sync script helps with keeping track of which files in -# which gphoto-m4 tree copy differ from the original gphoto-m4 tree. -# -# In normal operation, gphoto-m4-sync will search for gphoto-m4 -# directories anywhere in the directory trees given on the command -# line and compare the gphoto-m4 tree from which gphoto-m4-sync was -# started to those other trees. -# -# When not given a --diff options, gphoto-m4-sync will print a human -# readable report on which files are different in which gphoto-m4 -# tree. -# -# Options: -# -# --diff Print a list of 'diff' command lines to compare -# the different files instead. Pipe into something like -# "| sh | less" to execute. -# -# --help Print this help message. -# -# Exit code: -# -# 0 when no differences have been found among the gphoto-m4 trees -# 1 when any differences have been found among the gphoto-m4 trees -# 2 any other error - - -######################################################################## - - -import hashlib -import os -import sys - - -######################################################################## - - -class File(object): - - def __init__(self, tree, fname): - self.tree = tree - self.fname = fname - self.fpath = os.path.join(tree.top, fname) - - self.statinfo = os.stat(self.fpath) - - m = hashlib.sha1() - m.update(open(self.fpath, 'rb').read()) - self.digest = m.hexdigest() - - def __repr__(self): - return 'File(%s,%s)' % (repr(self.fname), repr(self.digest)) - - def __str__(self): - return '%s %s' % (self.digest, self.fname) - - -######################################################################## - - -class BaseTree(object): - - def __init__(self, top): - self.top = os.path.abspath(top) - self._files = self.__scan_files() - - def __repr__(self): - return '%s(%s)[%s]' % (self.__class__.__name__, self.top, self._files) - - def __iter__(self): - return sorted(self._files).__iter__() - - def __getitem__(self, key): - return self._files[key] - - def __scan_files(self): - files = {} - for dirpath, dirnames, filenames in os.walk(self.top, topdown=True): - try: # do not descend into these directories - dirnames.remove('.git') - except ValueError: - pass - - for fname in filenames: - # Ignore a bunch of files - if fname[-1] == '~': - continue - if fname.startswith('.git'): - continue - if fname in ['Makefile.in', 'Makefile']: - continue - - abs_fname = os.path.join(dirpath, fname) - rel_fname = os.path.relpath(abs_fname, start=self.top) - - files[rel_fname] = File(self, rel_fname) - return files - - -######################################################################## - - -class GitTree(BaseTree): - - def __init__(self, top): - path = os.path.join(top, '.git') - if not os.path.exists(path): - raise AssertionError("File or directory does not exist: %s" % - repr(path)) - super(GitTree, self).__init__(top) - - -######################################################################## - - -class NotGitTree(BaseTree): - - def __init__(self, top): - path = os.path.join(top, '.git') - if os.path.exists(path): - raise AssertionError("File or directory does exist: %s" % - repr(path)) - super(NotGitTree, self).__init__(top) - - -######################################################################## - - -def scan_tree(top): - for dirpath, dirnames, filenames in os.walk(top): - if os.path.basename(dirpath) == 'gphoto-m4': - if 'gp-camlibs.m4' not in filenames: - continue - yield (dirpath, NotGitTree(dirpath)) - - -######################################################################## - - -def print_help(): - skip_line = True - skip_lines = ['#', '# '] - for line in open(__file__, 'r'): - if line[-1] == '\n': - line = line[:-1] - - if line.startswith('#!'): - continue - elif skip_line and (line in skip_lines): - continue - elif skip_line and (line not in skip_lines): - skip_line = False - elif line == '': - break - - if not skip_line: - print(line[2:]) - - -######################################################################## - - -class ResultTable(object): - - def __init__(self): - self.lines = {} - self.files_with_differences = 0 - self.differences = 0 - - def __setitem__(self, key, value): - assert(key not in self.lines) - self.lines[key] = value - if value.file_versions > 0: - self.files_with_differences += 1 - self.differences += value.file_versions - - def __getitem__(self, key): - assert(self.files_with_differences != None) - return self.lines[key] - - def items(self): - for k in sorted(self.lines.keys()): - v = self.lines[k] - yield k,v - - def close(self): - pass - - -######################################################################## - - -class ResultLine(object): - - def __init__(self, fname): - self.fname = fname - - self.__digest_map = {} - self.__digests = {} - self.__digest_list = None - - self.__flags = {} - - self.__fpaths = {} - - def set_digest(self, index, digest): - self.__digest_map[index] = digest - self.__digests[digest] = True - - def close(self, file_versions): - self.file_versions = file_versions - self.__digest_list = sorted(self.__digests.keys()) - assert(len(self.__digest_list) > 0) - if file_versions == 0: - # All files are equal, so we do not need different characters - # to distinguish different digest values - a space will do as - # well. - self.__digest_map = {} - - def get_digest(self, index): - if self.__digest_list == None: - raise RuntimeError("You need to call ResultLine.close() before Result_Line.get_digest()") - if index in self.__digest_map: - dig = self.__digest_map[index] - idx = self.__digest_list.index(dig) - return 'abcdefghijklmnopqrstuvwxyz'[idx] - else: - return ' ' - - def set_flag(self, index, flag, fpath): - self.__flags[index] = flag - self.__fpaths[index] = fpath - - def get_flag(self, index): - return self.__flags[index] - - def get_fpath(self, index): - return self.__fpaths[index] - - -######################################################################## - - -def cmd_print_report(result_table, all_files, treelist, trees): - # Enumerate list of trees - print("Trees (0 is the original tree):") - for i, tree in enumerate(treelist): - print(" %d. %s" % (i,tree)) - print() - - # Determine maximum length of file name - fn_maxlen = 0 - for fn in all_files: - if len(fn) > fn_maxlen: - fn_maxlen = len(fn) - - fmt = " %%-%ds " % fn_maxlen - print("File table:") - - # print table head - print(fmt % '', end='') - print((' {0:-^%d}' % (3*len(treelist)-1)).format('Tree')) - print(fmt % 'file name', end='') - for i, tree in enumerate(treelist): - print(' %2d' % i, end='') - print(' file diffs') - sep_line = (' ' + - '-' * (fn_maxlen + 1 + 3*len(treelist) + 2 + len('file diffs'))) - print(sep_line) - - # print table body - for fname in sorted(all_files): - result_line = result_table[fname] - print(fmt % fname, end='') - print(" %s%s" % (result_line.get_flag(0), - result_line.get_digest(0)), end='') - - for tree_idx, tree_top in enumerate(sorted(trees.keys()), start=1): - tree = trees[tree_top] - print(" %s%s" % (result_line.get_flag(tree_idx), - result_line.get_digest(tree_idx)), end='') - - if result_line.file_versions > 0: - print(' %3d' % result_line.file_versions) - else: - print(' ok') - print(sep_line) - print() - - print("Legend:") - legend = [ - ('N', 'new file'), - ('O', 'original file'), - ('/', 'no such file'), - ('=', 'same content as the original file'), - ('<', 'file with different content is younger than original file'), - ('>', 'file with different content is older than original file'), - ] - for ch, descr in legend: - print(" %s %s" % (ch, descr)) - print(" ") - print(" Small letters identify file contents: Same letter means same content.") - print() - - # Determine exit code - exit_code = 0 - if result_table.differences > 0: - exit_code = 1 - - # Print summary - print("Summary:") - if result_table.differences > 0: - print(" About %d difference(s) found in %d file(s)." % - (result_table.differences, result_table.files_with_differences)) - print(" ") - print(" Diff commands for comparing differing files can be obtained with the") - print(" '--diff' option.") - else: - print(" All gphoto-m4 trees are equal.") - - # Finally exit. - sys.exit(exit_code) - - -######################################################################## - - -def print_diff_commands(diff_commands): - print("#!/bin/sh") - print("#") - print("# This file has been autogenerated by %s" % __file__) - print("#") - print("# List of diff commands. You can pipe these into") - print("# | sh | colordiff | less -r '+/comparing '") - print("# or") - print("# | sh | less '+/^comparing '") - print("# or") - print("# | less") - for fname, orig_dig, other_dig, orig_fpath, other_fpath in diff_commands: - if orig_fpath: - orig_label = "%s (digest '%s')" % (orig_fpath, orig_dig) - else: - orig_fpath = '/dev/null' - orig_label = '(no such file)' - - if other_dig: - other_label = "%s (digest '%s')" % (other_fpath, other_dig) - else: - other_label = other_fpath - - print() - print("""echo 'comparing fname %s'""" % fname) - print("""diff -u --label "%s" %s --label "%s" %s""" - % (orig_label, orig_fpath, - other_label, other_fpath)) - - -######################################################################## - - -def gphoto_m4_sync(dir_list, print_diffs): - - # List all files in this clone of the `gphoto-m4` repository - orig_top = os.path.dirname(os.path.abspath(__file__)) - orig_tree = GitTree(orig_top) - - # For each `gphoto-m4` directory given on the command line, find - # all files. - trees = {} - for top in dir_list: - for dirpath, tree in scan_tree(os.path.abspath(top)): - trees[dirpath] = tree - - if len(trees) == 0: - print("No gphoto-m4 trees found in directories given on command line.") - sys.exit(2) - - - # Make a list of all files within all `gphoto-m4` trees - all_files = {} - for i in orig_tree: - all_files[i] = True - for tree in trees.values(): - for i in tree: - all_files[i] = True - all_files = sorted(all_files.keys()) - - # calculate table values - diff_params = [] - result_table = ResultTable() - for fname in sorted(all_files): - result_line = ResultLine(fname) - file_diffs = 0 - if fname in orig_tree: - result_line.set_flag(0, 'O', orig_tree[fname].fpath) - orig_dig = orig_tree[fname].digest - result_line.set_digest(0, orig_dig) - else: - result_line.set_flag(0, '/', None) - orig_dig = None - - comp_digs = {} - for tree_idx, tree_top in enumerate(sorted(trees.keys()), start=1): - tree = trees[tree_top] - if fname in tree: - dig = tree[fname].digest - flag = 'N' - if orig_dig == dig: - flag = '=' - elif orig_dig: - if tree[fname].statinfo.st_mtime > orig_tree[fname].statinfo.st_mtime: - flag = '>' - elif tree[fname].statinfo.st_mtime < orig_tree[fname].statinfo.st_mtime: - flag = '<' - result_line.set_digest(tree_idx, dig) - else: - flag = '/' - - if fname in tree: - _fpath = tree[fname].fpath - else: - _fpath = None - result_line.set_flag(tree_idx, flag, _fpath) - - if orig_dig: - if result_line.get_flag(tree_idx) != '=': - file_diffs += 1 - else: - if result_line.get_flag(tree_idx) != '/': - file_diffs += 1 - - result_line.close(file_diffs) - del file_diffs - result_table[fname] = result_line - result_table.close() - - if False: - # Diff all files - (some comparisons are unnecessary) - for fname in sorted(all_files): - result_line = result_table[fname] - orig_dig = result_line.get_digest(0) - orig_fpath = result_line.get_fpath(0) - for tree_idx, tree_top in enumerate(sorted(trees.keys()), start=1): - tree = trees[tree_top] - if result_line.get_flag(0) == 'O': - if result_line.get_flag(tree_idx) not in ['=', '/']: - diff_params.append((fname, - orig_fpath, orig_dig, - result_line.get_fpath(tree_idx), - result_line.get_digest(tree_idx))) - else: - if result_line.get_flag(tree_idx) != '/': - diff_params.append((fname, - None, None, - result_line.get_fpath(tree_idx), - None)) - - # Print report - if not print_diffs: - cmd_print_report(result_table, all_files, - [orig_top] + sorted(trees.keys()), - trees) - - # Print diffs - if print_diffs: - # print("# Calculate minimum set of diff commands:") - diff_commands = [] - for fname, result_line in result_table.items(): - line_flags = [] - if result_line.file_versions > 0: - # print("# -", fname) - all_trees = [orig_tree] + [ trees[k] for k in sorted(trees.keys()) ] - for idx_a in range(len(all_trees)): - tree_a = all_trees[idx_a] - dig_a = result_line.get_digest(idx_a) - if dig_a == ' ': - continue - # print("# tree_a", tree_a) - for idx_b in range(len(all_trees)): - tree_b = all_trees[idx_b] - dig_b = result_line.get_digest(idx_b) - if dig_a == dig_b: - continue - if dig_b == ' ': - continue - # print("# tree_b", tree_b) - flag = (fname, dig_a, dig_b) - rev_flag = (fname, dig_b, dig_a) - if flag in line_flags: - pass - elif rev_flag in line_flags: - pass - else: - line_flags.append(flag) - cmd = (fname, dig_a, dig_b, - tree_a[fname].fpath, tree_b[fname].fpath) - diff_commands.append(cmd) - break - del line_flags - # print("#") - - print_diff_commands(diff_commands) - sys.exit(0) - - -####################################################################### - - -def main(args): - if (args == []): - print_help() - sys.exit(0) - - arg_diff = False - for i, arg in enumerate(args): - if arg == '--': - i += 1 - break - elif arg == '--help': - print_help() - sys.exit(0) - elif arg == '--diff': - arg_diff = True - elif arg.startswith('--'): - raise ValueError("Unhandled command line option '%s'" % arg) - else: - assert(arg[:2] != '--') - break - - dir_list = args[i:] - if False: - print("Arguments:", dir_list) - print() - - gphoto_m4_sync(dir_list, arg_diff) - - -######################################################################## - - -if __name__ == '__main__': - main(sys.argv[1:]) - - -######################################################################## diff --git a/libgphoto2_port/Makefile.am b/libgphoto2_port/Makefile.am index 9170736a9c..35e1302c88 100644 --- a/libgphoto2_port/Makefile.am +++ b/libgphoto2_port/Makefile.am @@ -26,7 +26,9 @@ bin_SCRIPTS = gphoto2-port-config # The . stands for the current dir, i.e. the iolibs to build. # Make sure the iolibs are built before running tests on them. -SUBDIRS = po libgphoto2_port . tests doc gphoto-m4 +SUBDIRS = po libgphoto2_port . tests doc + +include gphoto-m4/Makefile-files ######################################################################## diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index e689da476c..8bb998933b 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -588,7 +588,6 @@ AC_CONFIG_FILES([ gphoto2-port-config tests/Makefile doc/Makefile - gphoto-m4/Makefile ]) AC_OUTPUT From a9569215461a70b35a9457272ca6c0dee2bcc448 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Sun, 31 Oct 2021 12:54:45 +0100 Subject: [PATCH 17/37] Add "mode: autoconf" line to all *.m4 files This helps with editing the *.m4 files in the proper editor mode. --- libgphoto2_port/gphoto-m4/gp-byteorder.m4 | 10 +++++++++- libgphoto2_port/gphoto-m4/gp-check-doxygen.m4 | 10 +++++++--- .../gphoto-m4/gp-check-shell-environment.m4 | 6 ++++++ libgphoto2_port/gphoto-m4/gp-documentation.m4 | 10 ++++++++-- libgphoto2_port/gphoto-m4/gp-internal-docs.m4 | 7 +++++++ libgphoto2_port/gphoto-m4/gp-manual-docbook-xml.m4 | 7 +++++++ libgphoto2_port/gphoto-m4/gp-manual-documentation.m4 | 7 +++++++ libgphoto2_port/gphoto-m4/gp-manual-fig2dev.m4 | 7 +++++++ libgphoto2_port/gphoto-m4/gp-manual-graphviz.m4 | 7 +++++++ libgphoto2_port/gphoto-m4/gp-manual-gtk-doc.m4 | 7 +++++++ libgphoto2_port/gphoto-m4/gp-manual-pstoimg.m4 | 7 +++++++ libgphoto2_port/gphoto-m4/gp-manual-w3m.m4 | 7 +++++++ libgphoto2_port/gphoto-m4/gp-packaging.m4 | 8 +++++++- libgphoto2_port/gphoto-m4/gp-references.m4 | 7 +++++++ libgphoto2_port/gphoto-m4/gp-subpackage.m4 | 7 +++++++ libgphoto2_port/gphoto-m4/gp-udev.m4 | 7 +++++++ 16 files changed, 114 insertions(+), 7 deletions(-) diff --git a/libgphoto2_port/gphoto-m4/gp-byteorder.m4 b/libgphoto2_port/gphoto-m4/gp-byteorder.m4 index 95d7435bf3..e6f9ccdc66 100644 --- a/libgphoto2_port/gphoto-m4/gp-byteorder.m4 +++ b/libgphoto2_port/gphoto-m4/gp-byteorder.m4 @@ -447,4 +447,12 @@ esac cat >> "$1" << EOF #endif /*__BYTEORDER_H*/ -EOF]) +EOF +])dnl +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-check-doxygen.m4 b/libgphoto2_port/gphoto-m4/gp-check-doxygen.m4 index 482ba1e649..591e142b4f 100644 --- a/libgphoto2_port/gphoto-m4/gp-check-doxygen.m4 +++ b/libgphoto2_port/gphoto-m4/gp-check-doxygen.m4 @@ -16,6 +16,10 @@ AC_SUBST([HTML_APIDOC_DIR], ["${PACKAGE_TARNAME}-api.html"]) AC_SUBST([DOXYGEN_OUTPUT_DIR], [doxygen-output]) AC_SUBST([HTML_APIDOC_INTERNALS_DIR], ["${PACKAGE_TARNAME}-internals.html"]) ])dnl - - - +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-check-shell-environment.m4 b/libgphoto2_port/gphoto-m4/gp-check-shell-environment.m4 index a3d6749b94..3a84c5e064 100644 --- a/libgphoto2_port/gphoto-m4/gp-check-shell-environment.m4 +++ b/libgphoto2_port/gphoto-m4/gp-check-shell-environment.m4 @@ -46,3 +46,9 @@ printenv | grep -E '^(LC_|LANG)' dnl ])dnl dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-documentation.m4 b/libgphoto2_port/gphoto-m4/gp-documentation.m4 index d2c46f8562..10060b7607 100644 --- a/libgphoto2_port/gphoto-m4/gp-documentation.m4 +++ b/libgphoto2_port/gphoto-m4/gp-documentation.m4 @@ -4,7 +4,7 @@ dnl dnl determines documentation "root directory", i.e. the directory dnl where all documentation will be placed in dnl - +dnl AC_DEFUN([GP_CHECK_DOC_DIR], [ AC_BEFORE([$0], [GP_BUILD_GTK_DOCS])dnl @@ -110,4 +110,10 @@ apidocdir="${htmldir}/api" AC_SUBST([apidocdir]) ])dnl - +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-internal-docs.m4 b/libgphoto2_port/gphoto-m4/gp-internal-docs.m4 index 8593620aa5..01c4768dbd 100644 --- a/libgphoto2_port/gphoto-m4/gp-internal-docs.m4 +++ b/libgphoto2_port/gphoto-m4/gp-internal-docs.m4 @@ -27,3 +27,10 @@ AC_MSG_CHECKING([whether to create internal code docs]) AC_MSG_RESULT([${set_enable_internal_docs}]) AM_CONDITIONAL([ENABLE_INTERNAL_DOCS], [test "x${set_enable_internal_docs}" = "xyes"]) ])dnl +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-manual-docbook-xml.m4 b/libgphoto2_port/gphoto-m4/gp-manual-docbook-xml.m4 index bec00c7fd1..4c2be1bc46 100644 --- a/libgphoto2_port/gphoto-m4/gp-manual-docbook-xml.m4 +++ b/libgphoto2_port/gphoto-m4/gp-manual-docbook-xml.m4 @@ -44,3 +44,10 @@ fi AM_CONDITIONAL(XMLTO, $have_xmlto) ]) +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-manual-documentation.m4 b/libgphoto2_port/gphoto-m4/gp-manual-documentation.m4 index 717b34ea52..d73649eaa6 100644 --- a/libgphoto2_port/gphoto-m4/gp-manual-documentation.m4 +++ b/libgphoto2_port/gphoto-m4/gp-manual-documentation.m4 @@ -327,3 +327,10 @@ then fi ])dnl +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-manual-fig2dev.m4 b/libgphoto2_port/gphoto-m4/gp-manual-fig2dev.m4 index c61f2b7fe2..0eee53360e 100644 --- a/libgphoto2_port/gphoto-m4/gp-manual-fig2dev.m4 +++ b/libgphoto2_port/gphoto-m4/gp-manual-fig2dev.m4 @@ -38,3 +38,10 @@ fi AM_CONDITIONAL(ENABLE_FIGURES, $have_fig2dev) ]) +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-manual-graphviz.m4 b/libgphoto2_port/gphoto-m4/gp-manual-graphviz.m4 index 08e162d494..e901ac2319 100644 --- a/libgphoto2_port/gphoto-m4/gp-manual-graphviz.m4 +++ b/libgphoto2_port/gphoto-m4/gp-manual-graphviz.m4 @@ -47,3 +47,10 @@ fi AM_CONDITIONAL(ENABLE_GRAPHS, $have_dot) ]) +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-manual-gtk-doc.m4 b/libgphoto2_port/gphoto-m4/gp-manual-gtk-doc.m4 index 12ffca0945..b07213b863 100644 --- a/libgphoto2_port/gphoto-m4/gp-manual-gtk-doc.m4 +++ b/libgphoto2_port/gphoto-m4/gp-manual-gtk-doc.m4 @@ -22,3 +22,10 @@ if $try_gtkdoc; then fi AM_CONDITIONAL(ENABLE_GTK_DOC, $have_gtkdoc) ]) +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-manual-pstoimg.m4 b/libgphoto2_port/gphoto-m4/gp-manual-pstoimg.m4 index 8d40690cdd..cef82d6e5a 100644 --- a/libgphoto2_port/gphoto-m4/gp-manual-pstoimg.m4 +++ b/libgphoto2_port/gphoto-m4/gp-manual-pstoimg.m4 @@ -34,3 +34,10 @@ fi AM_CONDITIONAL(ENABLE_PSTOIMG, $have_pstoimg) ]) +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-manual-w3m.m4 b/libgphoto2_port/gphoto-m4/gp-manual-w3m.m4 index e563d7b902..4006cba536 100644 --- a/libgphoto2_port/gphoto-m4/gp-manual-w3m.m4 +++ b/libgphoto2_port/gphoto-m4/gp-manual-w3m.m4 @@ -43,3 +43,10 @@ fi AM_CONDITIONAL([HAVE_W3M], [$have_w3m]) ]) +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-packaging.m4 b/libgphoto2_port/gphoto-m4/gp-packaging.m4 index 6ea9e04720..2587ce6343 100644 --- a/libgphoto2_port/gphoto-m4/gp-packaging.m4 +++ b/libgphoto2_port/gphoto-m4/gp-packaging.m4 @@ -56,4 +56,10 @@ AC_DEFUN([GPKG_CHECK_LINUX], AC_SUBST([hotplugdocdir]) AC_SUBST([hotplugusermapdir]) ]) - +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-references.m4 b/libgphoto2_port/gphoto-m4/gp-references.m4 index e468c83fe9..7f00d06b45 100644 --- a/libgphoto2_port/gphoto-m4/gp-references.m4 +++ b/libgphoto2_port/gphoto-m4/gp-references.m4 @@ -46,3 +46,10 @@ GP_REF( [MAIL_GPHOTO_TRANSLATION], [gphoto translation mailing list]) ]) +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-subpackage.m4 b/libgphoto2_port/gphoto-m4/gp-subpackage.m4 index afabd8b175..d0978f9973 100644 --- a/libgphoto2_port/gphoto-m4/gp-subpackage.m4 +++ b/libgphoto2_port/gphoto-m4/gp-subpackage.m4 @@ -3,3 +3,10 @@ AC_DEFUN([GP_SUBPACKAGE], AC_ARG_VAR([enable_subpackage_][$1], [enable subpackage ][$1][ (true or false)]) test "x${[enable_subpackage_][$1]}" = "x" && [enable_subpackage_][$1]=true ])dnl +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/libgphoto2_port/gphoto-m4/gp-udev.m4 b/libgphoto2_port/gphoto-m4/gp-udev.m4 index ef5ecb52cb..c6b70873c5 100644 --- a/libgphoto2_port/gphoto-m4/gp-udev.m4 +++ b/libgphoto2_port/gphoto-m4/gp-udev.m4 @@ -7,3 +7,10 @@ AC_ARG_VAR([udevscriptdir],[Directory where udev scripts like check-ptp-camera w AC_SUBST([udevscriptdir]) AM_CONDITIONAL([HAVE_UDEV],[if echo "$host"|grep -i linux >/dev/null ; then $1; fi ]) ])dnl +dnl +dnl +dnl #################################################################### +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: From ecfe6b3f591498e55a99245165d7998da98d40d6 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 23:50:09 +0200 Subject: [PATCH 18/37] indentation for readability --- configure.ac | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 115cc9f1d8..1ca434df51 100644 --- a/configure.ac +++ b/configure.ac @@ -390,11 +390,11 @@ dnl If sys/mman.h is present, check whether mmap requires the mman dnl library (see camlibs/st2205/st2205.c st2205_malloc_page_aligned()). MMAP_LIBS="" AS_VAR_IF([ac_cv_header_sys_mman_h], [yes], [dnl -gp_saved_LIBS="$LIBS" -LIBS="" -AC_SEARCH_LIBS([mmap], [mman]) -MMAP_LIBS="$LIBS" -LIBS="$gp_saved_LIBS" + gp_saved_LIBS="$LIBS" + LIBS="" + AC_SEARCH_LIBS([mmap], [mman]) + MMAP_LIBS="$LIBS" + LIBS="$gp_saved_LIBS" ])dnl AC_SUBST([MMAP_LIBS]) From 123051dff1299e6f6b6d579c8a26c39bc4b5e356 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Sun, 31 Oct 2021 08:51:40 +0100 Subject: [PATCH 19/37] Remove definition of localedir The "localedir" variable has been introduced by autoconf-2.59c. We are requiring at least autoconf-2.62, so we do not need to define and AC_SUBST "localedir" any more. --- configure.ac | 1 - libgphoto2_port/configure.ac | 1 - 2 files changed, 2 deletions(-) diff --git a/configure.ac b/configure.ac index 1ca434df51..d0493f3f75 100644 --- a/configure.ac +++ b/configure.ac @@ -265,7 +265,6 @@ AM_GNU_GETTEXT([external]) AM_ICONV() GP_GETTEXT_FLAGS() -AC_SUBST([localedir],["\$(datadir)/locale"]) AM_CPPFLAGS="$AM_CPPFLAGS -DLOCALEDIR=\\\"${localedir}\\\"" dnl FIXME: We have to make sure this works first diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index 8bb998933b..8fba65fa85 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -146,7 +146,6 @@ AM_GNU_GETTEXT([external]) AM_ICONV() GP_GETTEXT_FLAGS() -AC_SUBST([localedir],["\$(datadir)/locale"]) AM_CPPFLAGS="$AM_CPPFLAGS -DLOCALEDIR=\\\"${localedir}\\\"" AC_CHECK_FUNC([gettext], [gettext_without_libintl=true]) From f848fc0fe898cd6bbcbd52554e2e6a9c46ba601e Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Sat, 30 Oct 2021 17:06:26 +0200 Subject: [PATCH 20/37] gp-camlibs.m4: Fix GP_SLEEP invocation in in Gentoo hack Fix the GP_SLEEP invocation in the Gentoo hack which adds the ptp2 camlib if the only camlib requested is canon, as modern Canon cameras use the ptp2 camlib, not the canon camlib. --- libgphoto2_port/gphoto-m4/gp-camlibs.m4 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libgphoto2_port/gphoto-m4/gp-camlibs.m4 b/libgphoto2_port/gphoto-m4/gp-camlibs.m4 index a6b14ac189..e472f77ea2 100644 --- a/libgphoto2_port/gphoto-m4/gp-camlibs.m4 +++ b/libgphoto2_port/gphoto-m4/gp-camlibs.m4 @@ -240,8 +240,9 @@ AS_VAR_IF([gp_sh_with_camlibs], [canon], [dnl # Autoselecting the 'ptp2' driver in addition to the 'canon' # # driver to prevent unnecessary support requests. # #==============================================================# - GP_SLEEP([5]) -])])dnl +]) + GP_SLEEP([5]) +])dnl dnl set -x From 14d17da83e46d4050bdcbd2b2b54a16c88178a6b Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Sat, 30 Oct 2021 17:07:18 +0200 Subject: [PATCH 21/37] with-camlibs: grammar fix for standard set description --- libgphoto2_port/gphoto-m4/gp-camlibs.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgphoto2_port/gphoto-m4/gp-camlibs.m4 b/libgphoto2_port/gphoto-m4/gp-camlibs.m4 index e472f77ea2..5615d993f8 100644 --- a/libgphoto2_port/gphoto-m4/gp-camlibs.m4 +++ b/libgphoto2_port/gphoto-m4/gp-camlibs.m4 @@ -212,7 +212,7 @@ AC_ARG_WITH([camlibs],[AS_HELP_STRING( [Compile camera drivers (camlibs) in . ]dnl [Camlibs may be separated with commas. ]dnl [CAUTION: DRIVER NAMES AND CAMERA NAMES MAY DIFFER. ]dnl - ['standard' is the default is a standard set of camlibs: ]dnl + ['standard' is the default and is a standard set of camlibs: ]dnl m4_set_contents(gp_m4s_camlib_set_standard, [ ]). ['outdated' is a set of camlibs for very old cameras: ]dnl m4_set_contents(gp_m4s_camlib_set_outdated, [ ]).dnl From a1fcb3d790bcfac616cfe5724341909aec1d3a21 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Sat, 30 Oct 2021 17:07:30 +0200 Subject: [PATCH 22/37] with-camlibs: document "everything" set in the --help output --- libgphoto2_port/gphoto-m4/gp-camlibs.m4 | 1 + 1 file changed, 1 insertion(+) diff --git a/libgphoto2_port/gphoto-m4/gp-camlibs.m4 b/libgphoto2_port/gphoto-m4/gp-camlibs.m4 index 5615d993f8..f61a9777fd 100644 --- a/libgphoto2_port/gphoto-m4/gp-camlibs.m4 +++ b/libgphoto2_port/gphoto-m4/gp-camlibs.m4 @@ -216,6 +216,7 @@ AC_ARG_WITH([camlibs],[AS_HELP_STRING( m4_set_contents(gp_m4s_camlib_set_standard, [ ]). ['outdated' is a set of camlibs for very old cameras: ]dnl m4_set_contents(gp_m4s_camlib_set_outdated, [ ]).dnl + ['everything' is the set including every camlib. ]dnl [You can add or remove camlibs or camlib sets by appending ]dnl [them to the list with a + or - sign in front.])], [gp_sh_with_camlibs="${withval}"], From 24f6caaac44a3e18ad77a809814f01b9746575c7 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 19:34:54 +0200 Subject: [PATCH 23/37] Add build tool version comment This adds a list of tool releases with their respective release dates and why they are important for libgphoto2 (libexif requirements, notable bug fixes and features). --- configure.ac | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/configure.ac b/configure.ac index d0493f3f75..11a4d5f4d2 100644 --- a/configure.ac +++ b/configure.ac @@ -31,6 +31,26 @@ AM_INIT_AUTOMAKE([ subdir-objects ]) +dnl Notable tool releases and why they are important for us: +dnl +dnl autoconf 2012-04-25 2.69 (what libexif requires) +dnl autoconf 2006-04-12 2.59c (introduces localedir) +dnl +dnl automake 2013-12-24 1.14.1 (what libexif requires) +dnl automake 2013-06-20 1.14 (introduces %reldir%, implies AM_PROG_CC_C_O) +dnl automake 2013-05-15 1.13.2 (bugfix for handling multiple m4 macro dirs) +dnl automake 2012-04-25 1.12 (introduces AM_PROG_AR) +dnl automake 2009-05-17 1.11 (introduces AM_SILENT_RULES, pkglibexecdir) +dnl automake 2005-07-10 1.9.6 (fixes filename-length-max=99) +dnl automake 2004-07-28 1.9 (libgphoto2 requirement since 2.2.1.3 2006-09-28) +dnl +dnl gettext 2014-06-10 0.19.1 (allows building without updating *.po) +dnl gettext 2013-07-07 0.18.3 (what libexif requires) +dnl gettext 2012-12-08 0.18.2 +dnl gettext 2004-01-30 0.14.1 +dnl +dnl libtool 2014-10-27 2.4.3 +dnl libtool 2011-10-18 2.4.2 # Use the silent-rules feature when possible. m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])]) From 5a245ad19fa189eb0ac58b5251eb6511fd9393b0 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Sun, 31 Oct 2021 09:02:02 +0100 Subject: [PATCH 24/37] Require at least autoconf-2.69 This gives us a few more features and bug fixes and fewer workarounds. autoconf 2.69 is the same autoconf version requirement as libexif uses. autoconf 2.69 has been released 2012-04-25. If you ever need to build a post 2021 libgphoto2 from git on a system with pre 2.69 autoconf, you can always prepare a tarball using "make dist" on a system with autoconf 2.69 or later, and build that tarball on the older machine. --- configure.ac | 2 +- libgphoto2_port/configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 11a4d5f4d2..a8b3d3817c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ dnl Process this file with autoreconf to produce a configure script. -AC_PREREQ([2.62]) +AC_PREREQ([2.69]) dnl NOTE: Be version style _higher_ than the last release. dnl So lastversion.X.trunk for instance. Bump X if necessary. diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index 8fba65fa85..33dc8d6fb5 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -1,5 +1,5 @@ dnl Process this file with autoreconf to produce a configure script. -AC_PREREQ([2.62]) +AC_PREREQ([2.69]) AC_INIT([libgphoto2 port access library], [0.12.0], From be5ec8a192c157df6decc8ae0b11dee1a9019439 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Sun, 31 Oct 2021 09:00:29 +0100 Subject: [PATCH 25/37] Require at least automake 1.14 This gives us a few more features, and a few less conditionals conditionally reimplementing features added to automake before automake 1.14. automake 1.14 is almost the same automake version requirement as libexif uses (libexif requires 1.14.1). automake 1.14 has been released 2013-06-20. If you ever need to build a post 2021 libgphoto2 from git on a system with pre 1.14 automake, you can can always prepare a tarball using "make dist" on a system with automake 1.14 or later, and build that tarball on the older machine. --- configure.ac | 14 ++------------ libgphoto2_port/configure.ac | 17 ++++------------- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/configure.ac b/configure.ac index a8b3d3817c..6f36b482a0 100644 --- a/configure.ac +++ b/configure.ac @@ -14,17 +14,10 @@ AC_CONFIG_SRCDIR([libgphoto2/gphoto2-version.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([auto-m4]) AC_CONFIG_AUX_DIR([auto-aux]) -dnl Working around bug in automake <= 1.9.6: -dnl - Please do not add filename-length-max=99 here. -dnl - Otherwise "make distdir" will fail in gphoto-suite -dnl The generated Makefile rule fails to remove the absolute part at -dnl the beginning of the /path/to/buildroot/PACKAGE-VERSION/foo/bar -dnl before determining the string length. However, the only relevant -dnl string to determine the length of would be PACKAGE-VERSION/foo/bar AM_INIT_AUTOMAKE([ -Wall foreign - 1.9 + 1.14 dist-bzip2 dist-xz check-news @@ -52,8 +45,6 @@ dnl dnl libtool 2014-10-27 2.4.3 dnl libtool 2011-10-18 2.4.2 -# Use the silent-rules feature when possible. -m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])]) AM_SILENT_RULES([no]) @@ -118,8 +109,7 @@ AC_PROG_CC AC_PROG_CPP AC_PROG_CXX AC_PROG_INSTALL -AM_PROG_CC_C_O -m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) +AM_PROG_AR dnl Something with the sequences is not quite alright yet. dnl SED is supposed to be set in AC_LIBTOOL_SETUP, but the diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index 33dc8d6fb5..bdfa07ffe7 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -10,27 +10,19 @@ AC_CONFIG_SRCDIR([libgphoto2_port/gphoto2-port-version.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([auto-m4]) AC_CONFIG_AUX_DIR([auto-aux]) -dnl Working around bug in automake <= 1.9.6: -dnl - Please do not add filename-length-max=99 here. -dnl - Otherwise "make distdir" will fail in libgphoto2 -dnl The generated Makefile rule fails to remove the absolute part at -dnl the beginning of the /path/to/buildroot/PACKAGE-VERSION/foo/bar -dnl before determining the string length. However, the only relevant -dnl string to determine the length of would be PACKAGE-VERSION/foo/bar AM_INIT_AUTOMAKE([ -Wall gnu - 1.9 + 1.14 dist-bzip2 check-news subdir-objects ]) +AM_SILENT_RULES([no]) + AC_LANG([C]) -# Use the silent-rules feature when possible. -m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])]) -AM_SILENT_RULES([no]) dnl Flag all GP_ strings in result as error unless specifically allowed. @@ -79,8 +71,7 @@ dnl --------------------------------------------------------------------------- AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL -AM_PROG_CC_C_O -m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) +AM_PROG_AR dnl Something with the sequences is not quite alright yet. From 5142f1a16ffe0f2d8c9aab4643c16c5a09c62b4a Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 13 Oct 2021 00:23:44 +0200 Subject: [PATCH 26/37] 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 bdfa07ffe7..447294b7da 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -331,7 +331,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.]) @@ -339,7 +342,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 8b1ac85c76..e6e126e5b1 100644 --- a/libgphoto2_port/gphoto-m4/gp-va-copy.m4 +++ b/libgphoto2_port/gphoto-m4/gp-va-copy.m4 @@ -17,38 +17,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 e28f3e870b48b6f731d6a305672dd4fef769b275 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 13 Oct 2021 00:24:45 +0200 Subject: [PATCH 27/37] 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 ee9ef004bb..1532715053 100644 --- a/libgphoto2_port/gphoto-m4/gp-check-library.m4 +++ b/libgphoto2_port/gphoto-m4/gp-check-library.m4 @@ -342,7 +342,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 dfbdbf7ed1d909836e711c2e4a694d611aea09a1 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 13 Oct 2021 00:25:19 +0200 Subject: [PATCH 28/37] 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 447294b7da..308dab9047 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -220,14 +220,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 50dcc9ffc8ecf075dbb901bcd7566c7e3935f58e Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 19:43:19 +0200 Subject: [PATCH 29/37] Use same AC_LANG invocation in both configure.ac files --- configure.ac | 7 ++++--- libgphoto2_port/configure.ac | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 6f36b482a0..3777c172d7 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,10 @@ 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 @@ -195,9 +199,6 @@ dnl GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Wno-format-overflow]) dnl GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Wno-format-truncation]) dnl GP_CONDITIONAL_COMPILE_FLAGS([CFLAGS], [-Wno-stringop-truncation]) -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 308dab9047..d13aacc706 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -21,6 +21,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 22603b6ec446e019c1f51d49c054b26b0417b4af Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 13 Oct 2021 00:34:40 +0200 Subject: [PATCH 30/37] 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 3777c172d7..d97e53864c 100644 --- a/configure.ac +++ b/configure.ac @@ -203,10 +203,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" @@ -343,7 +343,7 @@ AC_SUBST([LIBWS232]) 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], @@ -483,9 +483,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]) @@ -605,8 +607,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 --------------------------------------------------------------------------- @@ -648,16 +653,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 +]) # --------------------------------------------------------------------------- @@ -690,7 +695,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 d13aacc706..62f59b448a 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -147,9 +147,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 --------------------------------------------------------------------------- @@ -292,35 +292,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 @@ -332,16 +328,20 @@ AC_ARG_ENABLE([$1], [AS_HELP_STRING([--disable-][$1], [do not use ][$1][ library]) ], [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" @@ -375,11 +375,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], @@ -388,10 +388,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]) @@ -442,18 +442,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 ], [], @@ -471,9 +473,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], @@ -485,9 +487,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], @@ -568,10 +570,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 e6f9ccdc66..85bb8dc460 100644 --- a/libgphoto2_port/gphoto-m4/gp-byteorder.m4 +++ b/libgphoto2_port/gphoto-m4/gp-byteorder.m4 @@ -40,9 +40,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) cat > "$1" << EOF From 2b6de49695bce233efbaea049f652e38f7c4ab2f Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 20:54:59 +0200 Subject: [PATCH 31/37] 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 d97e53864c..213b5f7163 100644 --- a/configure.ac +++ b/configure.ac @@ -56,10 +56,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 @@ -100,6 +96,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 --------------------------------------------------------------------------- @@ -244,9 +245,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]) @@ -353,7 +354,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 @@ -363,14 +364,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}]) AM_CONDITIONAL([HAVE_LIBCURL], [test -n "$have_LIBCURL" && test "X$have_LIBCURL" != "Xno"]) @@ -387,7 +388,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 62f59b448a..4ae68e81d6 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -100,10 +100,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]) @@ -315,7 +315,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 @@ -376,7 +376,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 @@ -389,7 +389,7 @@ AS_IF([$try_lockdev], [dnl ]) ]) ]) -GP_CONFIG_MSG([lockdev locking],[${lockdev_msg}]) +GP_CONFIG_MSG([lockdev locking], [${lockdev_msg}]) ])dnl $have_serial @@ -482,7 +482,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 1532715053..22c86b2a6d 100644 --- a/libgphoto2_port/gphoto-m4/gp-check-library.m4 +++ b/libgphoto2_port/gphoto-m4/gp-check-library.m4 @@ -401,14 +401,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 7b8b6aa8f6..4f6cb43d33 100644 --- a/libgphoto2_port/gphoto-m4/gp-check-popt.m4 +++ b/libgphoto2_port/gphoto-m4/gp-check-popt.m4 @@ -225,8 +225,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 cc1935182c..6e585de594 100644 --- a/libgphoto2_port/gphoto-m4/gp-config-msg.m4 +++ b/libgphoto2_port/gphoto-m4/gp-config-msg.m4 @@ -6,7 +6,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 @@ -17,11 +17,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 @@ -80,7 +80,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 10060b7607..594f421cdb 100644 --- a/libgphoto2_port/gphoto-m4/gp-documentation.m4 +++ b/libgphoto2_port/gphoto-m4/gp-documentation.m4 @@ -86,7 +86,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]) # --------------------------------------------------------------------------- From 3c3c6fac2a56a43f19f6492f8c6447c9138d52ca Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 20:57:38 +0200 Subject: [PATCH 32/37] GP_CHECK_LIBRARY arguments with spacing Spacing improves readability. --- configure.ac | 31 ++++++++++++++----------------- libgphoto2_port/configure.ac | 17 +++++++++-------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/configure.ac b/configure.ac index 213b5f7163..cc64536076 100644 --- a/configure.ac +++ b/configure.ac @@ -359,18 +359,16 @@ 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}]) AM_CONDITIONAL([HAVE_LIBCURL], @@ -383,11 +381,10 @@ 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 --------------------------------------------------------------------------- @@ -618,12 +615,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? @@ -648,7 +645,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 4ae68e81d6..23e42a507f 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -249,12 +249,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? @@ -279,7 +279,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 @@ -409,8 +409,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" @@ -433,9 +433,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 From 834ef05ffb3084a986a63481e94efc62c4bcc7ca Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 21:02:30 +0200 Subject: [PATCH 33/37] 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 cc64536076..4a782387d2 100644 --- a/configure.ac +++ b/configure.ac @@ -392,7 +392,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()). @@ -442,7 +454,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 23e42a507f..c611eb432d 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -161,11 +161,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 fcde662c9c43061cd8f271510b34c2165858389f Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 21:34:29 +0200 Subject: [PATCH 34/37] 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 4a782387d2..9906b15e44 100644 --- a/configure.ac +++ b/configure.ac @@ -431,7 +431,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 c611eb432d..1d7ec42ef0 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -241,9 +241,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 1039a4b16be55d08494c9dfce11d3fe9a5b3ff44 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Tue, 12 Oct 2021 21:55:16 +0200 Subject: [PATCH 35/37] 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 9906b15e44..314347b6b5 100644 --- a/configure.ac +++ b/configure.ac @@ -393,17 +393,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 @@ -435,20 +435,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 1d7ec42ef0..564282aa93 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -162,33 +162,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 @@ -243,12 +240,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 61eda82c8a6b0352f058a16a8da964faeab47134 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Sun, 31 Oct 2021 12:55:27 +0100 Subject: [PATCH 36/37] Invoke AC_PROG_SED before using ${SED} --- configure.ac | 6 +----- libgphoto2_port/configure.ac | 6 +----- libgphoto2_port/gphoto-m4/gp-set.m4 | 1 + 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 314347b6b5..3dee1952da 100644 --- a/configure.ac +++ b/configure.ac @@ -114,13 +114,9 @@ AC_PROG_CC AC_PROG_CPP AC_PROG_CXX AC_PROG_INSTALL +AC_PROG_SED AM_PROG_AR -dnl Something with the sequences is not quite alright yet. -dnl SED is supposed to be set in AC_LIBTOOL_SETUP, but the -dnl sequence seems to get mixed up. -SED=${SED-sed} - dnl If CXX is neither unset nor empty nor "no", presume we can compile dnl C++ sources. A C++ compiler is not required for libgphoto2 itself, diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index 564282aa93..4ab6535895 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -73,14 +73,10 @@ dnl --------------------------------------------------------------------------- AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL +AC_PROG_SED AM_PROG_AR -dnl Something with the sequences is not quite alright yet. -dnl SED is supposed to be set in AC_LIBTOOL_SETUP, but the -dnl sequence seems to get mixed up. -SED=${SED-sed} - dnl check for/set up libtool and libltdl dnl AC_DISABLE_STATIC dnl AC_DISABLE_SHARED diff --git a/libgphoto2_port/gphoto-m4/gp-set.m4 b/libgphoto2_port/gphoto-m4/gp-set.m4 index 444d71f764..f9a061ec2e 100644 --- a/libgphoto2_port/gphoto-m4/gp-set.m4 +++ b/libgphoto2_port/gphoto-m4/gp-set.m4 @@ -168,6 +168,7 @@ dnl GP_SET_DUMP_ALL dnl Dump all sets to stdout. Intended for helping with debugging. dnl ###################################################################### AC_DEFUN([GP_SET_DUMP_ALL], [dnl +AC_REQUIRE([AC_PROG_SED])dnl AC_REQUIRE([_GP_SET_INIT])dnl for setfile in gp-set-file--* do From 4a8e1eab74089d7eefb0e7d8bb9d937198303ecc Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Mon, 25 Oct 2021 20:07:09 +0200 Subject: [PATCH 37/37] Require at least libtool 2.4.2, use LT_INIT This gives us a few more features and fixes to rely on which are present in libtool 2.4.2 (released 2011-10-18), which is older than our autoconf, automake, and gettext requirements. Update the libtool initialization to use the more modern (modern in the sense of libtool 1.9b from 2004-08-29) LT_INIT macro. We still do not use LTDL_INIT() as that insists on us shipping libltdl sources in our release tarballs. --- configure.ac | 17 ++++++++--------- libgphoto2_port/configure.ac | 16 +++++++--------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index 3dee1952da..a74a7981bf 100644 --- a/configure.ac +++ b/configure.ac @@ -225,15 +225,14 @@ GP_VA_COPY dnl check for/set up libtool and libltdl -dnl AC_DISABLE_STATIC -dnl AC_DISABLE_SHARED -dnl AC_LIBLTDL_CONVENIENCE([libltdl]) -dnl AC_WITH_LTDL -dnl AC_LIB_LTDL -AC_DISABLE_STATIC -AC_LIBTOOL_WIN32_DLL -AC_LIBTOOL_DLOPEN -AC_PROG_LIBTOOL +LT_PREREQ([2.4.2]) +dnl Disable building static library, as no one uses it anyway. +LT_INIT([ + disable-static + dlopen + win32-dll +]) +dnl LTDL_INIT([external]) dnl We are using our own libltdl checks instead of AC_WITH_LTDL dnl because we do not want to ship our own copy of libltdl. diff --git a/libgphoto2_port/configure.ac b/libgphoto2_port/configure.ac index 4ab6535895..9c7536354f 100644 --- a/libgphoto2_port/configure.ac +++ b/libgphoto2_port/configure.ac @@ -78,16 +78,14 @@ AM_PROG_AR dnl check for/set up libtool and libltdl -dnl AC_DISABLE_STATIC -dnl AC_DISABLE_SHARED -dnl AC_LIBLTDL_CONVENIENCE([libltdl]) -dnl AC_WITH_LTDL -dnl AC_LIB_LTDL +LT_PREREQ([2.4.2]) dnl Disable building static library, as no one uses it anyway. -AC_DISABLE_STATIC -AC_LIBTOOL_WIN32_DLL -AC_LIBTOOL_DLOPEN -AC_PROG_LIBTOOL +LT_INIT([ + disable-static + dlopen + win32-dll +]) +dnl LTDL_INIT([external]) dnl We are using our own libltdl checks instead of AC_WITH_LTDL dnl because we do not want to ship our own copy of libltdl.