Subject: -std=gnu99 in compiler wrappers
To: None <pkgsrc-users@netbsd.org, tech-pkg@netbsd.org>
From: Raymond Meyer <raymond.meyer@rambler.ru>
List: tech-pkg
Date: 02/10/2007 03:49:38
When building devel/glib2 on SPARC Solaris with native GCC, I get the following
error:

In file included from /usr/include/sys/types.h:18,
                 from giounix.c:38:
/opt/gcc4/lib/gcc/sparc-sun-solaris2.10/4.1.1/include/sys/feature_tests.h:341:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX applications"

[wrapper.sh] note: The real command line, after the pkgsrc wrapper, was:
/opt/pkg.obj/devel/glib2/work.e450/.gcc/bin/gcc -DHAVE_CONFIG_H -I. -I.. "-DG_LOG_DOMAIN=\"GLib\"" -DG_DISABLE_CAST_CHECKS -DG_DISABLE_DEPRECATED -DGLIB_COMPILATION "-DPREFIX=\"/opt/pkg\"" "-DPKGLOCALEDIR=\"lib\"" "-DPKG_SYSCONFDIR=\"/opt/pkg/etc\"" -I/opt/pkg.obj/devel/glib2/work.e450/.buildlink/include -D_REENTRANT -D_PTHREADS -O -Wall -MT giounix.lo -MD -MP -MF .deps/giounix.Tpo -c giounix.c -fPIC -DPIC -o .libs/giounix.o -std=gnu99 -L/opt/pkg.obj/devel/glib2/work.e450/.buildlink/lib 

I believe the above error is related to -std=gnu99 compiler flag.
None of the Makefiles in package source specify -std=gnu99, however looking
at:

/opt/pkg.obj/devel/glib2/work.e450/.wrapper/bin/cc

I see the following lines

case $append_extra_args in
yes)
        $debug_log $wrapperlog "    (wrapper.sh) append args: -std=gnu99 -I/opt/pkg.obj/devel/glib2/work.e450/.buildlink/include -L/opt/pkg.obj/devel/glib2/work.e450/.buildlink/lib"
        set -- "$@" -std=gnu99 -I/opt/pkg.obj/devel/glib2/work.e450/.buildlink/include -L/opt/pkg.obj/devel/glib2/work.e450/.buildlink/lib
        ;;
*)
        ;;
esac

My question is, why do pkgsrc wrappers append -std=gnu99?? Clearly this is
causing problems, it seems like pkgsrc wrappers are trying to be too clever
for their own good.