2013-02-25 06:38:36 +00:00
|
|
|
# -*-perl-*-
|
|
|
|
$description = "Test the shared object load API.";
|
|
|
|
|
|
|
|
$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;
|
|
|
|
|
2019-10-05 18:26:52 +00:00
|
|
|
my $cc = get_config('CC');
|
|
|
|
if (! $cc) {
|
Remove unsupported build facilities.
Over time the non-standard build and install systems (nmake files,
smake files, Visual Studio project files, etc.) have atrophied and
maintaining them is not worth the effort, for such a simple utility
as make. Remove all the non-standard build tool support and unify
OS-specific build rules under a basic set of (GNU make) makefiles.
Preserve the existing bootstrapping scripts (for POSIX, Windows,
and MS-DOS). Also the existing VMS build scripts are left unchanged:
I don't have enough experience with VMS to venture into this area.
Perhaps one of the VMS maintainers might like to determine whether
conversion would be appropriate.
Rather than create libraries for w32 and glob (non-POSIX), simply
link the object files directly to remove the complexity.
* NEWS: Update with user-facing notes.
* Makefile.am: Clean up to use the latest automake best practices.
Build Windows code directly from the root makefile to avoid recursion.
* README.Amiga, README.DOS.template, README.W32.template: Updated.
* INSTALL: Point readers at the README.git file.
* maintMakefile: Remove obsolete files. Create Basic.mk file.
* Basic.mk.template, mk/*.mk: Create basic GNU make-based makefiles.
* build_w32.bat: Copy Basic.mk to Makefile
* configure.ac: We no longer need AM_PROG_AR.
* dosbuild.bat: Rename to builddos.bat. Incorporate configure.bat.
* Makefile.DOS.template: Remove.
* NMakefile.template, w32/subproc/NMakefile: Remove.
* SMakefile.template, glob/SMakefile, glob/SCOPTIONS, make.lnk: Remove.
* configure.bat, glob/configure.bat: Remove.
* w32/Makefile.am: Remove.
* make_msvc_net2003.sln, make_msvc_net2003.vcproj: Remove.
2017-11-12 22:44:38 +00:00
|
|
|
$verbose and print "Skipping load test: no CC defined\n";
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2013-02-25 06:38:36 +00:00
|
|
|
# First build a shared object
|
|
|
|
# Provide both a default and non-default load symbol
|
|
|
|
|
|
|
|
unlink(qw(testapi.c testapi.so));
|
|
|
|
|
|
|
|
open(my $F, '> testapi.c') or die "open: testapi.c: $!\n";
|
|
|
|
print $F <<'EOF' ;
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "gnumake.h"
|
|
|
|
|
2013-05-15 02:53:42 +00:00
|
|
|
int plugin_is_GPL_compatible;
|
|
|
|
|
2013-02-25 06:38:36 +00:00
|
|
|
static char *
|
|
|
|
test_eval (const char *buf)
|
|
|
|
{
|
|
|
|
gmk_eval (buf, 0);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
test_expand (const char *val)
|
|
|
|
{
|
|
|
|
return gmk_expand (val);
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
2013-10-05 20:10:30 +00:00
|
|
|
test_noexpand (const char *val)
|
|
|
|
{
|
2013-11-24 09:08:30 +00:00
|
|
|
char *str = gmk_alloc (strlen (val) + 1);
|
2013-10-05 20:10:30 +00:00
|
|
|
strcpy (str, val);
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
func_test (const char *funcname, unsigned int argc, char **argv)
|
2013-02-25 06:38:36 +00:00
|
|
|
{
|
2013-05-04 21:38:53 +00:00
|
|
|
char *mem;
|
|
|
|
|
2013-02-25 06:38:36 +00:00
|
|
|
if (strcmp (funcname, "test-expand") == 0)
|
|
|
|
return test_expand (argv[0]);
|
|
|
|
|
|
|
|
if (strcmp (funcname, "test-eval") == 0)
|
|
|
|
return test_eval (argv[0]);
|
|
|
|
|
2013-10-05 20:10:30 +00:00
|
|
|
if (strcmp (funcname, "test-noexpand") == 0)
|
|
|
|
return test_noexpand (argv[0]);
|
|
|
|
|
|
|
|
mem = gmk_alloc (sizeof ("unknown"));
|
2013-05-04 21:38:53 +00:00
|
|
|
strcpy (mem, "unknown");
|
|
|
|
return mem;
|
2013-02-25 06:38:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
testapi_gmk_setup ()
|
|
|
|
{
|
2013-10-05 20:10:30 +00:00
|
|
|
gmk_add_function ("test-expand", func_test, 1, 1, GMK_FUNC_DEFAULT);
|
|
|
|
gmk_add_function ("test-noexpand", func_test, 1, 1, GMK_FUNC_NOEXPAND);
|
|
|
|
gmk_add_function ("test-eval", func_test, 1, 1, GMK_FUNC_DEFAULT);
|
|
|
|
gmk_add_function ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.", func_test, 0, 0, 0);
|
2013-02-25 06:38:36 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
close($F) or die "close: testapi.c: $!\n";
|
|
|
|
|
Remove unsupported build facilities.
Over time the non-standard build and install systems (nmake files,
smake files, Visual Studio project files, etc.) have atrophied and
maintaining them is not worth the effort, for such a simple utility
as make. Remove all the non-standard build tool support and unify
OS-specific build rules under a basic set of (GNU make) makefiles.
Preserve the existing bootstrapping scripts (for POSIX, Windows,
and MS-DOS). Also the existing VMS build scripts are left unchanged:
I don't have enough experience with VMS to venture into this area.
Perhaps one of the VMS maintainers might like to determine whether
conversion would be appropriate.
Rather than create libraries for w32 and glob (non-POSIX), simply
link the object files directly to remove the complexity.
* NEWS: Update with user-facing notes.
* Makefile.am: Clean up to use the latest automake best practices.
Build Windows code directly from the root makefile to avoid recursion.
* README.Amiga, README.DOS.template, README.W32.template: Updated.
* INSTALL: Point readers at the README.git file.
* maintMakefile: Remove obsolete files. Create Basic.mk file.
* Basic.mk.template, mk/*.mk: Create basic GNU make-based makefiles.
* build_w32.bat: Copy Basic.mk to Makefile
* configure.ac: We no longer need AM_PROG_AR.
* dosbuild.bat: Rename to builddos.bat. Incorporate configure.bat.
* Makefile.DOS.template: Remove.
* NMakefile.template, w32/subproc/NMakefile: Remove.
* SMakefile.template, glob/SMakefile, glob/SCOPTIONS, make.lnk: Remove.
* configure.bat, glob/configure.bat: Remove.
* w32/Makefile.am: Remove.
* make_msvc_net2003.sln, make_msvc_net2003.vcproj: Remove.
2017-11-12 22:44:38 +00:00
|
|
|
# Make sure we can compile
|
|
|
|
|
2019-10-05 18:26:52 +00:00
|
|
|
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";
|
2013-10-19 19:39:15 +00:00
|
|
|
|
|
|
|
my $clog = `$sobuild 2>&1`;
|
|
|
|
if ($? != 0) {
|
|
|
|
$verbose and print "Failed to build testapi.so:\n$sobuild\n$_";
|
|
|
|
return -1;
|
|
|
|
}
|
2013-02-25 06:38:36 +00:00
|
|
|
|
|
|
|
# TEST 1
|
|
|
|
# Check the gmk_expand() function
|
|
|
|
run_make_test(q!
|
|
|
|
EXPAND = expansion
|
|
|
|
all: ; @echo $(test-expand $$(EXPAND))
|
|
|
|
load testapi.so
|
|
|
|
!,
|
|
|
|
'', "expansion\n");
|
|
|
|
|
|
|
|
# TEST 2
|
|
|
|
# Check the eval operation. Prove that the argument is expanded only once
|
|
|
|
run_make_test(q!
|
|
|
|
load testapi.so
|
|
|
|
TEST = bye
|
|
|
|
ASSIGN = VAR = $(TEST) $(shell echo there)
|
|
|
|
$(test-eval $(value ASSIGN))
|
|
|
|
TEST = hi
|
|
|
|
all:;@echo '$(VAR)'
|
|
|
|
!,
|
|
|
|
'', "hi there\n");
|
|
|
|
|
2013-10-05 20:10:30 +00:00
|
|
|
# TEST 2
|
|
|
|
# Check the no-expand capability
|
|
|
|
run_make_test(q!
|
|
|
|
load testapi.so
|
|
|
|
TEST = hi
|
|
|
|
all:;@echo '$(test-noexpand $(TEST))'
|
|
|
|
!,
|
|
|
|
'', "\$(TEST)\n");
|
|
|
|
|
2013-02-25 06:38:36 +00:00
|
|
|
unlink(qw(testapi.c testapi.so)) unless $keep;
|
|
|
|
|
|
|
|
# This tells the test driver that the perl test script executed properly.
|
|
|
|
1;
|