| # |
| # 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) |
| ]) |