jdk

Форк
0
/
flags.m4 
498 строк · 17.9 Кб
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([flags-cflags.m4])
27
m4_include([flags-ldflags.m4])
28
m4_include([flags-other.m4])
29

30
################################################################################
31
#
32
# Setup ABI profile (for arm)
33
#
34
AC_DEFUN([FLAGS_SETUP_ABI_PROFILE],
35
[
36
  AC_ARG_WITH(abi-profile, [AS_HELP_STRING([--with-abi-profile],
37
      [specify ABI profile for ARM builds (arm-vfp-sflt,arm-vfp-hflt,arm-sflt, armv5-vfp-sflt,armv6-vfp-hflt,aarch64) @<:@toolchain dependent@:>@ ])])
38

39
  if test "x$with_abi_profile" != x; then
40
    if test "x$OPENJDK_TARGET_CPU" != xarm && \
41
        test "x$OPENJDK_TARGET_CPU" != xaarch64; then
42
      AC_MSG_ERROR([--with-abi-profile only available on arm/aarch64])
43
    fi
44

45
    OPENJDK_TARGET_ABI_PROFILE=$with_abi_profile
46
    AC_MSG_CHECKING([for ABI profle])
47
    AC_MSG_RESULT([$OPENJDK_TARGET_ABI_PROFILE])
48

49
    # --- Arm-sflt CFLAGS and ASFLAGS ---
50
    # Armv5te is required for assembler, because pld insn used in arm32 hotspot is only in v5E and above.
51
    # However, there is also a GCC bug which generates unaligned strd/ldrd instructions on armv5te:
52
    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82445, and it was fixed in gcc 7.1.
53
    # The resulting compromise is to enable v5TE for assembler and let GCC generate code for v5T.
54
    if test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-sflt; then
55
      ARM_FLOAT_TYPE=vfp-sflt
56
      ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
57
      ARM_ARCH_TYPE_ASFLAGS='-march=armv7-a -mthumb'
58
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-hflt; then
59
      ARM_FLOAT_TYPE=vfp-hflt
60
      ARM_ARCH_TYPE_FLAGS='-march=armv7-a -mthumb'
61
      ARM_ARCH_TYPE_ASFLAGS='-march=armv7-a -mthumb'
62
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-sflt; then
63
      ARM_FLOAT_TYPE=sflt
64
      ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
65
      ARM_ARCH_TYPE_ASFLAGS='-march=armv5te'
66
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv5-vfp-sflt; then
67
      ARM_FLOAT_TYPE=vfp-sflt
68
      ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
69
      ARM_ARCH_TYPE_ASFLAGS='-march=armv5te'
70
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv6-vfp-hflt; then
71
      ARM_FLOAT_TYPE=vfp-hflt
72
      ARM_ARCH_TYPE_FLAGS='-march=armv6 -marm'
73
      ARM_ARCH_TYPE_ASFLAGS='-march=armv6'
74
    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xaarch64; then
75
      # No special flags, just need to trigger setting JDK_ARCH_ABI_PROP_NAME
76
      ARM_FLOAT_TYPE=
77
      ARM_ARCH_TYPE_FLAGS=
78
      ARM_ARCH_TYPE_ASFLAGS=
79
    else
80
      AC_MSG_ERROR([Invalid ABI profile: "$OPENJDK_TARGET_ABI_PROFILE"])
81
    fi
82

83
    if test "x$ARM_FLOAT_TYPE" = xvfp-sflt; then
84
      ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=softfp -mfpu=vfp -DFLOAT_ARCH=-vfp-sflt'
85
      ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=softfp -mfpu=vfp"
86
    elif test "x$ARM_FLOAT_TYPE" = xvfp-hflt; then
87
      ARM_FLOAT_TYPE_FLAGS='-mfloat-abi=hard -mfpu=vfp -DFLOAT_ARCH=-vfp-hflt'
88
      ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=hard -mfpu=vfp"
89
    elif test "x$ARM_FLOAT_TYPE" = xsflt; then
90
      ARM_FLOAT_TYPE_FLAGS='-msoft-float -mfpu=vfp'
91
      ARM_FLOAT_TYPE_ASFLAGS="-mfloat-abi=soft -mfpu=vfp"
92
    fi
93
    AC_MSG_CHECKING([for $ARM_FLOAT_TYPE floating point flags])
94
    AC_MSG_RESULT([$ARM_FLOAT_TYPE_FLAGS])
95
    AC_MSG_CHECKING([for $ARM_FLOAT_TYPE floating point flags for assembler])
96
    AC_MSG_RESULT([$ARM_FLOAT_TYPE_ASFLAGS])
97

98
    AC_MSG_CHECKING([for arch type flags])
99
    AC_MSG_RESULT([$ARM_ARCH_TYPE_FLAGS])
100
    AC_MSG_CHECKING([for arch type flags for assembler])
101
    AC_MSG_RESULT([$ARM_ARCH_TYPE_ASFLAGS])
102

103
    # Now set JDK_ARCH_ABI_PROP_NAME. This is equivalent to the last part of the
104
    # autoconf target triplet.
105
    [ JDK_ARCH_ABI_PROP_NAME=`$ECHO $OPENJDK_TARGET_AUTOCONF_NAME | $SED -e 's/.*-\([^-]*\)$/\1/'` ]
106
    # Sanity check that it is a known ABI.
107
    if test "x$JDK_ARCH_ABI_PROP_NAME" != xgnu && \
108
        test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabi  && \
109
        test "x$JDK_ARCH_ABI_PROP_NAME" != xgnueabihf; then
110
          AC_MSG_WARN([Unknown autoconf target triplet ABI: "$JDK_ARCH_ABI_PROP_NAME"])
111
    fi
112
    AC_MSG_CHECKING([for ABI property name])
113
    AC_MSG_RESULT([$JDK_ARCH_ABI_PROP_NAME])
114
    AC_SUBST(JDK_ARCH_ABI_PROP_NAME)
115
  fi
116

117
  # When building with an abi profile, the name of that profile is appended on the
118
  # bundle platform, which is used in bundle names.
119
  if test "x$OPENJDK_TARGET_ABI_PROFILE" != x; then
120
    OPENJDK_TARGET_BUNDLE_PLATFORM="$OPENJDK_TARGET_OS_BUNDLE-$OPENJDK_TARGET_ABI_PROFILE"
121
  fi
122
])
123

