|
23 | 23 | # questions.
|
24 | 24 | #
|
25 | 25 |
|
| 26 | +# =========================================================================== |
| 27 | +# (c) Copyright IBM Corp. 2019, 2019 All Rights Reserved |
| 28 | +# =========================================================================== |
| 29 | + |
26 | 30 | ################################################################################
|
27 | 31 | # Check if a potential freeype library match is correct and usable
|
28 | 32 | ################################################################################
|
@@ -100,129 +104,131 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
|
100 | 104 | FREETYPE_CFLAGS=
|
101 | 105 | FREETYPE_LIBS=
|
102 | 106 |
|
103 |
| - if (test "x$with_freetype_include" = "x" && test "x$with_freetype_lib" != "x") || \ |
104 |
| - (test "x$with_freetype_include" != "x" && test "x$with_freetype_lib" = "x"); then |
105 |
| - AC_MSG_ERROR(['must specify both or neither of --with_freetype_include and --with_freetype_lib]) |
106 |
| - fi |
| 107 | + if test "x$NEEDS_LIB_FREETYPE" = xfalse; then |
| 108 | + if (test "x${with_freetype}" != x && test "x${with_freetype}" != xno) || \ |
| 109 | + (test "x${with_freetype_include}" != x && test "x${with_freetype_include}" != xno); then |
| 110 | + AC_MSG_WARN([[freetype not used, so --with-freetype[-*] is ignored]]) |
| 111 | + fi |
| 112 | + else |
| 113 | + if (test "x$with_freetype_include" = "x" && test "x$with_freetype_lib" != "x") || \ |
| 114 | + (test "x$with_freetype_include" != "x" && test "x$with_freetype_lib" = "x"); then |
| 115 | + AC_MSG_ERROR(['must specify both or neither of --with_freetype_include and --with_freetype_lib]) |
| 116 | + fi |
107 | 117 |
|
108 |
| - FREETYPE_TO_USE=bundled |
109 |
| - if (test "x$OPENJDK_TARGET_OS" != "xwindows" && test "x$OPENJDK_TARGET_OS" != "xmacosx"); then |
110 |
| - FREETYPE_TO_USE=system |
111 |
| - fi |
112 |
| - if (test "x$with_freetype" != "x"); then |
113 |
| - if (test "x$with_freetype" = "xsystem"); then |
114 |
| - FREETYPE_TO_USE=system |
115 |
| - elif (test "x$with_freetype" = "xbundled"); then |
116 | 118 | FREETYPE_TO_USE=bundled
|
117 |
| - if (test "x$with_freetype_include" != "x" || test "x$with_freetype_lib" != "x"); then |
118 |
| - AC_MSG_ERROR(['bundled' cannot be specified with --with_freetype_include and --with_freetype_lib]) |
| 119 | + if (test "x$OPENJDK_TARGET_OS" != "xwindows" && test "x$OPENJDK_TARGET_OS" != "xmacosx"); then |
| 120 | + FREETYPE_TO_USE=system |
| 121 | + fi |
| 122 | + if (test "x$with_freetype" != "x"); then |
| 123 | + if (test "x$with_freetype" = "xsystem"); then |
| 124 | + FREETYPE_TO_USE=system |
| 125 | + elif (test "x$with_freetype" = "xbundled"); then |
| 126 | + FREETYPE_TO_USE=bundled |
| 127 | + if (test "x$with_freetype_include" != "x" || test "x$with_freetype_lib" != "x"); then |
| 128 | + AC_MSG_ERROR(['bundled' cannot be specified with --with_freetype_include and --with_freetype_lib]) |
| 129 | + fi |
| 130 | + else |
| 131 | + AC_MSG_ERROR(['valid values for --with-freetype are 'system' and 'bundled']) |
| 132 | + fi |
119 | 133 | fi
|
120 |
| - else |
121 |
| - AC_MSG_ERROR(['valid values for --with-freetype are 'system' and 'bundled']) |
122 |
| - fi |
123 |
| - fi |
124 |
| -
|
125 |
| - if (test "x$with_freetype_include" != "x" && test "x$with_freetype_lib" != "x"); then |
126 |
| - FREETYPE_TO_USE=system |
127 |
| - fi |
128 | 134 |
|
129 |
| - if (test "x$FREETYPE_TO_USE" = "xsystem") && \ |
130 |
| - (test "x$OPENJDK_TARGET_OS" = "xwindows" || test "x$OPENJDK_TARGET_OS" = "xmacosx"); then |
131 |
| - AC_MSG_ERROR([Only bundled freetype can be specified on Mac and Windows]) |
132 |
| - fi |
| 135 | + if (test "x$with_freetype_include" != "x" && test "x$with_freetype_lib" != "x"); then |
| 136 | + FREETYPE_TO_USE=system |
| 137 | + fi |
133 | 138 |
|
134 |
| - if (test "x$with_freetype_include" != "x"); then |
135 |
| - POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype_include" |
136 |
| - fi |
137 |
| - if (test "x$with_freetype_lib" != "x"); then |
138 |
| - POTENTIAL_FREETYPE_LIB_PATH="$with_freetype_lib" |
139 |
| - fi |
| 139 | + if (test "x$FREETYPE_TO_USE" = "xsystem") && \ |
| 140 | + (test "x$OPENJDK_TARGET_OS" = "xwindows" || test "x$OPENJDK_TARGET_OS" = "xmacosx"); then |
| 141 | + AC_MSG_ERROR([Only bundled freetype can be specified on Mac and Windows]) |
| 142 | + fi |
140 | 143 |
|
141 |
| - if (test "x$FREETYPE_TO_USE" = "xsystem"); then |
142 |
| - if (test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != "x" && test "x$POTENTIAL_FREETYPE_LIB_PATH" != "x"); then |
143 |
| - # Okay, we got it. Check that it works. |
144 |
| - LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH, $POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype]) |
145 |
| - if (test "x$FOUND_FREETYPE" != "xyes"); then |
146 |
| - AC_MSG_ERROR([Can not find or use freetype at location given by --with-freetype-lib|include]) |
| 144 | + if (test "x$with_freetype_include" != "x"); then |
| 145 | + POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype_include" |
147 | 146 | fi
|
148 |
| - else |
149 |
| - # User did not specify a location, but asked for system freetype. Try to locate it. |
150 |
| -
|
151 |
| - # If we have a sysroot, assume that's where we are supposed to look and skip pkg-config. |
152 |
| - if (test "x$SYSROOT" = "x"); then |
153 |
| - if (test "x$FOUND_FREETYPE" != "xyes"); then |
154 |
| - # Check modules using pkg-config, but only if we have it (ugly output results otherwise) |
155 |
| - if (test "x$PKG_CONFIG" != "x"); then |
156 |
| - PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no]) |
157 |
| - if (test "x$FOUND_FREETYPE" = "xyes"); then |
158 |
| - # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us. |
159 |
| - FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'` |
160 |
| - # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64 |
161 |
| - if (test "x$OPENJDK_TARGET_OS" = "xsolaris" && test "x$OPENJDK_TARGET_CPU" = "xx86_64"); then |
162 |
| - FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'` |
| 147 | + if (test "x$with_freetype_lib" != "x"); then |
| 148 | + POTENTIAL_FREETYPE_LIB_PATH="$with_freetype_lib" |
| 149 | + fi |
| 150 | +
|
| 151 | + if (test "x$FREETYPE_TO_USE" = "xsystem"); then |
| 152 | + if (test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != "x" && test "x$POTENTIAL_FREETYPE_LIB_PATH" != "x"); then |
| 153 | + # Okay, we got it. Check that it works. |
| 154 | + LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH, $POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype]) |
| 155 | + if (test "x$FOUND_FREETYPE" != "xyes"); then |
| 156 | + AC_MSG_ERROR([Can not find or use freetype at location given by --with-freetype-lib|include]) |
| 157 | + fi |
| 158 | + else |
| 159 | + # User did not specify a location, but asked for system freetype. Try to locate it. |
| 160 | + # If we have a sysroot, assume that's where we are supposed to look and skip pkg-config. |
| 161 | + if (test "x$SYSROOT" = "x"); then |
| 162 | + if (test "x$FOUND_FREETYPE" != "xyes"); then |
| 163 | + # Check modules using pkg-config, but only if we have it (ugly output results otherwise) |
| 164 | + if (test "x$PKG_CONFIG" != "x"); then |
| 165 | + PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no]) |
| 166 | + if (test "x$FOUND_FREETYPE" = "xyes"); then |
| 167 | + # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us. |
| 168 | + FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'` |
| 169 | + # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64 |
| 170 | + if (test "x$OPENJDK_TARGET_OS" = "xsolaris" && test "x$OPENJDK_TARGET_CPU" = "xx86_64"); then |
| 171 | + FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'` |
| 172 | + fi |
| 173 | + AC_MSG_CHECKING([for freetype]) |
| 174 | + AC_MSG_RESULT([yes (using pkg-config)]) |
| 175 | + fi |
163 | 176 | fi
|
164 |
| - AC_MSG_CHECKING([for freetype]) |
165 |
| - AC_MSG_RESULT([yes (using pkg-config)]) |
166 | 177 | fi
|
167 | 178 | fi
|
168 |
| - fi |
169 |
| - fi |
170 |
| -
|
171 |
| - if (test "x$FOUND_FREETYPE" != "xyes"); then |
172 |
| - # Check in well-known locations |
173 |
| - FREETYPE_BASE_DIR="$SYSROOT/usr" |
174 |
| - LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location]) |
175 |
| -
|
176 |
| - if (test "x$FOUND_FREETYPE" != "xyes"); then |
177 |
| - FREETYPE_BASE_DIR="$SYSROOT/usr/X11" |
178 |
| - LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location]) |
179 |
| - fi |
180 |
| - if (test "x$FOUND_FREETYPE" != "xyes"); then |
181 |
| - FREETYPE_BASE_DIR="$SYSROOT/usr/local" |
182 |
| - LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location]) |
183 |
| - fi |
| 179 | + if (test "x$FOUND_FREETYPE" != "xyes"); then |
| 180 | + # Check in well-known locations |
| 181 | + FREETYPE_BASE_DIR="$SYSROOT/usr" |
| 182 | + LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location]) |
184 | 183 |
|
185 |
| - if (test "x$FOUND_FREETYPE" != "xyes"); then |
186 |
| - FREETYPE_BASE_DIR="$SYSROOT/usr" |
187 |
| - if (test "x$OPENJDK_TARGET_CPU_BITS" = "x64"); then |
188 |
| - LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/$OPENJDK_TARGET_CPU-linux-gnu], [well-known location]) |
189 | 184 | if (test "x$FOUND_FREETYPE" != "xyes"); then
|
190 |
| - LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib64], [well-known location]) |
| 185 | + FREETYPE_BASE_DIR="$SYSROOT/usr/X11" |
| 186 | + LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location]) |
191 | 187 | fi
|
192 |
| - else |
193 |
| - LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/i386-linux-gnu], [well-known location]) |
194 | 188 | if (test "x$FOUND_FREETYPE" != "xyes"); then
|
195 |
| - LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib32], [well-known location]) |
| 189 | + FREETYPE_BASE_DIR="$SYSROOT/usr/local" |
| 190 | + LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location]) |
| 191 | + fi |
| 192 | +
|
| 193 | + if (test "x$FOUND_FREETYPE" != "xyes"); then |
| 194 | + FREETYPE_BASE_DIR="$SYSROOT/usr" |
| 195 | + if (test "x$OPENJDK_TARGET_CPU_BITS" = "x64"); then |
| 196 | + LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/$OPENJDK_TARGET_CPU-linux-gnu], [well-known location]) |
| 197 | + if (test "x$FOUND_FREETYPE" != "xyes"); then |
| 198 | + LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib64], [well-known location]) |
| 199 | + fi |
| 200 | + else |
| 201 | + LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/i386-linux-gnu], [well-known location]) |
| 202 | + if (test "x$FOUND_FREETYPE" != "xyes"); then |
| 203 | + LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib32], [well-known location]) |
| 204 | + fi |
| 205 | + fi |
196 | 206 | fi
|
| 207 | + fi # end check in well-known locations |
| 208 | +
|
| 209 | + if (test "x$FOUND_FREETYPE" != "xyes"); then |
| 210 | + HELP_MSG_MISSING_DEPENDENCY([freetype]) |
| 211 | + AC_MSG_ERROR([Could not find freetype! $HELP_MSG ]) |
| 212 | + fi |
| 213 | + fi # end user specified settings |
| 214 | +
|
| 215 | + # Set FREETYPE_CFLAGS, _LIBS and _LIB_PATH from include and lib dir. |
| 216 | + if (test "x$FREETYPE_CFLAGS" = "x"); then |
| 217 | + if (test -d $FREETYPE_INCLUDE_PATH/freetype2/freetype); then |
| 218 | + FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH/freetype2 -I$FREETYPE_INCLUDE_PATH" |
| 219 | + else |
| 220 | + FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH" |
197 | 221 | fi
|
198 | 222 | fi
|
199 |
| - fi # end check in well-known locations |
200 | 223 |
|
201 |
| - if (test "x$FOUND_FREETYPE" != "xyes"); then |
202 |
| - HELP_MSG_MISSING_DEPENDENCY([freetype]) |
203 |
| - AC_MSG_ERROR([Could not find freetype! $HELP_MSG ]) |
204 |
| - fi |
205 |
| - fi # end user specified settings |
206 |
| -
|
207 |
| - # Set FREETYPE_CFLAGS, _LIBS and _LIB_PATH from include and lib dir. |
208 |
| - if (test "x$FREETYPE_CFLAGS" = "x"); then |
209 |
| - if (test -d $FREETYPE_INCLUDE_PATH/freetype2/freetype); then |
210 |
| - FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH/freetype2 -I$FREETYPE_INCLUDE_PATH" |
211 |
| - else |
212 |
| - FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH" |
| 224 | + if (test "x$FREETYPE_LIBS" = "x"); then |
| 225 | + FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -l$FREETYPE_BASE_NAME" |
| 226 | + fi |
213 | 227 | fi
|
214 |
| - fi |
215 | 228 |
|
216 |
| - if (test "x$FREETYPE_LIBS" = "x"); then |
217 |
| - FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -l$FREETYPE_BASE_NAME" |
218 |
| - fi |
| 229 | + AC_MSG_RESULT([Using freetype: $FREETYPE_TO_USE]) |
| 230 | + AC_SUBST(FREETYPE_TO_USE) |
| 231 | + AC_SUBST(FREETYPE_CFLAGS) |
| 232 | + AC_SUBST(FREETYPE_LIBS) |
219 | 233 | fi
|
220 |
| -
|
221 |
| -
|
222 |
| - AC_MSG_RESULT([Using freetype: $FREETYPE_TO_USE]) |
223 |
| -
|
224 |
| -
|
225 |
| - AC_SUBST(FREETYPE_TO_USE) |
226 |
| - AC_SUBST(FREETYPE_CFLAGS) |
227 |
| - AC_SUBST(FREETYPE_LIBS) |
228 | 234 | ])
|
0 commit comments