bug-gnulib
[Top][All Lists]
Advanced

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

Re: Use "$(MKDIR_P) sys", not race-prone "test -d sys || mkdir sys".


From: Bruno Haible
Subject: Re: Use "$(MKDIR_P) sys", not race-prone "test -d sys || mkdir sys".
Date: Tue, 23 Jan 2007 00:05:36 +0100 (MET)
User-agent: KMail/1.5.4

> > 2007-01-22  James Youngman  <address@hidden>
> > 
> >         * m4/gnulib-common.m4 (AC_PROG_MKDIR_P): If AC_PROG_MKDIR_P
> >         is already provided, call AC_SUBST on MKDIR_P anyway, since
> >         the version of AC_PROG_MKDIR_P in Autoconf-2.61 (at least)
> >         doesn't do that.

Actually, this patch had no effect at all. The AC_SUBST was apparently ignored.
So I backed it out and added the following instead. Tested with

     autoconf  | 2.59 | 2.60, 2.61 |
  automake     |      |            |
  -------------+------+------------+
  1.9, 1.9.6   |  OK  |     OK     |
  -------------+------+------------+
  1.10         | N/A  |     OK     |
  -------------+------+------------+


With automake-1.9.x, autoconf-2.59, the Makefile looks like this (in the
cases where "mkdir -p" works vs. fails):

$ grep -i mkdir gllib/Makefile
MKDIR_P = $(mkdir_p)
mkdir_p = mkdir -p --
            $(mkdir_p) "$(distdir)$$dir"; \
        $(mkdir_p) sys

$ grep -i '\(mkdir\|^install_sh \|sys$\)' gllib/Makefile
MKDIR_P = $(mkdir_p)
install_sh = /dev/shm/testdir2b/build-aux/install-sh
mkdir_p = $(install_sh) -d
            $(mkdir_p) "$(distdir)$$dir"; \
        $(mkdir_p) sys


With automake-1.9.x, autoconf >= 2.60, the Makefile looks like this:

$ grep -i mkdir gllib/Makefile
mkdir_p = mkdir -p --
            $(mkdir_p) "$(distdir)$$dir"; \
        /packages/gnu/bin/mkdir -p sys

$ grep -i '\(mkdir\|^install_sh \|sys$\)' gllib/Makefile
install_sh = /dev/shm/testdir3b/build-aux/install-sh
mkdir_p = $(install_sh) -d
            $(mkdir_p) "$(distdir)$$dir"; \
        ../build-aux/install-sh -c -d sys


With automake-1.10, autoconf >= 2.60, the Makefile looks like this:

$ grep -i mkdir gllib/Makefile
MKDIR_P = /packages/gnu/bin/mkdir -p
mkdir_p = /packages/gnu/bin/mkdir -p
          */*) $(MKDIR_P) `echo "$$dist_files" | \
        /packages/gnu/bin/mkdir -p sys

$ grep -i '\(mkdir\|^install_sh \|sys$\)' gllib/Makefile
MKDIR_P = ../build-aux/install-sh -c -d
install_sh = $(SHELL) /dev/shm/testdir9b/build-aux/install-sh
mkdir_p = $(top_builddir)/build-aux/install-sh -c -d
          */*) $(MKDIR_P) `echo "$$dist_files" | \
        ../build-aux/install-sh -c -d sys


So, the differences are:
  - automake < 1.10 does not notice that autoconf >= 2.60 defines a variable
    MKDIR_P; therefore we use @MKDIR_P@ instead of $(MKDIR_P).
  - $(install_sh) always has an absolute pathname of the install-sh file.
  - automake >= 1.10 also places a $(SHELL) into $(install_sh) [good!].
  - With autoconf >= 2.60, @MKDIR_P@ has a relative pathname of the install-sh
    file.
  - With autoconf >= 2.60, @MKDIR_P@ also passes the option -c to the install-sh
    script.
  - Automake >= 1.10 internally uses $(MKDIR_P), whereas
    automake 1.9.x internally uses $(mkdir_p).


2007-01-22  Bruno Haible  <address@hidden>

        * modules/sys_stat (Makefile.am): Use @MKDIR_P@ instead of $(MKDIR_P).
        * modules/sys_select (Makefile.am): Likewise.
        * modules/sys_socket (Makefile.am): Likewise.
        * modules/sys_time (Makefile.am): Likewise.

--- modules/sys_select  18 Jan 2007 16:19:13 -0000      1.6
+++ modules/sys_select  22 Jan 2007 22:45:04 -0000
@@ -17,7 +17,7 @@
 # We need the following in order to create <sys/select.h> when the system
 # doesn't have one that works with the given compiler.
 sys/select.h:
-       $(MKDIR_P) sys
+       @MKDIR_P@ sys
        rm -f address@hidden $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          echo '#include <sys/socket.h>'; \
--- modules/sys_socket  18 Jan 2007 16:19:13 -0000      1.10
+++ modules/sys_socket  22 Jan 2007 22:45:04 -0000
@@ -18,7 +18,7 @@
 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.
 sys/socket.h: socket_.h
-       $(MKDIR_P) sys
+       @MKDIR_P@ sys
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          cat $(srcdir)/socket_.h; \
        } > address@hidden
--- modules/sys_stat    18 Jan 2007 16:19:13 -0000      1.11
+++ modules/sys_stat    22 Jan 2007 22:45:04 -0000
@@ -18,7 +18,7 @@
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
 sys/stat.h: stat_.h
-       $(MKDIR_P) sys
+       @MKDIR_P@ sys
        rm -f address@hidden $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \
--- modules/sys_time    19 Jan 2007 02:00:37 -0000      1.3
+++ modules/sys_time    22 Jan 2007 22:45:04 -0000
@@ -18,7 +18,7 @@
 # We need the following in order to create <sys/time.h> when the system
 # doesn't have one that works with the given compiler.
 sys/time.h: sys_time_.h
-       $(MKDIR_P) sys
+       @MKDIR_P@ sys
        rm -f address@hidden $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \





reply via email to

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