build: Fallback to alphasort() if versionsort() isn't available

versionsort() is a GNU-ism and can't be relied on for non-GNU systems.

[modified to define SORTFUNC instead of copying lines by tiwai]

Signed-off-by: Arun Raghavan <arun.raghavan@collabora.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Arun Raghavan 2012-07-17 15:30:15 +05:30 committed by Takashi Iwai
parent df924cd9c5
commit 55abbc9fde
2 changed files with 12 additions and 2 deletions

View file

@ -3505,7 +3505,12 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t
struct dirent **namelist;
int n;
n = scandir(fi[idx].name, &namelist, config_filename_filter, versionsort);
#ifdef _GNU_SOURCE
#define SORTFUNC versionsort
#else
#define SORTFUNC alphasort
#endif
n = scandir(fi[idx].name, &namelist, config_filename_filter, SORTFUNC);
if (n > 0) {
int j;
err = 0;

View file

@ -1254,7 +1254,12 @@ int uc_mgr_scan_master_configs(const char **_list[])
"%s", env ? env : ALSA_USE_CASE_DIR);
filename[MAX_FILE-1] = '\0';
err = scandir(filename, &namelist, filename_filter, versionsort);
#ifdef _GNU_SOURCE
#define SORTFUNC versionsort
#else
#define SORTFUNC alphasort
#endif
err = scandir(filename, &namelist, filename_filter, SORTFUNC);
if (err < 0) {
err = -errno;
uc_error("error: could not scan directory %s: %s",