Salome HOME
To see which hdf5 we're using in configure log
[modules/kernel.git] / salome_adm / unix / config_files / ac_cxx_depend_flag.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 @synopsis AC_C_DEPEND_FLAG
23 dnl define C_DEPEND_FLAG
24 dnl define CXX_DEPEND_FLAG
25 dnl @version $Id$
26 dnl @author Marc Tajchman
27 dnl
28 AC_DEFUN([AC_DEPEND_FLAG],[
29  AC_MSG_CHECKING([which flag for dependency information generation])
30  AC_LANG_SAVE
31  AC_LANG_C
32  echo "conftest.o: conftest.c" > conftest.verif
33  echo "int  main() { return 0; }" > conftest.c
34
35 f77int="F77INT32"
36 case  $host_os in
37    irix5.* | irix6.* | osf4.* | osf5.* | linux*  )
38
39         linux64="true"
40 # porting on intel processor 64 bits
41         expr "$host_os" : 'linux' >/dev/null && ( test ! x"$host_cpu" = x"x86_64" && test ! x"$host_cpu" = x"ia64" ) && linux64="false"
42         if test ! x"$linux64" = "xfalse" ; then
43           echo "$as_me:$LINENO: checking for 64bits integers size in F77/F90" >&5
44 echo $ECHO_N "checking for 64bits integers size in F77/F90... $ECHO_C" >&6
45           # Check whether --enable-int64 or --disable-int64 was given.
46 if test "${enable_int64+set}" = set; then
47   enableval="$enable_int64"
48
49 fi;
50           case "X-$enable_int64" in
51             X-no)
52              echo "$as_me:$LINENO: result: \"disabled\"" >&5
53 echo "${ECHO_T}\"disabled\"" >&6
54              SUFFIXES="_32"
55              ;;
56             *)
57              echo "$as_me:$LINENO: result: \"enabled\"" >&5
58 echo "${ECHO_T}\"enabled\"" >&6
59              SUFFIXES=""
60              f77int="F77INT64"
61              ;;
62           esac
63         fi
64      ;;
65    *)
66      ;;
67 esac
68
69 case $host_os in
70     linux*)
71 # porting on intel processor 64 bits: if 64 bits processor, by default compilation in 64 bits
72         if test x"$linux64" = x"true"; then \
73           MACHINE="PCLINUX64${SUFFIXES}";
74           CFLAGS=" -D_OCC64 ${CXXFLAGS}";
75           CXXFLAGS=" -D_OCC64 ${CXXFLAGS}";\
76         else \
77           MACHINE=PCLINUX; \
78         fi
79         ;;
80     hpux*)
81         MACHINE=HP9000
82         ;;
83     aix4.*)
84         MACHINE=RS6000
85         host_os_novers=aix4.x
86         ;;
87     irix5.*)
88         MACHINE="IRIX64${SUFFIXES}"
89         host_os_novers=irix5.x
90         ;;
91     irix6.*)
92         MACHINE="IRIX64${SUFFIXES}"
93         host_os_novers=irix6.x
94         ;;
95     osf4.*)
96         MACHINE="OSF1${SUFFIXES}"
97         host_os_novers=osf4.x
98         ;;
99     osf5.*)
100         MACHINE="OSF1${SUFFIXES}"
101          host_os_novers=osf5.x
102          ;;
103     solaris2.*)
104         MACHINE=SUN4SOL2
105          host_os_novers=solaris2.x
106          ;;
107     uxpv*)
108         MACHINE=VPP5000
109          ;;
110     *)
111         MACHINE=
112          host_os_novers=$host_os
113          ;;
114 esac
115
116 dnl Evolution portage sur CCRT/osf system
117  case $host_os in
118    osf*)
119 dnl sur CCRT/osf pas d'equivalent de l'option -MG de gcc avec compilo natif
120 dnl on utilise donc gnu pour generer les dependances.
121      DEPCC=gcc
122      DEPCXX=g++
123      DEPCXXFLAGS=
124      DIFFFLAGS="-w"
125 dnl  MACHINE="OSF1"
126      ;;
127    *)
128      DEPCC=${CC-cc}
129      DEPCXX=${CXX-c++}
130      DEPCXXFLAGS="\${CXXFLAGS}"
131      DIFFFLAGS="-b -B"
132 dnl  MACHINE="PCLINUX"
133      ;;
134  esac
135  C_DEPEND_FLAG=
136  for ac_C_DEPEND_FLAG in -xM -MM -M ; do
137
138     rm -f conftest.d conftest.err
139     ${DEPCC} ${ac_C_DEPEND_FLAG} -c conftest.c 1> conftest.d 2> conftest.err
140     if test -f conftest.u ; then
141        mv conftest.u conftest.d
142     fi
143
144     rm -f conftest
145     diff ${DIFFFLAGS} conftest.d conftest.verif > conftest
146     if test ! -s conftest ; then
147        C_DEPEND_FLAG=${ac_C_DEPEND_FLAG}
148        break
149     fi
150  done
151
152 dnl use gcc option -MG : asume unknown file will be construct later
153  rm -f conftest.d conftest.err
154  ${DEPCC} ${C_DEPEND_FLAG} -MG -c conftest.c 1> conftest.d 2> conftest.err
155  if test -f conftest.u ; then
156     mv conftest.u conftest.d
157  fi
158  rm -f conftest
159  diff ${DIFFFLAGS} conftest.d conftest.verif > conftest
160  if test ! -s conftest ; then
161     C_DEPEND_FLAG=${C_DEPEND_FLAG}" -MG"
162  fi
163
164  rm -f conftest*
165  if test "x${C_DEPEND_FLAG}" = "x" ; then
166     echo "cannot determine flag (C language)"
167     exit
168  fi
169
170  printf " C :  ${DEPCC} ${C_DEPEND_FLAG}"
171
172  AC_LANG_CPLUSPLUS
173  echo "conftest.o: conftest.cxx" > conftest.verif
174  echo "int  main() { return 0; }" > conftest.cxx
175
176  CXX_DEPEND_FLAG=
177  for ac_CXX_DEPEND_FLAG in -xM -MM -M ; do
178
179     rm -f conftest.d conftest.err
180     ${DEPCXX} ${ac_CXX_DEPEND_FLAG} -c conftest.cxx 1> conftest.d 2> conftest.err
181     if test -f conftest.u ; then
182        mv conftest.u conftest.d
183     fi
184
185     rm -f conftest
186     diff ${DIFFFLAGS} conftest.d conftest.verif > conftest
187     if test ! -s conftest ; then
188        CXX_DEPEND_FLAG=${ac_CXX_DEPEND_FLAG}
189        break
190     fi
191  done
192
193 dnl use g++ option -MG : asume unknown file will be construct later
194  rm -f conftest.d conftest.err
195  ${DEPCXX} ${CXX_DEPEND_FLAG} -MG -c conftest.cxx 1> conftest.d 2> conftest.err
196  if test -f conftest.u ; then
197     mv conftest.u conftest.d
198  fi
199  rm -f conftest
200  diff ${DIFFFLAGS} conftest.d conftest.verif > conftest
201  if test ! -s conftest ; then
202     CXX_DEPEND_FLAG=${CXX_DEPEND_FLAG}" -MG"
203  fi
204
205
206  rm -f conftest*
207  if test "x${CXX_DEPEND_FLAG}" = "x" ; then
208     echo "cannot determine flag (C++ language)"
209     exit
210  fi
211
212  printf " C++ : ${DEPCXX} ${CXX_DEPEND_FLAG}"
213  AC_LANG_RESTORE
214
215  AC_MSG_RESULT([ ... done])
216
217  AC_SUBST(DEPCC)
218  AC_SUBST(DEPCXX)
219  AC_SUBST(DEPCXXFLAGS)
220  AC_SUBST(C_DEPEND_FLAG)
221  AC_SUBST(CXX_DEPEND_FLAG)
222  AC_SUBST(MACHINE)
223 ])