124
AC_DEFUN([FLAGS_SETUP_MACOSX_VERSION],
125
[
126
  # Additional macosx handling
127
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
128
    # The expected format for <version> is either nn.n.n or nn.nn.nn. See
129
    # /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/AvailabilityVersions.h
130

131
    # MACOSX_VERSION_MIN specifies the lowest version of macOS that the built
132
    # binaries should be compatible with, even if compiled on a newer version
133
    # of the OS. It currently has a hard coded value. Setting this also limits
134
    # exposure to API changes in header files. Bumping this is likely to
135
    # require code changes to build.
136
    MACOSX_VERSION_MIN=11.00.00
137
    MACOSX_VERSION_MIN_NODOTS=${MACOSX_VERSION_MIN//\./}
138

139
    AC_SUBST(MACOSX_VERSION_MIN)
140

141
    # Setting --with-macosx-version-max=<version> makes it an error to build or
142
    # link to macosx APIs that are newer than the given OS version.
143
    AC_ARG_WITH([macosx-version-max], [AS_HELP_STRING([--with-macosx-version-max],
144
        [error on use of newer functionality. @<:@macosx@:>@])],
145
        [
146
          if echo "$with_macosx_version_max" | $GREP -q "^[[0-9]][[0-9]]\.[[0-9]]\.[[0-9]]\$"; then
147
              MACOSX_VERSION_MAX=$with_macosx_version_max
148
          elif echo "$with_macosx_version_max" | $GREP -q "^[[0-9]][[0-9]]\.[[0-9]][[0-9]]\.[[0-9]][[0-9]]\$"; then
149
              MACOSX_VERSION_MAX=$with_macosx_version_max
150
          elif test "x$with_macosx_version_max" = "xno"; then
151
              # Use build system default
152
              MACOSX_VERSION_MAX=
153
          else
154
              AC_MSG_ERROR([osx version format must be nn.n.n or nn.nn.nn])
155
          fi
156
        ],
157
        [MACOSX_VERSION_MAX=]
158
    )
159
    MACOSX_VERSION_MAX_NODOTS=${MACOSX_VERSION_MAX//\./}
160

161
    AC_SUBST(MACOSX_VERSION_MAX)
162
  fi
163
])
164

165
# Reset the global CFLAGS/LDFLAGS variables and initialize them with the
166
# corresponding configure arguments instead
167
AC_DEFUN_ONCE([FLAGS_SETUP_USER_SUPPLIED_FLAGS],
168
[
169
  if test "x$CFLAGS" != "x"; then
170
    AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags])
171
  fi
172

173
  if test "x$CXXFLAGS" != "x"; then
174
    AC_MSG_WARN([Ignoring CXXFLAGS($CXXFLAGS) found in environment. Use --with-extra-cxxflags])
175
  fi
176

177
  if test "x$LDFLAGS" != "x"; then
178
    AC_MSG_WARN([Ignoring LDFLAGS($LDFLAGS) found in environment. Use --with-extra-ldflags])
179
  fi
180

181
  if test "x$ASFLAGS" != "x"; then
182
    AC_MSG_WARN([Ignoring ASFLAGS($ASFLAGS) found in environment. Use --with-extra-asflags])
183
  fi
184

185
  AC_ARG_WITH(extra-cflags, [AS_HELP_STRING([--with-extra-cflags],
186
      [extra flags to be used when compiling jdk c-files])])
187

188
  AC_ARG_WITH(extra-cxxflags, [AS_HELP_STRING([--with-extra-cxxflags],
189
      [extra flags to be used when compiling jdk c++-files])])
190

191
  AC_ARG_WITH(extra-ldflags, [AS_HELP_STRING([--with-extra-ldflags],
192
      [extra flags to be used when linking jdk])])
193

194
  AC_ARG_WITH(extra-asflags, [AS_HELP_STRING([--with-extra-asflags],
195
      [extra flags to be passed to the assembler])])
196

197
  USER_CFLAGS="$with_extra_cflags"
198
  USER_CXXFLAGS="$with_extra_cxxflags"
199
  USER_LDFLAGS="$with_extra_ldflags"
200
  USER_ASFLAGS="$with_extra_asflags"
201
])
202

