qb: Add c++ support for check_header.

This commit is contained in:
orbea 2020-02-01 15:40:43 -08:00
parent e005044f64
commit 65e071e470
2 changed files with 25 additions and 23 deletions

View File

@ -126,7 +126,7 @@ if [ "$HAVE_ANGLE" = 'yes' ]; then
;;
esac
else
check_header EGL EGL/egl.h EGL/eglext.h
check_header '' EGL EGL/egl.h EGL/eglext.h
# some systems have EGL libs, but no pkgconfig
# https://github.com/linux-sunxi/sunxi-mali/pull/8
check_val '' EGL "-l${VC_PREFIX}EGL $EXTRA_GL_LIBS" '' "${VC_PREFIX}egl" '' '' true
@ -165,7 +165,7 @@ check_enabled THREADS THREAD_STORAGE 'Thread Local Storage' 'Threads are' false
check_lib '' THREAD_STORAGE "$PTHREADLIB" pthread_key_create
if [ "$OS" = 'Linux' ]; then
check_header CDROM sys/ioctl.h scsi/sg.h
check_header '' CDROM sys/ioctl.h scsi/sg.h
fi
check_platform 'Linux Win32' CDROM 'CD-ROM is' user
@ -230,8 +230,8 @@ check_val '' SIXEL -lsixel '' libsixel 1.6.0 '' false
check_macro AUDIOIO AUDIO_SETINFO sys/audioio.h
if [ "$HAVE_OSS" != 'no' ]; then
check_header OSS sys/soundcard.h
check_header OSS_BSD soundcard.h
check_header '' OSS sys/soundcard.h
check_header '' OSS_BSD soundcard.h
check_lib '' OSS_LIB -lossaudio
fi
@ -303,7 +303,7 @@ check_val '' FLAC '-lFLAC' '' flac '' '' false
check_enabled SSL BUILTINMBEDTLS 'builtin mbedtls' 'ssl is' true
if [ "$HAVE_SSL" != 'no' ]; then
check_header MBEDTLS \
check_header '' MBEDTLS \
mbedtls/config.h \
mbedtls/certs.h \
mbedtls/debug.h \
@ -363,13 +363,13 @@ fi
if [ "$HAVE_OPENGL" != 'no' ] && [ "$HAVE_OPENGLES" != 'yes' ]; then
if [ "$OS" = 'Darwin' ]; then
check_header OPENGL "OpenGL/gl.h"
check_header '' OPENGL "OpenGL/gl.h"
check_lib '' OPENGL "-framework OpenGL"
elif [ "$OS" = 'Win32' ]; then
check_header OPENGL "GL/gl.h"
check_header '' OPENGL "GL/gl.h"
check_lib '' OPENGL -lopengl32
else
check_header OPENGL "GL/gl.h"
check_header '' OPENGL "GL/gl.h"
check_lib '' OPENGL -lGL
fi
@ -412,7 +412,7 @@ check_enabled ZLIB BUILTINZLIB 'builtin zlib' 'zlib is' true
check_val '' ZLIB '-lz' '' zlib '' '' false
check_val '' MPV -lmpv '' mpv '' '' false
check_header DRMINGW exchndl.h
check_header '' DRMINGW exchndl.h
check_lib '' DRMINGW -lexchndl
check_enabled THREADS FFMPEG FFmpeg 'Threads are' false
@ -425,7 +425,7 @@ if [ "$HAVE_FFMPEG" != 'no' ]; then
check_val '' AVUTIL -lavutil '' libavutil 55 '' false
check_val '' SWSCALE -lswscale '' libswscale 4 '' false
check_header AV_CHANNEL_LAYOUT libavutil/channel_layout.h
check_header '' AV_CHANNEL_LAYOUT libavutil/channel_layout.h
HAVE_FFMPEG='yes'
if [ "$HAVE_AVCODEC" = 'no' ] || [ "$HAVE_SWRESAMPLE" = 'no' ] || [ "$HAVE_AVFORMAT" = 'no' ] || [ "$HAVE_AVUTIL" = 'no' ] || [ "$HAVE_SWSCALE" = 'no' ]; then
@ -486,7 +486,7 @@ check_enabled XF86VM XVIDEO XVideo 'XF86vm is' false
check_val '' XVIDEO -lXv '' xv '' '' false
check_val '' XINERAMA -lXinerama '' xinerama '' '' false
check_lib '' XRANDR -lXrandr
check_header XSHM X11/Xlib.h X11/extensions/XShm.h
check_header '' XSHM X11/Xlib.h X11/extensions/XShm.h
check_val '' XKBCOMMON -lxkbcommon '' xkbcommon 0.3.2 '' false
check_val '' WAYLAND '-lwayland-egl -lwayland-client' '' wayland-egl 10.1.0 '' false
check_val '' WAYLAND_CURSOR -lwayland-cursor '' wayland-cursor 1.12 '' false
@ -506,8 +506,8 @@ else
HAVE_WAYLAND='no'
fi
check_header PARPORT linux/parport.h
check_header PARPORT linux/ppdev.h
check_header '' PARPORT linux/parport.h
check_header '' PARPORT linux/ppdev.h
if [ "$OS" != 'Win32' ] && [ "$OS" != 'Linux' ]; then
check_lib '' STRL "$CLIB" strlcpy

View File

@ -264,25 +264,27 @@ check_pkgconf()
}
# check_header:
# $1 = HAVE_$1
# $1 = language
# $2 = HAVE_$2
# $@ = header files
check_header()
{ add_opt "$1"
tmpval="$(eval "printf %s \"\$HAVE_$1\"")"
{ add_opt "$2"
check_compiler "$1" ''
tmpval="$(eval "printf %s \"\$HAVE_$2\"")"
[ "$tmpval" = 'no' ] && return 0
rm -f -- "$TEMP_C"
val="$1"
header="$2"
shift
val="$2"
header="$3"
shift 2
for head do
CHECKHEADER="$head"
printf %s\\n "#include <$head>" >> "$TEMP_C"
printf %s\\n "#include <$head>" >> "$TEMP_CODE"
done
printf %s\\n "int main(void) { return 0; }" >> "$TEMP_C"
printf %s\\n "int main(void) { return 0; }" >> "$TEMP_CODE"
answer='no'
printf %s "Checking presence of header file $CHECKHEADER ... "
$(printf %s "$CC") -o "$TEMP_EXE" "$TEMP_C" \
$(printf %s "$BUILD_DIRS $CFLAGS $LDFLAGS") >>config.log 2>&1 &&
$(printf %s "$COMPILER") -o "$TEMP_EXE" "$TEMP_CODE" \
$(printf %s "$BUILD_DIRS $FLAGS $LDFLAGS") >>config.log 2>&1 &&
answer='yes'
eval "HAVE_$val=\"$answer\""
printf %s\\n "$answer"