1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
#
# Contains some unsorted druntime utility macros.
#
# DRUNTIME_WERROR
# ---------------
# Check to see if -Werror is enabled.
AC_DEFUN([DRUNTIME_WERROR],
[
AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror],
[turns on -Werror @<:@default=no@:>@])])
WERROR_FLAG=""
if test "x$enable_werror" = "xyes"; then
WERROR_FLAG="-Werror"
fi
])
# DRUNTIME_CONFIGURE
# ------------------
# Substitute absolute paths for srcdir and builddir.
AC_DEFUN([DRUNTIME_CONFIGURE],
[
# These need to be absolute paths, yet at the same time need to
# canonicalize only relative paths, because then amd will not unmount
# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
libphobos_builddir=`${PWDCMD-pwd}`
case $srcdir in
[\\/$]* | ?:[\\/]*) libphobos_srcdir=${srcdir} ;;
*) libphobos_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
esac
AC_SUBST(libphobos_builddir)
AC_SUBST(libphobos_srcdir)
])
# DRUNTIME_MULTILIB
# -----------------
# Prepare the multilib_arg variable
AC_DEFUN([DRUNTIME_MULTILIB],
[
if test ${multilib} = yes; then
multilib_arg="--enable-multilib"
else
multilib_arg=
fi
])
# DRUNTIME_INSTALL_DIRECTORIES
# ----------------------------
# Setup various install directories for headers.
# Add the cross-host option and substitute the libphobos_toolexecdir
# libphobos_toolexeclibdir and gdc_include_dir variables.
AC_DEFUN([DRUNTIME_INSTALL_DIRECTORIES],
[
AC_REQUIRE([AC_PROG_GDC])
AC_MSG_CHECKING([D GCC version])
gcc_version=`eval $get_gcc_base_ver $srcdir/../gcc/BASE-VER`
AC_MSG_RESULT($gcc_version)
AC_SUBST(gcc_version)
AC_ARG_WITH([cross-host],
AC_HELP_STRING([--with-cross-host=HOST],
[configuring with a cross compiler]))
libphobos_toolexecdir=no
libphobos_toolexeclibdir=no
AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
AC_ARG_ENABLE([version-specific-runtime-libs],
AC_HELP_STRING([--enable-version-specific-runtime-libs],
[Specify that runtime libraries should be installed in a compiler-specific directory]),
[case "$enableval" in
yes) version_specific_libs=yes ;;
no) version_specific_libs=no ;;
*) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
esac],
[version_specific_libs=no])
AC_MSG_RESULT($version_specific_libs)
GCC_WITH_TOOLEXECLIBDIR
# Version-specific runtime libs processing.
if test $version_specific_libs = yes; then
libphobos_toolexecdir='${libdir}/gcc/${host_alias}'
libphobos_toolexeclibdir='${toolexecdir}/${gcc_version}$(MULTISUBDIR)'
else
# Calculate libphobos_toolexecdir, libphobos_toolexeclibdir
# Install a library built with a cross compiler in tooldir, not libdir.
if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
libphobos_toolexecdir='${exec_prefix}/${host_alias}'
case ${with_toolexeclibdir} in
no)
libphobos_toolexeclibdir='${toolexecdir}/lib'
;;
*)
libphobos_toolexeclibdir=${with_toolexeclibdir}
;;
esac
else
libphobos_toolexecdir='${libdir}/gcc/${host_alias}'
libphobos_toolexeclibdir='${libdir}'
fi
multi_os_directory=`$GDC -print-multi-os-directory`
case $multi_os_directory in
.) ;; # Avoid trailing /.
*) libphobos_toolexeclibdir=${libphobos_toolexeclibdir}/${multi_os_directory} ;;
esac
fi
AC_SUBST(libphobos_toolexecdir)
AC_SUBST(libphobos_toolexeclibdir)
# Default case for install directory for D sources files.
gdc_include_dir='$(libdir)/gcc/${target_alias}/${gcc_version}/include/d'
AC_SUBST(gdc_include_dir)
])
# DRUNTIME_SECTION_FLAGS
# ----------------------
# Check for -ffunction-sections nad -fdata-sections.
AC_DEFUN([DRUNTIME_SECTION_FLAGS],
[
WITH_LOCAL_DRUNTIME([
AC_LANG_PUSH([D])
GDCFLAGS="$GDCFLAGS -g -Werror -ffunction-sections -fdata-sections"
AC_TRY_COMPILE([int foo; void bar() { }],[return 0;],
[ac_fdsections=yes], [ac_fdsections=no])
if test "x$ac_fdsections" = "xyes"; then
SECTION_FLAGS='-ffunction-sections -fdata-sections'
fi
AC_MSG_RESULT($ac_fdsections)
AC_LANG_POP([D])
], [-nophoboslib])
AC_SUBST(SECTION_FLAGS)
])
|