diff options
author | Laurence Kedward <laurence.kedward@bristol.ac.uk> | 2021-06-07 09:34:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-07 09:34:34 +0100 |
commit | 2ba3478e7d79dc8bb0598485346740b5436fe914 (patch) | |
tree | 7a0b31bed0920d19029a422864a2118ca97aca26 /src/fpm_compiler.f90 | |
parent | 87a2cbfda5ac064c754e493d41950fde72e05fc7 (diff) | |
parent | 5651c74ae8b08e3bd72a1a761fd5c64396ed6856 (diff) | |
download | fpm-2ba3478e7d79dc8bb0598485346740b5436fe914.tar.gz fpm-2ba3478e7d79dc8bb0598485346740b5436fe914.zip |
Merge pull request #489 from awvwgk/ar-output
Redirect output when searching for archiver
Diffstat (limited to 'src/fpm_compiler.f90')
-rw-r--r-- | src/fpm_compiler.f90 | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/fpm_compiler.f90 b/src/fpm_compiler.f90 index 389ba94..b3e3a56 100644 --- a/src/fpm_compiler.f90 +++ b/src/fpm_compiler.f90 @@ -27,7 +27,7 @@ ! Unisys ? ? ? ? ? discontinued module fpm_compiler use fpm_model, only: fpm_model_t -use fpm_filesystem, only: join_path, basename +use fpm_filesystem, only: join_path, basename, get_temp_filename use fpm_environment, only: & get_os_type, & OS_LINUX, & @@ -36,13 +36,15 @@ use fpm_environment, only: & OS_CYGWIN, & OS_SOLARIS, & OS_FREEBSD, & - OS_OPENBSD + OS_OPENBSD, & + OS_UNKNOWN implicit none public :: is_unknown_compiler public :: get_module_flags public :: get_default_compile_flags public :: get_debug_compile_flags public :: get_release_compile_flags +public :: get_archiver enum, bind(C) enumerator :: & @@ -464,4 +466,23 @@ function is_unknown_compiler(compiler) result(is_unknown) is_unknown = get_compiler_id(compiler) == id_unknown end function is_unknown_compiler + +function get_archiver() result(archiver) + character(:), allocatable :: archiver + integer :: estat, os_type + + os_type = get_os_type() + if (os_type /= OS_WINDOWS .and. os_type /= OS_UNKNOWN) then + archiver = "ar -rs " + else + call execute_command_line("ar --version > "//get_temp_filename()//" 2>&1", & + & exitstat=estat) + if (estat /= 0) then + archiver = "lib /OUT:" + else + archiver = "ar -rs " + end if + end if +end function + end module fpm_compiler |