From: <and...@us...> - 2008-08-14 13:05:32
|
Revision: 8648 http://plplot.svn.sourceforge.net/plplot/?rev=8648&view=rev Author: andrewross Date: 2008-08-14 13:05:41 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Add in cmake check for fortran function isnan. If it exists, this will be used in example 21, otherwise an alternative is provided. This fixes problems with ifort optimising the alternative away. Modified Paths: -------------- trunk/cmake/modules/fortran.cmake trunk/examples/f77/CMakeLists.txt trunk/examples/f77/x21f.fm4 trunk/examples/f95/CMakeLists.txt trunk/examples/f95/x21f.f90 Modified: trunk/cmake/modules/fortran.cmake =================================================================== --- trunk/cmake/modules/fortran.cmake 2008-08-14 08:14:56 UTC (rev 8647) +++ trunk/cmake/modules/fortran.cmake 2008-08-14 13:05:41 UTC (rev 8648) @@ -62,6 +62,9 @@ include(TestF77CmdLine) endif(ENABLE_f77) + # Check if isnan is available as an fortran function + include(TestFortranIsnan) + # Determine which Fortran compiler we have. We do not need to # this for all compilers, just the ones that have a test in # bindings/f77/plstubs.h and bindings/f95/plstubs.h Modified: trunk/examples/f77/CMakeLists.txt =================================================================== --- trunk/examples/f77/CMakeLists.txt 2008-08-14 08:14:56 UTC (rev 8647) +++ trunk/examples/f77/CMakeLists.txt 2008-08-14 13:05:41 UTC (rev 8648) @@ -79,6 +79,19 @@ endforeach(STRING_INDEX ${f77_STRING_INDICES}) endif(PL_DOUBLE) +# Process fortran header file to define isnan +if(FORTRAN_HAVE_ISNAN) + set(HAVE_F77_ISNAN_FALSE C) +else(FORTRAN_HAVE_ISNAN) + set(HAVE_F77_ISNAN_TRUE C) +endif(FORTRAN_HAVE_ISNAN) +configure_file( +${CMAKE_CURRENT_SOURCE_DIR}/plf77demos.inc.cmake +${CMAKE_CURRENT_BINARY_DIR}/plf77demos.inc +) +set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/plf77demos.inc +PROPERTIES GENERATED ON) + if(BUILD_TEST) remove_definitions("-DHAVE_CONFIG_H") include_directories(${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include) @@ -106,3 +119,8 @@ DESTINATION ${DATA_DIR}/examples/f77 RENAME Makefile ) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plf77demos.inc +DESTINATION ${DATA_DIR}/examples/f77 +) + Modified: trunk/examples/f77/x21f.fm4 =================================================================== --- trunk/examples/f77/x21f.fm4 2008-08-14 08:14:56 UTC (rev 8647) +++ trunk/examples/f77/x21f.fm4 2008-08-14 13:05:41 UTC (rev 8648) @@ -20,6 +20,8 @@ C License along with PLplot; if not, write to the Free Software C Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + include 'plf77demos.inc' + implicit none real*8 PI @@ -45,6 +47,7 @@ external plrandd real*8 plrandd +C The function myisnan is defined in plf77demos.h external myisnan logical myisnan @@ -276,17 +279,17 @@ end subroutine - function myisnan(x) - implicit none - - logical myisnan - real*8 x +c function myisnan(x) +c implicit none +c +c logical myisnan +c real*8 x +c +c myisnan = (x.ne.x) +c return +c end function - myisnan = (x.ne.x) - return - end function - C---------------------------------------------------------------------------- C Subroutine a2mnmx C Minimum and the maximum elements of a 2-d array. Modified: trunk/examples/f95/CMakeLists.txt =================================================================== --- trunk/examples/f95/CMakeLists.txt 2008-08-14 08:14:56 UTC (rev 8647) +++ trunk/examples/f95/CMakeLists.txt 2008-08-14 13:05:41 UTC (rev 8648) @@ -50,6 +50,20 @@ "30" ) +# Process fortran header file to define isnan +if(FORTRAN_HAVE_ISNAN) + set(HAVE_F77_ISNAN_FALSE !) +else(FORTRAN_HAVE_ISNAN) + set(HAVE_F77_ISNAN_TRUE !) +endif(FORTRAN_HAVE_ISNAN) +configure_file( +${CMAKE_CURRENT_SOURCE_DIR}/plf95demos.inc.cmake +${CMAKE_CURRENT_BINARY_DIR}/plf95demos.inc +) +set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/plf95demos.inc +PROPERTIES GENERATED ON) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + if(BUILD_TEST) remove_definitions("-DHAVE_CONFIG_H") @@ -102,3 +116,8 @@ DESTINATION ${DATA_DIR}/examples/f95 RENAME Makefile ) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plf95demos.inc +DESTINATION ${DATA_DIR}/examples/f95 +) + Modified: trunk/examples/f95/x21f.f90 =================================================================== --- trunk/examples/f95/x21f.f90 2008-08-14 08:14:56 UTC (rev 8647) +++ trunk/examples/f95/x21f.f90 2008-08-14 13:05:41 UTC (rev 8648) @@ -21,6 +21,7 @@ ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use plplot, PI => PL_PI + implicit none ! integer PL_PARSE_FULL @@ -271,18 +272,6 @@ end subroutine cmap1_init - function myisnan(x) - use plplot - implicit none - - logical myisnan - real(kind=plflt) x - - myisnan = (x.ne.x) - return - end function myisnan - - !---------------------------------------------------------------------------- ! Subroutine a2mnmx ! Minimum and the maximum elements of a 2-d array. @@ -303,3 +292,7 @@ enddo enddo end subroutine a2mnmx + + include 'plf95demos.inc' + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |