jdk

Форк
0
/
basic.m4 
618 строк · 23.5 Кб
1
#
2
# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
#
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation.  Oracle designates this
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
10
#
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
16
#
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
#
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
23
# questions.
24
#
25

26
m4_include([basic_tools.m4])
27
m4_include([basic_windows.m4])
28

29
###############################################################################
30
AC_DEFUN_ONCE([BASIC_INIT],
31
[
32
  # Save the original command line. This is passed to us by the wrapper configure script.
33
  AC_SUBST(CONFIGURE_COMMAND_LINE)
34
  # We might have the original command line if the wrapper was called by some
35
  # other script.
36
  AC_SUBST(REAL_CONFIGURE_COMMAND_EXEC_SHORT)
37
  AC_SUBST(REAL_CONFIGURE_COMMAND_EXEC_FULL)
38
  AC_SUBST(REAL_CONFIGURE_COMMAND_LINE)
39
  # AUTOCONF might be set in the environment by the user. Preserve for "make reconfigure".
40
  AC_SUBST(AUTOCONF)
41
  # Save the path variable before it gets changed
42
  ORIGINAL_PATH="$PATH"
43
  AC_SUBST(ORIGINAL_PATH)
44
  DATE_WHEN_CONFIGURED=`date`
45
  AC_SUBST(DATE_WHEN_CONFIGURED)
46
  AC_MSG_NOTICE([Configuration created at $DATE_WHEN_CONFIGURED.])
47
])
48

49
###############################################################################
50
# Check that there are no unprocessed overridden variables left.
51
# If so, they are an incorrect argument and we will exit with an error.
52
AC_DEFUN([BASIC_CHECK_LEFTOVER_OVERRIDDEN],
53
[
54
  if test "x$CONFIGURE_OVERRIDDEN_VARIABLES" != x; then
55
    # Replace the separating ! with spaces before presenting for end user.
56
    unknown_variables=${CONFIGURE_OVERRIDDEN_VARIABLES//!/ }
57
    AC_MSG_WARN([The following variables might be unknown to configure: $unknown_variables])
58
  fi
59
])
60

61
###############################################################################
62
# Setup basic configuration paths, and platform-specific stuff related to PATHs.
63
# Make sure to only use tools set up in BASIC_SETUP_FUNDAMENTAL_TOOLS.
64
AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
65
[
66
  # Save the current directory this script was started from
67
  CONFIGURE_START_DIR="$PWD"
68

69
  # We might need to rewrite ORIGINAL_PATH, if it includes "#", to quote them
70
  # for make. We couldn't do this when we retrieved ORIGINAL_PATH, since SED
71
  # was not available at that time.
72
  REWRITTEN_PATH=`$ECHO "$ORIGINAL_PATH" | $SED -e 's/#/\\\\#/g'`
73
  if test "x$REWRITTEN_PATH" != "x$ORIGINAL_PATH"; then
74
    ORIGINAL_PATH="$REWRITTEN_PATH"
75
    AC_MSG_NOTICE([Rewriting ORIGINAL_PATH to $REWRITTEN_PATH])
76
  fi
77

78
  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
79
    BASIC_SETUP_PATHS_WINDOWS
80
  fi
81

82
  # We get the top-level directory from the supporting wrappers.
83
  BASIC_WINDOWS_VERIFY_DIR($TOPDIR, source)
84
  UTIL_FIXUP_PATH(TOPDIR)
85
  AC_MSG_CHECKING([for top-level directory])
86
  AC_MSG_RESULT([$TOPDIR])
87
  AC_SUBST(TOPDIR)
88

89
  if test "x$CUSTOM_ROOT" != x; then
90
    BASIC_WINDOWS_VERIFY_DIR($CUSTOM_ROOT, custom root)
91
    UTIL_FIXUP_PATH(CUSTOM_ROOT)
92
    WORKSPACE_ROOT="${CUSTOM_ROOT}"
93
  else
94
    WORKSPACE_ROOT="${TOPDIR}"
95
  fi
96
  AC_SUBST(WORKSPACE_ROOT)
97

98
  UTIL_FIXUP_PATH(CONFIGURE_START_DIR)
99
  AC_SUBST(CONFIGURE_START_DIR)
100

101
  # Locate the directory of this script.
102
  AUTOCONF_DIR=$TOPDIR/make/autoconf
103
])
104

