Add Autotools-based build infrastructure
This makes it easier to package ddclient, especially as enhancements are made such as unit tests or a man page. I chose GNU Autoconf and Automake mostly because I'm familiar with them, but also because I know they are well supported. Unfortunately they can be difficult to understand/maintain (especially Autoconf), so we may want to convert to something else later. Addresses #146, #147
This commit is contained in:
parent
bfdf9454f0
commit
8cbcecba99
12 changed files with 558 additions and 24 deletions
12
.gitignore
vendored
12
.gitignore
vendored
|
@ -3,3 +3,15 @@ release
|
||||||
.svn
|
.svn
|
||||||
.cvsignore
|
.cvsignore
|
||||||
*~
|
*~
|
||||||
|
/Makefile
|
||||||
|
/Makefile.in
|
||||||
|
/aclocal.m4
|
||||||
|
/autom4te.cache/
|
||||||
|
/build-aux/install-sh
|
||||||
|
/build-aux/missing
|
||||||
|
/config.log
|
||||||
|
/config.status
|
||||||
|
/configure
|
||||||
|
/ddclient
|
||||||
|
/ddclient-*.tar.gz
|
||||||
|
/ddclient.conf
|
||||||
|
|
|
@ -9,6 +9,10 @@ repository history](https://github.com/ddclient/ddclient/commits/master).
|
||||||
|
|
||||||
* Added support for OVH DynHost.
|
* Added support for OVH DynHost.
|
||||||
* Added support for ClouDNS.
|
* Added support for ClouDNS.
|
||||||
|
* Added a build system to make it easier for distributions to package
|
||||||
|
ddclient:
|
||||||
|
|
||||||
|
./autogen && ./configure && make && make install
|
||||||
|
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
|
|
||||||
|
|
58
Makefile.am
Normal file
58
Makefile.am
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
EXTRA_DIST = \
|
||||||
|
CONTRIBUTING.md \
|
||||||
|
COPYING \
|
||||||
|
COPYRIGHT \
|
||||||
|
ChangeLog.md \
|
||||||
|
README.cisco \
|
||||||
|
README.md \
|
||||||
|
README.ssl \
|
||||||
|
TODO \
|
||||||
|
UPGRADE \
|
||||||
|
autogen \
|
||||||
|
sample-ddclient-wrapper.sh \
|
||||||
|
sample-etc_cron.d_ddclient \
|
||||||
|
sample-etc_dhclient-exit-hooks \
|
||||||
|
sample-etc_dhcpc_dhcpcd-eth0.exe \
|
||||||
|
sample-etc_ppp_ip-up.local \
|
||||||
|
sample-etc_rc.d_init.d_ddclient \
|
||||||
|
sample-etc_rc.d_init.d_ddclient.alpine \
|
||||||
|
sample-etc_rc.d_init.d_ddclient.lsb \
|
||||||
|
sample-etc_rc.d_init.d_ddclient.redhat \
|
||||||
|
sample-etc_rc.d_init.d_ddclient.ubuntu \
|
||||||
|
sample-etc_systemd.service \
|
||||||
|
sample-get-ip-from-fritzbox
|
||||||
|
CLEANFILES =
|
||||||
|
|
||||||
|
# Command that replaces substitution variables with their values.
|
||||||
|
subst = sed \
|
||||||
|
-e 's|@PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \
|
||||||
|
-e 's|@PERL[@]|$(PERL)|g' \
|
||||||
|
-e 's|@localstatedir[@]|$(localstatedir)|g' \
|
||||||
|
-e 's|@runstatedir[@]|$(runstatedir)|g' \
|
||||||
|
-e 's|@sysconfdir[@]|$(sysconfdir)|g'
|
||||||
|
|
||||||
|
# Files that will be generated by passing their *.template file
|
||||||
|
# through $(subst).
|
||||||
|
subst_files = ddclient ddclient.conf
|
||||||
|
|
||||||
|
EXTRA_DIST += $(subst_files:=.template)
|
||||||
|
CLEANFILES += $(subst_files)
|
||||||
|
|
||||||
|
$(subst_files): Makefile
|
||||||
|
rm -f '$@' '$@'.tmp
|
||||||
|
in='$@'.template; \
|
||||||
|
test -f "$${in}" || in='$(srcdir)/'$${in}; \
|
||||||
|
$(subst) "$${in}" >'$@'.tmp && \
|
||||||
|
{ ! test -x "$${in}" || chmod +x '$@'.tmp; }
|
||||||
|
mv '$@'.tmp '$@'
|
||||||
|
|
||||||
|
ddclient: $(srcdir)/ddclient.template
|
||||||
|
ddclient.conf: $(srcdir)/ddclient.conf.template
|
||||||
|
|
||||||
|
bin_SCRIPTS = ddclient
|
||||||
|
|
||||||
|
sysconf_DATA = ddclient.conf
|
||||||
|
|
||||||
|
install-data-local:
|
||||||
|
$(MKDIR_P) '$(DESTDIR)$(localstatedir)'/cache/ddclient
|
48
README.md
48
README.md
|
@ -44,25 +44,47 @@ through github.com. Please check out http://ddclient.net
|
||||||
|
|
||||||
## REQUIREMENTS
|
## REQUIREMENTS
|
||||||
|
|
||||||
- one or more accounts from one of the dynamic DNS services
|
* An account from a supported dynamic DNS service provider
|
||||||
|
* Perl v5.10.1 or later
|
||||||
|
* `IO::Socket::SSL` perl library for ssl-support
|
||||||
|
* `JSON::PP` perl library for JSON support
|
||||||
|
* `IO::Socket:INET6` perl library for ipv6-support
|
||||||
|
* Linux, macOS, or any other Unix-ish system
|
||||||
|
* An implementation of `make` (such as [GNU
|
||||||
|
Make](https://www.gnu.org/software/make/))
|
||||||
|
* If you are installing from a clone of the Git repository, you will
|
||||||
|
also need [GNU Autoconf](https://www.gnu.org/software/autoconf/)
|
||||||
|
and [GNU Automake](https://www.gnu.org/software/automake/).
|
||||||
|
|
||||||
- Perl v5.10.1 or later
|
## DOWNLOAD
|
||||||
- `IO::Socket::SSL` perl library for ssl-support
|
|
||||||
- `JSON::PP` perl library for JSON support
|
|
||||||
- `IO::Socket:INET6` perl library for ipv6-support
|
|
||||||
|
|
||||||
- Linux or probably any common Unix system
|
See https://github.com/ddclient/ddclient/releases
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
## INSTALLATION
|
## INSTALLATION
|
||||||
|
|
||||||
cp ddclient /usr/sbin/
|
1. Extract the distribution tarball (`.tar.gz` file) and `cd` into
|
||||||
mkdir /etc/ddclient /var/cache/ddclient
|
the directory:
|
||||||
cp sample-etc_ddclient.conf /etc/ddclient/ddclient.conf
|
|
||||||
vi /etc/ddclient/ddclient.conf
|
|
||||||
|
|
||||||
and change hostnames, logins, and passwords appropriately
|
```shell
|
||||||
|
tar xvfa ddclient-3.9.1.tar.gz
|
||||||
|
cd ddclient-3.9.1
|
||||||
|
```
|
||||||
|
|
||||||
|
(If you are installing from a clone of the Git repository, you
|
||||||
|
must run `./autogen` before continuing to the next step.)
|
||||||
|
|
||||||
|
2. Run the following commands to build and install:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
./configure \
|
||||||
|
--prefix=/usr \
|
||||||
|
--sysconfdir=/etc/ddclient \
|
||||||
|
--localstatedir=/var
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Edit `/etc/ddclient/ddclient.conf`.
|
||||||
|
|
||||||
### systemd
|
### systemd
|
||||||
|
|
||||||
|
|
5
autogen
Executable file
5
autogen
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cd "${0%/*}" || exit 1
|
||||||
|
mkdir -p m4 build-aux || exit 1
|
||||||
|
exec autoreconf -fviW all
|
23
configure.ac
Normal file
23
configure.ac
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
AC_PREREQ([2.63])
|
||||||
|
AC_INIT([ddclient], [3.9.1])
|
||||||
|
AC_CONFIG_SRCDIR([ddclient.template])
|
||||||
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign subdir-objects])
|
||||||
|
AM_SILENT_RULES
|
||||||
|
|
||||||
|
AC_PROG_MKDIR_P
|
||||||
|
|
||||||
|
AX_WITH_PROG([PERL], perl)
|
||||||
|
AX_PROG_PERL_VERSION([5.10.1], [],
|
||||||
|
[AC_MSG_ERROR([Perl 5.10.1 or newer not found])])
|
||||||
|
AC_SUBST([PERL])
|
||||||
|
|
||||||
|
m4_foreach_w([_m], [
|
||||||
|
], [AX_PROG_PERL_MODULES([_m], [],
|
||||||
|
[AC_MSG_ERROR([missing required Perl module _m])])])
|
||||||
|
|
||||||
|
AC_CONFIG_FILES([
|
||||||
|
Makefile
|
||||||
|
])
|
||||||
|
AC_OUTPUT
|
|
@ -20,7 +20,7 @@ daemon=300 # check every 300 seconds
|
||||||
syslog=yes # log update msgs to syslog
|
syslog=yes # log update msgs to syslog
|
||||||
mail=root # mail all msgs to root
|
mail=root # mail all msgs to root
|
||||||
mail-failure=root # mail failed update msgs to root
|
mail-failure=root # mail failed update msgs to root
|
||||||
pid=/var/run/ddclient.pid # record PID in file.
|
pid=@runstatedir@/ddclient.pid # record PID in file.
|
||||||
ssl=yes # use ssl-support. Works with
|
ssl=yes # use ssl-support. Works with
|
||||||
# ssl-library
|
# ssl-library
|
||||||
# postscript=script # run script after updating. The
|
# postscript=script # run script after updating. The
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/perl
|
#!@PERL@
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# DDCLIENT - a Perl client for updating DynDNS information
|
# DDCLIENT - a Perl client for updating DynDNS information
|
||||||
|
@ -32,9 +32,25 @@ my $program = $programd;
|
||||||
$program =~ s/d$//;
|
$program =~ s/d$//;
|
||||||
my $now = time;
|
my $now = time;
|
||||||
my $hostname = hostname();
|
my $hostname = hostname();
|
||||||
my $etc = ($program =~ /test/i) ? './' : '/etc/ddclient/';
|
|
||||||
my $cachedir = ($program =~ /test/i) ? './' : '/var/cache/ddclient/';
|
# subst_var(subst, default) returns subst unless it looks like @foo@ in which case it returns
|
||||||
my $savedir = ($program =~ /test/i) ? 'URL/' : '/tmp/';
|
# default. The @foo@ strings are expected to be replaced by make; this function makes it possible
|
||||||
|
# to run this file as a Perl script before those substitutions are made.
|
||||||
|
sub subst_var {
|
||||||
|
my ($subst, $default) = @_;
|
||||||
|
return $default if $subst =~ /^@\w+@$/a;
|
||||||
|
return $subst;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $etc = subst_var('@sysconfdir@', '/etc/ddclient');
|
||||||
|
my $cachedir = subst_var('@localstatedir@', '/var') . '/cache/ddclient';
|
||||||
|
my $savedir = '/tmp';
|
||||||
|
if ($program =~ /test/i) {
|
||||||
|
$etc = '.';
|
||||||
|
$cachedir = '.';
|
||||||
|
$savedir = 'URL';
|
||||||
|
}
|
||||||
|
|
||||||
my $msgs = '';
|
my $msgs = '';
|
||||||
my $last_msgs = '';
|
my $last_msgs = '';
|
||||||
|
|
||||||
|
@ -321,8 +337,8 @@ my %variables = (
|
||||||
'global-defaults' => {
|
'global-defaults' => {
|
||||||
'daemon' => setv(T_DELAY, 0, 0, $daemon_default, interval('60s')),
|
'daemon' => setv(T_DELAY, 0, 0, $daemon_default, interval('60s')),
|
||||||
'foreground' => setv(T_BOOL, 0, 0, 0, undef),
|
'foreground' => setv(T_BOOL, 0, 0, 0, undef),
|
||||||
'file' => setv(T_FILE, 0, 0, "$etc$program.conf", undef),
|
'file' => setv(T_FILE, 0, 0, "$etc/$program.conf", undef),
|
||||||
'cache' => setv(T_FILE, 0, 0, "$cachedir$program.cache", undef),
|
'cache' => setv(T_FILE, 0, 0, "$cachedir/$program.cache", undef),
|
||||||
'pid' => setv(T_FILE, 0, 0, "", undef),
|
'pid' => setv(T_FILE, 0, 0, "", undef),
|
||||||
'proxy' => setv(T_FQDNP, 0, 0, '', undef),
|
'proxy' => setv(T_FQDNP, 0, 0, '', undef),
|
||||||
'protocol' => setv(T_PROTO, 0, 0, 'dyndns2', undef),
|
'protocol' => setv(T_PROTO, 0, 0, 'dyndns2', undef),
|
||||||
|
@ -2157,9 +2173,9 @@ sub geturl {
|
||||||
my $filename = "$server/$url";
|
my $filename = "$server/$url";
|
||||||
$filename =~ s|/|%2F|g;
|
$filename =~ s|/|%2F|g;
|
||||||
if (opt('exec')) {
|
if (opt('exec')) {
|
||||||
$reply = save_file("${savedir}$filename", $reply, 'unique');
|
$reply = save_file("$savedir/$filename", $reply, 'unique');
|
||||||
} else {
|
} else {
|
||||||
$reply = load_file("${savedir}$filename");
|
$reply = load_file("$savedir/$filename");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
177
m4/ax_compare_version.m4
Normal file
177
m4/ax_compare_version.m4
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# https://www.gnu.org/software/autoconf-archive/ax_compare_version.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# This macro compares two version strings. Due to the various number of
|
||||||
|
# minor-version numbers that can exist, and the fact that string
|
||||||
|
# comparisons are not compatible with numeric comparisons, this is not
|
||||||
|
# necessarily trivial to do in a autoconf script. This macro makes doing
|
||||||
|
# these comparisons easy.
|
||||||
|
#
|
||||||
|
# The six basic comparisons are available, as well as checking equality
|
||||||
|
# limited to a certain number of minor-version levels.
|
||||||
|
#
|
||||||
|
# The operator OP determines what type of comparison to do, and can be one
|
||||||
|
# of:
|
||||||
|
#
|
||||||
|
# eq - equal (test A == B)
|
||||||
|
# ne - not equal (test A != B)
|
||||||
|
# le - less than or equal (test A <= B)
|
||||||
|
# ge - greater than or equal (test A >= B)
|
||||||
|
# lt - less than (test A < B)
|
||||||
|
# gt - greater than (test A > B)
|
||||||
|
#
|
||||||
|
# Additionally, the eq and ne operator can have a number after it to limit
|
||||||
|
# the test to that number of minor versions.
|
||||||
|
#
|
||||||
|
# eq0 - equal up to the length of the shorter version
|
||||||
|
# ne0 - not equal up to the length of the shorter version
|
||||||
|
# eqN - equal up to N sub-version levels
|
||||||
|
# neN - not equal up to N sub-version levels
|
||||||
|
#
|
||||||
|
# When the condition is true, shell commands ACTION-IF-TRUE are run,
|
||||||
|
# otherwise shell commands ACTION-IF-FALSE are run. The environment
|
||||||
|
# variable 'ax_compare_version' is always set to either 'true' or 'false'
|
||||||
|
# as well.
|
||||||
|
#
|
||||||
|
# Examples:
|
||||||
|
#
|
||||||
|
# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
|
||||||
|
# AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
|
||||||
|
#
|
||||||
|
# would both be true.
|
||||||
|
#
|
||||||
|
# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
|
||||||
|
# AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
|
||||||
|
#
|
||||||
|
# would both be false.
|
||||||
|
#
|
||||||
|
# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
|
||||||
|
#
|
||||||
|
# would be true because it is only comparing two minor versions.
|
||||||
|
#
|
||||||
|
# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
|
||||||
|
#
|
||||||
|
# would be true because it is only comparing the lesser number of minor
|
||||||
|
# versions of the two values.
|
||||||
|
#
|
||||||
|
# Note: The characters that separate the version numbers do not matter. An
|
||||||
|
# empty string is the same as version 0. OP is evaluated by autoconf, not
|
||||||
|
# configure, so must be a string, not a variable.
|
||||||
|
#
|
||||||
|
# The author would like to acknowledge Guido Draheim whose advice about
|
||||||
|
# the m4_case and m4_ifvaln functions make this macro only include the
|
||||||
|
# portions necessary to perform the specific comparison specified by the
|
||||||
|
# OP argument in the final configure script.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Tim Toolan <toolan@ele.uri.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 13
|
||||||
|
|
||||||
|
dnl #########################################################################
|
||||||
|
AC_DEFUN([AX_COMPARE_VERSION], [
|
||||||
|
AC_REQUIRE([AC_PROG_AWK])
|
||||||
|
|
||||||
|
# Used to indicate true or false condition
|
||||||
|
ax_compare_version=false
|
||||||
|
|
||||||
|
# Convert the two version strings to be compared into a format that
|
||||||
|
# allows a simple string comparison. The end result is that a version
|
||||||
|
# string of the form 1.12.5-r617 will be converted to the form
|
||||||
|
# 0001001200050617. In other words, each number is zero padded to four
|
||||||
|
# digits, and non digits are removed.
|
||||||
|
AS_VAR_PUSHDEF([A],[ax_compare_version_A])
|
||||||
|
A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
|
||||||
|
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
|
||||||
|
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
|
||||||
|
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
|
||||||
|
-e 's/[[^0-9]]//g'`
|
||||||
|
|
||||||
|
AS_VAR_PUSHDEF([B],[ax_compare_version_B])
|
||||||
|
B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
|
||||||
|
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
|
||||||
|
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
|
||||||
|
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
|
||||||
|
-e 's/[[^0-9]]//g'`
|
||||||
|
|
||||||
|
dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
|
||||||
|
dnl # then the first line is used to determine if the condition is true.
|
||||||
|
dnl # The sed right after the echo is to remove any indented white space.
|
||||||
|
m4_case(m4_tolower($2),
|
||||||
|
[lt],[
|
||||||
|
ax_compare_version=`echo "x$A
|
||||||
|
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
|
||||||
|
],
|
||||||
|
[gt],[
|
||||||
|
ax_compare_version=`echo "x$A
|
||||||
|
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
|
||||||
|
],
|
||||||
|
[le],[
|
||||||
|
ax_compare_version=`echo "x$A
|
||||||
|
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
|
||||||
|
],
|
||||||
|
[ge],[
|
||||||
|
ax_compare_version=`echo "x$A
|
||||||
|
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
|
||||||
|
],[
|
||||||
|
dnl Split the operator from the subversion count if present.
|
||||||
|
m4_bmatch(m4_substr($2,2),
|
||||||
|
[0],[
|
||||||
|
# A count of zero means use the length of the shorter version.
|
||||||
|
# Determine the number of characters in A and B.
|
||||||
|
ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
|
||||||
|
ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
|
||||||
|
|
||||||
|
# Set A to no more than B's length and B to no more than A's length.
|
||||||
|
A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
|
||||||
|
B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
|
||||||
|
],
|
||||||
|
[[0-9]+],[
|
||||||
|
# A count greater than zero means use only that many subversions
|
||||||
|
A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
|
||||||
|
B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
|
||||||
|
],
|
||||||
|
[.+],[
|
||||||
|
AC_WARNING(
|
||||||
|
[invalid OP numeric parameter: $2])
|
||||||
|
],[])
|
||||||
|
|
||||||
|
# Pad zeros at end of numbers to make same length.
|
||||||
|
ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
|
||||||
|
B="$B`echo $A | sed 's/./0/g'`"
|
||||||
|
A="$ax_compare_version_tmp_A"
|
||||||
|
|
||||||
|
# Check for equality or inequality as necessary.
|
||||||
|
m4_case(m4_tolower(m4_substr($2,0,2)),
|
||||||
|
[eq],[
|
||||||
|
test "x$A" = "x$B" && ax_compare_version=true
|
||||||
|
],
|
||||||
|
[ne],[
|
||||||
|
test "x$A" != "x$B" && ax_compare_version=true
|
||||||
|
],[
|
||||||
|
AC_WARNING([invalid OP parameter: $2])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
AS_VAR_POPDEF([A])dnl
|
||||||
|
AS_VAR_POPDEF([B])dnl
|
||||||
|
|
||||||
|
dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
|
||||||
|
if test "$ax_compare_version" = "true" ; then
|
||||||
|
m4_ifvaln([$4],[$4],[:])dnl
|
||||||
|
m4_ifvaln([$5],[else $5])dnl
|
||||||
|
fi
|
||||||
|
]) dnl AX_COMPARE_VERSION
|
77
m4/ax_prog_perl_modules.m4
Normal file
77
m4/ax_prog_perl_modules.m4
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# https://www.gnu.org/software/autoconf-archive/ax_prog_perl_modules.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_PROG_PERL_MODULES([MODULES], [ACTION-IF-TRUE], [ACTION-IF-FALSE])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Checks to see if the given perl modules are available. If true the shell
|
||||||
|
# commands in ACTION-IF-TRUE are executed. If not the shell commands in
|
||||||
|
# ACTION-IF-FALSE are run. Note if $PERL is not set (for example by
|
||||||
|
# calling AC_CHECK_PROG, or AC_PATH_PROG), AC_CHECK_PROG(PERL, perl, perl)
|
||||||
|
# will be run.
|
||||||
|
#
|
||||||
|
# MODULES is a space separated list of module names. To check for a
|
||||||
|
# minimum version of a module, append the version number to the module
|
||||||
|
# name, separated by an equals sign.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
#
|
||||||
|
# AX_PROG_PERL_MODULES( Text::Wrap Net::LDAP=1.0.3, ,
|
||||||
|
# AC_MSG_WARN(Need some Perl modules)
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2009 Dean Povey <povey@wedgetail.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 8
|
||||||
|
|
||||||
|
AU_ALIAS([AC_PROG_PERL_MODULES], [AX_PROG_PERL_MODULES])
|
||||||
|
AC_DEFUN([AX_PROG_PERL_MODULES],[dnl
|
||||||
|
|
||||||
|
m4_define([ax_perl_modules])
|
||||||
|
m4_foreach([ax_perl_module], m4_split(m4_normalize([$1])),
|
||||||
|
[
|
||||||
|
m4_append([ax_perl_modules],
|
||||||
|
[']m4_bpatsubst(ax_perl_module,=,[ ])[' ])
|
||||||
|
])
|
||||||
|
|
||||||
|
# Make sure we have perl
|
||||||
|
if test -z "$PERL"; then
|
||||||
|
AC_CHECK_PROG(PERL,perl,perl)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$PERL" != x; then
|
||||||
|
ax_perl_modules_failed=0
|
||||||
|
for ax_perl_module in ax_perl_modules; do
|
||||||
|
AC_MSG_CHECKING(for perl module $ax_perl_module)
|
||||||
|
|
||||||
|
# Would be nice to log result here, but can't rely on autoconf internals
|
||||||
|
$PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1
|
||||||
|
if test $? -ne 0; then
|
||||||
|
AC_MSG_RESULT(no);
|
||||||
|
ax_perl_modules_failed=1
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(ok);
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Run optional shell commands
|
||||||
|
if test "$ax_perl_modules_failed" = 0; then
|
||||||
|
:
|
||||||
|
$2
|
||||||
|
else
|
||||||
|
:
|
||||||
|
$3
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
AC_MSG_WARN(could not find perl)
|
||||||
|
fi])dnl
|
70
m4/ax_prog_perl_version.m4
Normal file
70
m4/ax_prog_perl_version.m4
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# https://www.gnu.org/software/autoconf-archive/ax_prog_perl_version.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_PROG_PERL_VERSION([VERSION],[ACTION-IF-TRUE],[ACTION-IF-FALSE])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Makes sure that perl supports the version indicated. If true the shell
|
||||||
|
# commands in ACTION-IF-TRUE are executed. If not the shell commands in
|
||||||
|
# ACTION-IF-FALSE are run. Note if $PERL is not set (for example by
|
||||||
|
# running AC_CHECK_PROG or AC_PATH_PROG) the macro will fail.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
#
|
||||||
|
# AC_PATH_PROG([PERL],[perl])
|
||||||
|
# AX_PROG_PERL_VERSION([5.8.0],[ ... ],[ ... ])
|
||||||
|
#
|
||||||
|
# This will check to make sure that the perl you have supports at least
|
||||||
|
# version 5.8.0.
|
||||||
|
#
|
||||||
|
# NOTE: This macro uses the $PERL variable to perform the check.
|
||||||
|
# AX_WITH_PERL can be used to set that variable prior to running this
|
||||||
|
# macro. The $PERL_VERSION variable will be valorized with the detected
|
||||||
|
# version.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2009 Francesco Salvestrini <salvestrini@users.sourceforge.net>
|
||||||
|
#
|
||||||
|
# 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 13
|
||||||
|
|
||||||
|
AC_DEFUN([AX_PROG_PERL_VERSION],[
|
||||||
|
AC_REQUIRE([AC_PROG_SED])
|
||||||
|
AC_REQUIRE([AC_PROG_GREP])
|
||||||
|
|
||||||
|
AS_IF([test -n "$PERL"],[
|
||||||
|
ax_perl_version="$1"
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([for perl version])
|
||||||
|
changequote(<<,>>)
|
||||||
|
perl_version=`$PERL --version 2>&1 \
|
||||||
|
| $SED -n -e '/This is perl/b inspect
|
||||||
|
b
|
||||||
|
: inspect
|
||||||
|
s/.* (\{0,1\}v\([0-9]*\.[0-9]*\.[0-9]*\))\{0,1\} .*/\1/;p'`
|
||||||
|
changequote([,])
|
||||||
|
AC_MSG_RESULT($perl_version)
|
||||||
|
|
||||||
|
AC_SUBST([PERL_VERSION],[$perl_version])
|
||||||
|
|
||||||
|
AX_COMPARE_VERSION([$ax_perl_version],[le],[$perl_version],[
|
||||||
|
:
|
||||||
|
$2
|
||||||
|
],[
|
||||||
|
:
|
||||||
|
$3
|
||||||
|
])
|
||||||
|
],[
|
||||||
|
AC_MSG_WARN([could not find the perl interpreter])
|
||||||
|
$3
|
||||||
|
])
|
||||||
|
])
|
70
m4/ax_with_prog.m4
Normal file
70
m4/ax_with_prog.m4
Normal file
|
@ -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])
|
||||||
|
])
|
Loading…
Reference in a new issue