Salome HOME
To see which hdf5 we're using in configure log
[modules/kernel.git] / salome_adm / unix / config_files / local_install.m4
1 dnl Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 dnl
3 dnl Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 dnl
6 dnl This library is free software; you can redistribute it and/or
7 dnl modify it under the terms of the GNU Lesser General Public
8 dnl License as published by the Free Software Foundation; either
9 dnl version 2.1 of the License.
10 dnl
11 dnl This library is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 dnl Lesser General Public License for more details.
15 dnl
16 dnl You should have received a copy of the GNU Lesser General Public
17 dnl License along with this library; if not, write to the Free Software
18 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 dnl
20 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 dnl
22 dnl ---
23 dnl File   : local_install.m4
24 dnl Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
25 dnl ---
26 dnl
27
28 dnl The purpose of below autoconf macro is to generate custom install script
29 dnl to be used instead of global /usr/bin/install one.
30 dnl The difference is that resulting install script does not install file passed
31 dnl as parameter if its target copy exists and the file is not changed, i.e 
32 dnl source and target files are the identical.
33 dnl The check is performed by the diff command.
34
35 AC_DEFUN([AC_LOCAL_INSTALL],
36 [
37 GLOBAL_INSTALL=$INSTALL
38 absdir=`pwd`
39 INSTALL=${absdir}/local-install.sh
40 cat > ${INSTALL} << EOF
41 #!/bin/sh
42
43 nb_args=\$[#]
44 args=\$[*]
45 if test \$nb_args -gt 1 ; then
46     nb=\$(expr \$nb_args - 2)
47     shift \$nb
48     target=\$[2]
49     if test -f \$target ; then
50     orig=\$[1]
51     if test -f \$orig ; then
52         diff \$orig \$target > /dev/null 2>&1
53         if test \$[?] = 0 ; then
54         echo \$orig and \$target are identical
55         exit 0
56         fi
57     fi
58     fi
59 fi
60 ${GLOBAL_INSTALL} \$args 
61 EOF
62 chmod +x ${INSTALL}
63 AC_SUBST(INSTALL)
64 AC_SUBST(GLOBAL_INSTALL)
65 ])dnl