aboutsummaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-06-22 08:01:57 +0000
committerChristian Grothoff <christian@grothoff.org>2010-06-22 08:01:57 +0000
commit64bd95b216f833779e3558517375e8d0895fcc03 (patch)
treec5e5e13c62ec0c1caeb142f710f9e496b90373e6 /m4
parent09b088a9e5606fa4d9a7c6ea14fc0b098001f05c (diff)
downloadgnunet-64bd95b216f833779e3558517375e8d0895fcc03.tar.gz
gnunet-64bd95b216f833779e3558517375e8d0895fcc03.zip
mkdir
Diffstat (limited to 'm4')
-rw-r--r--m4/Makefile.am1
-rw-r--r--m4/mkdirp.m463
2 files changed, 64 insertions, 0 deletions
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 3afad7e81..5ef28bae0 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -21,6 +21,7 @@ lib-prefix.m4\
21libxml2.m4\ 21libxml2.m4\
22longdouble.m4\ 22longdouble.m4\
23longlong.m4\ 23longlong.m4\
24mkdir.m4\
24nls.m4\ 25nls.m4\
25pkg.m4\ 26pkg.m4\
26po.m4\ 27po.m4\
diff --git a/m4/mkdirp.m4 b/m4/mkdirp.m4
new file mode 100644
index 000000000..064c158dd
--- /dev/null
+++ b/m4/mkdirp.m4
@@ -0,0 +1,63 @@
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.)
30AC_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 --'
47else
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
62fi
63AC_SUBST([MKDIR_P])])