Merge pull request #9102 from orbea/cdrom

qb: Improve the CDROM check.
This commit is contained in:
bparker06 2019-07-13 10:40:27 -04:00 committed by GitHub
commit a6accec402
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 20 deletions

View File

@ -137,12 +137,12 @@ check_lib '' THREADS "$PTHREADLIB" pthread_create
check_enabled THREADS THREAD_STORAGE 'Thread Local Storage' 'Threads are' false
check_lib '' THREAD_STORAGE "$PTHREADLIB" pthread_key_create
if [ "$HAVE_NO_CDROM" = "" ]; then
if [ "$OS" = 'Win32' ] || [ "$OS" = 'Linux' ]; then
HAVE_CDROM=yes
fi
if [ "$OS" = 'Linux' ]; then
check_header CDROM stropts.h scsi/sg.h
fi
check_platform 'Linux Win32' CDROM 'CD-ROM is' user
if [ "$OS" = 'Win32' ]; then
HAVE_DYLIB=yes
else

View File

@ -144,4 +144,4 @@ HAVE_VIDEOPROCESSOR=auto # Enable video processor core
HAVE_VIDEOCORE=auto # Broadcom Videocore 4 support
HAVE_DRMINGW=no # DrMingw exception handler
HAVE_EASTEREGG=yes # Easter egg
HAVE_CDROM=no
HAVE_CDROM=auto # CD-ROM support

View File

@ -41,3 +41,19 @@ exists()
done
return $v
}
# match:
# Compares a variable against a list of variables
# $1 = variable
# $@ = list of variables
match()
{
var="$1"
shift
for string do
case "$string" in
"$var" ) return 0 ;;
esac
done
return 1
}

View File

@ -82,30 +82,45 @@ check_enabled()
}
# check_platform:
# $1 = OS
# $1 = OS ['OS' or 'OS OS2 OS3', $1 = name]
# $2 = HAVE_$2
# $3 = feature
# $4 = enable feature when true [checked only if non-empty]
# $4 = enable feature when 'true', disable errors with 'user' [checked only if non-empty]
check_platform()
{ tmpval="$(eval "printf %s \"\$HAVE_$2\"")"
[ "$tmpval" = 'no' ] && return 0
error=
newval=
setval="$(eval "printf %s \"\$USER_$2\"")"
for platform in $(printf %s "$1"); do
if [ "$setval" = 'yes' ]; then
if { [ "$1" != "$OS" ] && [ "${4:-}" = 'true' ]; } ||
{ [ "$1" = "$OS" ] &&
[ "${4:-}" != 'true' ]; }; then
die 1 "Error: $3 not supported for $OS."
if [ "$error" != 'no' ] && [ "${4:-}" != 'user' ] &&
{ { [ "$platform" != "$OS" ] &&
match "${4:-}" true user; } ||
{ [ "$platform" = "$OS" ] &&
! match "${4:-}" true user; }; }; then
error='yes'
elif match "${4:-}" true user; then
error='no'
fi
elif [ "$1" = "$OS" ]; then
if [ "${4:-}" = 'true' ]; then
eval "HAVE_$2=yes"
elif [ "$platform" = "$OS" ]; then
if match "${4:-}" true user; then
newval=yes
break
else
eval "HAVE_$2=no"
newval=no
fi
elif [ "${4:-}" = 'true' ]; then
eval "HAVE_$2="
elif match "${4:-}" true user; then
newval=auto
fi
done
if [ "${error}" = 'yes' ]; then
die 1 "Error: $3 not supported for $OS."
else
eval "HAVE_$2=\"${newval:-$tmpval}\""
fi
}