Skip to content

Commit 6d9c08e

Browse files
author
Cheng Jin
committed
Update configure scripts for RISC-V (make)
The changes are to modify the scripts in the make directory to enable RISC-V from the configuration perspective. Issue: ibmruntimes#218 Signed-off-by: Cheng Jin <[email protected]>
1 parent 642d340 commit 6d9c08e

7 files changed

+164
-108
lines changed

make/autoconf/build-aux/autoconf-config.guess

+7
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ timestamp='2012-02-10'
6161
# You can get the latest version of this script from:
6262
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
6363

64+
# ===========================================================================
65+
# (c) Copyright IBM Corp. 2019, 2019 All Rights Reserved
66+
# ===========================================================================
67+
6468
me=`echo "$0" | sed -e 's,.*/,,'`
6569

6670
usage="\
@@ -1000,6 +1004,9 @@ EOF
10001004
ppc:Linux:*:*)
10011005
echo powerpc-unknown-linux-gnu
10021006
exit ;;
1007+
riscv32:Linux:*:* | riscv64:Linux:*:*)
1008+
echo ${UNAME_MACHINE}-unknown-linux-gnu
1009+
exit ;;
10031010
s390:Linux:*:* | s390x:Linux:*:*)
10041011
echo ${UNAME_MACHINE}-ibm-linux
10051012
exit ;;

make/autoconf/build-aux/autoconf-config.sub

+6
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ timestamp='2008-01-16'
8080
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
8181
# It is wrong to echo any other type of specification.
8282

83+
# ===========================================================================
84+
# (c) Copyright IBM Corp. 2019, 2019 All Rights Reserved
85+
# ===========================================================================
86+
8387
me=`echo "$0" | sed -e 's,.*/,,'`
8488

8589
usage="\
@@ -302,6 +306,7 @@ case $basic_machine in
302306
| pdp10 | pdp11 | pj | pjl \
303307
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
304308
| pyramid \
309+
| riscv32 | riscv64 \
305310
| score \
306311
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
307312
| sh64 | sh64le \
@@ -383,6 +388,7 @@ case $basic_machine in
383388
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
384389
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
385390
| pyramid-* \
391+
| riscv32-* | riscv64-* \
386392
| romp-* | rs6000-* \
387393
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
388394
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \

make/autoconf/lib-freetype.m4

+110-104
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
# questions.
2424
#
2525

26+
# ===========================================================================
27+
# (c) Copyright IBM Corp. 2019, 2019 All Rights Reserved
28+
# ===========================================================================
29+
2630
################################################################################
2731
# Check if a potential freeype library match is correct and usable
2832
################################################################################
@@ -100,129 +104,131 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
100104
FREETYPE_CFLAGS=
101105
FREETYPE_LIBS=
102106
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
107117
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
116118
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
119133
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
128134
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
133138
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
140143
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"
147146
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
163176
fi
164-
AC_MSG_CHECKING([for freetype])
165-
AC_MSG_RESULT([yes (using pkg-config)])
166177
fi
167178
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])
184183
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])
189184
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])
191187
fi
192-
else
193-
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/i386-linux-gnu], [well-known location])
194188
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
196206
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"
197221
fi
198222
fi
199-
fi # end check in well-known locations
200223
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
213227
fi
214-
fi
215228
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)
219233
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)
228234
])

make/autoconf/libraries.m4

+20-3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
# questions.
2424
#
2525

26+
# ===========================================================================
27+
# (c) Copyright IBM Corp. 2019, 2019 All Rights Reserved
28+
# ===========================================================================
29+
2630
# Major library component reside in separate files.
2731
m4_include([lib-alsa.m4])
2832
m4_include([lib-bundled.m4])
@@ -40,7 +44,8 @@ m4_include([lib-tests.m4])
4044
AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES],
4145
[
4246
# Check if X11 is needed
43-
if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$OPENJDK_TARGET_OS" = xmacosx; then
47+
if test "x$OPENJDK_TARGET_OS" = xwindows \
48+
|| test "x$OPENJDK_TARGET_OS" = xmacosx; then
4449
# No X11 support on windows or macosx
4550
NEEDS_LIB_X11=false
4651
else
@@ -50,7 +55,8 @@ AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES],
5055
fi
5156
5257
# Check if fontconfig is needed
53-
if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$OPENJDK_TARGET_OS" = xmacosx; then
58+
if test "x$OPENJDK_TARGET_OS" = xwindows \
59+
|| test "x$OPENJDK_TARGET_OS" = xmacosx; then
5460
# No fontconfig support on windows or macosx
5561
NEEDS_LIB_FONTCONFIG=false
5662
else
@@ -60,7 +66,8 @@ AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES],
6066
fi
6167
6268
# Check if cups is needed
63-
if test "x$OPENJDK_TARGET_OS" = xwindows; then
69+
if test "x$OPENJDK_TARGET_OS" = xwindows \
70+
|| test "x$OPENJDK_TARGET_CPU" = xriscv64; then
6471
# Windows have a separate print system
6572
NEEDS_LIB_CUPS=false
6673
else
@@ -85,6 +92,16 @@ AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES],
8592
else
8693
NEEDS_LIB_FFI=false
8794
fi
95+
96+
# these libraries (not offered in the cross compilation toolchain)
97+
# might be installed on the RISC-V-based platform.
98+
if test "x$OPENJDK_TARGET_CPU" = xriscv64 && test "x$COMPILE_TYPE" = xcross; then
99+
NEEDS_LIB_X11=false
100+
NEEDS_LIB_CUPS=false
101+
NEEDS_LIB_FONTCONFIG=false
102+
NEEDS_LIB_FREETYPE=false
103+
NEEDS_LIB_ALSA=false
104+
fi
88105
])
89106

90107
################################################################################

make/autoconf/platform.m4

+10
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
# questions.
2424
#
2525

26+
# ===========================================================================
27+
# (c) Copyright IBM Corp. 2019, 2019 All Rights Reserved
28+
# ===========================================================================
29+
2630
# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
2731
# Converts autoconf style CPU name to OpenJDK style, into
2832
# VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN.
@@ -114,6 +118,12 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
114118
VAR_CPU_BITS=64
115119
VAR_CPU_ENDIAN=little
116120
;;
121+
riscv64)
122+
VAR_CPU=riscv64
123+
VAR_CPU_ARCH=riscv64
124+
VAR_CPU_BITS=64
125+
VAR_CPU_ENDIAN=little
126+
;;
117127
s390)
118128
VAR_CPU=s390
119129
VAR_CPU_ARCH=s390

0 commit comments

Comments
 (0)