Skip to content

Commit

Permalink
Use full path for install on MinGW. On all platforms, check if 'insta…
Browse files Browse the repository at this point in the history
…ll -p' works, and use it if available. Added configure option to disable it

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@27757 72102866-910b-0410-8b05-ffd578937521
  • Loading branch information
nicola committed Feb 2, 2009
1 parent 0321c00 commit 4ed78da
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 2 deletions.
21 changes: 21 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
2009-02-02 Nicola Pero <[email protected]>

This change means that file timestamps are more likely to be
preserved when files are installed. For example, if you reinstall
a library without having changed the headers, this should/might
prevent code using the library headers from being rebuilt.
* configure.ac: Check if 'install -p' works. If it works, use it
by default. Added --disable-install-p option to revert to the
previous behaviour of using 'install' instead of 'install -p'.
* configure: Regenerated
* config-install-p-test/: New directory.
* config-install-p-test/run-test.sh: New file.
* config-install-p-test/config-install-p-test-file: New file.

2009-02-02 Nicola Pero <[email protected]>

* configure.ac: On MinGW, do not set INSTALL to 'install -p'.
Prefer the install program chosen by configure, which has a full
path (typically '/bin/install -c') and so it is safer.
* configure: Regenerated.

2009-01-31 Nicola Pero <[email protected]>

* Documentation/README.MinGW: Updated installation instructions.
Expand Down
3 changes: 3 additions & 0 deletions config-install-p-test/config-install-p-test-file
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Some text.

Thanks
96 changes: 96 additions & 0 deletions config-install-p-test/run-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#! /bin/sh
#
# Test for '-p' flag in 'install' program
#
# Copyright (C) 2009 Free Software Foundation, Inc.
#
# Author: Nicola Pero <[email protected]>
#
# This file is part of the GNUstep Makefile Package.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# You should have received a copy of the GNU General Public
# License along with this library; see the file COPYING.
# If not, write to the Free Software Foundation,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#

# Check if 'install' program supports the '-p' flag.

# You should execute this shell scripts after setting the following
# environment variables:
#
# INSTALL
#
# ./configure at the top-level will set them for us; you need to
# set them manually if you want to run the test manually.

# We simply try executing
#
# ${INSTALL} -p test-file test-file2
#
# and then check that test-file2 exists

# The script will execute and:
# return 0 if install supports '-p'
# return 1 if install does not support '-p'

# The script takes a single argument, which is the directory where
# the temporary files and the log file will be written. If there
# is no argument specified, ./ will be used.

# This is the file where everything will be logged
gs_builddir="$1"

if test "$gs_builddir" = ""; then
gs_builddir="."
fi

gs_logfile="$gs_builddir/config-install-p-test.log"

# Clear logs
rm -f "$gs_logfile"

# Clear test results
rm -f "$gs_builddir/config-install-p-test-file2"

echo "** Environment" >>"$gs_logfile" 2>&1
echo " INSTALL: $INSTALL" >>"$gs_logfile" 2>&1
echo "" >>"$gs_logfile" 2>&1
echo " current directory: `pwd`" >>"$gs_logfile" 2>&1
echo " log file: $gs_logfile" >>"$gs_logfile" 2>&1
echo "" >>"$gs_logfile" 2>&1

echo "" >>"$gs_logfile" 2>&1

if test "$INSTALL" = ""; then
echo "INSTALL is not set: failure" >>"$gs_logfile" 2>&1
exit 1
fi

# Try to install config-install-p-test-file using '-p'.
echo "** Run $INSTALL -p" >>"$gs_logfile" 2>&1
echo "$INSTALL -p config-install-p-test-file \"$gs_builddir/config-install-p-test-file2\"" >>"$gs_logfile" 2>&1
$INSTALL -p config-install-p-test-file "$gs_builddir/config-install-p-test-file2" >>"$gs_logfile" 2>&1
if test ! "$?" = "0"; then
echo "Failure" >>"$gs_logfile" 2>&1
rm -f "$gs_builddir/config-install-p-test-file2"
exit 1
fi
echo "No error reported by $INSTALL" >>"$gs_logfile" 2>&1
echo "" >>"$gs_logfile" 2>&1

# Now check that the copied file is identical to the original one.
echo "** Checking that the installed file exists" >>"$gs_logfile" 2>&1
if test ! -f "$gs_builddir/config-install-p-test-file2"; then
echo "Failure - file \"$gs_builddir/config-install-p-test-file2\" missing" >>"$gs_logfile" 2>&1
exit 1
fi
echo "Success" >>"$gs_logfile" 2>&1

