summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2020-01-20 06:40:20 +0100
committerHans Ulrich Niedermann <hun@n-dimensional.de>2020-01-20 06:53:37 +0100
commit0ecabc3090a30eacf5df1b12ac895fad293b1524 (patch)
tree897980c844931658a63d345d80e43e5f827f65a7
parenta83165705c98b8dd4ec7e19176170c2d32aa07c0 (diff)
downloadlibgphoto2-0ecabc3090a30eacf5df1b12ac895fad293b1524.tar.gz
Use CMP DIFF and SORT variables for defining cmp diff and sort programs
Define and use the CMP, DIFF, and SORT variables when we use the cmp, diff, and sort utilities in camlibs/Makefile.am. This allows testing the scripts and Makefile rules with different non-default implementations of these programs, such as e.g. from busybox.
-rw-r--r--camlibs/Makefile.am8
-rw-r--r--gphoto-m4/gp-camlibs.m424
2 files changed, 28 insertions, 4 deletions
diff --git a/camlibs/Makefile.am b/camlibs/Makefile.am
index 39e4ddb46..cf27d13e7 100644
--- a/camlibs/Makefile.am
+++ b/camlibs/Makefile.am
@@ -140,11 +140,11 @@ CLEANFILES += all-src-camlibs all-def-camlibs
all-local: Makefile
@:; \
(for x in $(EXTRA_LTLIBRARIES) template.la; do echo "$$(basename "$$x" ".la")"; done) \
- | sort > all-src-camlibs; \
+ | $(SORT) > all-src-camlibs; \
(for x in $(ALL_DEFINED_CAMLIBS); do echo "$$x"; done) \
- | sort > all-def-camlibs; \
- if cmp all-def-camlibs all-src-camlibs; then :; else \
- diff -u all-def-camlibs all-src-camlibs; \
+ | $(SORT) > all-def-camlibs; \
+ if $(CMP) all-def-camlibs all-src-camlibs; then :; else \
+ $(DIFF) -u all-def-camlibs all-src-camlibs; \
echo "List of camlibs in configure.ac is out of date."; \
echo "Have a developer update it using \"make -C camlibs print-camlibs\"."; \
exit 1; \
diff --git a/gphoto-m4/gp-camlibs.m4 b/gphoto-m4/gp-camlibs.m4
index a4731bc4a..7227e36ad 100644
--- a/gphoto-m4/gp-camlibs.m4
+++ b/gphoto-m4/gp-camlibs.m4
@@ -28,8 +28,32 @@ dnl The camlibs basedir parameter of GP_CAMLIBS_DEFINE is optional.
dnl
dnl ####################################################################
dnl
+AC_DEFUN([GP_PROG_CMP],[dnl
+AC_PATH_PROG([CMP],[cmp])dnl
+AC_ARG_VAR([CMP], [the implementation of cmp to use])dnl
+])dnl
+dnl
+dnl ####################################################################
+dnl
+AC_DEFUN([GP_PROG_DIFF],[dnl
+AC_PATH_PROG([DIFF],[diff])dnl
+AC_ARG_VAR([DIFF], [the implementation of diff to use])dnl
+])dnl
+dnl
+dnl ####################################################################
+dnl
+AC_DEFUN([GP_PROG_SORT],[dnl
+AC_PATH_PROG([SORT],[sort])dnl
+AC_ARG_VAR([SORT], [the implementation of sort to use])dnl
+])dnl
+dnl
+dnl ####################################################################
+dnl
AC_DEFUN([GP_CAMLIBS_INIT],[dnl
AC_BEFORE([$0],[GP_CAMLIB])dnl
+GP_PROG_CMP
+GP_PROG_DIFF
+GP_PROG_SORT
m4_define_default([gp_camlib_srcdir], [camlibs])dnl
m4_define_default([gp_camlibs], [])dnl
m4_define_default([gp_camlibs_unlisted], [])dnl