From 87f6d89e12e80adf9cdd3b7456e05524337b5a3d Mon Sep 17 00:00:00 2001 From: Federico Perini Date: Mon, 26 Aug 2024 12:05:48 +0200 Subject: [PATCH] Windows archiver: also search for `gcc-ar` --- src/fpm_compiler.F90 | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/fpm_compiler.F90 b/src/fpm_compiler.F90 index 5928ee2fd1..2f8cf4b7ba 100644 --- a/src/fpm_compiler.F90 +++ b/src/fpm_compiler.F90 @@ -1065,13 +1065,26 @@ subroutine new_archiver(self, ar, echo, verbose) if (os_type /= OS_WINDOWS .and. os_type /= OS_UNKNOWN) then self%ar = "ar"//arflags else + ! Attempt "ar" call execute_command_line("ar --version > "//get_temp_filename()//" 2>&1", & & exitstat=estat) - if (estat /= 0) then - self%ar = "lib"//libflags + + if (estat == 0) then + + self%ar = "ar"//arflags + else - self%ar = "ar"//arflags - end if + + ! Then "gcc-ar" + call execute_command_line("gcc-ar --version > "//get_temp_filename()//" 2>&1", & + & exitstat=estat) + + if (estat /= 0) then + self%ar = "lib"//libflags + else + self%ar = "gcc-ar"//arflags + end if + endif end if end if self%use_response_file = os_type == OS_WINDOWS