# Everything looks OK.
exit 0
48 changes: 47 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,16 @@ Optional Features:
to be the gnu runtime with garbage collection.
--disable-install-p
Disable using 'install -p' when installing files. By default,
assuming that 'install -p' works, when installing files such as header files or libraries,
gnustep-make uses 'install -p', which preserves the original timestamp of the header file or
library. If you do not want the timestamp to be preserved, use this option
to have gnustep-make use 'install' instead of 'install -p'.
Unless you have a specific reason for not liking the default behaviour
this option is most likely irrelevant for you.
--enable-strict-v2-mode
Enable strict gnustep-make version 2 mode by default. Use this
option to have gnustep-make be aggressively backwards-incompatible
Expand Down Expand Up @@ -3760,7 +3770,6 @@ esac
if test "$MINGW32" = yes; then
echo "hosted on mingw32 .."
export INSTALL="install -p"
export SHELL=sh
export CC=${CC:-gcc}
export AR=${AR:-ar}
Expand Down Expand Up @@ -4185,6 +4194,43 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
{ echo "$as_me:$LINENO: checking if 'install -p' works" >&5
echo $ECHO_N "checking if 'install -p' works... $ECHO_C" >&6; }
gs_install_p_test_builddir="`pwd`"
gs_install_p_test_results=`(INSTALL="$INSTALL"; export INSTALL; cd "$srcdir/config-install-p-test/"; ./run-test.sh "$gs_install_p_test_builddir"; echo $?) 2>&5`
if test "$gs_install_p_test_results" = "0"; then
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; };
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; };
fi
{ echo "$as_me:$LINENO: checking if we should use 'install -p' when installing files" >&5
echo $ECHO_N "checking if we should use 'install -p' when installing files... $ECHO_C" >&6; }
# Check whether --enable-install-p was given.
if test "${enable_install_p+set}" = set; then
enableval=$enable_install_p; ac_cv_install_p=$enableval
else
ac_cv_install_p="yes"
fi
if test "$ac_cv_install_p" = "yes"; then
if test "$gs_install_p_test_results" = "0"; then
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; };
INSTALL="${INSTALL} -p"
else
{ echo "$as_me:$LINENO: result: no: install -p does not work" >&5
echo "${ECHO_T}no: install -p does not work" >&6; };
fi
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; };
fi
{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
LN_S=$as_ln_s
Expand Down
36 changes: 35 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ AC_EXEEXT
AC_OBJEXT
if test "$MINGW32" = yes; then
echo "hosted on mingw32 .."
export INSTALL="install -p"
export SHELL=sh
export CC=${CC:-gcc}
export AR=${AR:-ar}
Expand Down Expand Up @@ -201,6 +200,41 @@ else
fi

AC_PROG_INSTALL

AC_MSG_CHECKING([if 'install -p' works])
gs_install_p_test_builddir="`pwd`"
gs_install_p_test_results=`(INSTALL="$INSTALL"; export INSTALL; cd "$srcdir/config-install-p-test/"; ./run-test.sh "$gs_install_p_test_builddir"; echo $?) 2>&5`
if test "$gs_install_p_test_results" = "0"; then
AC_MSG_RESULT(yes);
else
AC_MSG_RESULT(no);
fi

AC_MSG_CHECKING([if we should use 'install -p' when installing files])
AC_ARG_ENABLE(install-p, [
--disable-install-p
Disable using 'install -p' when installing files. By default,
assuming that 'install -p' works, when installing files such as header files or libraries,
gnustep-make uses 'install -p', which preserves the original timestamp of the header file or
library. If you do not want the timestamp to be preserved, use this option
to have gnustep-make use 'install' instead of 'install -p'.
Unless you have a specific reason for not liking the default behaviour
this option is most likely irrelevant for you.
],
ac_cv_install_p=$enableval,
ac_cv_install_p="yes")

if test "$ac_cv_install_p" = "yes"; then
if test "$gs_install_p_test_results" = "0"; then
AC_MSG_RESULT(yes);
INSTALL="${INSTALL} -p"
else
AC_MSG_RESULT(no: install -p does not work);
fi
else
AC_MSG_RESULT(no);
fi

AC_PROG_LN_S([])

AC_CHECK_PROGS(TAR, gnutar gtar, tar)
Expand Down

0 comments on commit 4ed78da

Please sign in to comment.