]> git.ipfire.org Git - thirdparty/make.git/commitdiff
tests: Convert %CONFIG_FLAGS to get_config()
authorPaul Smith <psmith@gnu.org>
Sat, 5 Oct 2019 18:26:52 +0000 (14:26 -0400)
committerPaul Smith <psmith@gnu.org>
Sat, 5 Oct 2019 21:47:52 +0000 (17:47 -0400)
* tests/config-flags.pm.W32: Create a predefined Windows file.
* Makefile.am (test_FILES): Add it to the distribution.
* build_w32.bat: Install tests/config-flags.pm if not existing.
* tests/run_make_tests.pl (get_config): Create new function.
* tests/scripts/features/archives: Call get_config() rather than
using %CONFIG_FLAGS directly.
* tests/scripts/features/load: Ditto.
* tests/scripts/features/loadapi: Ditto.
* tests/scripts/functions/wildcard: Ditto.

Makefile.am
build_w32.bat
tests/config-flags.pm.W32 [new file with mode: 0644]
tests/run_make_tests.pl
tests/scripts/features/archives
tests/scripts/features/load
tests/scripts/features/loadapi
tests/scripts/functions/wildcard

index 10e04c845de6045e8f1fe4588d1ff5a639951173..30b6ee2727f9f213233f58da78dc55dad4937b27 100644 (file)
@@ -94,6 +94,7 @@ m4_FILES =    m4/gnulib-cache.m4
 test_FILES =   tests/run_make_tests tests/run_make_tests.bat \
                tests/run_make_tests.pl tests/test_driver.pl \
                tests/config-flags.pm.in tests/config_flags_pm.com \
+               tests/config-flags.pm.W32 \
                tests/mkshadow tests/jhelp.pl tests/guile.supp tests/README
 # test/scripts are added via dist-hook below.
 
index 9fbfb4bb44eca2b26fc7a53f6941793830ba6460..b245d0533292d7049804be6ea425adb17f050c8e 100755 (executable)
@@ -258,6 +258,7 @@ exit 1
 :Success\r
 echo %OUTDIR% build succeeded.\r
 if exist Basic.mk copy /Y Basic.mk Makefile\r
+if not exist tests\config-flags.pm copy /Y tests\config-flags.pm.W32 tests\config-flags.pm\r
 call :Reset\r
 goto :EOF\r
 \r
diff --git a/tests/config-flags.pm.W32 b/tests/config-flags.pm.W32
new file mode 100644 (file)
index 0000000..9d2602b
--- /dev/null
@@ -0,0 +1,9 @@
+# This is a -*-perl-*- script
+#
+# Set variables for Windows systems.
+
+%CONFIG_FLAGS = (
+    USE_SYSTEM_GLOB => 'no'
+);
+
+1;
index a7a555586d093c9e05e94e3e0803a6a8411bd6fb..16a0e3ff5eabeff6f7d85aa7b45f322419966813 100644 (file)
@@ -483,10 +483,14 @@ sub find_prog
   return ($v, $d, $f);
 }
 
