qb: Cleanup config.libs.sh.

This commit is contained in:
orbea 2019-01-24 15:38:37 -08:00
parent c8c23ffcfc
commit 0dc40a2d66
3 changed files with 101 additions and 92 deletions

View File

@ -87,7 +87,6 @@ fi
if [ "$HAVE_PRESERVE_DYLIB" = "yes" ]; then
die : 'Notice: Disabling dlclose() of shared objects for Valgrind support.'
add_define MAKEFILE HAVE_PRESERVE_DYLIB "1"
fi
if [ "$HAVE_FLOATHARD" = "yes" ]; then
@ -126,9 +125,7 @@ if [ "$HAVE_SSE" = "yes" ]; then
fi
if [ "$HAVE_EGL" != "no" ] && [ "$OS" != 'Win32' ]; then
check_pkgconf EGL "$VC_PREFIX"egl
# some systems have EGL libs, but no pkgconfig
check_val '' EGL "-l${VC_PREFIX}EGL $EXTRA_GL_LIBS"
check_val '' EGL "-l${VC_PREFIX}EGL $EXTRA_GL_LIBS" '' "${VC_PREFIX}egl" '' ''
if [ "$HAVE_EGL" = "yes" ]; then
EGL_LIBS="$EGL_LIBS $EXTRA_GL_LIBS"
fi
@ -184,12 +181,6 @@ else
check_lib '' DYLIB "$DYLIB" dlopen
fi
if [ "$HAVE_CXX" != 'yes' ]; then
HAVE_DISCORD='no'
HAVE_QT='no'
HAVE_VULKAN='no'
fi
check_lib '' NETWORKING "$SOCKETLIB" socket "" "$SOCKETHEADER"
if [ "$HAVE_NETWORKING" = 'yes' ]; then
@ -237,8 +228,7 @@ if [ "$HAVE_DYLIB" = 'no' ] && [ "$HAVE_DYNAMIC" = 'yes' ]; then
die 1 'Error: Dynamic loading of libretro is enabled, but your platform does not appear to have dlopen(), use --disable-dynamic or --with-libretro="-lretro".'
fi
check_pkgconf ALSA alsa
check_val '' ALSA -lasound alsa
check_val '' ALSA -lasound alsa alsa '' ''
check_lib '' CACA -lcaca
check_lib '' SIXEL -lsixel
@ -271,15 +261,22 @@ fi
check_pkgconf RSOUND rsound 1.1
check_pkgconf ROAR libroar
check_pkgconf JACK jack 0.120.1
check_pkgconf PULSE libpulse
check_pkgconf SDL sdl 1.2.10
check_pkgconf SDL2 sdl2 2.0.0
check_val '' JACK -ljack '' jack 0.120.1 ''
check_val '' PULSE -lpulse '' libpulse '' ''
check_val '' SDL -lSDL SDL sdl 1.2.10 ''
check_val '' SDL2 -lSDL2 SDL2 sdl2 2.0.0 ''
check_val '' JACK -ljack
check_val '' PULSE -lpulse
check_val '' SDL -lSDL SDL
check_val '' SDL2 -lSDL2 SDL2
if [ "$HAVE_SDL2" = 'yes' ] && [ "$HAVE_SDL" = 'yes' ]; then
die : 'Notice: SDL drivers will be replaced by SDL2 ones.'
HAVE_SDL=no
fi
check_enabled DISCORD discord
if [ "$HAVE_DISCORD" != 'no' ]; then
# Enable discord by default if it hasn't been disabled by check_enabled.
HAVE_DISCORD=yes
fi
check_enabled QT 'Qt companion'
@ -307,17 +304,11 @@ if [ "$HAVE_QT" != 'no' ]; then
#fi
fi
if [ "$HAVE_SDL2" = 'yes' ] && [ "$HAVE_SDL" = 'yes' ]; then
die : 'Notice: SDL drivers will be replaced by SDL2 ones.'
HAVE_SDL=no
fi
if [ "$HAVE_FLAC" = 'no' ]; then
HAVE_BUILTINFLAC=no
fi
check_pkgconf FLAC flac
check_val '' FLAC '-lFLAC'
check_val '' FLAC '-lFLAC' '' flac '' ''
if [ "$HAVE_SSL" = 'no' ]; then
HAVE_BUILTINMBEDTLS=no
@ -350,8 +341,7 @@ if [ "$HAVE_SSL" != 'no' ]; then
fi
fi
check_pkgconf LIBUSB libusb-1.0 1.0.13
check_val '' LIBUSB -lusb-1.0 libusb-1.0
check_val '' LIBUSB -lusb-1.0 libusb-1.0 libusb-1.0 1.0.13 ''
if [ "$OS" = 'Win32' ]; then
check_lib '' DINPUT -ldinput8
@ -406,12 +396,10 @@ if [ "$HAVE_ZLIB" = 'no' ]; then
elif [ "$HAVE_BUILTINZLIB" = 'yes' ]; then
HAVE_ZLIB=yes
else
check_pkgconf ZLIB zlib
check_val '' ZLIB '-lz'
check_val '' ZLIB '-lz' '' zlib '' ''
fi
check_pkgconf MPV mpv
check_val '' MPV -lmpv
check_val '' MPV -lmpv '' mpv '' ''
if [ "$HAVE_THREADS" = 'no' ] && [ "$HAVE_FFMPEG" != 'no' ]; then
HAVE_FFMPEG='no'
@ -422,21 +410,13 @@ check_header DRMINGW exchndl.h
check_lib '' DRMINGW -lexchndl
if [ "$HAVE_FFMPEG" != 'no' ]; then
check_pkgconf AVCODEC libavcodec 54
check_pkgconf AVFORMAT libavformat 54
check_pkgconf AVDEVICE libavdevice
check_pkgconf SWRESAMPLE libswresample
check_pkgconf AVRESAMPLE libavresample
check_pkgconf AVUTIL libavutil 51
check_pkgconf SWSCALE libswscale 2.1
check_val '' AVCODEC -lavcodec
check_val '' AVFORMAT -lavformat
check_val '' AVDEVICE -lavdevice
check_val '' SWRESAMPLE -lswresample
check_val '' AVRESAMPLE -lavresample
check_val '' AVUTIL -lavutil
check_val '' SWSCALE -lswscale
check_val '' AVCODEC -lavcodec '' libavcodec 54 ''
check_val '' AVFORMAT -lavformat '' libavformat 54 ''
check_val '' AVDEVICE -lavdevice '' libavdevice '' ''
check_val '' SWRESAMPLE -lswresample '' libswresample '' ''
check_val '' AVRESAMPLE -lavresample '' libavresample '' ''
check_val '' AVUTIL -lavutil '' libavutil 51 ''
check_val '' SWSCALE -lswscale '' libswscale 2.1 ''
check_header AV_CHANNEL_LAYOUT libavutil/channel_layout.h
@ -454,10 +434,8 @@ if [ "$OS" != 'Win32' ]; then
fi
if [ "$HAVE_KMS" != "no" ]; then
check_pkgconf GBM gbm 9.0
check_pkgconf DRM libdrm
check_val '' GBM -lgbm
check_val '' DRM -ldrm libdrm
check_val '' GBM -lgbm '' gbm 9.0 ''
check_val '' DRM -ldrm libdrm libdrm '' ''
if [ "$HAVE_GBM" = "yes" ] && [ "$HAVE_DRM" = "yes" ] && [ "$HAVE_EGL" = "yes" ]; then
HAVE_KMS=yes
@ -468,8 +446,7 @@ if [ "$HAVE_KMS" != "no" ]; then
fi
fi
check_pkgconf LIBXML2 libxml-2.0
check_val '' LIBXML2 -lxml2 libxml2
check_val '' LIBXML2 -lxml2 libxml2 libxml-2.0 '' ''
if [ "$HAVE_EGL" = "yes" ]; then
if [ "$HAVE_OPENGLES" != "no" ]; then
@ -485,34 +462,23 @@ if [ "$HAVE_EGL" = "yes" ]; then
fi
fi
fi
check_pkgconf VG "$VC_PREFIX"vg
check_val '' VG "-l${VC_PREFIX}OpenVG $EXTRA_GL_LIBS"
check_val '' VG "-l${VC_PREFIX}OpenVG $EXTRA_GL_LIBS" '' "${VC_PREFIX}vg" '' ''
else
HAVE_VG=no
HAVE_OPENGLES=no
fi
check_pkgconf V4L2 libv4l2
check_pkgconf FREETYPE freetype2
check_pkgconf X11 x11
check_pkgconf XCB xcb
check_pkgconf WAYLAND wayland-egl 1.15
check_pkgconf WAYLAND_CURSOR wayland-cursor 1.15
check_val '' V4L2 -lv4l2 '' libv4l2 '' ''
check_val '' FREETYPE -lfreetype freetype2 freetype2 '' ''
check_val '' X11 -lX11 '' x11 '' ''
check_val '' XCB -lxcb '' xcb '' ''
check_val '' WAYLAND '-lwayland-egl -lwayland-client' '' wayland-egl 1.15 ''
check_val '' WAYLAND_CURSOR -lwayland-cursor '' wayland-cursor 1.15 ''
check_pkgconf WAYLAND_PROTOS wayland-protocols 1.15
check_pkgconf XKBCOMMON xkbcommon 0.3.2
check_val '' XKBCOMMON -lxkbcommon '' xkbcommon 0.3.2 ''
check_pkgconf DBUS dbus-1
check_pkgconf XEXT xext
check_pkgconf XF86VM xxf86vm
check_val '' V4L2 -lv4l2
check_val '' FREETYPE -lfreetype freetype2
check_val '' X11 -lX11
check_val '' XCB -lxcb
check_val '' WAYLAND '-lwayland-egl -lwayland-client'
check_val '' WAYLAND_CURSOR -lwayland-cursor
check_val '' XKBCOMMON -lxkbcommon
check_val '' XEXT -lXext
check_val '' XF86VM -lXxf86vm
check_val '' XEXT -lXext '' xext '' ''
check_val '' XF86VM -lXxf86vm '' xxf86vm '' ''
if [ "$HAVE_WAYLAND_PROTOS" = yes ] && [ "$HAVE_WAYLAND" = yes ]; then
check_pkgconf WAYLAND_SCANNER wayland-scanner 1.15
@ -527,20 +493,17 @@ if [ "$HAVE_X11" = 'no' ]; then
fi
check_lib '' XRANDR -lXrandr
check_pkgconf XINERAMA xinerama
check_val '' XINERAMA -lXinerama
check_val '' XINERAMA -lXinerama '' xinerama '' ''
if [ "$HAVE_X11" = 'yes' ] && [ "$HAVE_XEXT" = 'yes' ] && [ "$HAVE_XF86VM" = 'yes' ]; then
check_pkgconf XVIDEO xv
check_val '' XVIDEO -lXv
check_val '' XVIDEO -lXv '' xv '' ''
else
die : 'Notice: X11, Xext or xf86vm not present. Skipping X11 code paths.'
HAVE_X11='no'
HAVE_XVIDEO='no'
fi
check_pkgconf UDEV libudev
check_val '' UDEV "-ludev"
check_val '' UDEV "-ludev" '' libudev '' ''
check_header XSHM X11/Xlib.h X11/extensions/XShm.h
check_header PARPORT linux/parport.h