105
###############################################################################
106
# Setup what kind of build environment type we have (CI or local developer)
107
AC_DEFUN_ONCE([BASIC_SETUP_BUILD_ENV],
108
[
109
  if test "x$CI" = "xtrue"; then
110
    DEFAULT_BUILD_ENV="ci"
111
    AC_MSG_NOTICE([CI environment variable set to $CI])
112
  else
113
    DEFAULT_BUILD_ENV="dev"
114
  fi
115

116
  UTIL_ARG_WITH(NAME: build-env, TYPE: literal,
117
      RESULT: BUILD_ENV,
118
      VALID_VALUES: [auto dev ci], DEFAULT: auto,
119
      CHECKING_MSG: [for build environment type],
120
      DESC: [select build environment type (affects certain default values)],
121
      IF_AUTO: [
122
        RESULT=$DEFAULT_BUILD_ENV
123
      ]
124
  )
125
  AC_SUBST(BUILD_ENV)
126

127
  if test "x$LOCALE" != x; then
128
    # Check if we actually have C.UTF-8; if so, use it
129
    if $LOCALE -a | $GREP -q -E "^C\.(utf8|UTF-8)$"; then
130
      LOCALE_USED=C.UTF-8
131
    else
132
      AC_MSG_WARN([C.UTF-8 locale not found, using C locale])
133
      LOCALE_USED=C
134
    fi
135
  else
136
    AC_MSG_WARN([locale command not not found, using C locale])
137
    LOCALE_USED=C
138
  fi
139

140
  export LC_ALL=$LOCALE_USED
141
  AC_SUBST(LOCALE_USED)
142
])
143

144
###############################################################################
145
# Evaluates platform specific overrides for devkit variables.
146
# $1: Name of variable
147
AC_DEFUN([BASIC_EVAL_DEVKIT_VARIABLE],
148
[
149
  if test "x[$]$1" = x; then
150
    eval $1="\${$1_${OPENJDK_TARGET_CPU}}"
151
  fi
152
])
153

154
###############################################################################
155
# Evaluates platform specific overrides for build devkit variables.
156
# $1: Name of variable
157
AC_DEFUN([BASIC_EVAL_BUILD_DEVKIT_VARIABLE],
158
[
159
  if test "x[$]$1" = x; then
160
    eval $1="\${$1_${OPENJDK_BUILD_CPU}}"
161
  fi
162
])
163

164
###############################################################################
165
AC_DEFUN([BASIC_SETUP_XCODE_SYSROOT],
166
[
167
  AC_MSG_CHECKING([for sdk name])
168
  AC_ARG_WITH([sdk-name], [AS_HELP_STRING([--with-sdk-name],
169
      [use the Xcode platform SDK of the given name. @<:@macosx@:>@])],
170
      [SDK_NAME=$with_sdk_name]
171
  )
172
  if test "x$SDK_NAME" = x; then
173
    SDK_NAME=macosx
174
  fi
175
  AC_MSG_RESULT([$SDK_NAME])
176

177
  if test "x$DEVKIT_ROOT" != x; then
178
    # We need to use xcodebuild from the devkit, if provided
179
    UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild, $DEVKIT_TOOLCHAIN_PATH)
180
    if test "x$XCODEBUILD" = x; then
181
      AC_MSG_ERROR([No xcodebuild tool found in the provided devkit])
182
    fi
183
    XCODEBUILD_OUTPUT=`"$XCODEBUILD" -version 2>&1`
184
    if test $? -ne 0; then
185
      AC_MSG_ERROR([The xcodebuild tool in the devkit reports an error: $XCODEBUILD_OUTPUT])
186
    fi
187
  elif test "x$TOOLCHAIN_PATH" != x; then
188
    UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild, $TOOLCHAIN_PATH)
189
    if test "x$XCODEBUILD" != x; then
190
      XCODEBUILD_OUTPUT=`"$XCODEBUILD" -version 2>&1`
