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>
dnl Checks for programs.
-CFLAGS="$CFLAGS -D_GNU_SOURCE"
-
-
AC_PROG_CC
AC_PROG_CPP
+AC_USE_SYSTEM_EXTENSIONS
AC_PROG_INSTALL
AC_PROG_LN_S
AC_DISABLE_STATIC
*/
+#include "local.h"
#include <stdarg.h>
#include <limits.h>
#include <sys/stat.h>
#include <dirent.h>
#include <locale.h>
-#include "local.h"
#ifdef HAVE_LIBPTHREAD
#include <pthread.h>
#endif
* \anchor example_test_timer
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/ioctl.h>
#include "timer_local.h"
+#include <signal.h>
+
static int snd_timer_open_conf(snd_timer_t **timer,
const char *name, snd_config_t *timer_root,
snd_config_t *timer_conf, int mode)
*
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
#include "timer_local.h"
#ifndef PIC
*
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <limits.h>
#include "local.h"
+#include <limits.h>
+#include <sys/ioctl.h>
#ifndef DOC_HIDDEN
typedef struct {
*
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
#include "timer_local.h"
static int snd_timer_query_open_conf(snd_timer_query_t **timer,
*
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
#include "timer_local.h"
#ifndef PIC
#define UC_MGR_DEBUG
#endif
-#include <pthread.h>
#include "local.h"
+#include <pthread.h>
#include "use-case.h"
#define MAX_FILE 256