203
# Setup the sysroot flags and add them to global CFLAGS and LDFLAGS so
204
# that configure can use them while detecting compilers.
205
# TOOLCHAIN_TYPE is available here.
206
# Param 1 - Optional prefix to all variables. (e.g BUILD_)
207
AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS],
208
[
209
  if test "x[$]$1SYSROOT" != "x"; then
210
    if test "x$TOOLCHAIN_TYPE" = xgcc; then
211
      $1SYSROOT_CFLAGS="--sysroot=[$]$1SYSROOT"
212
      $1SYSROOT_LDFLAGS="--sysroot=[$]$1SYSROOT"
213
    elif test "x$TOOLCHAIN_TYPE" = xclang; then
214
      if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
215
        # -isysroot has no effect on linux
216
        # https://bugs.llvm.org/show_bug.cgi?id=11503
217
        $1SYSROOT_CFLAGS="--sysroot=[$]$1SYSROOT"
218
        $1SYSROOT_LDFLAGS="--sysroot=[$]$1SYSROOT"
219
        if test -d "$DEVKIT_TOOLCHAIN_PATH"; then
220
          # In devkits, gcc is not located in the sysroot.
221
          # use --gcc-toolchain to let clang find the gcc installation.
222
          $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS --gcc-toolchain=$DEVKIT_TOOLCHAIN_PATH/.."
223
          $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS --gcc-toolchain=$DEVKIT_TOOLCHAIN_PATH/.."
224
        fi
225
      else
226
        $1SYSROOT_CFLAGS="-isysroot [$]$1SYSROOT"
227
        $1SYSROOT_LDFLAGS="-isysroot [$]$1SYSROOT"
228
      fi
229
    fi
230
  fi
231

232
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
233
    # We also need -iframework<path>/System/Library/Frameworks
234
    $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
235
    $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
236
    if test -d "[$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks" ; then
237
      # These always need to be set on macOS 10.X, or we can't find the frameworks embedded in JavaVM.framework
238
      # set this here so it doesn't have to be peppered throughout the forest
239
      $1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
240
      $1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
241
    fi
242
  fi
243

244
  # For the microsoft toolchain, we need to get the SYSROOT flags from the
245
  # Visual Studio environment. Currently we cannot handle this as a separate
246
  # build toolchain.
247
  if test "x$1" = x && test "x$OPENJDK_BUILD_OS" = "xwindows" \
248
      && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
249
    TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
250
  fi
251

252
  AC_SUBST($1SYSROOT_CFLAGS)
253
  AC_SUBST($1SYSROOT_LDFLAGS)
254
])
255

