BASIS  version 1.2.3 (revision 2104)
FindBLAS.cmake
Go to the documentation of this file.
00001 ##############################################################################
00002 # @file  FindBLAS.cmake
00003 # @brief Find BLAS library.
00004 #
00005 # This module finds an installed fortran library that implements the BLAS
00006 # linear-algebra interface (see http://www.netlib.org/blas/).
00007 # The list of libraries searched for is taken
00008 # from the autoconf macro file, acx_blas.m4 (distributed at
00009 # http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
00010 #
00011 # Modified by Andreas Schuh to enable the use at SBIA, where an ATLAS C library
00012 # is installed which contains the symbols without trailing _ character, i.e.,
00013 # instead of checking the existence of the cblas_dgemm_ function, the
00014 # existence of the cblas_dgemm function has to be checked.
00015 #
00016 # This module sets the following variables:
00017 #  BLAS_FOUND - set to true if a library implementing the BLAS interface
00018 #    is found
00019 #  BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l
00020 #    and -L).
00021 #  BLAS_LIBRARIES - uncached list of libraries (using full path name) to
00022 #    link against to use BLAS
00023 #  BLAS95_LIBRARIES - uncached list of libraries (using full path name)
00024 #    to link against to use BLAS95 interface
00025 #  BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
00026 #    is found
00027 #  BLA_STATIC  if set on this determines what kind of linkage we do (static)
00028 #  BLA_VENDOR  if set checks only the specified vendor, if not set checks
00029 #     all the possibilities
00030 #  BLA_F95     if set on tries to find the f95 interfaces for BLAS/LAPACK
00031 #
00032 # List of vendors (BLA_VENDOR) valid in this module
00033 # ATLAS, PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model),
00034 # Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,Apple, NAS, Generic
00035 # C/CXX should be enabled to use Intel mkl
00036 #
00037 # @verbatim
00038 # Copyright 2007-2009 Kitware, Inc.
00039 # All rights reserved.
00040 #
00041 # Redistribution and use in source and binary forms, with or without
00042 # modification, are permitted provided that the following conditions
00043 # are met:
00044 #
00045 # * Redistributions of source code must retain the above copyright
00046 #  notice, this list of conditions and the following disclaimer.
00047 #
00048 # * Redistributions in binary form must reproduce the above copyright
00049 #  notice, this list of conditions and the following disclaimer in the
00050 #  documentation and/or other materials provided with the distribution.
00051 #
00052 # * Neither the names of Kitware, Inc., the Insight Software Consortium,
00053 #  nor the names of their contributors may be used to endorse or promote
00054 #  products derived from this software without specific prior written
00055 #  permission.
00056 #
00057 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00058 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00059 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00060 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00061 # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00062 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00063 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00064 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00065 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00066 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00067 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00068 # @endverbatim
00069 #
00070 # @ingroup CMakeFindModules
00071 ##############################################################################
00072 
00073 include(CheckFunctionExists)
00074 include(CheckFortranFunctionExists)
00075 
00076 # Check the language being used
00077 get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES )
00078 if( _LANGUAGES_ MATCHES Fortran )
00079   set( _CHECK_FORTRAN TRUE )
00080 elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) )
00081   set( _CHECK_FORTRAN FALSE )
00082 else()
00083   if(BLAS_FIND_REQUIRED)
00084     message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.")
00085   else(BLAS_FIND_REQUIRED)
00086     message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)")
00087     return()
00088   endif(BLAS_FIND_REQUIRED)
00089 endif( )
00090 
00091 macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _threads)
00092 # This macro checks for the existence of the combination of fortran libraries
00093 # given by _list.  If the combination is found, this macro checks (using the
00094 # Check_Fortran_Function_Exists macro) whether can link against that library
00095 # combination using the name of a routine given by _name using the linker
00096 # flags given by _flags.  If the combination of libraries is found and passes
00097 # the link test, LIBRARIES is set to the list of complete library paths that
00098 # have been found.  Otherwise, LIBRARIES is set to FALSE.
00099 
00100 # N.B. _prefix is the prefix applied to the names of all cached variables that
00101 # are generated internally and marked advanced by this macro.
00102 
00103 set(_libraries_work TRUE)
00104 set(${LIBRARIES})
00105 set(_combined_name)
00106 foreach(_library ${_list})
00107   set(_combined_name ${_combined_name}_${_library})
00108 
00109   if(_libraries_work)
00110    if ( WIN32 )
00111     if(BLA_STATIC)
00112       set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
00113     endif(BLA_STATIC)
00114     find_library(${_prefix}_${_library}_LIBRARY
00115     NAMES ${_library}
00116     PATHS ENV LIB
00117     )
00118    endif ( WIN32 )
00119 
00120    if ( APPLE )
00121     if(BLA_STATIC)
00122      set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
00123     endif(BLA_STATIC)
00124     find_library(${_prefix}_${_library}_LIBRARY
00125     NAMES ${_library}
00126     PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
00127     )
00128 
00129    else ( APPLE )
00130     if(BLA_STATIC)
00131       set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
00132     endif(BLA_STATIC)
00133     find_library(${_prefix}_${_library}_LIBRARY
00134     NAMES ${_library}
00135     PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH
00136     )
00137    endif( APPLE )
00138     mark_as_advanced(${_prefix}_${_library}_LIBRARY)
00139     set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
00140     set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
00141   endif(_libraries_work)
00142 endforeach(_library ${_list})
00143 if(_libraries_work)
00144   # Test this combination of libraries.
00145   set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads})
00146 #  message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
00147   if (_CHECK_FORTRAN)
00148     check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
00149   else()
00150     check_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
00151     if (NOT ${_prefix}${_combined_name}_WORKS)
00152       check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
00153     endif ()
00154   endif()
00155   set(CMAKE_REQUIRED_LIBRARIES)
00156   mark_as_advanced(${_prefix}${_combined_name}_WORKS)
00157   set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
00158 endif(_libraries_work)
00159 if(NOT _libraries_work)
00160   set(${LIBRARIES} FALSE)
00161 endif(NOT _libraries_work)
00162 #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
00163 endmacro(Check_Fortran_Libraries)
00164 
00165 set(BLAS_LINKER_FLAGS)
00166 set(BLAS_LIBRARIES)
00167 set(BLAS95_LIBRARIES)
00168 if ($ENV{BLA_VENDOR} MATCHES ".+")
00169   set(BLA_VENDOR $ENV{BLA_VENDOR})
00170 else ($ENV{BLA_VENDOR} MATCHES ".+")
00171   if(NOT BLA_VENDOR)
00172     set(BLA_VENDOR "All")
00173   endif(NOT BLA_VENDOR)
00174 endif ($ENV{BLA_VENDOR} MATCHES ".+")
00175 
00176 if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
00177  if(NOT BLAS_LIBRARIES)
00178   # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
00179   check_fortran_libraries(
00180   BLAS_LIBRARIES
00181   BLAS
00182   cblas_dgemm
00183   ""
00184   "cblas;f77blas;atlas"
00185   ""
00186   )
00187  endif(NOT BLAS_LIBRARIES)
00188 endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
00189 
00190 # BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
00191 if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
00192  if(NOT BLAS_LIBRARIES)
00193   check_fortran_libraries(
00194   BLAS_LIBRARIES
00195   BLAS
00196   sgemm
00197   ""
00198   "sgemm;dgemm;blas"
00199   ""
00200   )
00201  endif(NOT BLAS_LIBRARIES)
00202 endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
00203 
00204 # BLAS in Alpha CXML library?
00205 if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
00206  if(NOT BLAS_LIBRARIES)
00207   check_fortran_libraries(
00208   BLAS_LIBRARIES
00209   BLAS
00210   sgemm
00211   ""
00212   "cxml"
00213   ""
00214   )
00215  endif(NOT BLAS_LIBRARIES)
00216 endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
00217 
00218 # BLAS in Alpha DXML library? (now called CXML, see above)
00219 if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
00220  if(NOT BLAS_LIBRARIES)
00221   check_fortran_libraries(
00222   BLAS_LIBRARIES
00223   BLAS
00224   sgemm
00225   ""
00226   "dxml"
00227   ""
00228   )
00229  endif(NOT BLAS_LIBRARIES)
00230 endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
00231 
00232 # BLAS in Sun Performance library?
00233 if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
00234  if(NOT BLAS_LIBRARIES)
00235   check_fortran_libraries(
00236   BLAS_LIBRARIES
00237   BLAS
00238   sgemm
00239   "-xlic_lib=sunperf"
00240   "sunperf;sunmath"
00241   ""
00242   )
00243   if(BLAS_LIBRARIES)
00244     set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
00245   endif(BLAS_LIBRARIES)
00246  endif(NOT BLAS_LIBRARIES)
00247 endif (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
00248 
00249 # BLAS in SCSL library?  (SGI/Cray Scientific Library)
00250 if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
00251  if(NOT BLAS_LIBRARIES)
00252   check_fortran_libraries(
00253   BLAS_LIBRARIES
00254   BLAS
00255   sgemm
00256   ""
00257   "scsl"
00258   ""
00259   )
00260  endif(NOT BLAS_LIBRARIES)
00261 endif (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
00262 
00263 # BLAS in SGIMATH library?
00264 if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
00265  if(NOT BLAS_LIBRARIES)
00266   check_fortran_libraries(
00267   BLAS_LIBRARIES
00268   BLAS
00269   sgemm
00270   ""
00271   "complib.sgimath"
00272   ""
00273   )
00274  endif(NOT BLAS_LIBRARIES)
00275 endif (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
00276 
00277 # BLAS in IBM ESSL library? (requires generic BLAS lib, too)
00278 if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
00279  if(NOT BLAS_LIBRARIES)
00280   check_fortran_libraries(
00281   BLAS_LIBRARIES
00282   BLAS
00283   sgemm
00284   ""
00285   "essl;blas"
00286   ""
00287   )
00288  endif(NOT BLAS_LIBRARIES)
00289 endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
00290 
00291 #BLAS in acml library?
00292 if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "ACML_MP" OR BLA_VENDOR STREQUAL "All")
00293 # the patch from Chuck Atkins:
00294  if( ((_BLAS_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR
00295     ((_BLAS_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) )
00296    if( WIN32 )
00297     file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" )
00298    else()
00299     file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" )
00300    endif()
00301    if( _ACML_ROOT )
00302     get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH )
00303     if( SIZEOF_INTEGER EQUAL 8 )
00304      set( _ACML_PATH_SUFFIX "_int64" )
00305     else()
00306     set( _ACML_PATH_SUFFIX "" )
00307    endif()
00308    if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
00309     set( _ACML_COMPILER32 "ifort32" )
00310     set( _ACML_COMPILER64 "ifort64" )
00311    elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" )
00312     set( _ACML_COMPILER32 "sun32" )
00313     set( _ACML_COMPILER64 "sun64" )
00314    elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
00315     set( _ACML_COMPILER32 "pgi32" )
00316     if( WIN32 )
00317      set( _ACML_COMPILER64 "win64" )
00318     else()
00319      set( _ACML_COMPILER64 "pgi64" )
00320     endif()
00321    elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" )
00322     # 32 bit builds not supported on Open64 but for code simplicity
00323     # We'll just use the same directory twice
00324     set( _ACML_COMPILER32 "open64_64" )
00325     set( _ACML_COMPILER64 "open64_64" )
00326    elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" )
00327     set( _ACML_COMPILER32 "nag32" )
00328     set( _ACML_COMPILER64 "nag64" )
00329    else() #if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
00330     set( _ACML_COMPILER32 "gfortran32" )
00331     set( _ACML_COMPILER64 "gfortran64" )
00332    endif()
00333 
00334    if( _BLAS_VENDOR STREQUAL "ACML_MP" )
00335     set(_ACML_MP_LIB_DIRS
00336      "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
00337      "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )
00338    else() #if( _BLAS_VENDOR STREQUAL "ACML" )
00339     set(_ACML_LIB_DIRS
00340      "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
00341      "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )
00342    endif()
00343   endif()
00344  endif()
00345 
00346  if( _BLAS_VENDOR STREQUAL "ACML_MP" )
00347   foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS} )
00348    _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "acml_mp;acml_mv" "" )
00349    if( BLAS_${_BLAS_VENDOR}_FOUND )
00350     break()
00351    endif()
00352   endforeach()
00353  else() #if( _BLAS_VENDOR STREQUAL "ACML" )
00354   foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} )
00355    _BLAS_LOCATE_AND_TEST( ${_BLAS_VENDOR} "acml;acml_mv" "" )
00356    if( BLAS_${_BLAS_VENDOR}_FOUND )
00357     break()
00358    endif()
00359   endforeach()
00360  endif()
00361 
00362  # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both
00363  if(NOT BLAS_LIBRARIES)
00364   check_fortran_libraries(
00365   BLAS_LIBRARIES
00366   BLAS
00367   sgemm
00368   ""
00369   "acml;acml_mv"
00370   ""
00371   )
00372  endif(NOT BLAS_LIBRARIES)
00373  if(NOT BLAS_LIBRARIES)
00374   check_fortran_libraries(
00375   BLAS_LIBRARIES
00376   BLAS
00377   sgemm
00378   ""
00379   "acml_mp;acml_mv"
00380   ""
00381   )
00382  endif(NOT BLAS_LIBRARIES)
00383 endif () # ACML
00384 
00385 # Apple BLAS library?
00386 if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
00387 if(NOT BLAS_LIBRARIES)
00388   check_fortran_libraries(
00389   BLAS_LIBRARIES
00390   BLAS
00391   cblas_dgemm
00392   ""
00393   "Accelerate"
00394   ""
00395   )
00396  endif(NOT BLAS_LIBRARIES)
00397 endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
00398 
00399 if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
00400  if ( NOT BLAS_LIBRARIES )
00401     check_fortran_libraries(
00402     BLAS_LIBRARIES
00403     BLAS
00404     cblas_dgemm
00405     ""
00406     "vecLib"
00407     ""
00408     )
00409  endif ( NOT BLAS_LIBRARIES )
00410 endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
00411 # Generic BLAS library?
00412 if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
00413  if(NOT BLAS_LIBRARIES)
00414   check_fortran_libraries(
00415   BLAS_LIBRARIES
00416   BLAS
00417   sgemm
00418   ""
00419   "blas"
00420   ""
00421   )
00422  endif(NOT BLAS_LIBRARIES)
00423 endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
00424 
00425 #BLAS in intel mkl 10 library? (em64t 64bit)
00426 if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
00427  if (NOT WIN32)
00428   set(LM "-lm")
00429  endif ()
00430  if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
00431   if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
00432     find_package(Threads)
00433   else(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
00434     find_package(Threads REQUIRED)
00435   endif(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
00436   if (WIN32)
00437   if(BLA_F95)
00438     if(NOT BLAS95_LIBRARIES)
00439     check_fortran_libraries(
00440     BLAS95_LIBRARIES
00441     BLAS
00442     sgemm
00443     ""
00444     "mkl_blas95;mkl_intel_c;mkl_intel_thread;mkl_core;libguide40"
00445     ""
00446     )
00447     endif(NOT BLAS95_LIBRARIES)
00448   else(BLA_F95)
00449     if(NOT BLAS_LIBRARIES)
00450     check_fortran_libraries(
00451     BLAS_LIBRARIES
00452     BLAS
00453     SGEMM
00454     ""
00455     "mkl_c_dll;mkl_intel_thread_dll;mkl_core_dll;libguide40"
00456     ""
00457     )
00458     endif(NOT BLAS_LIBRARIES)
00459   endif(BLA_F95)
00460   else(WIN32)
00461   if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
00462     if(BLA_F95)
00463       if(NOT BLAS95_LIBRARIES)
00464       check_fortran_libraries(
00465       BLAS95_LIBRARIES
00466       BLAS
00467       sgemm
00468       ""
00469       "mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide"
00470       "${CMAKE_THREAD_LIBS_INIT};${LM}"
00471       )
00472       endif(NOT BLAS95_LIBRARIES)
00473     else(BLA_F95)
00474     if(NOT BLAS_LIBRARIES)
00475       check_fortran_libraries(
00476       BLAS_LIBRARIES
00477       BLAS
00478       sgemm
00479       ""
00480       "mkl_intel;mkl_intel_thread;mkl_core;guide"
00481       "${CMAKE_THREAD_LIBS_INIT}"
00482       "${LM}"
00483       )
00484       endif(NOT BLAS_LIBRARIES)
00485     endif(BLA_F95)
00486   endif (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
00487   if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
00488    if(BLA_F95)
00489     if(NOT BLAS95_LIBRARIES)
00490       check_fortran_libraries(
00491       BLAS95_LIBRARIES
00492       BLAS
00493       sgemm
00494       ""
00495       "mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
00496       "${CMAKE_THREAD_LIBS_INIT};${LM}"
00497       )
00498     endif(NOT BLAS95_LIBRARIES)
00499    else(BLA_F95)
00500      if(NOT BLAS_LIBRARIES)
00501       check_fortran_libraries(
00502       BLAS_LIBRARIES
00503       BLAS
00504       sgemm
00505       ""
00506       "mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
00507       "${CMAKE_THREAD_LIBS_INIT};${LM}"
00508       )
00509      endif(NOT BLAS_LIBRARIES)
00510    endif(BLA_F95)
00511   endif (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
00512   endif (WIN32)
00513   #older vesions of intel mkl libs
00514   # BLAS in intel mkl library? (shared)
00515   if(NOT BLAS_LIBRARIES)
00516     check_fortran_libraries(
00517     BLAS_LIBRARIES
00518     BLAS
00519     sgemm
00520     ""
00521     "mkl;guide"
00522     "${CMAKE_THREAD_LIBS_INIT};${LM}"
00523     )
00524   endif(NOT BLAS_LIBRARIES)
00525   #BLAS in intel mkl library? (static, 32bit)
00526   if(NOT BLAS_LIBRARIES)
00527     check_fortran_libraries(
00528     BLAS_LIBRARIES
00529     BLAS
00530     sgemm
00531     ""
00532     "mkl_ia32;guide"
00533     "${CMAKE_THREAD_LIBS_INIT};${LM}"
00534     )
00535   endif(NOT BLAS_LIBRARIES)
00536   #BLAS in intel mkl library? (static, em64t 64bit)
00537   if(NOT BLAS_LIBRARIES)
00538     check_fortran_libraries(
00539     BLAS_LIBRARIES
00540     BLAS
00541     sgemm
00542     ""
00543     "mkl_em64t;guide"
00544     "${CMAKE_THREAD_LIBS_INIT};${LM}"
00545     )
00546   endif(NOT BLAS_LIBRARIES)
00547  endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
00548 endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
00549 
00550 
00551 if(BLA_F95)
00552  if(BLAS95_LIBRARIES)
00553     set(BLAS95_FOUND TRUE)
00554   else(BLAS95_LIBRARIES)
00555     set(BLAS95_FOUND FALSE)
00556   endif(BLAS95_LIBRARIES)
00557 
00558   if(NOT BLAS_FIND_QUIETLY)
00559     if(BLAS95_FOUND)
00560       message(STATUS "A library with BLAS95 API found.")
00561     else(BLAS95_FOUND)
00562       if(BLAS_FIND_REQUIRED)
00563         message(FATAL_ERROR
00564         "A required library with BLAS95 API not found. Please specify library location.")
00565       else(BLAS_FIND_REQUIRED)
00566         message(STATUS
00567         "A library with BLAS95 API not found. Please specify library location.")
00568       endif(BLAS_FIND_REQUIRED)
00569     endif(BLAS95_FOUND)
00570   endif(NOT BLAS_FIND_QUIETLY)
00571   set(BLAS_FOUND TRUE)
00572   set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
00573 else(BLA_F95)
00574   if(BLAS_LIBRARIES)
00575     set(BLAS_FOUND TRUE)
00576   else(BLAS_LIBRARIES)
00577     set(BLAS_FOUND FALSE)
00578   endif(BLAS_LIBRARIES)
00579 
00580   if(NOT BLAS_FIND_QUIETLY)
00581     if(BLAS_FOUND)
00582       message(STATUS "A library with BLAS API found.")
00583     else(BLAS_FOUND)
00584       if(BLAS_FIND_REQUIRED)
00585         message(FATAL_ERROR
00586         "A required library with BLAS API not found. Please specify library location."
00587         )
00588       else(BLAS_FIND_REQUIRED)
00589         message(STATUS
00590         "A library with BLAS API not found. Please specify library location."
00591         )
00592       endif(BLAS_FIND_REQUIRED)
00593     endif(BLAS_FOUND)
00594   endif(NOT BLAS_FIND_QUIETLY)
00595 endif(BLA_F95)