Commit cc3fe1a182c759040121ecc263c5de7ea41c53bb

Ozkan Sezer 2021-10-31T08:25:24

tests: don't fail configury if libunwind is not available.

diff --git a/test/configure b/test/configure
index 7a93cca..98d332a 100755
--- a/test/configure
+++ b/test/configure
@@ -584,8 +584,8 @@ PACKAGE_URL=
 ac_unique_file="loopwave.c"
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
-libunwind_LIBS
-libunwind_CFLAGS
+LIBUNWIND_LIBS
+LIBUNWIND_CFLAGS
 SDL_TTF_LIB
 XLIB
 GLES2LIB
@@ -684,8 +684,8 @@ SDL_CFLAGS
 SDL_LIBS
 XMKMF
 CPP
-libunwind_CFLAGS
-libunwind_LIBS'
+LIBUNWIND_CFLAGS
+LIBUNWIND_LIBS'
 
 
 # Initialize some variables set by options.
@@ -1327,10 +1327,10 @@ Some influential environment variables:
   SDL_LIBS    linker flags for SDL, overriding pkg-config
   XMKMF       Path to xmkmf, Makefile generator for X Window System
   CPP         C preprocessor
-  libunwind_CFLAGS
-              C compiler flags for libunwind, overriding pkg-config
-  libunwind_LIBS
-              linker flags for libunwind, overriding pkg-config
+  LIBUNWIND_CFLAGS
+              C compiler flags for LIBUNWIND, overriding pkg-config
+  LIBUNWIND_LIBS
+              linker flags for LIBUNWIND, overriding pkg-config
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -4030,11 +4030,11 @@ fi
 
 
 pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libunwind" >&5
-$as_echo_n "checking for libunwind... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBUNWIND" >&5
+$as_echo_n "checking for LIBUNWIND... " >&6; }
 
-if test -n "$libunwind_CFLAGS"; then
-    pkg_cv_libunwind_CFLAGS="$libunwind_CFLAGS"
+if test -n "$LIBUNWIND_CFLAGS"; then
+    pkg_cv_LIBUNWIND_CFLAGS="$LIBUNWIND_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5
@@ -4042,15 +4042,15 @@ if test -n "$libunwind_CFLAGS"; then
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_libunwind_CFLAGS=`$PKG_CONFIG --cflags "libunwind" 2>/dev/null`
+  pkg_cv_LIBUNWIND_CFLAGS=`$PKG_CONFIG --cflags "libunwind" 2>/dev/null`
 else
   pkg_failed=yes
 fi
  else
     pkg_failed=untried
 fi
-if test -n "$libunwind_LIBS"; then
-    pkg_cv_libunwind_LIBS="$libunwind_LIBS"
+if test -n "$LIBUNWIND_LIBS"; then
+    pkg_cv_LIBUNWIND_LIBS="$LIBUNWIND_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5
@@ -4058,7 +4058,7 @@ if test -n "$libunwind_LIBS"; then
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_libunwind_LIBS=`$PKG_CONFIG --libs "libunwind" 2>/dev/null`
+  pkg_cv_LIBUNWIND_LIBS=`$PKG_CONFIG --libs "libunwind" 2>/dev/null`
 else
   pkg_failed=yes
 fi
@@ -4078,44 +4078,27 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        libunwind_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libunwind" 2>&1`
+	        LIBUNWIND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libunwind" 2>&1`
         else
-	        libunwind_PKG_ERRORS=`$PKG_CONFIG --print-errors "libunwind" 2>&1`
+	        LIBUNWIND_PKG_ERRORS=`$PKG_CONFIG --print-errors "libunwind" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
-	echo "$libunwind_PKG_ERRORS" >&5
+	echo "$LIBUNWIND_PKG_ERRORS" >&5
 
-	as_fn_error $? "Package requirements (libunwind) were not met:
-
-$libunwind_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-Alternatively, you may set the environment variables libunwind_CFLAGS
-and libunwind_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5
+	have_libunwind=no
 elif test $pkg_failed = untried; then
      	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-Alternatively, you may set the environment variables libunwind_CFLAGS
-and libunwind_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5; }
+	have_libunwind=no
 else
-	libunwind_CFLAGS=$pkg_cv_libunwind_CFLAGS
-	libunwind_LIBS=$pkg_cv_libunwind_LIBS
+	LIBUNWIND_CFLAGS=$pkg_cv_LIBUNWIND_CFLAGS
+	LIBUNWIND_LIBS=$pkg_cv_LIBUNWIND_LIBS
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-	LIBS="$LIBS $libunwind_LIBS"
+	have_libunwind=yes
+fi
+if test x$have_libunwind = xyes ; then
+   LIBS="$LIBS $LIBUNWIND_LIBS"
 fi
 
 ac_config_files="$ac_config_files Makefile"
diff --git a/test/configure.ac b/test/configure.ac
index 1ff1157..0934c56 100644
--- a/test/configure.ac
+++ b/test/configure.ac
@@ -197,7 +197,10 @@ dnl libunwind.h when configured), but SDL2_test is a static library, so
 dnl there's no way for it to link against it. We could make SDL2 depend on
 dnl it, but we don't want all SDL2 build to suddenly gain an extra dependency,
 dnl so just assume that if it's here now, SDL2_test was probably built with it.
-PKG_CHECK_MODULES(libunwind, libunwind, [LIBS="$LIBS $libunwind_LIBS"])
+PKG_CHECK_MODULES(LIBUNWIND, libunwind, have_libunwind=yes, have_libunwind=no)
+if test x$have_libunwind = xyes ; then
+   LIBS="$LIBS $LIBUNWIND_LIBS"
+fi
 
 dnl Finally create all the generated files
 AC_CONFIG_FILES([Makefile])