[FFmpeg-cvslog] r14754 - trunk/configure

Måns Rullgård mans
Fri Aug 15 00:30:57 CEST 2008


Aurelien Jacobs <aurel at gnuage.org> writes:

> D wrote:
>
>> On Aug 14, 2008, at 7:40 AM, michael wrote:
>> 
>> > Author: michael
>> > Date: Thu Aug 14 13:40:14 2008
>> > New Revision: 14754
>> >
>> > Log:
>> > Add -D_POSIX_C_SOURCE=200112 to cflags.
>> 
>> This breaks on Mac OS X as such:
>> 
>> gcc -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I. - 
>> I"/Users/lessen/ffmpeg" -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 - 
>> pipe -force_cpusubtype_ALL -Wno-sign-compare -mdynamic-no-pic -fomit- 
>> frame-pointer -g -Wdeclaration-after-statement -Wall -Wno-switch - 
>> Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer- 
>> sign -Wcast-qual -Wwrite-strings -O3 -fno-math-errno       -c -o  
>> libavformat/os_support.o /Users/davedc/Projects/ffmpeg-git/libavformat/ 
>> os_support.c
>> /Users/davedc/Projects/ffmpeg-git/libavformat/os_support.c: In  
>> function ?resolve_host?:
>> /Users/davedc/Projects/ffmpeg-git/libavformat/os_support.c:63:  
>> warning: implicit declaration of function ?inet_aton?
>> /Users/davedc/Projects/ffmpeg-git/libavformat/os_support.c:67: error:  
>> ?struct hostent? has no member named ?h_addr?
>> make: *** [libavformat/os_support.o] Error 1
>> 
>> 
>> It seems the problem is that the h_addr compatibilty macro and  
>> inet_aton are not defined at all in the 10.4 headers if  
>> _POSIX_C_SOURCE is. 10.5 headers define them when _POSIX_C_SOURCE is  
>> defined only if _DARWIN_C_SOURCE is also defined.
>> 
>> Apparently this was a deliberate change from 10.3 which supposedly  
>> does not have these conditions, as evidenced by lynx having the same  
>> problem over 3 years ago ( http://www.mail-archive.com/lynx-dev at nongnu.org/msg00950.html 
>>   )
>> 
>> Two possible solutions I see: don't define _POSIX_C_SOURCE on Darwin  
>> or use h_addr_list[0] rather than h_addr.
>
> I guess h_addr_list[0] is the way to go. h_addr is not posix:
> http://www.opengroup.org/onlinepubs/000095399/basedefs/netdb.h.html
>
> Anyone against the attached patch ?
> I fear this might break some very old, non-posix systems. But the
> best way to find it out, is probably to commit it.
>
> Aurel
>
> Index: libavformat/os_support.c
> ===================================================================
> --- libavformat/os_support.c	(revision 14766)
> +++ libavformat/os_support.c	(working copy)
> @@ -68,7 +68,7 @@
>          hp = gethostbyname(hostname);
>          if (!hp)
>              return -1;
> -        memcpy(sin_addr, hp->h_addr, sizeof(struct in_addr));
> +        memcpy(sin_addr, hp->h_addr_list[0], sizeof(struct in_addr));
>      }
>      return 0;
>  }

Looks good to me.  Nobody is listed as maintainer for that file, so go
ahead and commit.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-cvslog mailing list