Homebrew/homebrew — pull request #27786 by dinkypumpkin (2014-03-22 18:24:00+00:00)
Title: mplayer: require stdenv

stdev is required by mplayer configure script to correctly identify compiler and set corresponding CFLAGS

Builds of mplayer with gcc fail in superenv on OS X 10.5 and higher. On 10.6+, this error is encountered:
```
libao2/ao_coreaudio.c:1250: error:
libao2/ao_coreaudio.c: In function 'DeviceListener':
libao2/ao_coreaudio.c:1267: error: 'for' loop initial declaration used outside C99 mode
make: *** [libao2/ao_coreaudio.o] Error 1
make: *** Waiting for unfinished jobs....
```
On 10.5, this error is encountered:
```
libavcodec/cabac_functions.h: In function 'get_cabac':
libavcodec/x86/cabac.h:167: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
make[1]: *** [libavcodec/h264_cabac.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [ffmpeg/libavcodec/libavcodec.a] Error 2
```
Both errors stem from the same root cause. The mplayer configure script's compiler identification fails and the appropriate CFLAGS are not set. This occurs because the output from "gcc -v" is different between superenv and stdenv and the output in superenv can't be parsed by the configure script. The wrapper scripts in superenv don't treat "-v" as a terminal option and go on to attempt to link a.out. In superenv, the output looks like:
```
bash-3.2$ gcc -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5666.3~6/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
/usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch x86_64 -macosx_version_min 10.6.8 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/local/lib -L/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64 -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. -headerpad_max_install_names -lSystem -lgcc -lSystem
Undefined symbols:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
```
In stdenv, the output looks like:
```
bash-3.2$ gcc -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5666.3~6/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
```
The mplayer configure script expects to see "gcc" in the final line rather than "collect2".

The same thing occurs with clang, but the clang output is parsed differently by the mplayer configure script. It passes muster as a sort of happy accident.

This issue is more germane to 10.6 and 10.5, where gcc is the default compiler. However, the same problem manifests on 10.7+ if you are using apple-gcc42 from Homebrew dupes repo.

This is the same error addressed by a (rejected) patch in #26126. No patching is necessary with stdenv.