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