Add check against GNU/Linux driver. More info in include/cdio/config.

This commit is contained in:
R. Bernstein
2008-12-07 06:40:51 -05:00
parent a904cc23ec
commit ca23ec2ae5
3 changed files with 35 additions and 4 deletions

View File

@@ -188,8 +188,8 @@ dnl headers
AC_HEADER_STDC
AC_CHECK_HEADERS(errno.h fcntl.h glob.h limits.h pwd.h)
AC_CHECK_HEADERS(stdarg.h stdbool.h stdio.h sys/cdio.h sys/param.h)
AC_CHECK_HEADERS(sys/time.h sys/timeb.h)
AC_CHECK_HEADERS(stdarg.h stdbool.h stdio.h sys/cdio.h sys/param.h \
sys/time.h sys/timeb.h sys/utsname.h)
AC_CHECK_HEADERS(ncurses.h curses.h, break, [enable_cdda_player='no'])
dnl FreeBSD 4 has getopt in unistd.h. So we include that before
@@ -674,7 +674,7 @@ cat > include/cdio/cdio_config.h << EOF
version of config.h
*/
EOF
head -n 233 config.h >> include/cdio/cdio_config.h
head -n 254 config.h >> include/cdio/cdio_config.h
]],[[]])
AC_OUTPUT

View File

@@ -1,3 +1,4 @@
/*~
/Makefile
/Makefile.in
/cdio_config.h

View File

@@ -35,6 +35,10 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_SYS_UTSNAME_H
#include <sys/utsname.h>
#endif
#include <string.h>
static void
@@ -79,10 +83,36 @@ main(int argc, const char *argv[])
if (cdio_have_driver(-1) != false)
{
printf("Bogus driver number -1 should be regexted\n");
fprintf(stderr, "Bogus driver number -1 should be regexted\n");
return 5;
}
#ifdef HAVE_SYS_UTSNAME_H
{
struct utsname utsname;
if (0 == uname(&utsname))
{
if (0 == strncmp("Linux", utsname.sysname, sizeof("Linux")))
{
if (!cdio_have_driver(DRIVER_LINUX))
{
fprintf(stderr,
"You should have been able to get GNU/Linux driver\n");
return 6;
}
}
else if (0 == strncmp("Cygwin", utsname.sysname, sizeof("Cygwin")))
{
if (!cdio_have_driver(DRIVER_WIN32))
{
fprintf(stderr,
"You should have been able to get Win32 driver\n");
return 6;
}
}
}
}
#endif
if (! (cdio_have_driver(DRIVER_NRG) && cdio_have_driver(DRIVER_BINCUE)) ) {
printf("You don't have enough drivers for this test\n");