Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions build-aux/ax_require_prog.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_require_prog.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_REQUIRE_PROG([EXECUTABLE], [VARIABLE])
#
# DESCRIPTION
#
# Locates an installed binary program that is a prerequisite to continue.
# Uses AX_WITH_PROG under the hood, but follows up the check with an error
# if no executable could be located.
#
# Example usage:
#
# AX_REQUIRE_PROG(git-warp-time)
#
# Note: If the second argument is not provided, a default value of
# VARIABLE is automatically derived from the executable name by upper
# casing it and substituting any dashes or periods with underscores. In
# the example above the resulting precious variable would be
# GIT_WARP_TIME.
#
# LICENSE
#
# Copyright (c) 2021 Caleb Maclennan <caleb@alerque.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.

#serial 1

AC_DEFUN([AX_REQUIRE_PROG], [
AC_PREREQ([2.61])

pushdef([EXECUTABLE],$1)
pushdef([VARIABLE],m4_default($2,m4_toupper(m4_translit($1,-.,__))))

AX_WITH_PROG(VARIABLE,EXECUTABLE)
AS_IF([test "x$with_$1" != xno && test -z "$VARIABLE"], [
AC_MSG_ERROR([EXECUTABLE is required])
])

popdef([VARIABLE])
popdef([EXECUTABLE])
])
70 changes: 70 additions & 0 deletions build-aux/ax_with_prog.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_with_prog.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_WITH_PROG([VARIABLE],[program],[VALUE-IF-NOT-FOUND],[PATH])
#
# DESCRIPTION
#
# Locates an installed program binary, placing the result in the precious
# variable VARIABLE. Accepts a present VARIABLE, then --with-program, and
# failing that searches for program in the given path (which defaults to
# the system path). If program is found, VARIABLE is set to the full path
# of the binary; if it is not found VARIABLE is set to VALUE-IF-NOT-FOUND
# if provided, unchanged otherwise.
#
# A typical example could be the following one:
#
# AX_WITH_PROG(PERL,perl)
#
# NOTE: This macro is based upon the original AX_WITH_PYTHON macro from
# Dustin J. Mitchell <dustin@cs.uchicago.edu>.
#
# LICENSE
#
# Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
# Copyright (c) 2008 Dustin J. Mitchell <dustin@cs.uchicago.edu>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.

#serial 17

AC_DEFUN([AX_WITH_PROG],[
AC_PREREQ([2.61])

pushdef([VARIABLE],$1)
pushdef([EXECUTABLE],$2)
pushdef([VALUE_IF_NOT_FOUND],$3)
pushdef([PATH_PROG],$4)

AC_ARG_VAR(VARIABLE,Absolute path to EXECUTABLE executable)

AS_IF(test -z "$VARIABLE",[
AC_MSG_CHECKING(whether EXECUTABLE executable path has been provided)
AC_ARG_WITH(EXECUTABLE,AS_HELP_STRING([--with-EXECUTABLE=[[[PATH]]]],absolute path to EXECUTABLE executable), [
AS_IF([test "$withval" != yes && test "$withval" != no],[
VARIABLE="$withval"
AC_MSG_RESULT($VARIABLE)
],[
VARIABLE=""
AC_MSG_RESULT([no])
AS_IF([test "$withval" != no], [
AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[])
])
])
],[
AC_MSG_RESULT([no])
AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[])
])
])

