From da770010ec765893bf44aecdcbfd788031820bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Tue, 16 Jun 2015 20:40:25 -0300 Subject: [PATCH 1/6] (qb) Cleanup --- qb/qb.comp.sh | 89 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 34 deletions(-) diff --git a/qb/qb.comp.sh b/qb/qb.comp.sh index e695d6d938..13632acf36 100644 --- a/qb/qb.comp.sh +++ b/qb/qb.comp.sh @@ -4,9 +4,6 @@ TEMP_C=.tmp.c TEMP_CXX=.tmp.cxx TEMP_EXE=.tmp -ECHOBUF="Checking operating system" -#echo -n "Checking operating system" - if [ -n "$CROSS_COMPILE" ]; then case "$CROSS_COMPILE" in *'-mingw32'*) OS='Win32';; @@ -32,55 +29,79 @@ if [ -e /etc/lsb-release ]; then DISTRO="(${DISTRIB_DESCRIPTION} ${DISTRIB_RELEASE})" fi -echo "$ECHOBUF ... $OS ${DISTRO}" +echo "Checking operating system ... $OS ${DISTRO}" # Checking for working C compiler -if [ "$USE_LANG_C" = 'yes' ]; then - ECHOBUF="Checking for suitable working C compiler" -# echo -n "Checking for suitable working C compiler" - cat << EOF > "$TEMP_C" +cat << EOF > "$TEMP_C" #include int main(void) { puts("Hai world!"); return 0; } EOF - if [ -z "$CC" ]; then - for CC in ${CC:=$(which ${CROSS_COMPILE}gcc ${CROSS_COMPILE}cc ${CROSS_COMPILE}clang 2>/dev/null)} ''; do - "$CC" -o "$TEMP_EXE" "$TEMP_C" >/dev/null 2>&1 && break - done - fi - [ "$CC" ] || { echo "$ECHOBUF ... Not found. Exiting."; exit 1;} - echo "$ECHOBUF ... $CC" - rm -f "$TEMP_C" "$TEMP_EXE" + +cc_works=0 +if [ "$CC" ]; then + "$CC" -o "$TEMP_EXE" "$TEMP_C" >/dev/null 2>&1 && cc_works=1 +else + for CC in ${CC:=$(which ${CROSS_COMPILE}gcc ${CROSS_COMPILE}cc ${CROSS_COMPILE}clang 2>/dev/null)} ''; do + "$CC" -o "$TEMP_EXE" "$TEMP_C" >/dev/null 2>&1 && cc_works=1 && break + done +fi + +rm -f "$TEMP_C" "$TEMP_EXE" + +cc_status='does not work' +if [ "$cc_works" == '1' ]; then + cc_status='works' +elif [ -z $CC ]; then + cc_status='not found' +fi + +echo "Checking for suitable working C compiler ... $CC $cc_status" + +if [ "$cc_works" == '0' ] && [ "$USE_LANG_C" = 'yes' ]; then + echo "Error: Cannot proceed without a working C compiler." + exit 1 fi # Checking for working C++ -if [ "$USE_LANG_CXX" = 'yes' ]; then - ECHOBUF="Checking for suitable working C++ compiler" -# echo -n "Checking for suitable working C++ compiler" - cat << EOF > "$TEMP_CXX" +cat << EOF > "$TEMP_CXX" #include int main() { std::cout << "Hai guise" << std::endl; return 0; } EOF - if [ -z "$CXX" ]; then - for CXX in ${CXX:=$(which ${CROSS_COMPILE}g++ ${CROSS_COMPILE}c++ ${CROSS_COMPILE}clang++ 2>/dev/null)} ''; do - "$CXX" -o "$TEMP_EXE" "$TEMP_CXX" >/dev/null 2>&1 && break - done - fi - [ "$CXX" ] || { echo "$ECHOBUF ... Not found. Exiting."; exit 1;} - echo "$ECHOBUF ... $CXX" - rm -f "$TEMP_CXX" "$TEMP_EXE" + +cxx_works=0 +if [ "$CXX" ]; then + "$CXX" -o "$TEMP_EXE" "$TEMP_CXX" >/dev/null 2>&1 && cxx_works=1 +else + for CXX in ${CXX:=$(which ${CROSS_COMPILE}g++ ${CROSS_COMPILE}c++ ${CROSS_COMPILE}clang++ 2>/dev/null)} ''; do + "$CXX" -o "$TEMP_EXE" "$TEMP_CXX" >/dev/null 2>&1 && cxx_works=1 && break + done +fi + +rm -f "$TEMP_CXX" "$TEMP_EXE" + +cxx_status='does not work' +if [ "$cxx_works" == '1' ]; then + cxx_status='works' +elif [ -z $CXX ]; then + cxx_status='not found' +fi + +echo "Checking for suitable working C++ compiler ... $CXX $cxx_status" + +if [ "$cxx_works" == '0' ] && [ "$USE_LANG_CXX" = 'yes' ]; then + echo "Error: Cannot proceed without a working C++ compiler." + exit 1 fi if [ "$OS" = "Win32" ]; then - ECHOBUF="Checking for windres" + echobuf="Checking for windres" if [ -z "$WINDRES" ]; then WINDRES=$(which ${CROSS_COMPILE}windres) - [ "$WINDRES" ] || { echo "$ECHOBUF ... Not found. Exiting."; exit 1; } + [ "$WINDRES" ] || { echo "$echobuf ... Not found. Exiting."; exit 1; } fi - echo "$ECHOBUF ... $WINDRES" + echo "$echobuf ... $WINDRES" fi -ECHOBUF="Checking for pkg-config" - [ -n "$PKG_CONF_PATH" ] || { PKG_CONF_PATH="none" @@ -93,7 +114,7 @@ ECHOBUF="Checking for pkg-config" } -echo "$ECHOBUF ... $PKG_CONF_PATH" +echo "Checking for pkg-config ... $PKG_CONF_PATH" if [ "$PKG_CONF_PATH" = "none" ]; then echo "Warning: pkg-config not found, package checks will fail." From 51d7bc89c34585b7bafa7ed5512d002fe1819536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Tue, 16 Jun 2015 20:45:35 -0300 Subject: [PATCH 2/6] (qb) Cleanup --- qb/qb.comp.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qb/qb.comp.sh b/qb/qb.comp.sh index 13632acf36..d3cf2bd184 100644 --- a/qb/qb.comp.sh +++ b/qb/qb.comp.sh @@ -80,7 +80,7 @@ fi rm -f "$TEMP_CXX" "$TEMP_EXE" cxx_status='does not work' -if [ "$cxx_works" == '1' ]; then +if [ "$cxx_works" = '1' ]; then cxx_status='works' elif [ -z $CXX ]; then cxx_status='not found' @@ -88,7 +88,7 @@ fi echo "Checking for suitable working C++ compiler ... $CXX $cxx_status" -if [ "$cxx_works" == '0' ] && [ "$USE_LANG_CXX" = 'yes' ]; then +if [ "$cxx_works" = '0' ] && [ "$USE_LANG_CXX" = 'yes' ]; then echo "Error: Cannot proceed without a working C++ compiler." exit 1 fi From 54240500f0c0311f65530e153299c767f9c44981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Tue, 16 Jun 2015 20:46:11 -0300 Subject: [PATCH 3/6] (qb) Add qb.system.sh --- configure | 2 ++ qb/qb.comp.sh | 27 --------------------------- qb/qb.system.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 27 deletions(-) create mode 100644 qb/qb.system.sh diff --git a/configure b/configure index 3d6cb624c0..1bdac87b51 100755 --- a/configure +++ b/configure @@ -4,6 +4,8 @@ PACKAGE_NAME=retroarch cat /dev/null > config.log +. qb/qb.system.sh + . qb/qb.params.sh . qb/qb.comp.sh diff --git a/qb/qb.comp.sh b/qb/qb.comp.sh index d3cf2bd184..f87d246b53 100644 --- a/qb/qb.comp.sh +++ b/qb/qb.comp.sh @@ -4,33 +4,6 @@ TEMP_C=.tmp.c TEMP_CXX=.tmp.cxx TEMP_EXE=.tmp -if [ -n "$CROSS_COMPILE" ]; then - case "$CROSS_COMPILE" in - *'-mingw32'*) OS='Win32';; - *);; - esac -fi - -if [ -z "$CROSS_COMPILE" ] || [ -z "$OS" ]; then - case "$(uname)" in - 'Linux') OS='Linux';; - *'BSD') OS='BSD';; - 'Darwin') OS='Darwin';; - 'CYGWIN'*) OS='Cygwin';; - 'Haiku') OS='Haiku';; - 'MINGW'*) OS='Win32';; - *) OS="Win32";; - esac -fi - -DISTRO='' -if [ -e /etc/lsb-release ]; then - . /etc/lsb-release - DISTRO="(${DISTRIB_DESCRIPTION} ${DISTRIB_RELEASE})" -fi - -echo "Checking operating system ... $OS ${DISTRO}" - # Checking for working C compiler cat << EOF > "$TEMP_C" #include diff --git a/qb/qb.system.sh b/qb/qb.system.sh new file mode 100644 index 0000000000..63d465e44d --- /dev/null +++ b/qb/qb.system.sh @@ -0,0 +1,28 @@ + +if [ -n "$CROSS_COMPILE" ]; then + case "$CROSS_COMPILE" in + *'-mingw32'*) OS='Win32';; + *);; + esac +fi + +if [ -z "$CROSS_COMPILE" ] || [ -z "$OS" ]; then + case "$(uname)" in + 'Linux') OS='Linux';; + *'BSD') OS='BSD';; + 'Darwin') OS='Darwin';; + 'CYGWIN'*) OS='Cygwin';; + 'Haiku') OS='Haiku';; + 'MINGW'*) OS='Win32';; + *) OS="Win32";; + esac +fi + +DISTRO='' +if [ -e /etc/lsb-release ]; then + . /etc/lsb-release + DISTRO="(${DISTRIB_DESCRIPTION} ${DISTRIB_RELEASE})" +fi + +echo "Checking operating system ... $OS ${DISTRO}" + From 6e3662953dfbe11b62a4873e74c48691d7f78dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Tue, 16 Jun 2015 20:46:54 -0300 Subject: [PATCH 4/6] (qb) Make C++ compiler optional in non-Win32 builds --- qb/config.comp.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qb/config.comp.sh b/qb/config.comp.sh index cd894adfb6..f0fcc84844 100644 --- a/qb/config.comp.sh +++ b/qb/config.comp.sh @@ -1,2 +1,7 @@ USE_LANG_C="yes" -USE_LANG_CXX="yes" + +# C++ compiler is optional in other platforms supported by ./configure +if [ "$OS" = 'Win32' ]; then + USE_LANG_CXX="yes" +fi + From 38be1d90d72503f8d8a09f07be7103ad04f28cce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Tue, 16 Jun 2015 20:59:17 -0300 Subject: [PATCH 5/6] (qb) Add check for -lGL --- qb/config.libs.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/qb/config.libs.sh b/qb/config.libs.sh index 4d3c6c7eb8..cdc86d21f8 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -246,6 +246,7 @@ if [ "$HAVE_OPENGL" != 'no' ] && [ "$HAVE_GLES" != 'yes' ]; then else # On some distros, -lCg doesn't link against -lstdc++ it seems ... check_lib_cxx CG -lCg cgCreateContext + check_lib OPENGL -lGL [ "$HAVE_CG" = 'yes' ] && CG_LIBS='-lCg -lCgGL' fi From 134364ad1ae66c23a1a5c0871999d9655d0d183f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Tue, 16 Jun 2015 21:25:55 -0300 Subject: [PATCH 6/6] (qb) Add check for GL/gl.h --- qb/config.libs.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/qb/config.libs.sh b/qb/config.libs.sh index cdc86d21f8..3343bde8af 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -247,6 +247,7 @@ if [ "$HAVE_OPENGL" != 'no' ] && [ "$HAVE_GLES" != 'yes' ]; then # On some distros, -lCg doesn't link against -lstdc++ it seems ... check_lib_cxx CG -lCg cgCreateContext check_lib OPENGL -lGL + check_header OPENGL "GL/gl.h" [ "$HAVE_CG" = 'yes' ] && CG_LIBS='-lCg -lCgGL' fi