191
      if test $? -ne 0; then
192
        AC_MSG_WARN([Ignoring the located xcodebuild tool $XCODEBUILD due to an error: $XCODEBUILD_OUTPUT])
193
        XCODEBUILD=
194
      fi
195
    fi
196
  else
197
    UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild)
198
    if test "x$XCODEBUILD" != x; then
199
      XCODEBUILD_OUTPUT=`"$XCODEBUILD" -version 2>&1`
200
      if test $? -ne 0; then
201
        AC_MSG_WARN([Ignoring the located xcodebuild tool $XCODEBUILD due to an error: $XCODEBUILD_OUTPUT])
202
        XCODEBUILD=
203
      fi
204
    fi
205
  fi
206

207
  if test "x$SYSROOT" != x; then
208
    if ! test -f "$SYSROOT/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
209
      AC_MSG_ERROR([Invalid sysroot, framework headers not found])
210
    fi
211
    if test "x$with_sdk_name" != x; then
212
      AC_MSG_WARN([--with-sdk-name will be ignored since a sysroot or devkit is provided])
213
    fi
214
    AC_MSG_NOTICE([Setting sysroot from devkit or --with-sysroot])
215
  else
216
    if test "x$XCODEBUILD" != x; then
217
      SYSROOT=`"$XCODEBUILD" -sdk "$SDK_NAME" -version | $GREP '^Path: ' | $SED 's/Path: //'`
218
      if test "x$SYSROOT" = x; then
219
        AC_MSG_ERROR([No sysroot found for SDK $SDK_NAME from xcodebuild. Check your Xcode installation.])
220
      fi
221
      if ! test -f "$SYSROOT/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
222
        AC_MSG_ERROR([Unable to find required framework headers, provide a path to an SDK via --with-sysroot or --with-sdk-name and be sure Xcode is installed properly])
223
      fi
224
      AC_MSG_NOTICE([Setting sysroot from xcodebuild with SDK $SDK_NAME])
225
    else
226
      UTIL_LOOKUP_PROGS(XCRUN, xcrun)
227
      if test "x$XCRUN" != x; then
228
        XCRUN_SDK_PATH=`"$XCRUN" --show-sdk-path -sdk "$SDK_NAME"`
229
      fi
230

231
      if test "x$XCRUN_SDK_PATH" != x && test -f "$XCRUN_SDK_PATH/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h"; then
232
        AC_MSG_NOTICE([Setting sysroot from xcrun with SDK $SDK_NAME])
233
        SYSROOT="$XCRUN_SDK_PATH"
234
      elif test -f /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h; then
235
        AC_MSG_WARN([No devkit provided and no xcodebuild found. Proceeding using system headers.])
236
        if test "x$with_sdk_name" != x; then
237
          AC_MSG_WARN([--with-sdk-name will be ignored since no xcodebuild could be found])
238
        fi
239
      else
240
        AC_MSG_NOTICE([No devkit provided, no xcodebuild tool and no system headers found in the system.])
241
        AC_MSG_NOTICE([Check that Xcode is properly installed, or set a devkit with --with-devkit,])
242
        AC_MSG_NOTICE([or override SDK selection using --with-sysroot or --with-sdk-name.])
243
        AC_MSG_ERROR([Cannot continue])
244
      fi
245
    fi
246
  fi
247
])
248

249
###############################################################################
250
AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
251
[
252
  AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
253
      [use this devkit for compilers, tools and resources])])
254

255
  if test "x$with_devkit" = xyes; then
256
    AC_MSG_ERROR([--with-devkit must have a value])
257
  elif test "x$with_devkit" != x && test "x$with_devkit" != xno; then
258
    UTIL_FIXUP_PATH([with_devkit])
259
    DEVKIT_ROOT="$with_devkit"
260
    # Check for a meta data info file in the root of the devkit
261
    if test -f "$DEVKIT_ROOT/devkit.info"; then
262
      . $DEVKIT_ROOT/devkit.info
263
      # This potentially sets the following:
264
      # A descriptive name of the devkit
265
      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_NAME])
266
      # Corresponds to --with-extra-path
267
      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_EXTRA_PATH])
