11#
2- # Copyright (c) 2011, 2018 , Oracle and/or its affiliates. All rights reserved.
2+ # Copyright (c) 2011, 2020 , Oracle and/or its affiliates. All rights reserved.
33# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44#
55# This code is free software; you can redistribute it and/or modify it
@@ -79,7 +79,7 @@ AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE],
7979AC_DEFUN_ONCE ( [ LIB_SETUP_FREETYPE] ,
8080[
8181 AC_ARG_WITH ( freetype , [ AS_HELP_STRING ( [ --with-freetype] ,
82- [ specify whether to use 'system' or 'bundled' freetype. Other values are errors.
82+ [ specify whether to use 'system' or 'bundled' freetype.
8383 The selected option applies to both build time and run time.
8484 The default behaviour can be platform dependent.
8585 If using 'system' and either the include files or libraries cannot be
@@ -90,76 +90,90 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
9090 AC_ARG_WITH ( freetype-lib , [ AS_HELP_STRING ( [ --with-freetype-lib] ,
9191 [ specify directory for the freetype library] ) ] )
9292
93- # This setup is to verify access to system installed freetype header and libraries.
94- # On Windows and MacOS this does not apply and using these options will report an error.
95- # On other platforms (Linux, Solaris), they will default to using
96- # the system libraries. If they are found automatically, nothing need be done.
97- # If they are not found, the configure "--with-freetype-*" options may be used to fix that.
98- # If the preference is to bundle on these platforms then use --with-freetype=bundled
93+ # This setup is to verify access to system installed freetype header and
94+ # libraries. On Windows and MacOS this does not apply and using these options
95+ # will report an error. On other platforms (Linux, Solaris), they will
96+ # default to using the system libraries. If they are found automatically,
97+ # nothing need be done. If they are not found, the configure
98+ # "--with-freetype-*" options may be used to fix that. If the preference is
99+ # to bundle on these platforms then use --with-freetype=bundled.
100+
99101 FREETYPE_BASE_NAME=freetype
100102 FREETYPE_CFLAGS=
101103 FREETYPE_LIBS=
102104
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] )
105+ if (test "x$with_freetype_include" = "x" && test "x$with_freetype_lib" != "x") || \
106+ (test "x$with_freetype_include" != "x" && test "x$with_freetype_lib" = "x"); then
107+ AC_MSG_ERROR ( [ Must specify both or neither of --with-freetype-include and --with-freetype-lib] )
106108 fi
107109
108110 FREETYPE_TO_USE=bundled
109- if (test "x$OPENJDK_TARGET_OS" != "xwindows" && test "x$OPENJDK_TARGET_OS" != "xmacosx" \
110- && test "x$OPENJDK_TARGET_OS" != "xaix"); then
111+ if test "x$OPENJDK_TARGET_OS" != "xwindows" && \
112+ test "x$OPENJDK_TARGET_OS" != "xmacosx" && \
113+ test "x$OPENJDK_TARGET_OS" != "xaix"; then
111114 FREETYPE_TO_USE=system
112115 fi
113- if ( test "x$with_freetype" != "x") ; then
114- if ( test "x$with_freetype" = "xsystem") ; then
116+ if test "x$with_freetype" != "x" ; then
117+ if test "x$with_freetype" = "xsystem" ; then
115118 FREETYPE_TO_USE=system
116- elif ( test "x$with_freetype" = "xbundled") ; then
119+ elif test "x$with_freetype" = "xbundled" ; then
117120 FREETYPE_TO_USE=bundled
118- if (test "x$with_freetype_include" != "x" || test "x$with_freetype_lib" != "x"); then
121+ if test "x$with_freetype_include" != "x" || \
122+ test "x$with_freetype_lib" != "x" ; then
119123 AC_MSG_ERROR ( [ 'bundled' cannot be specified with --with-freetype-include and --with-freetype-lib] )
120124 fi
121125 else
122- AC_MSG_ERROR ( [ 'valid values for --with-freetype are 'system' and 'bundled'] )
126+ AC_MSG_ERROR ( [ Valid values for --with-freetype are 'system' and 'bundled'] )
123127 fi
124128 fi
125129
126- if (test "x$with_freetype_include" != "x" && test "x$with_freetype_lib" != "x"); then
127- FREETYPE_TO_USE=system
130+ if test "x$with_freetype_include" != "x" && \
131+ test "x$with_freetype_lib" != "x" ; then
132+ FREETYPE_TO_USE=system
128133 fi
129134
130- if (test "x$FREETYPE_TO_USE" = "xsystem") && \
131- (test "x$OPENJDK_TARGET_OS" = "xwindows" || test "x$OPENJDK_TARGET_OS" = "xmacosx"); then
132- AC_MSG_ERROR ( [ Only bundled freetype can be specified on Mac and Windows] )
135+ if test "x$FREETYPE_TO_USE" = "xsystem" && \
136+ (test "x$OPENJDK_TARGET_OS" = "xwindows" || \
137+ test "x$OPENJDK_TARGET_OS" = "xmacosx"); then
138+ AC_MSG_ERROR ( [ Only bundled freetype can be specified on Mac and Windows] )
133139 fi
134140
135- if ( test "x$with_freetype_include" != "x") ; then
141+ if test "x$with_freetype_include" != "x" ; then
136142 POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype_include"
137143 fi
138- if ( test "x$with_freetype_lib" != "x") ; then
144+ if test "x$with_freetype_lib" != "x" ; then
139145 POTENTIAL_FREETYPE_LIB_PATH="$with_freetype_lib"
140146 fi
141147
142- if (test "x$FREETYPE_TO_USE" = "xsystem"); then
143- if (test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != "x" && test "x$POTENTIAL_FREETYPE_LIB_PATH" != "x"); then
148+ if test "x$FREETYPE_TO_USE" = "xsystem" ; then
149+ if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != "x" && \
150+ test "x$POTENTIAL_FREETYPE_LIB_PATH" != "x" ; then
144151 # Okay, we got it. Check that it works.
145- LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH, $POTENTIAL_FREETYPE_LIB_PATH, [ --with-freetype] )
146- if (test "x$FOUND_FREETYPE" != "xyes"); then
152+ LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH,
153+ $POTENTIAL_FREETYPE_LIB_PATH, [ --with-freetype] )
154+ if test "x$FOUND_FREETYPE" != "xyes" ; then
147155 AC_MSG_ERROR ( [ Can not find or use freetype at location given by --with-freetype-lib|include] )
148156 fi
149157 else
150- # User did not specify a location, but asked for system freetype. Try to locate it.
151-
152- # If we have a sysroot, assume that's where we are supposed to look and skip pkg-config.
153- if (test "x$SYSROOT" = "x"); then
154- if (test "x$FOUND_FREETYPE" != "xyes"); then
155- # Check modules using pkg-config, but only if we have it (ugly output results otherwise)
156- if (test "x$PKG_CONFIG" != "x"); then
158+ # User did not specify a location, but asked for system freetype.
159+ # Try to locate it.
160+
161+ # If we have a sysroot, assume that's where we are supposed to look and
162+ # skip pkg-config.
163+ if test "x$SYSROOT" = "x" ; then
164+ if test "x$FOUND_FREETYPE" != "xyes" ; then
165+ # Check modules using pkg-config, but only if we have it (ugly output
166+ # results otherwise)
167+ if test "x$PKG_CONFIG" != "x" ; then
157168 PKG_CHECK_MODULES(FREETYPE, freetype2, [ FOUND_FREETYPE=yes] , [ FOUND_FREETYPE=no] )
158- if (test "x$FOUND_FREETYPE" = "xyes"); then
159- # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
169+ if test "x$FOUND_FREETYPE" = "xyes" ; then
170+ # On solaris, pkg_check adds -lz to freetype libs, which isn't
171+ # necessary for us.
160172 FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'`
161- # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
162- if (test "x$OPENJDK_TARGET_OS" = "xsolaris" && test "x$OPENJDK_TARGET_CPU" = "xx86_64"); then
173+ # 64-bit libs for Solaris x86 are installed in the amd64
174+ # subdirectory, change lib to lib/amd64
175+ if test "x$OPENJDK_TARGET_OS" = "xsolaris" && \
176+ test "x$OPENJDK_TARGET_CPU" = "xx86_64" ; then
163177 FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'`
164178 fi
165179 AC_MSG_CHECKING ( [ for freetype] )
@@ -169,59 +183,65 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
169183 fi
170184 fi
171185
172- if ( test "x$FOUND_FREETYPE" != "xyes") ; then
186+ if test "x$FOUND_FREETYPE" != "xyes" ; then
173187 # Check in well-known locations
174188 FREETYPE_BASE_DIR="$SYSROOT/usr"
175- LIB_CHECK_POTENTIAL_FREETYPE([ $FREETYPE_BASE_DIR/include] , [ $FREETYPE_BASE_DIR/lib] , [ well-known location] )
176189
177- if (test "x$FOUND_FREETYPE" != "xyes"); then
178- FREETYPE_BASE_DIR="$SYSROOT/usr/X11"
179- LIB_CHECK_POTENTIAL_FREETYPE([ $FREETYPE_BASE_DIR/include] , [ $FREETYPE_BASE_DIR/lib] , [ well-known location] )
190+ if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" ; then
191+ LIB_CHECK_POTENTIAL_FREETYPE([ $FREETYPE_BASE_DIR/include] ,
192+ [ $FREETYPE_BASE_DIR/lib/$OPENJDK_TARGET_CPU-linux-gnu] , [ well-known location] )
193+ if test "x$FOUND_FREETYPE" != "xyes" ; then
194+ LIB_CHECK_POTENTIAL_FREETYPE([ $FREETYPE_BASE_DIR/include] ,
195+ [ $FREETYPE_BASE_DIR/lib64] , [ well-known location] )
196+ fi
197+ else
198+ LIB_CHECK_POTENTIAL_FREETYPE([ $FREETYPE_BASE_DIR/include] ,
199+ [ $FREETYPE_BASE_DIR/lib/i386-linux-gnu] , [ well-known location] )
200+ if test "x$FOUND_FREETYPE" != "xyes" ; then
201+ LIB_CHECK_POTENTIAL_FREETYPE([ $FREETYPE_BASE_DIR/include] ,
202+ [ $FREETYPE_BASE_DIR/lib32] , [ well-known location] )
203+ fi
180204 fi
181- if (test "x$FOUND_FREETYPE" != "xyes"); then
182- FREETYPE_BASE_DIR="$SYSROOT/usr/local"
183- LIB_CHECK_POTENTIAL_FREETYPE([ $FREETYPE_BASE_DIR/include] , [ $FREETYPE_BASE_DIR/lib] , [ well-known location] )
205+
206+ if test "x$FOUND_FREETYPE" != "xyes" ; then
207+ LIB_CHECK_POTENTIAL_FREETYPE([ $FREETYPE_BASE_DIR/include] ,
208+ [ $FREETYPE_BASE_DIR/lib] , [ well-known location] )
184209 fi
185210
186- if (test "x$FOUND_FREETYPE" != "xyes"); then
187- FREETYPE_BASE_DIR="$SYSROOT/usr"
188- if (test "x$OPENJDK_TARGET_CPU_BITS" = "x64"); then
189- LIB_CHECK_POTENTIAL_FREETYPE([ $FREETYPE_BASE_DIR/include] , [ $FREETYPE_BASE_DIR/lib/$OPENJDK_TARGET_CPU-linux-gnu] , [ well-known location] )
190- if (test "x$FOUND_FREETYPE" != "xyes"); then
191- LIB_CHECK_POTENTIAL_FREETYPE([ $FREETYPE_BASE_DIR/include] , [ $FREETYPE_BASE_DIR/lib64] , [ well-known location] )
192- fi
193- else
194- LIB_CHECK_POTENTIAL_FREETYPE([ $FREETYPE_BASE_DIR/include] , [ $FREETYPE_BASE_DIR/lib/i386-linux-gnu] , [ well-known location] )
195- if (test "x$FOUND_FREETYPE" != "xyes"); then
196- LIB_CHECK_POTENTIAL_FREETYPE([ $FREETYPE_BASE_DIR/include] , [ $FREETYPE_BASE_DIR/lib32] , [ well-known location] )
197- fi
198- fi
211+ if test "x$FOUND_FREETYPE" != "xyes" ; then
212+ FREETYPE_BASE_DIR="$SYSROOT/usr/X11"
213+ LIB_CHECK_POTENTIAL_FREETYPE([ $FREETYPE_BASE_DIR/include] ,
214+ [ $FREETYPE_BASE_DIR/lib] , [ well-known location] )
215+ fi
216+
217+ if test "x$FOUND_FREETYPE" != "xyes" ; then
218+ FREETYPE_BASE_DIR="$SYSROOT/usr/local"
219+ LIB_CHECK_POTENTIAL_FREETYPE([ $FREETYPE_BASE_DIR/include] ,
220+ [ $FREETYPE_BASE_DIR/lib] , [ well-known location] )
199221 fi
200222 fi # end check in well-known locations
201223
202- if ( test "x$FOUND_FREETYPE" != "xyes") ; then
224+ if test "x$FOUND_FREETYPE" != "xyes" ; then
203225 HELP_MSG_MISSING_DEPENDENCY([ freetype] )
204226 AC_MSG_ERROR ( [ Could not find freetype! $HELP_MSG ] )
205227 fi
206228 fi # end user specified settings
207229
208230 # Set FREETYPE_CFLAGS, _LIBS and _LIB_PATH from include and lib dir.
209- if ( test "x$FREETYPE_CFLAGS" = "x") ; then
210- if ( test -d $FREETYPE_INCLUDE_PATH/freetype2/freetype) ; then
231+ if test "x$FREETYPE_CFLAGS" = "x" ; then
232+ if test -d $FREETYPE_INCLUDE_PATH/freetype2/freetype ; then
211233 FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH/freetype2 -I$FREETYPE_INCLUDE_PATH"
212234 else
213235 FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH"
214236 fi
215237 fi
216238
217- if ( test "x$FREETYPE_LIBS" = "x") ; then
239+ if test "x$FREETYPE_LIBS" = "x" ; then
218240 FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -l$FREETYPE_BASE_NAME"
219241 fi
220242 fi
221243
222-
223- AC_MSG_RESULT ( [ Using freetype: $FREETYPE_TO_USE] )
224-
244+ AC_MSG_RESULT ( [ Using freetype: $FREETYPE_TO_USE] )
225245
226246 AC_SUBST ( FREETYPE_TO_USE )
227247 AC_SUBST ( FREETYPE_CFLAGS )
0 commit comments