+sub get_config
+{
+  return exists($CONFIG_FLAGS{$_[0]}) ? $CONFIG_FLAGS{$_[0]} : '';
+}
+
 sub set_more_defaults
 {
-  local($string);
-  local($index);
+  my $string;
 
   # Now that we have located make_path, locate the srcdir and blddir
   my ($mpv, $mpd, $mpf) = find_prog($make_path);
index beceb46ccbb0a08403cb220d16b4c9487c5fde47..dcd38e5a81cbde2c0f73452d0d544398c981668f 100644 (file)
@@ -29,11 +29,8 @@ if ($osname eq 'VMS') {
   utouch(-60, qw(a1.o a2.o a3.o));
 }
 
-my $ar = $CONFIG_FLAGS{AR};
-
-# Fallback if configure did not find AR, such as VMS
-# which does not run configure.
-$ar = 'ar' if $ar eq '';
+# Fallback if configure did not find AR
+my $ar = get_config('AR') || 'ar';
 
 my $redir = '2>&1';
 $redir = '' if $osname eq 'VMS';
index 56f80e24cb93602b7781bdea4bde48c59918e174..fa4b86f6cb16834ba6ca4b166ebc9cfd55a55f1e 100644 (file)
@@ -6,8 +6,8 @@ $details = "Test dynamic loading of modules.";
 # Don't do anything if this system doesn't support "load"
 exists $FEATURES{load} or return -1;
 
-# CONFIG_FLAGS are loaded from config-flags.pm and set by configure
-if (! exists $CONFIG_FLAGS{CC}) {
+my $cc = get_config('CC');
+if (! $cc) {
     $verbose and print "Skipping load test: no CC defined\n";
     return -1;
 }
@@ -46,7 +46,10 @@ close($F) or die "close: testload.c: $!\n";
 
 # Make sure we can compile
 
-my $sobuild = "$CONFIG_FLAGS{CC} ".($srcdir? "-I$srcdir/src":'')." $CONFIG_FLAGS{CPPFLAGS} $CONFIG_FLAGS{CFLAGS} -shared -fPIC $CONFIG_FLAGS{LDFLAGS} -o testload.so testload.c";
+my $cflags = get_config('CFLAGS');
+my $cppflags = get_config('CPPFLAGS');
+my $ldflags = get_config('LDFLAGS');
+my $sobuild = "$cc ".($srcdir? "-I$srcdir/src":'')." $cppflags $cflags -shared -fPIC $ldflags -o testload.so testload.c";
 
 my $clog = `$sobuild 2>&1`;
 if ($? != 0) {
index c8895572d50a4d096dad8aea12d9dd713454b540..ba149281985ce870ee9231569e33b45374c1ac65 100644 (file)
@@ -6,8 +6,8 @@ $details = "Verify the different aspects of the shared object API.";
 # Don't do anything if this system doesn't support "load"
 exists $FEATURES{load} or return -1;
 
-# CONFIG_FLAGS are loaded from config-flags.pm and set by configure
-if (! exists $CONFIG_FLAGS{CC}) {
+my $cc = get_config('CC');
+if (! $cc) {
     $verbose and print "Skipping load test: no CC defined\n";
     return -1;
 }
@@ -80,7 +80,10 @@ close($F) or die "close: testapi.c: $!\n";
 
 # Make sure we can compile
 
-my $sobuild = "$CONFIG_FLAGS{CC} ".($srcdir? "-I$srcdir/src":'')." $CONFIG_FLAGS{CPPFLAGS} $CONFIG_FLAGS{CFLAGS} -shared -fPIC $CONFIG_FLAGS{LDFLAGS} -o testapi.so testapi.c";
+my $cflags = get_config('CFLAGS');
+my $cppflags = get_config('CPPFLAGS');
+my $ldflags = get_config('LDFLAGS');
+my $sobuild = "$cc ".($srcdir? "-I$srcdir/src":'')." $cppflags $cflags -shared -fPIC $ldflags -o testapi.so testapi.c";
 
 my $clog = `$sobuild 2>&1`;
 if ($? != 0) {
index d1449af3f678b417343afdf545869a0b3ff98bb6..c3210effc310fb2e67e68f51d4cb7e1479eade63 100644 (file)
@@ -145,7 +145,7 @@ if ($port_type ne 'W32' && eval { symlink("",""); 1 }) {
     # Test for dangling symlinks
     # This doesn't work with the built-in glob... needs to be updated!
 
-    if ($CONFIG_FLAGS{USE_SYSTEM_GLOB} eq 'yes') {
+    if (get_config('USE_SYSTEM_GLOB') eq 'yes') {
         symlink($dir, $lnk);
 
         run_make_test(qq!all: ; \@echo \$(wildcard $lnk)!, '', "$lnk");