autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: Splitting and testing AC_SHELL_DIRNAME


From: Akim Demaille
Subject: FYI: Splitting and testing AC_SHELL_DIRNAME
Date: 25 Oct 2000 16:34:59 +0200
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

Tonight, if I have some time, I will separate the AC_SHELL_* macros
into shell.m4 (or a better name if you have suggestion), and rename
them as AS_*.  Then acgeneral (or better yet, autoconf.m4) will map
them to the AC_SHELL_ name.  Unless we decide to keep them as AS_,
which seems a good idea to me.  In fact, I think it is time to declare
once for all that all the A._* names are reserved to us (including AM_
reserved for Automake of course).

I will also separate base.m4 into shell.m4 and m4sugar.m4.  If someone
fears problem because of equal names, please suggest better names.

        Akim

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * acgeneral.m4 (AC_SHELL_DIRNAME): Split its code into...
        (AC_SHELL_DIRNAME_EXPR, AC_SHELL_DIRNAME_SED): these new macros.
        * tests/base.m4 (AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): New
        test.

Index: acgeneral.m4
===================================================================
RCS file: /cvs/autoconf/acgeneral.m4,v
retrieving revision 1.594
diff -u -r1.594 acgeneral.m4
--- acgeneral.m4 2000/10/25 10:25:15 1.594
+++ acgeneral.m4 2000/10/25 14:30:10
@@ -920,18 +920,24 @@
 # a silly length limit that causes expr to fail if the matched
 # substring is longer than 120 bytes.  So fall back on echo|sed if
 # expr fails.