268
      # Corresponds to --with-toolchain-path
269
      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_TOOLCHAIN_PATH])
270
      # Corresponds to --with-sysroot
271
      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_SYSROOT])
272

273
      # Identifies the Visual Studio version in the devkit
274
      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_VERSION])
275
      # The Visual Studio include environment variable
276
      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_INCLUDE])
277
      # The Visual Studio lib environment variable
278
      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_LIB])
279
      # Corresponds to --with-msvcr-dll
280
      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCR_DLL])
281
      # Corresponds to --with-vcruntime-1-dll
282
      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VCRUNTIME_1_DLL])
283
      # Corresponds to --with-msvcp-dll
284
      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCP_DLL])
285
      # Corresponds to --with-ucrt-dll-dir
286
      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_UCRT_DLL_DIR])
287
    fi
288

289
    AC_MSG_CHECKING([for devkit])
290
    if test "x$DEVKIT_NAME" != x; then
291
      AC_MSG_RESULT([$DEVKIT_NAME in $DEVKIT_ROOT])
292
    else
293
      AC_MSG_RESULT([$DEVKIT_ROOT])
294
    fi
295

296
    UTIL_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH)
297

298
    # Fallback default of just /bin if DEVKIT_PATH is not defined
299
    if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then
300
      DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin"
301
    fi
302
    UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],$DEVKIT_TOOLCHAIN_PATH)
303

304
    # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known
305
    # places for backwards compatibility.
306
    if test "x$DEVKIT_SYSROOT" != x; then
307
      SYSROOT="$DEVKIT_SYSROOT"
308
    elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then
309
      SYSROOT="$DEVKIT_ROOT/$host_alias/libc"
310
    elif test -d "$DEVKIT_ROOT/$host/sys-root"; then
311
      SYSROOT="$DEVKIT_ROOT/$host/sys-root"
312
    fi
313

314
    if test "x$DEVKIT_ROOT" != x; then
315
      DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib"
316
      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
317
        DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib64"
318
      fi
319
      AC_SUBST(DEVKIT_LIB_DIR)
320
    fi
321
  fi
322

323
  # You can force the sysroot if the sysroot encoded into the compiler tools
324
  # is not correct.
325
  AC_ARG_WITH(sys-root, [AS_HELP_STRING([--with-sys-root],
326
      [alias for --with-sysroot for backwards compatibility])],
327
      [SYSROOT=$with_sys_root]
328
  )
329

330
  AC_ARG_WITH(sysroot, [AS_HELP_STRING([--with-sysroot],
331
      [use this directory as sysroot])],
332
      [SYSROOT=$with_sysroot]
333
  )
334

335
  AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir],
336
      [alias for --with-toolchain-path for backwards compatibility])],
337
      [UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_tools_dir)]
338
  )
339

340
  AC_ARG_WITH([toolchain-path], [AS_HELP_STRING([--with-toolchain-path],
341
      [prepend these directories when searching for toolchain binaries (compilers etc)])],
342
      [UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_toolchain_path)]
343
  )
344

345
  AC_ARG_WITH([xcode-path], [AS_HELP_STRING([--with-xcode-path],
346
      [set up toolchain on Mac OS using a path to an Xcode installation])])
347

348
  if test "x$with_xcode_path" != x; then
349
    if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
350
      UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],
351
          $with_xcode_path/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$with_xcode_path/Contents/Developer/usr/bin)
352
    else
353
      AC_MSG_WARN([Option --with-xcode-path is only valid on Mac OS, ignoring.])
354
    fi
355
  fi
356

357
  AC_MSG_CHECKING([for toolchain path])
358
  AC_MSG_RESULT([$TOOLCHAIN_PATH])
359
  AC_SUBST(TOOLCHAIN_PATH)
360

361
  AC_ARG_WITH([extra-path], [AS_HELP_STRING([--with-extra-path],
362
      [prepend these directories to the default path])],
363
      [UTIL_PREPEND_TO_PATH([EXTRA_PATH],$with_extra_path)]
364
  )
365

366
  if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then
367
    BASIC_SETUP_XCODE_SYSROOT
368
  fi