View File

@ -121,7 +121,7 @@ HAVE_CHEEVOS=yes # Retro Achievements
HAVE_NEW_CHEEVOS=no # Use rcheevos to process RetroAchievements
C89_NEW_CHEEVOS=no
HAVE_LUA=no # Lua support (for Retro Achievements)
HAVE_DISCORD=yes # Discord Integration
HAVE_DISCORD=auto # Discord Integration
C89_DISCORD=no
HAVE_SHADERPIPELINE=yes # Additional shader-based pipelines
C89_SHADERPIPELINE=no

View File

@ -7,7 +7,10 @@ SHARE_DIR="${SHARE_DIR:-${PREFIX}/share}"
add_define() # $1 = MAKEFILE or CONFIG $2 = define $3 = value
{ eval "${1}_DEFINES=\"\${${1}_DEFINES} $2=$3\""; }
add_dirs() # $1 = INCLUDE or LIBRARY $@ = include or library paths
# add_dirs:
# $1 = INCLUDE or LIBRARY
# $@ = include or library paths
add_dirs()
{ ADD="$1"; LINK="${1%"${1#?}"}"; shift
while [ "$1" ]; do
eval "${ADD}_DIRS=\"\${${ADD}_DIRS} -${LINK}${1}\""
@ -16,7 +19,10 @@ add_dirs() # $1 = INCLUDE or LIBRARY $@ = include or library paths
eval "${ADD}_DIRS=\"\${${ADD}_DIRS# }\""
}
check_compiler() # $1 = language $2 = function in lib
# check_compiler:
# $1 = language
# $2 = function in lib
check_compiler()
{ if [ "$1" = cxx ]; then
COMPILER="$CXX"
TEMP_CODE="$TEMP_CXX"
@ -28,7 +34,10 @@ check_compiler() # $1 = language $2 = function in lib
fi
}
check_enabled() # $1 = HAVE_$1 $2 = lib
# check_enabled:
# $1 = HAVE_$1
# $2 = lib
check_enabled()
{ [ "$HAVE_CXX" != 'no' ] && return 0
tmpval="$(eval "printf %s \"\$HAVE_$1\"")"
@ -40,7 +49,16 @@ check_enabled() # $1 = HAVE_$1 $2 = lib
die 1 "Forced to build with $2 support and the C++ compiler is disabled. Exiting ..."
}
check_lib() # $1 = language $2 = HAVE_$2 $3 = lib $4 = function in lib $5 = extralibs $6 = headers $7 = critical error message [checked only if non-empty]
# check_lib:
# Compiles a simple test program to check if a library is available.
# $1 = language
# $2 = HAVE_$2
# $3 = lib
# $4 = function in lib
# $5 = extralibs
# $6 = headers
# $7 = critical error message [checked only if non-empty]
check_lib()
{ tmpval="$(eval "printf %s \"\$HAVE_$2\"")"
[ "$tmpval" = 'no' ] && return 0
@ -81,7 +99,13 @@ check_lib() # $1 = language $2 = HAVE_$2 $3 = lib $4 = function in lib $5 =
return 0
}
check_pkgconf() # $1 = HAVE_$1 $2 = package $3 = version $4 = critical error message [checked only if non-empty]
# check_pkgconf:
# If available uses $PKG_CONF_PATH to find a library.
# $1 = HAVE_$1
# $2 = package
# $3 = version [checked only if non-empty]
# $4 = critical error message [checked only if non-empty]
check_pkgconf()
{ tmpval="$(eval "printf %s \"\$HAVE_$1\"")"
eval "TMP_$1=\$tmpval"
[ "$tmpval" = 'no' ] && return 0
@ -115,7 +139,10 @@ check_pkgconf() # $1 = HAVE_$1 $2 = package $3 = version $4 = critical error
fi
}
check_header() #$1 = HAVE_$1 $2, $3, ... = header files
# check_header:
# $1 = HAVE_$1
# $@ = header files
check_header()
{ tmpval="$(eval "printf %s \"\$HAVE_$1\"")"
[ "$tmpval" = 'no' ] && return 0
rm -f -- "$TEMP_C"
@ -137,7 +164,11 @@ check_header() #$1 = HAVE_$1 $2, $3, ... = header files
die 1 "Build assumed that $header exists, but cannot locate. Exiting ..."
}
check_macro() #$1 = HAVE_$1 $2 = macro name $3 = header name [included only if non-empty]
# check_macro:
# $1 = HAVE_$1
# $2 = macro name
# $3 = header name [included only if non-empty]
check_macro()
{ tmpval="$(eval "printf %s \"\$HAVE_$1\"")"
[ "$tmpval" = 'no' ] && return 0
if [ "${3}" ]; then
@ -166,7 +197,12 @@ EOF
die 1 "Build assumed that $macro is defined, but it's not. Exiting ..."
}
check_switch() # $1 = language $2 = HAVE_$2 $3 = switch $4 = critical error message [checked only if non-empty]
# check_switch:
# $1 = language
# $2 = HAVE_$2
# $3 = switch
# $4 = critical error message [checked only if non-empty]
check_switch()
{ check_compiler "$1" ''
ECHOBUF="Checking for availability of switch $3 in $COMPILER"
@ -181,8 +217,18 @@ check_switch() # $1 = language $2 = HAVE_$2 $3 = switch $4 = critical error m
}
}
check_val() # $1 = language $2 = HAVE_$2 $3 = lib $4 = include directory [checked only if non-empty]
{ tmpval="$(eval "printf %s \"\$HAVE_$2\"")"
# check_val:
# Uses check_pkgconf to find a library and falls back to check_lib if false.
# $1 = language
# $2 = HAVE_$2
# $3 = lib
# $4 = include directory [checked only if non-empty]
# $5 = package
# $6 = version [checked only if non-empty]
# $7 = critical error message [checked only if non-empty]
check_val()
{ check_pkgconf "$2" "$5" "$6" "${7:-}"
tmpval="$(eval "printf %s \"\$HAVE_$2\"")"
oldval="$(eval "printf %s \"\$TMP_$2\"")"
if [ "$tmpval" = 'no' ] && [ "$oldval" != 'no' ]; then
eval "HAVE_$2=auto"