about summary refs log tree commit diff
path: root/buildtools
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2013-10-20 20:00:51 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2013-10-20 20:00:51 +0000
commit59498fa94e044604ace91a0f7dc06e8740e6cf9b (patch)
treef0d990b1f9ebed7308f71697c7bac6a0b868f015 /buildtools
parentcbba7cc2c587c5187eb9c07232af21eeeb4b0e4a (diff)
downloadnetpbm-mirror-59498fa94e044604ace91a0f7dc06e8740e6cf9b.tar.gz
netpbm-mirror-59498fa94e044604ace91a0f7dc06e8740e6cf9b.tar.xz
netpbm-mirror-59498fa94e044604ace91a0f7dc06e8740e6cf9b.zip
Use <emmintrins.h> interface for MMX SSE instrinsics instead of GCC-specific verisons
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2022 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'buildtools')
-rwxr-xr-xbuildtools/configure.pl62
1 files changed, 61 insertions, 1 deletions
diff --git a/buildtools/configure.pl b/buildtools/configure.pl
index 2179454b..8f1c46ba 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,59 @@ sub getInt64($$) {
 
 
 
+sub determineMmxCapability($) {
+
+    my ($haveEmmintrinR) = @_;
+
+    if (defined($testCc)) {
+
+        print("(Doing test compiles to determine if your compiler has MMX " .
+              "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 = 'Y';
+        } else {
+            print("It does not.  Programs will not exploit fast MMX " .
+                  "instructions.\n");
+            $$haveEmmintrinR = 'N';
+        }
+        print("\n");
+    } else {
+        $$haveEmmintrinR = "N";
+    }
+}
+
+
+
+sub getMmx($) {
+
+    my ($wantMmxR) = @_;
+
+    determineMmxCapability(\my $haveEmmintrin);
+
+    my $gotit;
+
+    print("Use MMX instructions?\n");
+    print("\n");
+
+    my $default = $haveEmmintrin ? "y" : "n";
+
+    $$wantMmxR = promptYesNo($default);
+}
+
+
+
 # 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 +2013,8 @@ getInttypes(\my $inttypesHeaderFile);
 
 getInt64($inttypesHeaderFile, \my $haveInt64);
 
+getMmx(\my $wantMmx);
+
 findProcessManagement(\my $dontHaveProcessMgmt);
 
 #******************************************************************************
@@ -2385,6 +2441,10 @@ if ($haveInt64 ne 'Y') {
     push(@config_mk, "HAVE_INT64 = $haveInt64\n");
 }
 
+if ($wantMmx) {
+    push(@config_mk, "WANT_MMX = Y\n");
+}
+
 if ($dontHaveProcessMgmt) {
     push(@config_mk, "DONT_HAVE_PROCESS_MGMT = Y\n");
 }