diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2013-12-26 06:13:41 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2013-12-26 06:13:41 +0000 |
commit | 51ffbae51ba9379bad460566cdf9babaa63b14c3 (patch) | |
tree | 441f6e9297c478261bdce544497decaf6abc31a4 /buildtools | |
parent | d6f45222d7b29adb9defdd79dd8ad1dbc97bb3e1 (diff) | |
download | netpbm-mirror-51ffbae51ba9379bad460566cdf9babaa63b14c3.tar.gz netpbm-mirror-51ffbae51ba9379bad460566cdf9babaa63b14c3.tar.xz netpbm-mirror-51ffbae51ba9379bad460566cdf9babaa63b14c3.zip |
Update to current Development release - 10.65.00
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@2083 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'buildtools')
-rw-r--r-- | buildtools/Makefile | 19 | ||||
-rwxr-xr-x | buildtools/configure.pl | 75 | ||||
-rw-r--r-- | buildtools/testrandom.c | 130 |
3 files changed, 77 insertions, 147 deletions
diff --git a/buildtools/Makefile b/buildtools/Makefile index e90feeca..6a2e33da 100644 --- a/buildtools/Makefile +++ b/buildtools/Makefile @@ -8,24 +8,10 @@ include $(BUILDDIR)/config.mk MERGE_OBJECTS = -# These are programs that are used by the make files: -BUILDPROGS = libopt typegen endiangen - -# Ideally, this directory would not contain anything but build tools, which -# means they would all be built to run in the build environment, not the -# target environment. But we have no other convenient place for test tools, -# so we put them here and build them for the target environment. -TESTPROGS = testrandom - -PROGS = $(BUILDPROGS) $(TESTPROGS) +PROGS = libopt typegen endiangen all: $(PROGS) -PORTBINARIES = $(TESTPROGS) -BINARIES = $(PORTBINARIES) -OBJECTS = $(BINARIES:%=%.o) -SCRIPTS = - OMIT_BUILDTOOL_RULE = 1 include $(SRCDIR)/common.mk @@ -40,7 +26,8 @@ endif libopt.o: libopt.c $(CC_FOR_BUILD) -c -o $@ $(CFLAGS_FOR_BUILD) \ -DSHLIBPREFIXLIST="\"$(SHLIBPREFIXLIST)\"" \ - $(STRIP_DLL_VERSION) $(EXPLICIT) $(CFLAGS_PERSONAL) $(CADD) \ + $(STRIP_DLL_VERSION) $(EXPLICIT) \ + $(CFLAGS_PERSONAL) $(CFLAGS) $(CADD) \ $< typegen.o endiangen.o:%.o:%.c diff --git a/buildtools/configure.pl b/buildtools/configure.pl index 2179454b..b03630d8 100755 --- a/buildtools/configure.pl +++ b/buildtools/configure.pl @@ -99,7 +99,7 @@ sub prompt($$) { sub promptYesNo($) { - my ($default) = $@; + my ($default) = @_; my $retval; @@ -947,6 +947,7 @@ sub getInttypes($) { } + sub getInt64($$) { my ($inttypes_h, $haveInt64R) = @_; @@ -982,6 +983,72 @@ sub getInt64($$) { +sub determineSseCapability($) { + + my ($haveEmmintrinR) = @_; + + if (defined($testCc)) { + + print("(Doing test compiles to determine if your compiler has SSE " . + "intrinsics -- ignore errors)\n"); + + my $cflags = testCflags(); + + my $works; + + my @cSourceCode = ( + "#include <emmintrin.h>\n", + ); + + testCompile($cflags, \@cSourceCode, \my $success); + + if ($success) { + print("It does.\n"); + $$haveEmmintrinR = $TRUE; + } else { + print("It does not. Programs will not exploit fast SSE " . + "instructions.\n"); + $$haveEmmintrinR = $FALSE; + } + print("\n"); + } else { + # We conservatively estimate the facility isn't there + $$haveEmmintrinR = $FALSE; + } +} + + + +sub getSse($) { + + my ($wantSseR) = @_; + + determineSseCapability(\my $haveEmmintrin); + + my $gotit; + + print("Use SSE instructions?\n"); + print("\n"); + + my $default = $haveEmmintrin ? "y" : "n"; + + $$wantSseR = promptYesNo($default); + + # Another complication in the SSE world is that GNU compiler options + # -msse, -msse2, and -march=xxx affect whether the compiler can or will + # generate the instructions. When compiling for older processors, the + # default for these options is negative ; for newer processors, it is + # affirmative. -[no]msse2 determines whether macro __SSE2__ macro is + # defined. If it is not, #include <emmintrins.h> fails (<emmintrins.h> + # checks __SSE2__. + + # The Netpbm build does not mess with these compiler options. If the + # user wants something other than the default, he can put it in CFLAGS + # in config.mk manually or on the make command line on in CFLAGS_PERSONAL. +} + + + # TODO: These should do test compiles to see if the headers are in the # default search path, both to create a default to offer and to issue a # warning after user has chosen. Also test links to test the link library. @@ -1959,6 +2026,8 @@ getInttypes(\my $inttypesHeaderFile); getInt64($inttypesHeaderFile, \my $haveInt64); +getSse(\my $wantSse); + findProcessManagement(\my $dontHaveProcessMgmt); #****************************************************************************** @@ -2385,6 +2454,10 @@ if ($haveInt64 ne 'Y') { push(@config_mk, "HAVE_INT64 = $haveInt64\n"); } +if ($wantSse) { + push(@config_mk, "WANT_SSE = Y\n"); +} + if ($dontHaveProcessMgmt) { push(@config_mk, "DONT_HAVE_PROCESS_MGMT = Y\n"); } diff --git a/buildtools/testrandom.c b/buildtools/testrandom.c deleted file mode 100644 index 3f65f0d2..00000000 --- a/buildtools/testrandom.c +++ /dev/null @@ -1,130 +0,0 @@ -/*============================================================================= - testrandom -=============================================================================== - Test for the random number generator type by generating 5 values with rand() - and comparing them against values in a table. - - Currently only recognizes ISO glibc rand(). - - Options: - -q : quiet mode - -v : verbose mode : Use to generate values for new table -=============================================================================*/ -#include <stdio.h> -#include <stdlib.h> - -/* Exit values */ -#define EXIT_ERROR 1 -#define EXIT_UNKNOWN 80 -#define ISO_GLIBC 81 -/* 82-90: reserved */ - -typedef enum {QUIET=0, NORMAL=1, VERBOSE=2} VerbosityLevel; - -/* On some Sun systems RAND_MAX is not defined */ -#ifndef RAND_MAX -#define RAND_MAX 0 -#endif - -#define SEED 3791 - -static struct { - int const type; - /* Exit value for this rand() function */ - int const randMax; - /* Usually 0x7fffffff, sometimes 0x7fff */ - /* Other values are possible; 0 means undefined */ - unsigned int const res[5]; - /* Sample values returned from our tests */ - const char * const name; - /* Name for this rand() function */ -} rTable[2] = { - { ISO_GLIBC, /* glibc rand() */ - 0x7fffffff, /* 31 bits */ - { 217313873, 969144303, 1757357552, 1096307597, 818311031 }, - "ISO C glibc rand() or equivalent" }, - - /* Insert additional entries here */ - - { 0, /* terminating code */ - 0, - {0, 0, 0, 0, 0}, NULL /* unknown type */} -}; - - - -static void -parseCommandLine(int const argc, - const char * const argv[], - VerbosityLevel * const verbosityP) { - - *verbosityP = NORMAL; /* Initial value */ - - if (argc == 2) { - if (argv[1][0] == '-' && argv[1][2] == '\0') { - switch ( argv[1][1] ) { - case 'v' : *verbosityP = VERBOSE; break; - case 'q' : *verbosityP = QUIET ; break; - default : fprintf (stderr, - "Error: Unrecognized argument: %s\n", argv[1]); - exit (EXIT_ERROR); - } - } - } - if (argc > 2 ) { - fprintf (stderr, "Error: Too many arguments.\n"); - exit (EXIT_ERROR); - } -} - - - -int -main(int const argc, const char * const argv[]) { - - unsigned int i; - unsigned int res[5]; - VerbosityLevel verbosity; - - parseCommandLine(argc, argv, &verbosity); - - if (verbosity == VERBOSE) { - if (RAND_MAX > 0) - fprintf(stderr, "RAND_MAX = 0x%x (%d)\n", RAND_MAX, RAND_MAX); - else - fprintf(stderr, "RAND_MAX is undefined\n"); - } - - /* Set seed for pseudo-random number generator */ - if (verbosity == VERBOSE) - fprintf(stderr, "Generating samples. Seed=%u\n", SEED); - - srand(SEED); - - /* Generate five samples and store in array res[] */ - for (i = 0; i < 5; ++i) { - res[i] = rand(); - if (verbosity == VERBOSE) - fprintf (stderr, "%d\n",res[i]); - } - - /* Look for a match in table */ - for (i = 0; rTable[i].type != 0; ++i) { - if (rTable[i].randMax == RAND_MAX && rTable[i].res[0] == res[0] && - rTable[i].res[1] == res[1] && rTable[i].res[2] == res[2] && - rTable[i].res[3] == res[3] && rTable[i].res[4] == res[4]) { - if (verbosity != QUIET) - fprintf(stderr, - "Random number generator is %s.\n", rTable[i].name); - - exit(rTable[i].type); - } - } - /* No matches */ - if (verbosity != QUIET) - fprintf(stderr, "Random number generator is of unknown type.\n"); - exit(EXIT_UNKNOWN); -} - - - |