diff --git a/qb/config.libs.sh b/qb/config.libs.sh index e82602db9b..a0751abc62 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -119,7 +119,7 @@ else fi [ "$HAVE_DYNAMIC" = 'yes' ] || { - check_lib '' RETRO "$LIBRETRO" retro_init "$DYLIB" '' 'Cannot find libretro, did you forget --with-libretro="-lretro"?' + check_lib '' RETRO "$LIBRETRO" retro_init "$DYLIB" '' '' 'Cannot find libretro, did you forget --with-libretro="-lretro"?' add_define MAKEFILE libretro "$LIBRETRO" } diff --git a/qb/qb.libs.sh b/qb/qb.libs.sh index e1a9097b33..3a142ff0e7 100644 --- a/qb/qb.libs.sh +++ b/qb/qb.libs.sh @@ -85,7 +85,8 @@ check_enabled() # $4 = function in lib [checked only if non-empty] # $5 = extralibs [checked only if non-empty] # $6 = headers [checked only if non-empty] -# $7 = critical error message [checked only if non-empty] +# $7 = include directory [checked only if non-empty] +# $8 = critical error message [checked only if non-empty] check_lib() { tmpval="$(eval "printf %s \"\$HAVE_$2\"")" [ "$tmpval" = 'no' ] && return 0 @@ -106,19 +107,30 @@ check_lib() val="$2" lib="$3" - error="${7:-}" + include="${7:-}" + error="${8:-}" answer='no' eval "set -- $INCLUDE_DIRS $LIBRARY_DIRS $5 $CFLAGS $LDFLAGS $3" "$COMPILER" -o "$TEMP_EXE" "$TEMP_CODE" "$@" >>config.log 2>&1 && answer='yes' + + if [ "$answer" = 'yes' ] && [ "$include" ]; then + eval "set -- $INCLUDES" + for dir do + [ -d "/$dir/$include" ] && { eval "${val}_CFLAGS=\"-I/$dir/$include\""; break; } + done + [ -z "$(eval "printf %s \"\${${val}_CFLAGS}\"")" ] && answer='no' + fi + eval "HAVE_$val=\"$answer\"" printf %s\\n "$ECHOBUF ... $answer" rm -f -- "$TEMP_CODE" "$TEMP_EXE" if [ "$answer" = 'no' ]; then [ "$error" ] && die 1 "$error" - [ "$tmpval" = 'yes' ] && { + setval="$(eval "printf %s \"\$USER_$val\"")" + if [ "$setval" = 'yes' ]; then die 1 "Forced to build with library $lib, but cannot locate. Exiting ..." - } + fi else eval "${val}_LIBS=\"$lib\"" PKG_CONF_USED="$PKG_CONF_USED $val" @@ -170,8 +182,10 @@ check_pkgconf() printf %s\\n "$ECHOBUF ... $version" if [ "$answer" = 'no' ]; then [ "$err" ] && die 1 "$err" - [ "$tmpval" = 'yes' ] && + setval="$(eval "printf %s \"\$USER_$val\"")" + if [ "$setval" = 'yes' ]; then die 1 "Forced to build with package $pkg, but cannot locate. Exiting ..." + fi else PKG_CONF_USED="$PKG_CONF_USED $val" fi @@ -198,8 +212,10 @@ check_header() eval "HAVE_$val=\"$answer\"" printf %s\\n "Checking presence of header file $CHECKHEADER ... $answer" rm -f -- "$TEMP_C" "$TEMP_EXE" - [ "$tmpval" = 'yes' ] && [ "$answer" = 'no' ] && \ + setval="$(eval "printf %s \"\$USER_$val\"")" + if [ "$setval" = 'yes' ] && [ "$answer" = 'no' ]; then die 1 "Build assumed that $header exists, but cannot locate. Exiting ..." + fi } # check_macro: @@ -231,8 +247,10 @@ EOF eval "HAVE_$val=\"$answer\"" printf %s\\n "$ECHOBUF ... $answer" rm -f -- "$TEMP_C" "$TEMP_EXE" - [ "$tmpval" = 'yes' ] && [ "$answer" = 'no' ] && \ + setval="$(eval "printf %s \"\$USER_$val\"")" + if [ "$setval" = 'yes' ] && [ "$answer" = 'no' ]; then die 1 "Build assumed that $macro is defined, but it's not. Exiting ..." + fi } # check_switch: @@ -272,21 +290,7 @@ check_val() oldval="$(eval "printf %s \"\$TMP_$2\"")" if [ "$tmpval" = 'no' ] && [ "$oldval" != 'no' ]; then eval "HAVE_$2=auto" - check_lib "$1" "$2" "$3" - - if [ "${4:-}" ] && [ "$answer" = 'yes' ]; then - val="$2" - include="$4" - eval "set -- $INCLUDES" - for dir do - [ -d "/$dir/$include" ] && { eval "${val}_CFLAGS=\"-I/$dir/$include\""; break; } - done - [ -z "$(eval "printf %s \"\${${val}_CFLAGS}\"")" ] && eval "HAVE_$val=no" - fi - - if [ "$answer" = 'no' ] && [ "$oldval" = 'yes' ]; then - die 1 "Forced to build with library $lib, but cannot locate. Exiting ..." - fi + check_lib "$1" "$2" "$3" '' '' '' "$4" '' fi } diff --git a/qb/qb.params.sh b/qb/qb.params.sh index 62f0a1487a..e280400c07 100644 --- a/qb/qb.params.sh +++ b/qb/qb.params.sh @@ -70,7 +70,9 @@ parse_input() # Parse stuff :V OPTS='' while read -r VAR _; do TMPVAR="${VAR%=*}" - OPTS="$OPTS ${TMPVAR##HAVE_}" + NEWVAR="${TMPVAR##HAVE_}" + OPTS="$OPTS $NEWVAR" + eval "USER_$NEWVAR=no" done < 'qb/config.params.sh' #OPTS contains all available options in config.params.sh - used to speedup #things in opt_exists() @@ -93,7 +95,6 @@ parse_input() # Parse stuff :V --disable-*) opt_exists "${1##--disable-}" "$1" eval "HAVE_$opt=no" - eval "USER_$opt=no" eval "HAVE_NO_$opt=yes" ;; --with-*)