| @@ -1,54 +1,65 @@ | | | @@ -1,54 +1,65 @@ |
1 | $NetBSD: patch-configure,v 1.5 2017/07/03 21:50:32 adam Exp $ | | 1 | $NetBSD: patch-configure,v 1.6 2017/12/20 11:52:23 dholland Exp $ |
2 | | | 2 | |
3 | Remove unwanted compiler flags. | | 3 | Remove unwanted compiler flags. |
| | | 4 | Avoid leaving scratch files in /tmp. |
4 | | | 5 | |
5 | --- configure.orig 2017-07-02 21:40:53.000000000 +0000 | | 6 | --- configure.orig 2017-11-27 15:38:43.000000000 +0000 |
6 | +++ configure | | 7 | +++ configure |
7 | @@ -2,7 +2,7 @@ | | 8 | @@ -2,7 +2,7 @@ |
8 | | | 9 | |
9 | CONFIG="config.mk" | | 10 | CONFIG="config.mk" |
10 | PREFIX="/usr/local" | | 11 | PREFIX="/usr/local" |
11 | -VERSION=$(grep LIQ_VERSION_STRING libimagequant.h | grep -Eo "2\.[0-9.]+") | | 12 | -VERSION=$(grep LIQ_VERSION_STRING libimagequant.h | grep -Eo "2\.[0-9.]+") |
12 | +VERSION=$(awk -F\" '/LIQ_VERSION_STRING/ {print $2}' libimagequant.h) | | 13 | +VERSION=$(awk -F\" '/LIQ_VERSION_STRING/ {print $2}' libimagequant.h) |
13 | | | 14 | |
14 | DEBUG= | | 15 | DEBUG= |
15 | QUIET=0 | | 16 | QUIET=0 |
16 | @@ -136,7 +136,7 @@ cflags "-std=c99 -I." | | 17 | @@ -124,7 +124,8 @@ if [ "$QUIET" -ne 1 ]; then |
| | | 18 | fi |
| | | 19 | |
| | | 20 | # /tmp, because mingw has problems opening /dev/null and gives false negative |
| | | 21 | -if ! echo "int main(){}" | "$CC" -xc -std=c99 -o /tmp/gcccheck - > /dev/null; then |
| | | 22 | +# not /tmp, because that's not safe |
| | | 23 | +if ! echo "int main(){}" | "$CC" -xc -std=c99 -o ./tmp-gcccheck - > /dev/null; then |
| | | 24 | error "Compiler" "$CC failed to compile anything (make sure it's installed and supports C99)" |
| | | 25 | fi |
| | | 26 | |
| | | 27 | @@ -136,7 +137,7 @@ cflags "-std=c99 -I." |
17 | | | 28 | |
18 | # DEBUG | | 29 | # DEBUG |
19 | if [ -z "$DEBUG" ]; then | | 30 | if [ -z "$DEBUG" ]; then |
20 | - cflags "-O3 -DNDEBUG" | | 31 | - cflags "-O3 -DNDEBUG" |
21 | + cflags "-DNDEBUG" | | 32 | + cflags "-DNDEBUG" |
22 | status "Debug" "no" | | 33 | status "Debug" "no" |
23 | else | | 34 | else |
24 | cflags "-O1 -g" | | 35 | cflags "-O1 -g" |
25 | @@ -174,15 +174,9 @@ if [ -n "$OPENMP" ]; then | | 36 | @@ -174,15 +175,9 @@ if [ -n "$OPENMP" ]; then |
26 | else | | 37 | else |
27 | OPENMPFLAGS="-fopenmp" | | 38 | OPENMPFLAGS="-fopenmp" |
28 | fi | | 39 | fi |
29 | - if [[ "$("$CC" -xc -E $OPENMPFLAGS <(echo "#ifdef _OPENMP | | 40 | - if [[ "$("$CC" -xc -E $OPENMPFLAGS <(echo "#ifdef _OPENMP |
30 | - #include <omp.h> | | 41 | - #include <omp.h> |
31 | - #endif") 2>&1)" =~ "omp_get_thread_num" ]]; then | | 42 | - #endif") 2>&1)" =~ "omp_get_thread_num" ]]; then |
32 | cflags "$OPENMPFLAGS" | | 43 | cflags "$OPENMPFLAGS" |
33 | lflags "$OPENMPFLAGS" | | 44 | lflags "$OPENMPFLAGS" |
34 | status "OpenMP" "yes" | | 45 | status "OpenMP" "yes" |
35 | - else | | 46 | - else |
36 | - error "OpenMP" "not supported by compiler (please install a compiler that supports OpenMP (e.g. gcc) and specify it with the CC= argument)" | | 47 | - error "OpenMP" "not supported by compiler (please install a compiler that supports OpenMP (e.g. gcc) and specify it with the CC= argument)" |
37 | - fi | | 48 | - fi |
38 | else | | 49 | else |
39 | # silence warnings about omp pragmas | | 50 | # silence warnings about omp pragmas |
40 | cflags "-Wno-unknown-pragmas" | | 51 | cflags "-Wno-unknown-pragmas" |
41 | @@ -190,20 +184,10 @@ else | | 52 | @@ -190,20 +185,10 @@ else |
42 | status "OpenMP" "no" | | 53 | status "OpenMP" "no" |
43 | fi | | 54 | fi |
44 | | | 55 | |
45 | -# Cocoa | | 56 | -# Cocoa |
46 | -if [[ "$OSTYPE" =~ "darwin" ]]; then | | 57 | -if [[ "$OSTYPE" =~ "darwin" ]]; then |
47 | - cflags "-mmacosx-version-min=10.6" | | 58 | - cflags "-mmacosx-version-min=10.6" |
48 | - lflags "-mmacosx-version-min=10.6" | | 59 | - lflags "-mmacosx-version-min=10.6" |
49 | -fi | | 60 | -fi |
50 | | | 61 | |
51 | if [[ "$OSTYPE" =~ "darwin" ]]; then | | 62 | if [[ "$OSTYPE" =~ "darwin" ]]; then |
52 | SOLIBSUFFIX=dylib | | 63 | SOLIBSUFFIX=dylib |
53 | | | 64 | |
54 | - # Search Developer SDK paths, since Apple seems to have dropped the standard Unixy ones | | 65 | - # Search Developer SDK paths, since Apple seems to have dropped the standard Unixy ones |