diff mbox

[FFmpeg-devel,1/3] configure: use c++11 and fallback to c++0x for c++ files

Message ID 20170325235137.5330-1-cus@passwd.hu
State Accepted
Commit 7cfa98fd9460160d94c049bf72123e88d9c41a01
Headers show

Commit Message

Marton Balint March 25, 2017, 11:51 p.m. UTC
Needed for the C+11 atomics. Also change add_cxxflags to check_cxxflags.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Almer March 26, 2017, 12:20 a.m. UTC | #1
On 3/25/2017 8:51 PM, Marton Balint wrote:
> Needed for the C+11 atomics. Also change add_cxxflags to check_cxxflags.
> 
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index c1aeb6e..6823894 100755
> --- a/configure
> +++ b/configure
> @@ -4648,7 +4648,7 @@ fi
>  
>  add_cppflags -D_ISOC99_SOURCE
>  add_cxxflags -D__STDC_CONSTANT_MACROS
> -add_cxxflags -std=c++98
> +check_cxxflags -std=c++11 || check_cxxflags -std=c++0x

Do compilers that support setting --std=c++0x (Old provisional name for C++11)
have actual support for std::atomic? They have by definition experimental and
incomplete support for the standard in question.
Maybe an actual check for it would be needed if --std=c++11 isn't available.

>  
>  # some compilers silently accept -std=c11, so we also need to check that the
>  # version macro is defined properly
>
Marton Balint March 26, 2017, 10:22 a.m. UTC | #2
On Sat, 25 Mar 2017, James Almer wrote:

> On 3/25/2017 8:51 PM, Marton Balint wrote:
>> Needed for the C+11 atomics. Also change add_cxxflags to check_cxxflags.
>> 
>> Signed-off-by: Marton Balint <cus@passwd.hu>
>> ---
>>  configure | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/configure b/configure
>> index c1aeb6e..6823894 100755
>> --- a/configure
>> +++ b/configure
>> @@ -4648,7 +4648,7 @@ fi
>>
>>  add_cppflags -D_ISOC99_SOURCE
>>  add_cxxflags -D__STDC_CONSTANT_MACROS
>> -add_cxxflags -std=c++98
>> +check_cxxflags -std=c++11 || check_cxxflags -std=c++0x
>
> Do compilers that support setting --std=c++0x (Old provisional name for C++11)
> have actual support for std::atomic? They have by definition experimental and
> incomplete support for the standard in question.

Yes, gcc supports it since 4.4.
https://gcc.gnu.org/projects/cxx-status.html

Also MSVC 2012 (which AFAIK does not even support -std) has support for it:
https://msdn.microsoft.com/en-us/library/hh874894(v=vs.110).aspx

Clang since 3.1:
https://clang.llvm.org/cxx_status.html

> Maybe an actual check for it would be needed if --std=c++11 isn't available.

Well, only decklink_enc needs this, so if we really want to check this, 
and fail, if not, then it should be done somewhere after checking for 
decklink stuff. I don't particularly think that is very useful, but can do 
it if you think so.

Regards,
Marton
James Almer March 26, 2017, 1:29 p.m. UTC | #3
On 3/26/2017 7:22 AM, Marton Balint wrote:
> 
> On Sat, 25 Mar 2017, James Almer wrote:
> 
>> On 3/25/2017 8:51 PM, Marton Balint wrote:
>>> Needed for the C+11 atomics. Also change add_cxxflags to check_cxxflags.
>>>
>>> Signed-off-by: Marton Balint <cus@passwd.hu>
>>> ---
>>>  configure | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/configure b/configure
>>> index c1aeb6e..6823894 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -4648,7 +4648,7 @@ fi
>>>
>>>  add_cppflags -D_ISOC99_SOURCE
>>>  add_cxxflags -D__STDC_CONSTANT_MACROS
>>> -add_cxxflags -std=c++98
>>> +check_cxxflags -std=c++11 || check_cxxflags -std=c++0x
>>
>> Do compilers that support setting --std=c++0x (Old provisional name for C++11)
>> have actual support for std::atomic? They have by definition experimental and
>> incomplete support for the standard in question.
> 
> Yes, gcc supports it since 4.4.
> https://gcc.gnu.org/projects/cxx-status.html
> 
> Also MSVC 2012 (which AFAIK does not even support -std) has support for it:
> https://msdn.microsoft.com/en-us/library/hh874894(v=vs.110).aspx
> 
> Clang since 3.1:
> https://clang.llvm.org/cxx_status.html

Ok, cool then.

> 
>> Maybe an actual check for it would be needed if --std=c++11 isn't available.
> 
> Well, only decklink_enc needs this, so if we really want to check this, and fail, if not, then it should be done somewhere after checking for decklink stuff. I don't particularly think that is very useful, but can do it if you think so.

No, it's ok. Patch LGTM as is.

Thanks for handling this.
Marton Balint March 28, 2017, 8:33 p.m. UTC | #4
On Sun, 26 Mar 2017, James Almer wrote:

> On 3/26/2017 7:22 AM, Marton Balint wrote:
>> 
>> On Sat, 25 Mar 2017, James Almer wrote:
>> 
>>> On 3/25/2017 8:51 PM, Marton Balint wrote:
>>>> Needed for the C+11 atomics. Also change add_cxxflags to check_cxxflags.
>>>>
>>>> Signed-off-by: Marton Balint <cus@passwd.hu>
>>>> ---
>>>>  configure | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/configure b/configure
>>>> index c1aeb6e..6823894 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -4648,7 +4648,7 @@ fi
>>>>
>>>>  add_cppflags -D_ISOC99_SOURCE
>>>>  add_cxxflags -D__STDC_CONSTANT_MACROS
>>>> -add_cxxflags -std=c++98
>>>> +check_cxxflags -std=c++11 || check_cxxflags -std=c++0x
>>>
>>> Do compilers that support setting --std=c++0x (Old provisional name for C++11)
>>> have actual support for std::atomic? They have by definition experimental and
>>> incomplete support for the standard in question.
>> 
>> Yes, gcc supports it since 4.4.
>> https://gcc.gnu.org/projects/cxx-status.html
>> 
>> Also MSVC 2012 (which AFAIK does not even support -std) has support for it:
>> https://msdn.microsoft.com/en-us/library/hh874894(v=vs.110).aspx
>> 
>> Clang since 3.1:
>> https://clang.llvm.org/cxx_status.html
>
> Ok, cool then.
>
>> 
>>> Maybe an actual check for it would be needed if --std=c++11 isn't available.
>> 
>> Well, only decklink_enc needs this, so if we really want to check this, and fail, if not, then it should be done somewhere after checking for decklink stuff. I don't particularly think that is very useful, but can do it if you think so.
>
> No, it's ok. Patch LGTM as is.
>

Ok, thanks, I pushed the series.

Regards,
Marton
diff mbox

Patch

diff --git a/configure b/configure
index c1aeb6e..6823894 100755
--- a/configure
+++ b/configure
@@ -4648,7 +4648,7 @@  fi
 
 add_cppflags -D_ISOC99_SOURCE
 add_cxxflags -D__STDC_CONSTANT_MACROS
-add_cxxflags -std=c++98
+check_cxxflags -std=c++11 || check_cxxflags -std=c++0x
 
 # some compilers silently accept -std=c11, so we also need to check that the
 # version macro is defined properly