From ed495e4214e7e81e004bd48d49e4c56cad287101 Mon Sep 17 00:00:00 2001 From: ng0 Date: Sun, 26 May 2019 23:42:52 +0000 Subject: configure: improvements (mainly: detects libzbar with passing --with-libzbar). The m4 scripts so far originated from gst-plugins-bad. --- m4/as-auto-alt.m4 | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ m4/check-libheader.m4 | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 m4/as-auto-alt.m4 create mode 100644 m4/check-libheader.m4 (limited to 'm4') diff --git a/m4/as-auto-alt.m4 b/m4/as-auto-alt.m4 new file mode 100644 index 000000000..3f7920dd2 --- /dev/null +++ b/m4/as-auto-alt.m4 @@ -0,0 +1,50 @@ +dnl as-auto-alt.m4 0.0.2 +dnl autostars m4 macro for supplying alternate autotools versions to configure +dnl thomas@apestaart.org +dnl +dnl AS_AUTOTOOLS_ALTERNATE() +dnl +dnl supplies --with arguments for autoconf, autoheader, automake, aclocal + +AC_DEFUN([AS_AUTOTOOLS_ALTERNATE], +[ + dnl allow for different autoconf version + AC_ARG_WITH(autoconf, + AC_HELP_STRING([--with-autoconf], + [use a different autoconf for regeneration of Makefiles]), + [ + unset AUTOCONF + AM_MISSING_PROG(AUTOCONF, ${withval}) + AC_MSG_NOTICE([Using $AUTOCONF as autoconf]) + ]) + + dnl allow for different autoheader version + AC_ARG_WITH(autoheader, + AC_HELP_STRING([--with-autoheader], + [use a different autoheader for regeneration of Makefiles]), + [ + unset AUTOHEADER + AM_MISSING_PROG(AUTOHEADER, ${withval}) + AC_MSG_NOTICE([Using $AUTOHEADER as autoheader]) + ]) + + dnl allow for different automake version + AC_ARG_WITH(automake, + AC_HELP_STRING([--with-automake], + [use a different automake for regeneration of Makefiles]), + [ + unset AUTOMAKE + AM_MISSING_PROG(AUTOMAKE, ${withval}) + AC_MSG_NOTICE([Using $AUTOMAKE as automake]) + ]) + + dnl allow for different aclocal version + AC_ARG_WITH(aclocal, + AC_HELP_STRING([--with-aclocal], + [use a different aclocal for regeneration of Makefiles]), + [ + unset ACLOCAL + AM_MISSING_PROG(ACLOCAL, ${withval}) + AC_MSG_NOTICE([Using $ACLOCAL as aclocal]) + ]) +]) diff --git a/m4/check-libheader.m4 b/m4/check-libheader.m4 new file mode 100644 index 000000000..1e24d8a97 --- /dev/null +++ b/m4/check-libheader.m4 @@ -0,0 +1,40 @@ +dnl +dnl CHECK-LIBHEADER(FEATURE-NAME, LIB-NAME, LIB-FUNCTION, HEADER-NAME, +dnl ACTION-IF-FOUND, ACTION-IF-NOT-FOUND, +dnl EXTRA-LDFLAGS, EXTRA-CPPFLAGS) +dnl +dnl FEATURE-NAME - feature name; library and header files are treated +dnl as feature, which we look for +dnl LIB-NAME - library name as in AC_CHECK_LIB macro +dnl LIB-FUNCTION - library symbol as in AC_CHECK_LIB macro +dnl HEADER-NAME - header file name as in AC_CHECK_HEADER +dnl ACTION-IF-FOUND - when feature is found then execute given action +dnl ACTION-IF-NOT-FOUND - when feature is not found then execute given action +dnl EXTRA-LDFLAGS - extra linker flags (-L or -l) +dnl EXTRA-CPPFLAGS - extra C preprocessor flags, i.e. -I/usr/X11R6/include +dnl +dnl Based on GST_CHECK_LIBHEADER from gstreamer plugins 0.3.1. +dnl +AC_DEFUN([CHECK_LIBHEADER], +[ + AC_CHECK_LIB([$2], [$3], HAVE_[$1]=yes, HAVE_[$1]=no, [$7]) + check_libheader_feature_name=translit([$1], A-Z, a-z) + + if test "x$HAVE_[$1]" = "xyes"; then + check_libheader_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="[$8] $CPPFLAGS" + AC_CHECK_HEADER([$4], :, HAVE_[$1]=no) + CPPFLAGS=$check_libheader_save_CPPFLAGS + fi + + if test "x$HAVE_[$1]" = "xyes"; then + ifelse([$5], , :, [$5]) + AC_MSG_NOTICE($check_libheader_feature_name was found) + else + ifelse([$6], , :, [$6]) + AC_MSG_WARN($check_libheader_feature_name not found) + fi + AC_SUBST(HAVE_[$1]) +] +) + -- cgit v1.2.3