| 1 | ## -*- Autoconf -*-
|
|---|
| 2 | # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
|---|
| 3 | #
|
|---|
| 4 | # This file is free software; the Free Software Foundation
|
|---|
| 5 | # gives unlimited permission to copy and/or distribute it,
|
|---|
| 6 | # with or without modifications, as long as this notice is preserved.
|
|---|
| 7 |
|
|---|
| 8 | # AM_PROG_MKDIR_P
|
|---|
| 9 | # ---------------
|
|---|
| 10 | # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
|
|---|
| 11 | #
|
|---|
| 12 | # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
|
|---|
| 13 | # created by `make install' are always world readable, even if the
|
|---|
| 14 | # installer happens to have an overly restrictive umask (e.g. 077).
|
|---|
| 15 | # This was a mistake. There are at least two reasons why we must not
|
|---|
| 16 | # use `-m 0755':
|
|---|
| 17 | # - it causes special bits like SGID to be ignored,
|
|---|
| 18 | # - it may be too restrictive (some setups expect 775 directories).
|
|---|
| 19 | #
|
|---|
| 20 | # Do not use -m 0755 and let people choose whatever they expect by
|
|---|
| 21 | # setting umask.
|
|---|
| 22 | #
|
|---|
| 23 | # We cannot accept any implementation of `mkdir' that recognizes `-p'.
|
|---|
| 24 | # Some implementations (such as Solaris 8's) are not thread-safe: if a
|
|---|
| 25 | # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
|
|---|
| 26 | # concurrently, both version can detect that a/ is missing, but only
|
|---|
| 27 | # one can create it and the other will error out. Consequently we
|
|---|
| 28 | # restrict ourselves to GNU make (using the --version option ensures
|
|---|
| 29 | # this.)
|
|---|
| 30 | AC_DEFUN([AM_PROG_MKDIR_P],
|
|---|
| 31 | [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
|
|---|
| 32 | # We used to keeping the `.' as first argument, in order to
|
|---|
| 33 | # allow $(mkdir_p) to be used without argument. As in
|
|---|
| 34 | # $(mkdir_p) $(somedir)
|
|---|
| 35 | # where $(somedir) is conditionally defined. However this is wrong
|
|---|
| 36 | # for two reasons:
|
|---|
| 37 | # 1. if the package is installed by a user who cannot write `.'
|
|---|
| 38 | # make install will fail,
|
|---|
| 39 | # 2. the above comment should most certainly read
|
|---|
| 40 | # $(mkdir_p) $(DESTDIR)$(somedir)
|
|---|
| 41 | # so it does not work when $(somedir) is undefined and
|
|---|
| 42 | # $(DESTDIR) is not.
|
|---|
| 43 | # To support the latter case, we have to write
|
|---|
| 44 | # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
|
|---|
| 45 | # so the `.' trick is pointless.
|
|---|
| 46 | mkdir_p='mkdir -p --'
|
|---|
| 47 | else
|
|---|
| 48 | # On NextStep and OpenStep, the `mkdir' command does not
|
|---|
| 49 | # recognize any option. It will interpret all options as
|
|---|
| 50 | # directories to create, and then abort because `.' already
|
|---|
| 51 | # exists.
|
|---|
| 52 | for d in ./-p ./--version;
|
|---|
| 53 | do
|
|---|
| 54 | test -d $d && rmdir $d
|
|---|
| 55 | done
|
|---|
| 56 | # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
|
|---|
| 57 | if test -f "$ac_aux_dir/mkinstalldirs"; then
|
|---|
| 58 | mkdir_p='$(mkinstalldirs)'
|
|---|
| 59 | else
|
|---|
| 60 | mkdir_p='$(install_sh) -d'
|
|---|
| 61 | fi
|
|---|
| 62 | fi
|
|---|
| 63 | AC_SUBST([mkdir_p])])
|
|---|