256
AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN],
257
[
258
  # We should always include user supplied flags
259
  FLAGS_SETUP_USER_SUPPLIED_FLAGS
260

261
  # The sysroot flags are needed for configure to be able to run the compilers
262
  FLAGS_SETUP_SYSROOT_FLAGS
263

264
  # For clang/gcc, the flag is only strictly required for reduced builds, but
265
  # set it always where possible (x86 and ppc).
266
  if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
267
    if test "x$OPENJDK_TARGET_CPU_ARCH" = xx86 &&
268
        test "x$OPENJDK_TARGET_CPU" != xx32 ||
269
        test "x$OPENJDK_TARGET_CPU_ARCH" = xppc; then
270
      MACHINE_FLAG="-m${OPENJDK_TARGET_CPU_BITS}"
271
    fi
272
  fi
273

274
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
275
    if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
276
      MACHINE_FLAG="$MACHINE_FLAG -arch arm64"
277
    elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
278
      MACHINE_FLAG="$MACHINE_FLAG -arch x86_64"
279
    fi
280
  fi
281

282
  # FIXME: global flags are not used yet...
283
  # The "global" flags will *always* be set. Without them, it is not possible to
284
  # get a working compilation.
285
  GLOBAL_CFLAGS="$MACHINE_FLAG $SYSROOT_CFLAGS $USER_CFLAGS"
286
  GLOBAL_CXXFLAGS="$MACHINE_FLAG $SYSROOT_CFLAGS $USER_CXXFLAGS"
287
  GLOBAL_LDFLAGS="$MACHINE_FLAG $SYSROOT_LDFLAGS $USER_LDFLAGS"
288
  # FIXME: Don't really know how to do with this, but this was the old behavior
289
  GLOBAL_CPPFLAGS="$SYSROOT_CFLAGS"
290

291
  # FIXME: For compatibility, export this as EXTRA_CFLAGS for now.
292
  EXTRA_CFLAGS="$MACHINE_FLAG $USER_CFLAGS"
293
  EXTRA_CXXFLAGS="$MACHINE_FLAG $USER_CXXFLAGS"
294
  EXTRA_LDFLAGS="$MACHINE_FLAG $USER_LDFLAGS"
295
  EXTRA_ASFLAGS="$USER_ASFLAGS"
296

297
  AC_SUBST(MACHINE_FLAG)
298
  AC_SUBST(EXTRA_CFLAGS)
299
  AC_SUBST(EXTRA_CXXFLAGS)
300
  AC_SUBST(EXTRA_LDFLAGS)
301
  AC_SUBST(EXTRA_ASFLAGS)
302

303
  # For autoconf testing to work, the global flags must also be stored in the
304
  # "unnamed" CFLAGS etc.
305
  CFLAGS="$GLOBAL_CFLAGS"
306
  CXXFLAGS="$GLOBAL_CXXFLAGS"
307
  LDFLAGS="$GLOBAL_LDFLAGS"
308
  CPPFLAGS="$GLOBAL_CPPFLAGS"
309

310
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
311
    # When autoconf sends both compiler and linker flags to cl.exe at the same
312
    # time, linker flags must be last at the command line. Achieve this by
313
    # moving them to LIBS.
314
    LIBS="$LIBS -link $LDFLAGS"
315
    LDFLAGS=""
316
  fi
317
])
318

