Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
efe8df6aa98e633f37ee3dc8e912ac95fcfa07b9
[simgrid.git] / buildtools / Cmake / Modules / FindF2c.cmake
1 find_path(HAVE_F2C_H f2c.h
2   HINTS
3   $ENV{LD_LIBRARY_PATH}
4   PATH_SUFFIXES include/
5   PATHS
6   /opt
7   /opt/local
8   /opt/csw
9   /sw
10   /usr
11   )
12
13 find_program(F2C_EXE
14   NAME f2c
15   PATH_SUFFIXES bin/
16   PATHS
17   /opt
18   /opt/local
19   /opt/csw
20   /sw
21   /usr
22   )
23
24 find_library(HAVE_F2C_LIB
25   NAME f2c
26   HINTS
27   $ENV{LD_LIBRARY_PATH}
28   PATH_SUFFIXES lib/
29   PATHS
30   /opt
31   /opt/local
32   /opt/csw
33   /sw
34   /usr
35   )
36
37 if(HAVE_F2C_H)
38   set(HAVE_SMPI_F2C_H 1)
39 endif()
40
41 message(STATUS "Looking for f2c.h")
42 if(HAVE_F2C_H)
43   message(STATUS "Looking for f2c.h - found")
44 else()
45   message(STATUS "Looking for f2c.h - not found")
46 endif()
47
48 message(STATUS "Looking for lib f2c")
49 if(HAVE_F2C_LIB)
50   message(STATUS "Looking for lib f2c - found")
51 else()
52   message(STATUS "Looking for lib f2c - not found")
53 endif()
54
55 message(STATUS "Looking for bin f2c")
56 if(F2C_EXE)
57   message(STATUS "Found F2C: ${F2C_EXE}")
58 else()
59   message(STATUS "Looking for bin f2c - not found")
60 endif()
61
62 mark_as_advanced(HAVE_F2C_H)
63 mark_as_advanced(F2C_EXE)
64 mark_as_advanced(HAVE_F2C_LIB)
65
66 if(HAVE_F2C_H)
67   include_directories(${HAVE_F2C_H})
68 else()
69     message("-- Fortran for smpi is not installed (http://www.netlib.org/f2c/).")
70 endif()
71
72
73 #Some old versions of 64 bits systems seem to have a different size between C and Fortran Datatypes
74 #Deactivate F2C with these versions, in order to avoid breaking test cases in legacy systems (as Fedora 13)
75 set(COMPILER_OK 1)
76 if(PROCESSOR_x86_64 AND "${CMAKE_SYSTEM}" MATCHES "Linux" AND ${CMAKE_C_COMPILER_ID} STREQUAL "GNU" AND "4.5" STRGREATER "${COMPILER_C_VERSION_MAJOR_MINOR}" )
77     set(COMPILER_OK 0)
78     message("Your C compiler is a bit old and Fortran support is quite problematic on 64 bit platforms, F2C has been deactivated")
79 endif()
80
81 set(SMPI_F2C 0)
82 if(HAVE_F2C_H AND F2C_EXE AND HAVE_F2C_LIB AND COMPILER_OK)
83   set(SMPI_F2C 1)
84 endif()