Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/yacs.git] / src / wrappergen / bin / HXX2SALOME_GENERIC_CLASS_NAME_SRC / adm_local / unix / config_files / ac_cxx_depend_flag.m4
1 dnl Copyright (C) 2006-2012  CEA/DEN, EDF R&D
2 dnl
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.
7 dnl
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.
12 dnl
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
16 dnl
17 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 dnl
19
20 dnl @synopsis AC_C_DEPEND_FLAG
21 dnl define C_DEPEND_FLAG
22 dnl define CXX_DEPEND_FLAG
23 dnl @version $Id$
24 dnl @author Marc Tajchman
25 dnl
26 AC_DEFUN(AC_DEPEND_FLAG,
27 [AC_CACHE_CHECK(which flag for dependency information generation,
28 ac_cv_depend_flag,
29 [AC_LANG_SAVE
30  AC_LANG_C
31  echo "conftest.o: conftest.c" > conftest.verif
32  echo "int  main() { return 0; }" > conftest.c
33
34 dnl Evolution portage sur CCRT/osf system
35  case $host_os in
36    osf*)
37 dnl sur CCRT/osf pas d'equivalent de l'option -MG de gcc avec compilo natif
38 dnl on utilise donc gnu pour generer les dependances.
39      DEPCC=gcc
40      DEPCXX=g++
41      DEPCXXFLAGS="-Wno-deprecated"
42      DIFFFLAGS="-w"
43      MACHINE="OSF1"
44      ;;
45    *)
46      DEPCC=${CC-cc}
47      DEPCXX=${CXX-c++}
48      DEPCXXFLAGS="\${CXXFLAGS}"
49      DIFFFLAGS="-b -B"
50      MACHINE="PCLINUX"
51      ;;
52  esac
53  C_DEPEND_FLAG=
54  for ac_C_DEPEND_FLAG in -xM -MM -M ; do
55
56     rm -f conftest.d conftest.err
57     ${DEPCC} ${ac_C_DEPEND_FLAG} -c conftest.c 1> conftest.d 2> conftest.err
58     if test -f conftest.u ; then
59        mv conftest.u conftest.d
60     fi
61
62     rm -f conftest
63     diff ${DIFFFLAGS} conftest.d conftest.verif > conftest
64     if test ! -s conftest ; then
65        C_DEPEND_FLAG=${ac_C_DEPEND_FLAG}
66        break
67     fi
68  done
69
70 dnl use gcc option -MG : asume unknown file will be construct later
71  rm -f conftest.d conftest.err
72  ${DEPCC} ${C_DEPEND_FLAG} -MG -c conftest.c 1> conftest.d 2> conftest.err
73  if test -f conftest.u ; then
74     mv conftest.u conftest.d
75  fi
76  rm -f conftest
77  diff ${DIFFFLAGS} conftest.d conftest.verif > conftest
78  if test ! -s conftest ; then
79     C_DEPEND_FLAG=${C_DEPEND_FLAG}" -MG"
80  fi
81
82  rm -f conftest*
83  if test "x${C_DEPEND_FLAG}" = "x" ; then
84     echo "cannot determine flag (C language)"
85     exit
86  fi
87
88  printf " C :  ${DEPCC} ${C_DEPEND_FLAG}"
89
90  AC_LANG_CPLUSPLUS
91  echo "conftest.o: conftest.cxx" > conftest.verif
92  echo "int  main() { return 0; }" > conftest.cxx
93
94  CXX_DEPEND_FLAG=
95  for ac_CXX_DEPEND_FLAG in -xM -MM -M ; do
96
97     rm -f conftest.d conftest.err
98     ${DEPCXX} ${ac_CXX_DEPEND_FLAG} -c conftest.cxx 1> conftest.d 2> conftest.err
99     if test -f conftest.u ; then
100        mv conftest.u conftest.d
101     fi
102
103     rm -f conftest
104     diff ${DIFFFLAGS} conftest.d conftest.verif > conftest
105     if test ! -s conftest ; then
106        CXX_DEPEND_FLAG=${ac_CXX_DEPEND_FLAG}
107        break
108     fi
109  done
110
111 dnl use g++ option -MG : asume unknown file will be construct later
112  rm -f conftest.d conftest.err
113  ${DEPCXX} ${CXX_DEPEND_FLAG} -MG -c conftest.cxx 1> conftest.d 2> conftest.err
114  if test -f conftest.u ; then
115     mv conftest.u conftest.d
116  fi
117  rm -f conftest
118  diff ${DIFFFLAGS} conftest.d conftest.verif > conftest
119  if test ! -s conftest ; then
120     CXX_DEPEND_FLAG=${CXX_DEPEND_FLAG}" -MG"
121  fi
122
123
124  rm -f conftest*
125  if test "x${CXX_DEPEND_FLAG}" = "x" ; then
126     echo "cannot determine flag (C++ language)"
127     exit
128  fi
129
130  printf " C++ : ${DEPCXX} ${CXX_DEPEND_FLAG}"
131  AC_LANG_RESTORE
132
133  AC_SUBST(DEPCC)
134  AC_SUBST(DEPCXX)
135  AC_SUBST(DEPCXXFLAGS)
136  AC_SUBST(C_DEPEND_FLAG)
137  AC_SUBST(CXX_DEPEND_FLAG)
138  AC_SUBST(MACHINE)
139 ])
140 ])