autoconf-patches
[Top][All Lists]
Advanced

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

Re: AC_FUNC_FNMATCH jamboree patch


From: Akim Demaille
Subject: Re: AC_FUNC_FNMATCH jamboree patch
Date: 06 Jun 2002 18:23:12 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter)

>>>>> "Akim" == Akim Demaille <address@hidden> writes:

Akim> That's the patch I had in mind.

Well, there was trailing code, and AC_GNU_SOURCE was not properly
invoked.  Sorry.

Index: lib/autoconf/functions.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/functions.m4,v
retrieving revision 1.62
diff -u -u -r1.62 functions.m4
--- lib/autoconf/functions.m4 28 May 2002 04:13:59 -0000 1.62
+++ lib/autoconf/functions.m4 6 Jun 2002 16:21:28 -0000
@@ -342,25 +342,24 @@
 AU_ALIAS([AM_FUNC_ERROR_AT_LINE], [AC_FUNC_ERROR_AT_LINE])
 
 
-# _AC_FUNC_FNMATCH([DIR], STANDARD, SHELL_VAR, VARIABLE)
-# ---------------------------------------------
-AC_DEFUN([_AC_FUNC_FNMATCH],
-[m4_ifval([$1],
-   [AC_REQUIRE([AC_C_CONST])
-    AC_REQUIRE([AC_FUNC_ALLOCA])
-    AC_REQUIRE([AC_TYPE_MBSTATE_T])])
- AC_CACHE_CHECK(
-   [for working $2 fnmatch],
-   [$3],
-   # Some versions of Solaris, SCO, and the GNU C Library
+# _AC_FUNC_FNMATCH_IF(STANDARD = GNU | POSIX, CACHE_VAR, IF-TRUE, IF-FALSE)
+# -------------------------------------------------------------------------
+# If a STANDARD compliant fnmatch is found, run IF-TRUE, otherwise
+# IF-FALSE.  Use CACHE_VAR.
+AC_DEFUN([_AC_FUNC_FNMATCH_IF],
+[AC_CACHE_CHECK(
+   [for working $1 fnmatch],
+   [$2],
+  [# Some versions of Solaris, SCO, and the GNU C Library
    # have a broken or incompatible fnmatch.
    # So we run a test program.  If we are cross-compiling, take no chance.
    # Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test.
-   [AC_RUN_IFELSE(
+   AC_RUN_IFELSE(
       [AC_LANG_PROGRAM(
         [#include <fnmatch.h>
 #         define y(a, b, c) (fnmatch (a, b, c) == 0)
-#         define n(a, b, c) (fnmatch (a, b, c) == FNM_NOMATCH)],
+#         define n(a, b, c) (fnmatch (a, b, c) == FNM_NOMATCH)
+         ],
         [exit
           (!(y ("a*", "abc", 0)
              && n ("d*/*1", "d/s/1", FNM_PATHNAME)
@@ -368,7 +367,7 @@
              && n ("a\\\\bc", "abc", FNM_NOESCAPE)
              && y ("*x", ".x", 0)
              && n ("*x", ".x", FNM_PERIOD)
-             && m4_if([$2], [GNU],
+             && m4_if([$1], [GNU],
                   [y ("xxXX", "xXxX", FNM_CASEFOLD)
                    && y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH)
                    && n ("d*/*1", "d/s/1", FNM_FILE_NAME)
@@ -376,37 +375,69 @@
                    && y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR)
                    && y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)],
                   1)));])],
-      [$3=yes],
-      [$3=no],
-      [$3=cross])])
- if test $$3 = yes; then
-   m4_ifval([$1], [rm -f $1/fnmatch.h])
-   AC_DEFINE([$4], 1,
-     [Define to 1 if your system has a working $2 `fnmatch' function.])
- else
-   m4_ifval([$1],
-     [AC_CHECK_DECLS([getenv])
-      AC_CHECK_FUNCS(mbsrtowcs mempcpy wmempcpy)
-      AC_CHECK_HEADERS(wchar.h wctype.h)
-      AC_LIBOBJ(fnmatch)
-      AC_CONFIG_LINKS([$1/fnmatch.h:$1/fnmatch_.h])
-      AC_DEFINE(fnmatch, rpl_fnmatch,
-       [Define to rpl_fnmatch if the replacement function should be used.])
-     ],
-     [:])
- fi
-])# _AC_FUNC_FNMATCH
+      [$2=yes],
+      [$2=no],
+      [$2=cross])])
+AS_IF([test $$2 = yes], [$3], [$4])
+])# _AC_FUNC_FNMATCH_IF
 
-# AC_FUNC_FNMATCH([DIR])
-# ----------------------
+
+# AC_FUNC_FNMATCH
+# ---------------
 AC_DEFUN([AC_FUNC_FNMATCH],
-[_AC_FUNC_FNMATCH([$1], [POSIX], [ac_cv_func_fnmatch_works], [HAVE_FNMATCH])])
+[_AC_FUNC_FNMATCH_IF([POSIX], [ac_cv_func_fnmatch_works],
+                     [AC_DEFINE([HAVE_FNMATCH], 1,
+                     [Define to 1 if your system has a working POSIX `fnmatch'
+                      function.])])
+])# AC_FUNC_FNMATCH
+
 
-# AC_FUNC_FNMATCH_GNU([DIR])
-# --------------------------
+# AC_FUNC_FNMATCH_GNU
+# -------------------
 AC_DEFUN([AC_FUNC_FNMATCH_GNU],
 [AC_REQUIRE([AC_GNU_SOURCE])
- _AC_FUNC_FNMATCH([$1], [GNU], [ac_cv_func_fnmatch_gnu], [HAVE_FNMATCH_GNU])])
+_AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu],
+                    [AC_DEFINE([HAVE_FNMATCH], 1,
+                    [Define to 1 if your system has a working GNU `fnmatch'
+                    function.])])
+])# AC_FUNC_FNMATCH_GNU
+
+
+# _AC_LIBOBJ_FNMATCH
+# ------------------
+# Prepare the replacement of fnmatch.
+AC_DEFUN([_AC_LIBOBJ_FNMATCH],
+[AC_REQUIRE([AC_C_CONST])dnl
+AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+AC_REQUIRE([AC_TYPE_MBSTATE_T])dnl
+AC_CHECK_DECLS([getenv])
+AC_CHECK_FUNCS([mbsrtowcs mempcpy wmempcpy])
+AC_CHECK_HEADERS([wchar.h wctype.h])
+AC_LIBOBJ([fnmatch])
+AC_CONFIG_LINKS([$ac_config_libobj_dir/fnmatch.h:$ac_config_libobj_dir/fnmatch_.h])
+AC_DEFINE(fnmatch, rpl_fnmatch,
+          [Define to rpl_fnmatch if the replacement function should be used.])
+])# _AC_LIBOBJ_FNMATCH
+
+
+# AC_REPLACE_FUNC_FNMATCH
+# -----------------------
+AC_DEFUN([AC_REPLACE_FUNC_FNMATCH],
+[_AC_FUNC_FNMATCH_IF([POSIX], [ac_cv_func_fnmatch_works],
+                     [rm -f $ac_config_libobj_dir/fnmatch.h],
+                     [_AC_LIBOBJ_FNMATCH])
+])# AC_REPLACE_FUNC_FNMATCH
+
+
+# AC_REPLACE_FUNC_FNMATCH_GNU
+# ---------------------------
+AC_DEFUN([AC_REPLACE_FNMATCH_GNU],
+[AC_REQUIRE([AC_GNU_SOURCE])
+_AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu],
+                    [rm -f $ac_config_libobj_dir/fnmatch.h],
+                    [_AC_LIBOBJ_FNMATCH])
+])# AC_REPLACE_FUNC_FNMATCH_GNU
+
 
 # AU::AM_FUNC_FNMATCH
 # AU::fp_FUNC_FNMATCH
Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.798
diff -u -u -r1.798 general.m4
--- lib/autoconf/general.m4 29 May 2002 22:25:50 -0000 1.798
+++ lib/autoconf/general.m4 6 Jun 2002 16:21:28 -0000
@@ -443,6 +443,7 @@
 # Initializations.
 #
 ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
 cross_compiling=no
 subdirs=
 MFLAGS=
@@ -2352,9 +2353,18 @@
 ])# AC_CHECK_DECLS
 
 
-## -------------------------------- ##
-## Checking for library functions.  ##
-## -------------------------------- ##
+
+## ---------------------------------- ##
+## Replacement of library functions.  ##
+## ---------------------------------- ##
+
+
+# AC_CONFIG_LIBOBJ_DIR(DIRNAME)
+# -----------------------------
+# Announce LIBOBJ replacement files are in DIRNAME.
+m4_define([AC_CONFIG_LIBOBJ_DIR],
+[ac_config_libobj_dir=$1
+])
 
 
 # AC_LIBSOURCE(FILENAME)



reply via email to

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