popdef([PATH_PROG])
popdef([VALUE_IF_NOT_FOUND])
popdef([EXECUTABLE])
popdef([VARIABLE])
])
14 changes: 9 additions & 5 deletions build-aux/que_dist_checksums.m4
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
AC_DEFUN_ONCE([QUE_DIST_CHECKSUMS], [

AM_COND_IF([DEVELOPER_MODE], [
QUE_TRANSFORM_PACKAGE_NAME

AC_REQUIRE([AX_AM_MACROS])
AX_ADD_AM_MACRO([dnl
EXTRA_DIST += build-aux/que_dist_checksums.am
])dnl

QUE_PROGVAR([sha256sum])
QUE_PROGVAR([tee])
AM_COND_IF([DEVELOPER_MODE], [

QUE_TRANSFORM_PACKAGE_NAME
AX_REQUIRE_PROG([sha256sum])
AX_REQUIRE_PROG([tee])

AC_REQUIRE([AX_AM_MACROS])
AX_ADD_AM_MACRO([dnl
$(cat build-aux/que_dist_checksums.am)
])dnl
Expand Down
8 changes: 5 additions & 3 deletions build-aux/que_git_version.m4
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ AC_DEFUN_ONCE([QUE_GIT_VERSION], [
AM_CONDITIONAL([SOURCE_IS_ARCHIVE],
[test ! -d .git -a ! -f .tarball-version])

AC_PROG_AWK
AC_PROG_GREP
AC_REQUIRE([AC_PROG_AWK])
AC_REQUIRE([AC_PROG_GREP])

QUE_TRANSFORM_PACKAGE_NAME

AM_COND_IF([SOURCE_IS_DIST], [], [QUE_PROGVAR([cmp])])
AM_COND_IF([SOURCE_IS_DIST], [], [AX_REQUIRE_PROG([cmp])])

AC_REQUIRE([AX_AM_MACROS])
AX_ADD_AM_MACRO([dnl
EXTRA_DIST += build-aux/que_git_version.am

$(cat build-aux/que_git_version.am)
])dnl

Expand Down
5 changes: 0 additions & 5 deletions build-aux/que_progvar.m4

This file was deleted.

4 changes: 2 additions & 2 deletions build-aux/que_shell_completion_dirs.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ AC_DEFUN_ONCE([QUE_SHELL_COMPLETION_DIRS], [

QUE_TRANSFORM_PACKAGE_NAME

AC_PROG_SED

AC_ARG_WITH([bash-completion-dir],
AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
[Install the bash auto-completion script in this directory. @<:@default=yes@:>@]),
Expand Down Expand Up @@ -34,6 +32,8 @@ AC_DEFUN_ONCE([QUE_SHELL_COMPLETION_DIRS], [

AC_REQUIRE([AX_AM_MACROS])
AX_ADD_AM_MACRO([dnl
EXTRA_DIST += build-aux/que_shell_completion_dirs.am

$(cat build-aux/que_shell_completion_dirs.am)
])dnl

Expand Down
2 changes: 1 addition & 1 deletion build-aux/que_transform_package_name.m4
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

AC_DEFUN_ONCE([QUE_TRANSFORM_PACKAGE_NAME], [

AC_PROG_SED
AC_REQUIRE([AC_PROG_SED])

TRANSFORMED_PACKAGE_NAME="$(printf "$PACKAGE_NAME" | $SED -e "$(printf "$program_transform_name" | $SED -e 's/\$\$/\$/')")"
AC_SUBST([TRANSFORMED_PACKAGE_NAME])
Expand Down
10 changes: 5 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ QUE_DIST_CHECKSUMS
AC_PROG_GREP
AC_PROG_SED

QUE_PROGVAR([comm])
QUE_PROGVAR([git])
QUE_PROGVAR([wc])
AX_REQUIRE_PROG([comm])
AX_REQUIRE_PROG([git])
AX_REQUIRE_PROG([wc])

AC_ARG_WITH([deployment],
AS_HELP_STRING([--with-deployment],
Expand All @@ -58,7 +58,7 @@ AM_CONDITIONAL([ENABLE_MAN_PAGE],

AM_COND_IF([SOURCE_IS_GIT],
[AM_COND_IF([ENABLE_MAN_PAGE],
[QUE_PROGVAR([ronn])])
[AX_REQUIRE_PROG([ronn])])
])

AM_COND_IF([SOURCE_IS_GIT],
Expand All @@ -73,7 +73,7 @@ AM_CONDITIONAL([ENABLE_TESTS],
[test x"$enable_tests" != x"no"])

AM_COND_IF([ENABLE_TESTS], [
QUE_PROGVAR([prove])
AX_REQUIRE_PROG([prove])
AX_PROG_PERL_MODULES(Shell::Command, [],
AC_MSG_ERROR(Perl module required for testing not found))
AX_PROG_PERL_MODULES(Test::Most, [],
Expand Down
Loading