319
AC_DEFUN([FLAGS_SETUP_TOOLCHAIN_CONTROL],
320
[
321
  if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
322
    CC_OUT_OPTION=-Fo
323
  else
324
    # The option used to specify the target .o,.a or .so file.
325
    # When compiling, how to specify the to be created object file.
326
    CC_OUT_OPTION='-o$(SPACE)'
327
  fi
328
  AC_SUBST(CC_OUT_OPTION)
329

330
  # Generate make dependency files
331
  if test "x$TOOLCHAIN_TYPE" = xgcc; then
332
    GENDEPS_FLAGS="-MMD -MF"
333
  elif test "x$TOOLCHAIN_TYPE" = xclang; then
334
    GENDEPS_FLAGS="-MMD -MF"
335
  fi
336
  AC_SUBST(GENDEPS_FLAGS)
337
])
338

339
AC_DEFUN_ONCE([FLAGS_POST_TOOLCHAIN],
340
[
341
  FLAGS_SETUP_TOOLCHAIN_CONTROL
342

343
  if test "x$BUILD_SYSROOT" != x; then
344
    FLAGS_SETUP_SYSROOT_FLAGS([BUILD_])
345
  else
346
    if test "x$COMPILE_TYPE" != "xcross"; then
347
      BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
348
      BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
349
    fi
350
  fi
351
])
352

353
AC_DEFUN([FLAGS_SETUP_FLAGS],
354
[
355
  FLAGS_SETUP_MACOSX_VERSION
356
  FLAGS_SETUP_ABI_PROFILE
357

358
  FLAGS_SETUP_SHARED_LIBS
359
  FLAGS_SETUP_DEBUG_SYMBOLS
360
  FLAGS_SETUP_WARNINGS
361
  FLAGS_SETUP_QUALITY_CHECKS
362
  FLAGS_SETUP_OPTIMIZATION
363

364
  FLAGS_SETUP_CFLAGS
365
  FLAGS_SETUP_LDFLAGS
366

367
  FLAGS_SETUP_ARFLAGS
368
  FLAGS_SETUP_LIBFLAGS
369
  FLAGS_SETUP_STRIPFLAGS
370
  FLAGS_SETUP_RCFLAGS
371
  FLAGS_SETUP_NMFLAGS
372

373
  FLAGS_SETUP_ASFLAGS
374
  FLAGS_SETUP_ASFLAGS_CPU_DEP([TARGET])
375
  FLAGS_SETUP_ASFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
376
])
377

378
# FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
379
#                                  IF_FALSE: [RUN-IF-FALSE])
380
# ------------------------------------------------------------
381
# Check that the C compiler supports an argument
382
UTIL_DEFUN_NAMED([FLAGS_C_COMPILER_CHECK_ARGUMENTS],
383
    [*ARGUMENT IF_TRUE IF_FALSE PREFIX], [$@],
384
[
385
  AC_MSG_CHECKING([if ARG_PREFIX[CC] supports "ARG_ARGUMENT"])
386
  supports=yes
387

388
  saved_cflags="$CFLAGS"
389
  saved_cc="$CC"
390
  CFLAGS="$CFLAGS $CFLAGS_WARNINGS_ARE_ERRORS ARG_ARGUMENT"
391
  CC="$ARG_PREFIX[CC]"
392
  AC_LANG_PUSH([C])
393
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
394
      [supports=no])
395
  AC_LANG_POP([C])
396
  CC="$saved_cc"
397
  CFLAGS="$saved_cflags"
398

399
  AC_MSG_RESULT([$supports])
400
  if test "x$supports" = "xyes" ; then
401
    :
402
    ARG_IF_TRUE
403
  else
404
    :
405
    ARG_IF_FALSE
406
  fi
407
])
408

