1 dnl Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
3 dnl This library is free software; you can redistribute it and/or
4 dnl modify it under the terms of the GNU Lesser General Public
5 dnl License as published by the Free Software Foundation; either
6 dnl version 2.1 of the License, or (at your option) any later version.
8 dnl This library is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 dnl Lesser General Public License for more details.
13 dnl You should have received a copy of the GNU Lesser General Public
14 dnl License along with this library; if not, write to the Free Software
15 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 dnl File : local_install.m4
22 dnl Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
25 dnl The purpose of below autoconf macro is to generate custom install script
26 dnl to be used instead of global /usr/bin/install one.
27 dnl The difference is that resulting install script does not install file passed
28 dnl as parameter if its target copy exists and the file is not changed, i.e
29 dnl source and target files are the identical.
30 dnl The check is performed by the diff command.
32 AC_DEFUN([AC_LOCAL_INSTALL],
34 GLOBAL_INSTALL=$INSTALL
36 INSTALL=${absdir}/local-install.sh
37 cat > ${INSTALL} << EOF
42 if test \$nb_args -gt 1 ; then
43 nb=\$(expr \$nb_args - 2)
46 if test -f \$target ; then
48 if test -f \$orig ; then
49 diff \$orig \$target > /dev/null 2>&1
50 if test \$[?] = 0 ; then
51 echo \$orig and \$target are identical
57 ${GLOBAL_INSTALL} \$args
61 AC_SUBST(GLOBAL_INSTALL)