369

370
  # Prepend the extra path to the global path
371
  UTIL_PREPEND_TO_PATH([PATH],$EXTRA_PATH)
372

373
  UTIL_FIXUP_PATH([SYSROOT])
374

375
  AC_MSG_CHECKING([for sysroot])
376
  AC_MSG_RESULT([$SYSROOT])
377
  AC_SUBST(SYSROOT)
378

379
  AC_MSG_CHECKING([for extra path])
380
  AC_MSG_RESULT([$EXTRA_PATH])
381
])
382

383
###############################################################################
384
AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
385
[
386

387
  AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name],
388
      [use this as the name of the configuration @<:@generated from important configuration options@:>@])],
389
      [ CONF_NAME=${with_conf_name} ])
390

391
  # Test from where we are running configure, in or outside of src root.
392
  AC_MSG_CHECKING([where to store configuration])
393
  if test "x$CONFIGURE_START_DIR" = "x$TOPDIR" \
394
      || test "x$CONFIGURE_START_DIR" = "x$CUSTOM_ROOT" \
395
      || test "x$CONFIGURE_START_DIR" = "x$TOPDIR/make/autoconf" \
396
      || test "x$CONFIGURE_START_DIR" = "x$TOPDIR/make" ; then
397
    # We are running configure from the src root.
398
    # Create a default ./build/target-variant-debuglevel output root.
399
    if test "x${CONF_NAME}" = x; then
400
      AC_MSG_RESULT([in default location])
401
      CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JVM_VARIANTS_WITH_AND}-${DEBUG_LEVEL}"
402
    else
403
      AC_MSG_RESULT([in build directory with custom name])
404
    fi
405

406
    OUTPUTDIR="${WORKSPACE_ROOT}/build/${CONF_NAME}"
407
    $MKDIR -p "$OUTPUTDIR"
408
    if test ! -d "$OUTPUTDIR"; then
409
      AC_MSG_ERROR([Could not create build directory $OUTPUTDIR])
410
    fi
411
  else
412
    # We are running configure from outside of the src dir.
413
    # Then use the current directory as output dir!
414
    # If configuration is situated in normal build directory, just use the build
415
    # directory name as configuration name, otherwise use the complete path.
416
    if test "x${CONF_NAME}" = x; then
417
      CONF_NAME=`$ECHO $CONFIGURE_START_DIR | $SED -e "s!^${TOPDIR}/build/!!"`
418
    fi
419
    OUTPUTDIR="$CONFIGURE_START_DIR"
420
    AC_MSG_RESULT([in current directory])
421

422
    # WARNING: This might be a bad thing to do. You need to be sure you want to
423
    # have a configuration in this directory. Do some sanity checks!
424

425
    if test ! -e "$OUTPUTDIR/spec.gmk" && test ! -e "$OUTPUTDIR/configure-support/generated-configure.sh"; then
426
      # If we have a spec.gmk or configure-support/generated-configure.sh,
427
      # we have run here before and we are OK. Otherwise, check for other files
428
      files_present=`$LS $OUTPUTDIR`
429
      # Configure has already touched config.log and confdefs.h in the current dir when this check
430
      # is performed.
431
      filtered_files=`$ECHO "$files_present" \
432
          | $SED -e 's/config.log//g' \
433
              -e 's/configure.log//g' \
434
              -e 's/confdefs.h//g' \
435
              -e 's/configure-support//g' \
436
              -e 's/ //g' \
437
          | $TR -d '\n'`
438
      if test "x$filtered_files" != x; then
439
        AC_MSG_NOTICE([Current directory is $CONFIGURE_START_DIR.])
440
        AC_MSG_NOTICE([Since this is not the source root, configure will output the configuration here])
441
        AC_MSG_NOTICE([(as opposed to creating a configuration in <src_root>/build/<conf-name>).])
442
        AC_MSG_NOTICE([However, this directory is not empty, additionally to some allowed files])
443
        AC_MSG_NOTICE([it contains $filtered_files.])
444
        AC_MSG_NOTICE([This is not allowed, since it could seriously mess up just about everything.])
445
        AC_MSG_NOTICE([Try 'cd $TOPDIR' and restart configure])