-define([AC_SHELL_DIRNAME],
+define([AC_SHELL_DIRNAME_EXPR],
 [expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \
       X[]$1 : 'X\(//\)[[^/]]' \| \
       X[]$1 : 'X\(//\)$' \| \
       X[]$1 : 'X\(/\)' \| \
-      .   : '\(.\)' 2>/dev/null ||
-echo "X[]$1" |
+      .     : '\(.\)'])
+
+define([AC_SHELL_DIRNAME_SED],
+[echo "X[]$1" |
     sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
          /^X\(\/\/\)[^/].*/{ s//\1/; q; }
          /^X\(\/\/\)$/{ s//\1/; q; }
          /^X\(\/\).*/{ s//\1/; q; }
          s/.*/./; q']])
+
+define([AC_SHELL_DIRNAME],
+[AC_SHELL_DIRNAME_EXPR([$1]) 2>/dev/null ||
+AC_SHELL_DIRNAME_SED([$1])])
 
 
 ## --------------------------------------------------- ##
Index: tests/base.m4
===================================================================
RCS file: /cvs/autoconf/tests/base.m4,v
retrieving revision 1.7
diff -u -r1.7 base.m4
--- tests/base.m4 2000/08/11 09:28:24 1.7
+++ tests/base.m4 2000/10/25 14:30:10
@@ -6,8 +6,9 @@
 
 EOF
 
-# m4_wrap
-# -------
+## ------- ##
+## m4_wrap ##
+## ------- ##
 
 AT_SETUP(m4_wrap)
 
@@ -54,8 +55,9 @@
 
 
 
-# AC_REQUIRE
-# ----------
+## ------------ ##
+## AC_REQUIRE.  ##
+## ------------ ##
 
 # Check that dependencies are always properly honored.
 
@@ -94,8 +96,9 @@
 AT_CLEANUP(configure)
 
 
-# AC_SHELL_MKDIR_P
-# ----------------
+## ------------------ ##
+## AC_SHELL_MKDIR_P.  ##
+## ------------------ ##
 
 # Build nested dirs.
 
@@ -118,3 +121,75 @@
 AT_CHECK([./configure], 0)
 
 AT_CLEANUP(configure 1 a)
+
+
+
+## ----------------------------------------- ##
+## AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED.  ##
+## ----------------------------------------- ##
+
+# Build nested dirs.
+
+AT_SETUP(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED)
+
+AT_DATA(configure.in,
+[[
+
+define([AC_SHELL_DIRNAME_TEST],
+[dir=`AC_SHELL_DIRNAME([$1])`
+test "$dir" = "$2" ||
+  echo "dirname($1) = $dir instead of $2" >&2])
+define([AC_SHELL_DIRNAME_SED_TEST],
+[dir=`AC_SHELL_DIRNAME_SED([$1])`
+test "$dir" = "$2" ||
+  echo "dirname_sed($1) = $dir instead of $2" >&2])
+
+AC_PLAIN_SCRIPT
+AC_SHELL_DIRNAME_TEST([//1],           [//])
+AC_SHELL_DIRNAME_TEST([/1],            [/])
+AC_SHELL_DIRNAME_TEST([./1],           [.])
+AC_SHELL_DIRNAME_TEST([../../2],       [../..])
+AC_SHELL_DIRNAME_TEST([//1/],          [//])
+AC_SHELL_DIRNAME_TEST([/1/],           [/])
+AC_SHELL_DIRNAME_TEST([./1/],          [.])
+AC_SHELL_DIRNAME_TEST([../../2],       [../..])
+AC_SHELL_DIRNAME_TEST([//1/3],         [//1])
+AC_SHELL_DIRNAME_TEST([/1/3],          [/1])
+AC_SHELL_DIRNAME_TEST([./1/3],         [./1])
+AC_SHELL_DIRNAME_TEST([../../2/3],     [../../2])
+AC_SHELL_DIRNAME_TEST([//1/3///],      [//1])
+AC_SHELL_DIRNAME_TEST([/1/3///],       [/1])
+AC_SHELL_DIRNAME_TEST([./1/3///],      [./1])
+AC_SHELL_DIRNAME_TEST([../../2/3///],  [../../2])
+AC_SHELL_DIRNAME_TEST([//1//3/],       [//1])
+AC_SHELL_DIRNAME_TEST([/1//3/],                [/1])
+AC_SHELL_DIRNAME_TEST([./1//3/],       [./1])
+AC_SHELL_DIRNAME_TEST([../../2//3/],   [../../2])
+
+AC_SHELL_DIRNAME_SED_TEST([//1],               [//])
+AC_SHELL_DIRNAME_SED_TEST([/1],                        [/])
+AC_SHELL_DIRNAME_SED_TEST([./1],               [.])
+AC_SHELL_DIRNAME_SED_TEST([../../2],           [../..])
+AC_SHELL_DIRNAME_SED_TEST([//1/],              [//])
+AC_SHELL_DIRNAME_SED_TEST([/1/],               [/])
+AC_SHELL_DIRNAME_SED_TEST([./1/],              [.])
+AC_SHELL_DIRNAME_SED_TEST([../../2],           [../..])
+AC_SHELL_DIRNAME_SED_TEST([//1/3],             [//1])
+AC_SHELL_DIRNAME_SED_TEST([/1/3],              [/1])
+AC_SHELL_DIRNAME_SED_TEST([./1/3],             [./1])
+AC_SHELL_DIRNAME_SED_TEST([../../2/3],         [../../2])
+AC_SHELL_DIRNAME_SED_TEST([//1/3///],          [//1])
+AC_SHELL_DIRNAME_SED_TEST([/1/3///],           [/1])
+AC_SHELL_DIRNAME_SED_TEST([./1/3///],          [./1])
+AC_SHELL_DIRNAME_SED_TEST([../../2/3///],      [../../2])
+AC_SHELL_DIRNAME_SED_TEST([//1//3/],           [//1])
+AC_SHELL_DIRNAME_SED_TEST([/1//3/],            [/1])
+AC_SHELL_DIRNAME_SED_TEST([./1//3/],           [./1])
+AC_SHELL_DIRNAME_SED_TEST([../../2//3/],       [../../2])
+exit 0
+]])
+
+AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])
+AT_CHECK([./configure], 0)
+
+AT_CLEANUP(configure)
Index: tests/suite.m4
===================================================================
RCS file: /cvs/autoconf/tests/suite.m4,v
retrieving revision 1.12
diff -u -r1.12 suite.m4
--- tests/suite.m4 2000/10/23 19:13:37 1.12
+++ tests/suite.m4 2000/10/25 14:30:10
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Validation suite for Autoconf
-# Copyright (C) 2000 Free Software Foundation, Inc.
+# Copyright 2000 Free Software Foundation, Inc.
 
 # Still many parts of `autoconf' are not exercised by the test suite.  A few
 # FIXME's, below, are used to list tests that we would need.  Do you feel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]