Lines 1-11
Link Here
|
1 |
Index: configure |
1 |
--- configure.orig 2016-06-23 15:50:59 UTC |
|
|
2 |
+++ configure |
2 |
@@ -1,4 +1,4 @@ |
3 |
@@ -1,4 +1,4 @@ |
3 |
-#!/usr/bin/env bash |
4 |
-#!/usr/bin/env bash |
4 |
+#!/bin/sh |
5 |
+#!/bin/sh |
5 |
|
6 |
|
6 |
CONFIG="config.mk" |
7 |
CONFIG="config.mk" |
7 |
PREFIX="/usr/local" |
8 |
PREFIX="/usr/local" |
8 |
@@ -8,7 +8,7 @@ |
9 |
@@ -8,7 +8,7 @@ DEBUG= |
9 |
SSE=auto |
10 |
SSE=auto |
10 |
OPENMP= |
11 |
OPENMP= |
11 |
LIBPNG_DIR=. |
12 |
LIBPNG_DIR=. |
Lines 14-29
Index: configure
Link Here
|
14 |
COCOA_READER=auto |
15 |
COCOA_READER=auto |
15 |
LCMS2=0 |
16 |
LCMS2=0 |
16 |
else |
17 |
else |
17 |
@@ -38,7 +38,7 @@ |
18 |
@@ -38,7 +38,7 @@ for i in "$@"; do |
18 |
echo |
19 |
echo |
19 |
help "--with-openmp=static compile with multicore support" |
20 |
help "--with-openmp=static compile with multicore support" |
20 |
help "--with-lcms2/--without-lcms2 compile with color profile support" |
21 |
help "--with-lcms2/--without-lcms2 compile with color profile support" |
21 |
-if [[ "$OSTYPE" =~ "darwin" ]]; then |
22 |
-if [[ "$OSTYPE" =~ "darwin" ]]; then |
22 |
+if echo "$OSTYPE" | grep -q "darwin"; then |
23 |
+if echo "$OSTYPE" | grep -q "darwin"; then |
23 |
help "--with-cocoa/--without-cocoa use Cocoa framework to read images" |
24 |
help "--with-cocoa/--without-cocoa use Cocoa framework to read images" |
24 |
help "--with-libpng=<dir> search for libpng in directory" |
|
|
25 |
fi |
25 |
fi |
26 |
@@ -110,7 +110,7 @@ |
26 |
help "--with-libpng=<dir> search for libpng in directory" |
|
|
27 |
@@ -109,7 +109,7 @@ done |
27 |
|
28 |
|
28 |
# If someone runs sudo make install as very first command, and configure later, |
29 |
# If someone runs sudo make install as very first command, and configure later, |
29 |
# $CONFIG cannot be overwritten, and must be deleted before continuing. |
30 |
# $CONFIG cannot be overwritten, and must be deleted before continuing. |
Lines 32-68
Index: configure
Link Here
|
32 |
echo "Cannot overwrite file $CONFIG! Please delete it." |
33 |
echo "Cannot overwrite file $CONFIG! Please delete it." |
33 |
exit 1 |
34 |
exit 1 |
34 |
fi |
35 |
fi |
35 |
@@ -147,7 +147,7 @@ |
36 |
@@ -146,7 +146,7 @@ find_h() { |
36 |
|
37 |
|
37 |
find_pkgconfig() { |
38 |
find_pkgconfig() { |
38 |
LIBNAME=$1 |
39 |
local LIBNAME=$1 |
39 |
- if pkg-config --exists "$LIBNAME" &> /dev/null; then |
40 |
- if pkg-config --exists "$LIBNAME" &> /dev/null; then |
40 |
+ if pkg-config --exists "$LIBNAME" >/dev/null 2>&1; then |
41 |
+ if pkg-config --exists "$LIBNAME" >/dev/null; then |
41 |
cflags "$(pkg-config --cflags "$LIBNAME")" |
42 |
cflags "$(pkg-config --cflags "$LIBNAME")" |
42 |
lflags "$(pkg-config --libs "$LIBNAME")" |
43 |
lflags "$(pkg-config --libs "$LIBNAME")" |
43 |
status "$LIBNAME" "shared ($(pkg-config --modversion "$LIBNAME"))" |
44 |
status "$LIBNAME" "shared ($(pkg-config --modversion "$LIBNAME"))" |
44 |
@@ -191,11 +191,16 @@ |
45 |
@@ -210,9 +210,13 @@ find_library() { |
45 |
return 0 |
46 |
return 0 |
46 |
fi |
47 |
fi |
47 |
|
48 |
|
48 |
- for i in "${DIRS[@]}"; do |
49 |
- for i in "${DIRS[@]}"; do |
49 |
- DIR=($i) |
50 |
- DIR=($i) |
50 |
- HPATH=$(find_h "${DIR[0]}" "$HEADERPATTERN") |
51 |
- if find_dynamic "$LIBNAME" "$HEADERPATTERN" "$DYNAMICPATTERN" "${DIR[0]}" "${DIR[1]}"; then |
51 |
+ # destroys positional parameters |
52 |
+ # destroys positional parameters |
52 |
+ set -- ${DIRS} |
53 |
+ set -- ${DIRS} |
53 |
+ while [ -n "$1" -a -n "$2" ]; do |
54 |
+ while [ -n "$1" -a -n "$2" ]; do |
54 |
+ DIRS_h="$1" |
55 |
+ DIRS_h="$1" |
55 |
+ DIRS_l="$2" |
56 |
+ DIRS_l="$2" |
56 |
+ shift 2 |
57 |
+ shift 2 |
57 |
+ |
58 |
+ if find_dynamic "$LIBNAME" "$HEADERPATTERN" "$DYNAMICPATTERN" "${DIRS_h}" "${DIRS_l}"; then |
58 |
+ HPATH=$(find_h "${DIRS_h}" "$HEADERPATTERN") |
59 |
return 0 |
59 |
if [ -n "$HPATH" ]; then |
60 |
fi |
60 |
- SOPATH=$(find_f "${DIR[1]}" "$DYNAMICPATTERN") |
61 |
done |
61 |
+ SOPATH=$(find_f "${DIRS_l}" "$DYNAMICPATTERN") |
62 |
@@ -262,10 +266,8 @@ fi |
62 |
if [ -n "$SOPATH" ]; then |
|
|
63 |
cflags "-I${HPATH%/*}" |
64 |
lflags "-L${SOPATH%/*} -l$DYNAMICLIBNAME" |
65 |
@@ -250,10 +255,8 @@ |
66 |
|
63 |
|
67 |
# SSE |
64 |
# SSE |
68 |
if [ "$SSE" = 'auto' ]; then |
65 |
if [ "$SSE" = 'auto' ]; then |
Lines 75-81
Index: configure
Link Here
|
75 |
fi |
72 |
fi |
76 |
|
73 |
|
77 |
if [ "$SSE" -eq 1 ]; then |
74 |
if [ "$SSE" -eq 1 ]; then |
78 |
@@ -276,9 +279,8 @@ |
75 |
@@ -288,9 +290,8 @@ if [ -n "$OPENMP" ]; then |
79 |
else |
76 |
else |
80 |
OPENMPFLAGS="-fopenmp" |
77 |
OPENMPFLAGS="-fopenmp" |
81 |
fi |
78 |
fi |
Lines 87-93
Index: configure
Link Here
|
87 |
cflags "$OPENMPFLAGS" |
84 |
cflags "$OPENMPFLAGS" |
88 |
lflags "$OPENMPFLAGS" |
85 |
lflags "$OPENMPFLAGS" |
89 |
status "OpenMP" "yes" |
86 |
status "OpenMP" "yes" |
90 |
@@ -293,11 +295,13 @@ |
87 |
@@ -305,11 +306,13 @@ else |
91 |
fi |
88 |
fi |
92 |
|
89 |
|
93 |
# Cocoa |
90 |
# Cocoa |
Lines 103-122
Index: configure
Link Here
|
103 |
COCOA_READER=1 |
100 |
COCOA_READER=1 |
104 |
cflags "-DUSE_COCOA=1" |
101 |
cflags "-DUSE_COCOA=1" |
105 |
lflags "-framework Cocoa" |
102 |
lflags "-framework Cocoa" |
106 |
@@ -308,19 +312,18 @@ |
103 |
@@ -320,25 +323,24 @@ if [[ "$OSTYPE" =~ "darwin" ]]; then |
107 |
fi |
104 |
fi |
108 |
|
105 |
|
109 |
# pairs of possible *.h and lib*.so locations |
106 |
# pairs of possible *.h and lib*.so locations |
110 |
-DIRS=("/usr/local/include /usr/local/lib" |
107 |
-DIRS=() |
|
|
108 |
+DIRS= |
109 |
|
110 |
if command -v >/dev/null libpng-config; then |
111 |
- DIRS+=("$(libpng-config --prefix) $(libpng-config --libdir)") |
112 |
+ DIRS="$(libpng-config --prefix) $(libpng-config --libdir)" |
113 |
fi |
114 |
|
115 |
-DIRS+=("/usr/local/include /usr/local/lib" |
111 |
- "/usr/include /usr/lib" |
116 |
- "/usr/include /usr/lib" |
112 |
- "/opt/local/include /opt/local/lib" # macports |
117 |
- "/opt/local/include /opt/local/lib" # macports |
113 |
- ) |
118 |
- ) |
114 |
+DIRS="${PREFIX}/include ${PREFIX}/lib \ |
119 |
+DIRS="$DIRS /usr/local/include /usr/local/lib \ |
115 |
+ /usr/include /usr/lib \ |
120 |
+ /usr/include /usr/lib \ |
116 |
+ /opt/local/include /opt/local/lib" # macports |
121 |
+ /opt/local/include /opt/local/lib" # macports |
117 |
|
122 |
|
118 |
-if [[ "$OSTYPE" =~ "darwin" ]]; then |
123 |
-if [[ "$OSTYPE" =~ "darwin" ]]; then |
119 |
+if echo "$OSTYPE" | grep -q "darwin"; then |
124 |
+if echo "$OSTYPE" | grep -q "darwin" ; then |
120 |
SOLIBSUFFIX=dylib |
125 |
SOLIBSUFFIX=dylib |
121 |
|
126 |
|
122 |
# Search Developer SDK paths, since Apple seems to have dropped the standard Unixy ones |
127 |
# Search Developer SDK paths, since Apple seems to have dropped the standard Unixy ones |
Lines 129-144
Index: configure
Link Here
|
129 |
else |
134 |
else |
130 |
SOLIBSUFFIX=so |
135 |
SOLIBSUFFIX=so |
131 |
fi |
136 |
fi |
132 |
@@ -332,7 +335,7 @@ |
137 |
@@ -350,7 +352,7 @@ HAS_LIBPNG=0 |
133 |
if echo "#include \"png.h\" |
138 |
if echo "#include \"png.h\" |
134 |
int main(){ |
139 |
int main(){ |
135 |
return !png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); |
140 |
return !png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); |
136 |
-}" | "$CC" -xc -std=c99 -o /dev/null $CFLAGS $LDFLAGS - &> /dev/null; then |
141 |
-}" | "$CC" -xc -std=c99 -o /dev/null $CFLAGS $LDFLAGS - &> /dev/null; then |
137 |
+}" | "$CC" -xc -std=c99 -o /dev/null $CFLAGS $LDFLAGS - >/dev/null 2>&1; then |
142 |
+}" | "$CC" -xc -std=c99 -o /dev/null $CFLAGS $LDFLAGS - >/dev/null 2>&1; then |
138 |
status "libpng" "custom flags" |
143 |
status "libpng" "custom flags" |
139 |
SUCCESS=1 |
144 |
HAS_LIBPNG=1 |
140 |
fi |
145 |
fi |
141 |
@@ -343,7 +346,7 @@ |
146 |
@@ -361,7 +363,7 @@ if [ "$HAS_LIBPNG" -eq 0 ]; then |
142 |
if [ -n "$PNGH" ]; then |
147 |
if [ -n "$PNGH" ]; then |
143 |
PNGH_STRING=$(pngh_string "$PNGH") |
148 |
PNGH_STRING=$(pngh_string "$PNGH") |
144 |
PNGH_MAJMIN=$(pngh_majmin "$PNGH") |
149 |
PNGH_MAJMIN=$(pngh_majmin "$PNGH") |
Lines 147-155
Index: configure
Link Here
|
147 |
LIBPNGA=$(find_f "$LIBPNG_DIR" "libpng${PNGH_MAJMIN}.a") |
152 |
LIBPNGA=$(find_f "$LIBPNG_DIR" "libpng${PNGH_MAJMIN}.a") |
148 |
if [ -n "$LIBPNGA" ]; then |
153 |
if [ -n "$LIBPNGA" ]; then |
149 |
cflags "-I${PNGH%/*}" |
154 |
cflags "-I${PNGH%/*}" |
150 |
@@ -359,14 +362,19 @@ |
155 |
@@ -377,14 +379,19 @@ if [ "$HAS_LIBPNG" -eq 0 ]; then |
151 |
if find_pkgconfig libpng; then |
156 |
if find_pkgconfig libpng; then |
152 |
SUCCESS=1 |
157 |
HAS_LIBPNG=1 |
153 |
else |
158 |
else |
154 |
- for i in "${DIRS[@]}"; do |
159 |
- for i in "${DIRS[@]}"; do |
155 |
- DIR=($i) |
160 |
- DIR=($i) |
Lines 172-183
Index: configure
Link Here
|
172 |
if [ -n "$LIBPNGSO" ]; then |
177 |
if [ -n "$LIBPNGSO" ]; then |
173 |
cflags "-I${PNGH%/*}" |
178 |
cflags "-I${PNGH%/*}" |
174 |
lflags "-L${LIBPNGSO%/*} -lpng${PNGH_MAJMIN}" |
179 |
lflags "-L${LIBPNGSO%/*} -lpng${PNGH_MAJMIN}" |
175 |
@@ -380,7 +388,7 @@ |
180 |
@@ -398,7 +405,7 @@ if [ "$HAS_LIBPNG" -eq 0 ]; then |
176 |
fi |
181 |
fi |
177 |
fi |
182 |
fi |
178 |
if [ "$SUCCESS" -eq 0 ]; then |
183 |
if [ "$HAS_LIBPNG" -eq 0 ]; then |
179 |
- if [[ "$OSTYPE" =~ "darwin" ]]; then |
184 |
- if [[ "$OSTYPE" =~ "darwin" ]]; then |
180 |
+ if echo "$OSTYPE" | grep -q "darwin"; then |
185 |
+ if echo "$OSTYPE" | grep -q "darwin"; then |
181 |
LIBPNG_CMD='`brew install libpng`' |
186 |
LIBPNG_CMD='`brew install libpng`' |
182 |
else |
187 |
else |
183 |
LIBPNG_CMD='`apt-get install libpng-dev` or `yum install libpng-devel`' |
188 |
LIBPNG_CMD='`apt-get install libpng16-dev` or `apt-get install libpng-dev` or `yum install libpng-devel`' |