Assume ANSI C <string.h>, <stdlib.h>.
[gnulib.git] / m4 / dirname.m4
index 48ecd00..9a5e6f5 100644 (file)
@@ -1,27 +1,15 @@
-#serial 1
+# dirname.m4 serial 2
+dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
 
-dnl See if the dirname function modifies its argument.
-dnl We can't just do AC_REPLACE_FUNCS(dirname) because some systems
-dnl (e.g., X/Open) have a function by that name that modifies and returns
-dnl its argument.
-AC_DEFUN(jm_FUNC_DIRNAME,
-[dnl
-  AC_CACHE_CHECK([for working dirname function], jm_cv_func_working_dirname,
-  [AC_TRY_RUN([
-    int main ()
-    {
-      const char *path = "a/b";
-      char *dir = dirname (path);
-      exit ((dir != path && *dir == 'a' && dir[1] == 0) ? 0 : 1);
-    }
-    ], jm_cv_func_working_dirname=yes dnl The library version works.
-    , jm_cv_func_working_dirname=no dnl The library version does NOT work.
-    , jm_cv_func_working_dirname=no dnl We're cross compiling.
-    )
-  ])
+AC_DEFUN([gl_DIRNAME],
+[
+  dnl Prerequisites of lib/dirname.h.
+  AC_REQUIRE([jm_AC_DOS])
 
-  if test $jm_cv_func_working_dirname = no; then
-    LIBOBJS="$LIBOBJS dirname.o"
-    AC_SUBST(LIBOBJS)dnl
-  fi
+  dnl No prerequisites of lib/basename.c, lib/dirname.c, lib/stripslash.c.
 ])