[09/10] configure: Only redefine inline to __inline for msvc if necessary

Message ID 1437904678-19444-9-git-send-email-martin@martin.st
State Committed
Commit 5fd553d31272d5ed42a7a5a0ecaab7b3452da83a
Headers show

Commit Message

Martin Storsjö July 26, 2015, 9:57 a.m.
This isn't necessary on MSVC 2015 any longer.
---
 configure | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Luca Barbato July 26, 2015, 10:20 a.m. | #1
On 26/07/15 11:57, Martin Storsjö wrote:
> This isn't necessary on MSVC 2015 any longer.
> ---
>   configure | 13 ++++++++++++-
>   1 file changed, 12 insertions(+), 1 deletion(-)
>

Ok.
Jean-Baptiste Kempf July 26, 2015, 11:02 a.m. | #2
On 26 Jul, Martin Storsjö wrote :
> This isn't necessary on MSVC 2015 any longer.

LGTM.
With my kindest regards,
Janne Grunau July 26, 2015, 10:28 p.m. | #3
On 2015-07-26 12:57:57 +0300, Martin Storsjö wrote:
> This isn't necessary on MSVC 2015 any longer.
> ---
>  configure | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index b67c4b5..ab174f2 100755
> --- a/configure
> +++ b/configure
> @@ -3062,7 +3062,7 @@ probe_cc(){
>          _ld_lib='lib%.a'
>          _ld_path='-libpath:'
>          _flags='-nologo'
> -        _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dinline=__inline -Dstrtoll=_strtoi64'
> +        _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dstrtoll=_strtoi64'
>      elif $_cc 2>&1 | grep -q Intel; then
>          _type=icl
>          _ident=$($_cc 2>&1 | head -n1)
> @@ -4747,6 +4747,17 @@ EOF
>      fi
>  fi
>  
> +for pfx in "" host_; do
> +    pfx_no_=${pfx%_}
> +    varname=${pfx_no_}cc_type

the double expansion is not necessary. varname=${pfx%_}cc_type works as 
well

> +    eval "type=\$$varname"
> +    if [ $type = "msvc" ]; then
> +        check_${pfx}cc <<EOF || add_${pfx}cflags -Dinline=__inline
> +static inline int foo(int a) { return a; }
> +EOF
> +    fi
> +done
> +

no pretty but I don't see how it can be better, ok


Janne
Martin Storsjö July 27, 2015, 7 a.m. | #4
On Mon, 27 Jul 2015, Janne Grunau wrote:

> On 2015-07-26 12:57:57 +0300, Martin Storsjö wrote:
>> This isn't necessary on MSVC 2015 any longer.
>> ---
>>  configure | 13 ++++++++++++-
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index b67c4b5..ab174f2 100755
>> --- a/configure
>> +++ b/configure
>> @@ -3062,7 +3062,7 @@ probe_cc(){
>>          _ld_lib='lib%.a'
>>          _ld_path='-libpath:'
>>          _flags='-nologo'
>> -        _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dinline=__inline -Dstrtoll=_strtoi64'
>> +        _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dstrtoll=_strtoi64'
>>      elif $_cc 2>&1 | grep -q Intel; then
>>          _type=icl
>>          _ident=$($_cc 2>&1 | head -n1)
>> @@ -4747,6 +4747,17 @@ EOF
>>      fi
>>  fi
>>
>> +for pfx in "" host_; do
>> +    pfx_no_=${pfx%_}
>> +    varname=${pfx_no_}cc_type
>
> the double expansion is not necessary. varname=${pfx%_}cc_type works as
> well

Ah, yes. I'll fix that, in a separate commit unfortunately since this has 
already been pushed.

// Martin

Patch

diff --git a/configure b/configure
index b67c4b5..ab174f2 100755
--- a/configure
+++ b/configure
@@ -3062,7 +3062,7 @@  probe_cc(){
         _ld_lib='lib%.a'
         _ld_path='-libpath:'
         _flags='-nologo'
-        _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dinline=__inline -Dstrtoll=_strtoi64'
+        _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dstrtoll=_strtoi64'
     elif $_cc 2>&1 | grep -q Intel; then
         _type=icl
         _ident=$($_cc 2>&1 | head -n1)
@@ -4747,6 +4747,17 @@  EOF
     fi
 fi
 
+for pfx in "" host_; do
+    pfx_no_=${pfx%_}
+    varname=${pfx_no_}cc_type
+    eval "type=\$$varname"
+    if [ $type = "msvc" ]; then
+        check_${pfx}cc <<EOF || add_${pfx}cflags -Dinline=__inline
+static inline int foo(int a) { return a; }
+EOF
+    fi
+done
+
 case $as_type in
     clang)
         add_asflags -Qunused-arguments