446
        AC_MSG_NOTICE([(or create a new empty directory and cd to it).])
447
        AC_MSG_ERROR([Will not continue creating configuration in $CONFIGURE_START_DIR])
448
      fi
449
    fi
450
  fi
451
  AC_MSG_CHECKING([what configuration name to use])
452
  AC_MSG_RESULT([$CONF_NAME])
453

454
  BASIC_WINDOWS_VERIFY_DIR($OUTPUTDIR, output)
455
  UTIL_FIXUP_PATH(OUTPUTDIR)
456

457
  CONFIGURESUPPORT_OUTPUTDIR="$OUTPUTDIR/configure-support"
458
  $MKDIR -p "$CONFIGURESUPPORT_OUTPUTDIR"
459

460
  SPEC="$OUTPUTDIR/spec.gmk"
461
  AC_SUBST(SPEC)
462
  AC_SUBST(CONF_NAME)
463
  AC_SUBST(OUTPUTDIR)
464
  AC_SUBST(CONFIGURESUPPORT_OUTPUTDIR)
465

466
  # The spec.gmk file contains all variables for the make system.
467
  AC_CONFIG_FILES([$OUTPUTDIR/spec.gmk:$AUTOCONF_DIR/spec.gmk.template])
468
  # The bootcycle-spec.gmk file contains support for boot cycle builds.
469
  AC_CONFIG_FILES([$OUTPUTDIR/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.template])
470
  # The buildjdk-spec.gmk file contains support for building a buildjdk when cross compiling.
471
  AC_CONFIG_FILES([$OUTPUTDIR/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.template])
472
  # The compare.sh is used to compare the build output to other builds.
473
  AC_CONFIG_FILES([$OUTPUTDIR/compare.sh:$AUTOCONF_DIR/compare.sh.template])
474
  # The generated Makefile knows where the spec.gmk is and where the source is.
475
  # You can run make from the OUTPUTDIR, or from the top-level Makefile
476
  # which will look for generated configurations
477
  AC_CONFIG_FILES([$OUTPUTDIR/Makefile:$AUTOCONF_DIR/Makefile.template])
478
])
479

480
###############################################################################
481
# Check if build directory is on local disk. If not possible to determine,
482
# we prefer to claim it's local.
483
# Argument 1: directory to test
484
# Argument 2: what to do if it is on local disk
485
# Argument 3: what to do otherwise (remote disk or failure)
486
AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK],
487
[
488
  # df -l lists only local disks; if the given directory is not found then
489
  # a non-zero exit code is given
490
  if test "x$DF" = x; then
491
    # No df here, say it's local
492
    $2
493
  else
494
    # JDK-8189619
495
    # df on AIX does not understand -l. On modern AIXes it understands "-T local" which
496
    # is the same. On older AIXes we just continue to live with a "not local build" warning.
497
    if test "x$OPENJDK_TARGET_OS" = xaix; then
498
      if $DF -T local > /dev/null 2>&1; then
499
        DF_LOCAL_ONLY_OPTION='-T local'
500
      else # AIX may use GNU-utils instead
501
        DF_LOCAL_ONLY_OPTION='-l'
502
      fi
503
    elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1"; then
504
      # In WSL1, we can only build on a drvfs file system (that is, a mounted real Windows drive)
505
      DF_LOCAL_ONLY_OPTION='-t drvfs'
506
    else
507
      DF_LOCAL_ONLY_OPTION='-l'
508
    fi
509
    if $DF $DF_LOCAL_ONLY_OPTION $1 > /dev/null 2>&1; then
510
      $2
511
    else
512
      $3
513
    fi
514
  fi
515
])
516

517
###############################################################################
518
# Check that source files have basic read permissions set. This might
519
# not be the case in cygwin in certain conditions.
520
AC_DEFUN_ONCE([BASIC_CHECK_SRC_PERMS],
521
[
522
  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
523
    # The choice of file here is somewhat arbitrary, it just needs to be there
524
    # in the source tree when configure runs
525
    file_to_test="$TOPDIR/Makefile"
526
    if test `$STAT -c '%a' "$file_to_test"` -lt 400; then
527
      AC_MSG_ERROR([Bad file permissions on src files. This is usually caused by cloning the repositories with non cygwin tools in a directory not created in cygwin.])
528
    fi
529
  fi
530
])
531

