@@ -14,8 +14,8 @@ module fpm_environment
14
14
integer , parameter , public :: OS_SOLARIS = 5
15
15
integer , parameter , public :: OS_FREEBSD = 6
16
16
contains
17
+ ! > Determine the OS type
17
18
integer function get_os_type () result(r)
18
- ! ! Determine the OS type
19
19
! !
20
20
! ! Returns one of OS_UNKNOWN, OS_LINUX, OS_MACOS, OS_WINDOWS, OS_CYGWIN,
21
21
! ! OS_SOLARIS, OS_FREEBSD.
@@ -106,6 +106,9 @@ integer function get_os_type() result(r)
106
106
end if
107
107
end function get_os_type
108
108
109
+ ! > Compare the output of [[get_os_type]] or the optional
110
+ ! ! passed INTEGER value to the value for OS_WINDOWS
111
+ ! ! and return .TRUE. if they match and .FALSE. otherwise
109
112
logical function os_is_unix (os ) result(unix)
110
113
integer , intent (in ), optional :: os
111
114
integer :: build_os
@@ -117,6 +120,7 @@ logical function os_is_unix(os) result(unix)
117
120
unix = os /= OS_WINDOWS
118
121
end function os_is_unix
119
122
123
+ ! > echo command string and pass it to the system for execution
120
124
subroutine run (cmd ,echo )
121
125
character (len=* ), intent (in ) :: cmd
122
126
logical ,intent (in ),optional :: echo
@@ -137,10 +141,15 @@ subroutine run(cmd,echo)
137
141
end if
138
142
end subroutine run
139
143
144
+ ! > get named environment variable value. It it is blank or
145
+ ! ! not set return the optional default value
140
146
function get_env (NAME ,DEFAULT ) result(VALUE)
141
147
implicit none
142
- character (len=* ),intent (in ) :: NAME
148
+ ! > name of environment variable to get the value of
149
+ character (len=* ),intent (in ) :: NAME
150
+ ! > default value to return if the requested value is undefined or blank
143
151
character (len=* ),intent (in ),optional :: DEFAULT
152
+ ! > the returned value
144
153
character (len= :),allocatable :: VALUE
145
154
integer :: howbig
146
155
integer :: stat
0 commit comments