[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] {maint} More tests on macro `AM_WITH_REGEX'.
From: |
Stefano Lattarini |
Subject: |
Re: [PATCH] {maint} More tests on macro `AM_WITH_REGEX'. |
Date: |
Thu, 11 Nov 2010 15:41:07 +0100 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
Pinging this patch again, following this:
<http://lists.gnu.org/archive/html/automake-patches/2010-11/msg00003.html>
Since I was at it, I rebased the patch against latest maint, and threw
in a couple of minor improvements. The updated patch is attached.
Regards,
Stefano
From 461c125cc982612c1d6ab11280e405dd80ad6e49 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Mon, 20 Sep 2010 22:57:15 +0200
Subject: [PATCH] More tests on macro `AM_WITH_REGEX'.
* tests/regex.test: Extend with more configure runs. Add
trailing `:' command.
* tests/regex2.test: New test.
* tests/regex3.test: Likewise.
* tests/Makefile.am (TESTS): Updated
---
ChangeLog | 9 +++++
tests/Makefile.am | 2 +
tests/Makefile.in | 2 +
tests/regex.test | 8 ++++-
tests/regex2.test | 84 +++++++++++++++++++++++++++++++++++++++++++++++
tests/regex3.test | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 198 insertions(+), 1 deletions(-)
create mode 100755 tests/regex2.test
create mode 100755 tests/regex3.test
diff --git a/ChangeLog b/ChangeLog
index a356958..ff55767 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-11-11 Stefano Lattarini <address@hidden>
+
+ More tests on macro `AM_WITH_REGEX'.
+ * tests/regex.test: Extend with more configure runs. Add
+ trailing `:' command.
+ * tests/regex2.test: New test.
+ * tests/regex3.test: Likewise.
+ * tests/Makefile.am (TESTS): Updated
+
2010-11-07 Stefano Lattarini <address@hidden>
Fix a bug in variable concatanation with `+='.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index da81c49..64240c8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -621,6 +621,8 @@ remake5.test \
remake6.test \
remake7.test \
regex.test \
+regex2.test \
+regex3.test \
req.test \
reqd.test \
reqd2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index eb461a9..c43ece0 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -888,6 +888,8 @@ remake5.test \
remake6.test \
remake7.test \
regex.test \
+regex2.test \
+regex3.test \
req.test \
reqd.test \
reqd2.test \
diff --git a/tests/regex.test b/tests/regex.test
index babd92a..611ce24 100755
--- a/tests/regex.test
+++ b/tests/regex.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2004 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2010 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Make sure AM_WITH_REGEX compiles and runs.
+# See also related tests `regex2.test' and `regex3.test'
. ./defs || Exit 1
@@ -28,3 +29,8 @@ $ACLOCAL
$AUTOCONF
./configure
./configure --without-regex
+./configure --with-regex
+./configure --with-regex=no
+./configure --with-regex=yes
+
+:
diff --git a/tests/regex2.test b/tests/regex2.test
new file mode 100755
index 0000000..a5fe6c7
--- /dev/null
+++ b/tests/regex2.test
@@ -0,0 +1,84 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure AM_WITH_REGEX compiles and runs as advertised in
+# documentation.
+# See also sister test `regex3.test'
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_HEADERS([config.h])
+AM_WITH_REGEX
+AC_OUTPUT
+END
+
+cat > config.h.in <<'END'
+#undef WITH_REGEX
+END
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = foo
+check-local:
+ @echo "with_regex='$$with_regex'"
+ grep '#.* WITH_REGEX' config.h # sanity check
+ ./foo$(EXEEXT)
+ if test x"$$with_regex" = x"yes"; then \
+ test x"`./foo$(EXEEXT)`" = x'WITH_REGEX=1'; \
+ else \
+ test x"`./foo$(EXEEXT)`" = x'undef WITH_REGEX'; \
+ fi
+END
+
+cat > foo.c <<'END'
+#include <config.h>
+#include <stdio.h>
+int main(void)
+{
+#ifndef WITH_REGEX
+ printf("undef WITH_REGEX\n");
+#else
+ printf("WITH_REGEX=%d\n", (WITH_REGEX));
+#endif
+ return 0;
+}
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+for result_option in \
+ 'yes' \
+ 'no --without-regex' \
+ 'yes --with-regex' \
+ 'no --with-regex=no' \
+ 'yes --with-regex=yes' \
+; do
+ set x $result_option
+ result=$2
+ option=$3
+ # For systems lacking both `regex' and `rx' libraries.
+ config_args="$option am_cv_gnu_regex=yes ac_cv_func_re_rx_search=yes"
+ ./configure $config_args
+ with_regex="$result" $MAKE check
+ with_regex="$result" $MAKE distcheck \
+ "DISTCHECK_CONFIGURE_FLAGS=$config_args"
+done
+
+:
diff --git a/tests/regex3.test b/tests/regex3.test
new file mode 100755
index 0000000..1dad797
--- /dev/null
+++ b/tests/regex3.test
@@ -0,0 +1,94 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure AM_WITH_REGEX works even when both `rx' and `regex'
+# libraries are absent on the system.
+# See also sister test `regex2.test'
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_HEADERS([config.h])
+AM_WITH_REGEX
+AC_SUBST([am_cv_gnu_regex])
+AC_SUBST([ac_cv_func_re_rx_search])
+AC_OUTPUT
+END
+
+cat > config.h.in <<'END'
+#undef WITH_REGEX
+END
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = foo
+foo_LDADD = $(LIBOBJS)
+check-local:
+ @echo "with_regex='$$with_regex'"
+ @echo 'am_cv_gnu_regex=$(am_cv_gnu_regex)'
+ @echo 'ac_cv_func_re_rx_search=$(ac_cv_func_re_rx_search)'
+ grep '#.* WITH_REGEX' config.h # sanity check
+ ./foo$(EXEEXT)
+ if test x"$$with_regex" = x"yes"; then \
+ test x"`./foo$(EXEEXT)`" = x'regex, WITH_REGEX=1'; \
+ else \
+ test x"`./foo$(EXEEXT)`" = x'rx, undef WITH_REGEX'; \
+ fi
+END
+
+cat > foo.c <<'END'
+#include <config.h>
+#include <stdio.h>
+#include "regex.h"
+int main(void)
+{
+ printf("%s, ", foo);
+#ifndef WITH_REGEX
+ printf("undef WITH_REGEX\n");
+#else
+ printf("WITH_REGEX=%d\n", (WITH_REGEX));
+#endif
+ return 0;
+}
+END
+
+echo 'char *foo = "regex";' > regex.c
+echo 'char *foo = "rx";' > rx.c
+echo 'extern char *foo;' > regex.h
+echo 'extern char *foo;' > rx.h
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+# Use less options than in test `regex2.test', otherwise the
+# test takes too long.
+for result_option in \
+ 'no --without-regex' \
+ 'yes --with-regex' \
+; do
+ set x $result_option
+ result=$2
+ option=$3
+ config_args="$option am_cv_gnu_regex=no ac_cv_func_re_rx_search=no"
+ ./configure $config_args
+ with_regex="$result" $MAKE check
+ with_regex="$result" $MAKE distcheck \
+ "DISTCHECK_CONFIGURE_FLAGS=$config_args"
+done
+
+:
--
1.7.1
- Re: [PATCH] {maint} More tests on macro `AM_WITH_REGEX'.,
Stefano Lattarini <=