532
###############################################################################
533
AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES],
534
[
535
  AC_MSG_CHECKING([if build directory is on local disk])
536
  BASIC_CHECK_DIR_ON_LOCAL_DISK($OUTPUTDIR,
537
      [OUTPUT_DIR_IS_LOCAL="yes"],
538
      [OUTPUT_DIR_IS_LOCAL="no"])
539
  AC_MSG_RESULT($OUTPUT_DIR_IS_LOCAL)
540

541
  BASIC_CHECK_SRC_PERMS
542

543
  # Check if the user has any old-style ALT_ variables set.
544
  FOUND_ALT_VARIABLES=`env | grep ^ALT_`
545

546
  # Before generating output files, test if they exist. If they do, this is a reconfigure.
547
  # Since we can't properly handle the dependencies for this, warn the user about the situation
548
  if test -e $OUTPUTDIR/spec.gmk; then
549
    IS_RECONFIGURE=yes
550
  else
551
    IS_RECONFIGURE=no
552
  fi
553
])
554

555
################################################################################
556
#
557
# Default make target
558
#
559
AC_DEFUN_ONCE([BASIC_SETUP_DEFAULT_MAKE_TARGET],
560
[
561
  AC_ARG_WITH(default-make-target, [AS_HELP_STRING([--with-default-make-target],
562
      [set the default make target @<:@exploded-image@:>@])])
563
  if test "x$with_default_make_target" = "x" \
564
      || test "x$with_default_make_target" = "xyes"; then
565
    DEFAULT_MAKE_TARGET="exploded-image"
566
  elif test "x$with_default_make_target" = "xno"; then
567
    AC_MSG_ERROR([--without-default-make-target is not a valid option])
568
  else
569
    DEFAULT_MAKE_TARGET="$with_default_make_target"
570
  fi
571

572
  AC_SUBST(DEFAULT_MAKE_TARGET)
573
])
574

575
###############################################################################
576
# Setup the default value for LOG=
577
#
578
AC_DEFUN_ONCE([BASIC_SETUP_DEFAULT_LOG],
579
[
580
  AC_ARG_WITH(log, [AS_HELP_STRING([--with-log],
581
      [[default value for make LOG argument [warn]]])])
582
  AC_MSG_CHECKING([for default LOG value])
583
  if test "x$with_log" = x; then
584
    DEFAULT_LOG=""
585
  else
586
    # Syntax for valid LOG options is a bit too complex for it to be worth
587
    # implementing a test for correctness in configure. Just accept it.
588
    DEFAULT_LOG=$with_log
589
  fi
590
  AC_MSG_RESULT([$DEFAULT_LOG])
591
  AC_SUBST(DEFAULT_LOG)
592
])
593

594
###############################################################################
595
# Code to run after AC_OUTPUT
596
AC_DEFUN_ONCE([BASIC_POST_CONFIG_OUTPUT],
597
[
598
  # Try to move config.log (generated by autoconf) to the configure-support directory.
599
  if test -e ./config.log; then
600
    $MV -f ./config.log "$CONFIGURESUPPORT_OUTPUTDIR/config.log" 2> /dev/null
601
  fi
602

603
  # Rotate our log file (configure.log)
604
  if test -e "$OUTPUTDIR/configure.log.old"; then
605
    $RM -f "$OUTPUTDIR/configure.log.old"
606
  fi
607
  if test -e "$OUTPUTDIR/configure.log"; then
608
    $MV -f "$OUTPUTDIR/configure.log" "$OUTPUTDIR/configure.log.old" 2> /dev/null
609
  fi
610

611
  # Move configure.log from current directory to the build output root
612
  if test -e ./configure.log; then
613
    $MV -f ./configure.log "$OUTPUTDIR/configure.log" 2> /dev/null
614
  fi
615

616
  # Make the compare script executable
617
  $CHMOD +x $OUTPUTDIR/compare.sh
618
])
619

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.