409
# FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
410
#                                    IF_FALSE: [RUN-IF-FALSE])
411
# ------------------------------------------------------------
412
# Check that the C++ compiler supports an argument
413
UTIL_DEFUN_NAMED([FLAGS_CXX_COMPILER_CHECK_ARGUMENTS],
414
    [*ARGUMENT IF_TRUE IF_FALSE PREFIX], [$@],
415
[
416
  AC_MSG_CHECKING([if ARG_PREFIX[CXX] supports "ARG_ARGUMENT"])
417
  supports=yes
418

419
  saved_cxxflags="$CXXFLAGS"
420
  saved_cxx="$CXX"
421
  CXXFLAGS="$CXXFLAG $CFLAGS_WARNINGS_ARE_ERRORS ARG_ARGUMENT"
422
  CXX="$ARG_PREFIX[CXX]"
423
  AC_LANG_PUSH([C++])
424
  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
425
      [supports=no])
426
  AC_LANG_POP([C++])
427
  CXX="$saved_cxx"
428
  CXXFLAGS="$saved_cxxflags"
429

430
  AC_MSG_RESULT([$supports])
431
  if test "x$supports" = "xyes" ; then
432
    :
433
    ARG_IF_TRUE
434
  else
435
    :
436
    ARG_IF_FALSE
437
  fi
438
])
439

440
# FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
441
#                                IF_FALSE: [RUN-IF-FALSE])
442
# ------------------------------------------------------------
443
# Check that the C and C++ compilers support an argument
444
UTIL_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
445
    [*ARGUMENT IF_TRUE IF_FALSE PREFIX], [$@],
446
[
447
  FLAGS_C_COMPILER_CHECK_ARGUMENTS(ARGUMENT: ARG_ARGUMENT,
448
      IF_TRUE: [C_COMP_SUPPORTS="yes"],
449
      IF_FALSE: [C_COMP_SUPPORTS="no"],
450
      PREFIX: ARG_PREFIX)
451
  FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: ARG_ARGUMENT,
452
      IF_TRUE: [CXX_COMP_SUPPORTS="yes"],
453
      IF_FALSE: [CXX_COMP_SUPPORTS="no"],
454
      PREFIX: ARG_PREFIX)
455

456
  AC_MSG_CHECKING([if both ARG_PREFIX[CC] and ARG_PREFIX[CXX] support "ARG_ARGUMENT"])
457
  supports=no
458
  if test "x$C_COMP_SUPPORTS" = "xyes" -a "x$CXX_COMP_SUPPORTS" = "xyes"; then
459
    supports=yes;
460
  fi
461

462
  AC_MSG_RESULT([$supports])
463
  if test "x$supports" = "xyes" ; then
464
    :
465
    ARG_IF_TRUE
466
  else
467
    :
468
    ARG_IF_FALSE
469
  fi
470
])
471

472
# FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
473
#                                   IF_FALSE: [RUN-IF-FALSE])
474
# ------------------------------------------------------------
475
# Check that the linker support an argument
476
UTIL_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
477
    [*ARGUMENT IF_TRUE IF_FALSE], [$@],
478
[
479
  AC_MSG_CHECKING([if linker supports "ARG_ARGUMENT"])
480
  supports=yes
481

482
  saved_ldflags="$LDFLAGS"
483
  LDFLAGS="$LDFLAGS ARG_ARGUMENT"
484
  AC_LANG_PUSH([C])
485
  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
486
      [], [supports=no])
487
  AC_LANG_POP([C])
488
  LDFLAGS="$saved_ldflags"
489

490
  AC_MSG_RESULT([$supports])
491
  if test "x$supports" = "xyes" ; then
492
    :
493
    ARG_IF_TRUE
494
  else
495
    :
496
    ARG_IF_FALSE
497
  fi
498
])
499

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

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

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

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