xref: /netbsd-src/external/gpl3/gcc/dist/libphobos/m4/gcc_support.m4 (revision b1e838363e3c6fc78a55519254d99869742dd33c)
1181254a7Smrg#
2181254a7Smrg# Contains macros to allow building libphobos as part of GCC.
3181254a7Smrg# This includes macros to locate directories and do configure checks
4181254a7Smrg# without an installed libdruntime.
5181254a7Smrg#
6181254a7Smrg
7181254a7Smrg
8181254a7Smrg# PHOBOS_ABS_SRCDIR
9181254a7Smrg# -----------------
10181254a7Smrg# Find absolute top level source directory and set phobos_cv_abs_srcdir
11181254a7SmrgAC_DEFUN([PHOBOS_ABS_SRCDIR], [
12181254a7Smrg  dnl Not sure if 100% portable, but we need the absolute dir as the _LT_COMPILER_C_O
13181254a7Smrg  dnl test changes the directory
14181254a7Smrg  AC_CACHE_CHECK([[for absolute libphobos source path]],
15181254a7Smrg    [[phobos_cv_abs_srcdir]],
16181254a7Smrg    [[phobos_cv_abs_srcdir=`cd $srcdir && pwd`]])
17181254a7Smrg    AS_IF([[test -d "$phobos_cv_abs_srcdir"]],
18181254a7Smrg      [],
19181254a7Smrg      [AC_MSG_ERROR([[can't find absolute libphobos source path]])])
20181254a7Smrg])
21181254a7Smrg
22181254a7Smrg
23181254a7Smrg# WITH_LOCAL_DRUNTIME(CALL, EXTRAFLAGS)
24181254a7Smrg# -------------------------------------
25181254a7Smrg# Execute CALL with GDCFLAGS adjusted to use the local druntime includes.
26181254a7Smrg# Flags contains extra arguments to append to GDCFLAGS (e.g. -nophoboslib).
27181254a7SmrgAC_DEFUN([WITH_LOCAL_DRUNTIME], [
28181254a7Smrg  AC_REQUIRE([PHOBOS_ABS_SRCDIR])
29181254a7Smrg  gdc_save_DFLAGS=$GDCFLAGS
30*b1e83836Smrg  GDCFLAGS="-fno-druntime -nostdinc -I $phobos_cv_abs_srcdir/libdruntime $2 $GDCFLAGS"
31181254a7Smrg  $1
32181254a7Smrg  GDCFLAGS=$gdc_save_DFLAGS
33181254a7Smrg])
34