36 FOUND_FREETYPE=yes
37
38 # First look for the canonical freetype main include file ft2build.h.
39 if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
40 # Oh no! Let's try in the freetype2 directory.
41 POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
42 if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
43 # Fail.
44 FOUND_FREETYPE=no
45 fi
46 fi
47
48 if test "x$FOUND_FREETYPE" = "xyes"; then
49 # Include file found, let's continue the sanity check.
50 AC_MSG_NOTICE([Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD])
51
52 FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
53 if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
54 AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location.])
55 FOUND_FREETYPE=no
56 else
57 if test "x$OPENJDK_TARGET_OS" = "xsolaris" \
58 && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
59 # Found lib in isa dir, use that instead.
60 POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
61 AC_MSG_NOTICE([Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead])
62 fi
63 fi
64 fi
65
66 if test "x$FOUND_FREETYPE" = "xyes"; then
67 FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
68 AC_MSG_CHECKING([for freetype includes])
69 AC_MSG_RESULT([$FREETYPE_INCLUDE_PATH])
70 FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
71 AC_MSG_CHECKING([for freetype libraries])
72 AC_MSG_RESULT([$FREETYPE_LIB_PATH])
73 fi
74 ])
75
76 ################################################################################
77 # Setup freetype (The FreeType2 font rendering library)
78 ################################################################################
79 AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
80 [
81 AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype],
82 [specify whether to use 'system' or 'bundled' freetype.
83 The selected option applies to both build time and run time.
84 The default behaviour can be platform dependent.
85 If using 'system' and either the include files or libraries cannot be
86 located automatically, then additionally specify both using
87 --with-freetype-include and --with-freetype-lib.])])
88 AC_ARG_WITH(freetype-include, [AS_HELP_STRING([--with-freetype-include],
89 [specify directory for the freetype include files])])
90 AC_ARG_WITH(freetype-lib, [AS_HELP_STRING([--with-freetype-lib],
91 [specify directory for the freetype library])])
92
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
101 FREETYPE_BASE_NAME=freetype
102 FREETYPE_CFLAGS=
103 FREETYPE_LIBS=
104
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])
108 fi
109
110 FREETYPE_TO_USE=bundled
111 if test "x$OPENJDK_TARGET_OS" != "xwindows" && \
112 test "x$OPENJDK_TARGET_OS" != "xmacosx" && \
113 test "x$OPENJDK_TARGET_OS" != "xaix"; then
114 FREETYPE_TO_USE=system
115 fi
153 $POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype])
154 if test "x$FOUND_FREETYPE" != "xyes" ; then
155 AC_MSG_ERROR([Can not find or use freetype at location given by --with-freetype-lib|include])
156 fi
157 else
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
168 PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
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.
172 FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'`
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
177 FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'`
178 fi
179 AC_MSG_CHECKING([for freetype])
180 AC_MSG_RESULT([yes (using pkg-config)])
181 fi
182 fi
183 fi
184 fi
185
186 if test "x$FOUND_FREETYPE" != "xyes" ; then
187 # Check in well-known locations
188 FREETYPE_BASE_DIR="$SYSROOT/usr"
189
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],
|
36 FOUND_FREETYPE=yes
37
38 # First look for the canonical freetype main include file ft2build.h.
39 if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
40 # Oh no! Let's try in the freetype2 directory.
41 POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
42 if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
43 # Fail.
44 FOUND_FREETYPE=no
45 fi
46 fi
47
48 if test "x$FOUND_FREETYPE" = "xyes"; then
49 # Include file found, let's continue the sanity check.
50 AC_MSG_NOTICE([Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD])
51
52 FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
53 if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
54 AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location.])
55 FOUND_FREETYPE=no
56 fi
57 fi
58
59 if test "x$FOUND_FREETYPE" = "xyes"; then
60 FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
61 AC_MSG_CHECKING([for freetype includes])
62 AC_MSG_RESULT([$FREETYPE_INCLUDE_PATH])
63 FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
64 AC_MSG_CHECKING([for freetype libraries])
65 AC_MSG_RESULT([$FREETYPE_LIB_PATH])
66 fi
67 ])
68
69 ################################################################################
70 # Setup freetype (The FreeType2 font rendering library)
71 ################################################################################
72 AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
73 [
74 AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype],
75 [specify whether to use 'system' or 'bundled' freetype.
76 The selected option applies to both build time and run time.
77 The default behaviour can be platform dependent.
78 If using 'system' and either the include files or libraries cannot be
79 located automatically, then additionally specify both using
80 --with-freetype-include and --with-freetype-lib.])])
81 AC_ARG_WITH(freetype-include, [AS_HELP_STRING([--with-freetype-include],
82 [specify directory for the freetype include files])])
83 AC_ARG_WITH(freetype-lib, [AS_HELP_STRING([--with-freetype-lib],
84 [specify directory for the freetype library])])
85
86 # This setup is to verify access to system installed freetype header and
87 # libraries. On Windows and MacOS this does not apply and using these options
88 # will report an error. On other platforms (Linux), they will
89 # default to using the system libraries. If they are found automatically,
90 # nothing need be done. If they are not found, the configure
91 # "--with-freetype-*" options may be used to fix that. If the preference is
92 # to bundle on these platforms then use --with-freetype=bundled.
93
94 FREETYPE_BASE_NAME=freetype
95 FREETYPE_CFLAGS=
96 FREETYPE_LIBS=
97
98 if (test "x$with_freetype_include" = "x" && test "x$with_freetype_lib" != "x") || \
99 (test "x$with_freetype_include" != "x" && test "x$with_freetype_lib" = "x"); then
100 AC_MSG_ERROR([Must specify both or neither of --with-freetype-include and --with-freetype-lib])
101 fi
102
103 FREETYPE_TO_USE=bundled
104 if test "x$OPENJDK_TARGET_OS" != "xwindows" && \
105 test "x$OPENJDK_TARGET_OS" != "xmacosx" && \
106 test "x$OPENJDK_TARGET_OS" != "xaix"; then
107 FREETYPE_TO_USE=system
108 fi
146 $POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype])
147 if test "x$FOUND_FREETYPE" != "xyes" ; then
148 AC_MSG_ERROR([Can not find or use freetype at location given by --with-freetype-lib|include])
149 fi
150 else
151 # User did not specify a location, but asked for system freetype.
152 # Try to locate it.
153
154 # If we have a sysroot, assume that's where we are supposed to look and
155 # skip pkg-config.
156 if test "x$SYSROOT" = "x" ; then
157 if test "x$FOUND_FREETYPE" != "xyes" ; then
158 # Check modules using pkg-config, but only if we have it (ugly output
159 # results otherwise)
160 if test "x$PKG_CONFIG" != "x" ; then
161 PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
162 if test "x$FOUND_FREETYPE" = "xyes" ; then
163 # On solaris, pkg_check adds -lz to freetype libs, which isn't
164 # necessary for us.
165 FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'`
166 AC_MSG_CHECKING([for freetype])
167 AC_MSG_RESULT([yes (using pkg-config)])
168 fi
169 fi
170 fi
171 fi
172
173 if test "x$FOUND_FREETYPE" != "xyes" ; then
174 # Check in well-known locations
175 FREETYPE_BASE_DIR="$SYSROOT/usr"
176
177 if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" ; then
178 LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
179 [$FREETYPE_BASE_DIR/lib/$OPENJDK_TARGET_CPU-linux-gnu], [well-known location])
180 if test "x$FOUND_FREETYPE" != "xyes" ; then
181 LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
182 [$FREETYPE_BASE_DIR/lib64], [well-known location])
183 fi
184 else
185 LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include],
|