]> git.alsa-project.org Git - alsa-lib.git/commit
fix _GNU_SOURCE handling & header inclusion
authorMike Frysinger <vapier@chromium.org>
Fri, 9 Oct 2015 21:47:40 +0000 (17:47 -0400)
committerTakashi Iwai <tiwai@suse.de>
Mon, 12 Oct 2015 08:36:15 +0000 (10:36 +0200)
commit99dc70f023cf118f1e23125301d9fd38fb805f6d
tree64172c5ff01a3d356db10f907ff37553098b49e2
parent08c4b3b0adf1ab0c920dde5ffe5f914785686e54
fix _GNU_SOURCE handling & header inclusion

The configure script blindly adds -D_GNU_SOURCE to all build settings,
even on non-GNU systems.  This isn't too much of a big deal (even if
it uses the wrong variable -- CFLAGS instead of CPPFLAGS), except that
the alsa-lib source itself determines whether to use GNU features when
this is defined (such as versionsort).  So when we build on non-glibc
systems, we get build failures like:
src/ucm/parser.c:1268:18: error: 'versionsort' undeclared (first use in this function)
 #define SORTFUNC versionsort
                  ^
src/ucm/parser.c:1272:54: note: in expansion of macro 'SORTFUNC'
  err = scandir(filename, &namelist, filename_filter, SORTFUNC);
                                                      ^

The correct way to add these flags is to use the autoconf helper
AC_USE_SYSTEM_EXTENSIONS.  Unfortunately, that triggers some more
bugs in the alsa build.  This macro adds defines to config.h and
not directly to CPPFLAGS, so it relies on files correctly including
config.h before anything else.  A number of alsa files do not do
this leading to build failures.  The fix there is to shuffle the
includes around so that the local ones come first.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
configure.ac
src/conf.c
src/timer/timer.c
src/timer/timer_hw.c
src/timer/timer_local.h
src/timer/timer_query.c
src/timer/timer_query_hw.c
src/ucm/ucm_local.h