D compiler sanity checks in configure; check D2 by default if no D1 compiler can be found.
For both D1 and D2, if the compiler has not been specified explicitly via a command line option, the configure script tries to compile a minimal program stub. Only if this succeeds, the respective compiler is enabled. If neither a working D1 nor a working D2 compiler has been found, D is skipped completely as usual. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12334 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
56dfa781ff
commit
e120dfcc70
2 changed files with 55 additions and 7 deletions
|
|
@ -1219,6 +1219,10 @@ go_clean:
|
||||||
|
|
||||||
DLIBPREFIX = @DLIBPREFIX@
|
DLIBPREFIX = @DLIBPREFIX@
|
||||||
|
|
||||||
|
ifeq (,$(D_VERSION))
|
||||||
|
D_VERSION = @DDEFAULTVERSION@
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq (2,$(D_VERSION))
|
ifeq (2,$(D_VERSION))
|
||||||
SWIGD = $(SWIG) -d -d2
|
SWIGD = $(SWIG) -d -d2
|
||||||
DCOMPILER = @D2COMPILER@
|
DCOMPILER = @D2COMPILER@
|
||||||
|
|
@ -1229,7 +1233,7 @@ endif
|
||||||
|
|
||||||
ifeq (dmd,$(DCOMPILER))
|
ifeq (dmd,$(DCOMPILER))
|
||||||
# DMD is 32bit only by now
|
# DMD is 32bit only by now
|
||||||
CFLAGS += -m32
|
DCFLAGS = -m32
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
|
|
@ -1238,8 +1242,8 @@ endif
|
||||||
|
|
||||||
d: $(SRCS)
|
d: $(SRCS)
|
||||||
$(SWIGD) $(SWIGOPT) $(INTERFACEPATH)
|
$(SWIGD) $(SWIGOPT) $(INTERFACEPATH)
|
||||||
$(CC) -c $(CCSHARED) $(CFLAGS) $(EXTRA_CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES)
|
$(CC) -c $(CCSHARED) $(CFLAGS) $(DCFLAGS) $(EXTRA_CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES)
|
||||||
$(LDSHARED) $(CFLAGS) $(EXTRA_LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(DLIBPREFIX)$(TARGET)$(SO)
|
$(LDSHARED) $(CFLAGS) $(DCFLAGS) $(EXTRA_LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(DLIBPREFIX)$(TARGET)$(SO)
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# Build a dynamically loadable D wrapper for a C++ module
|
# Build a dynamically loadable D wrapper for a C++ module
|
||||||
|
|
@ -1247,8 +1251,8 @@ d: $(SRCS)
|
||||||
|
|
||||||
d_cpp: $(SRCS)
|
d_cpp: $(SRCS)
|
||||||
$(SWIGD) -c++ $(SWIGOPT) $(INTERFACEPATH)
|
$(SWIGD) -c++ $(SWIGOPT) $(INTERFACEPATH)
|
||||||
$(CXX) -c $(CCSHARED) $(CFLAGS) $(EXTRA_CFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES)
|
$(CXX) -c $(CCSHARED) $(CFLAGS) $(DCFLAGS) $(EXTRA_CFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES)
|
||||||
$(CXXSHARED) $(CFLAGS) $(EXTRA_LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(DLIBPREFIX)$(TARGET)$(SO)
|
$(CXXSHARED) $(CFLAGS) $(DCFLAGS) $(EXTRA_LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(DLIBPREFIX)$(TARGET)$(SO)
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# Compile D files
|
# Compile D files
|
||||||
|
|
|
||||||
48
configure.in
48
configure.in
|
|
@ -2028,25 +2028,68 @@ AC_SUBST(GO)
|
||||||
#----------------------------------------------------------------
|
#----------------------------------------------------------------
|
||||||
|
|
||||||
AC_ARG_WITH(d, AS_HELP_STRING([--without-d], [Disable D]), [with_d="$withval"], [with_d=yes])
|
AC_ARG_WITH(d, AS_HELP_STRING([--without-d], [Disable D]), [with_d="$withval"], [with_d=yes])
|
||||||
AC_ARG_WITH(d1-compiler, [ --with-d1-compiler=path Set location of D1 compiler (DMD compatible)],[D1COMPILERBIN="$withval"], [D1COMPILERBIN=])
|
AC_ARG_WITH(d1-compiler, [ --with-d1-compiler=path Set location of D1/Tango compiler (DMD compatible)],[D1COMPILERBIN="$withval"], [D1COMPILERBIN=])
|
||||||
AC_ARG_WITH(d2-compiler, [ --with-d2-compiler=path Set location of D2 compiler (DMD compatible)],[D2COMPILERBIN="$withval"], [D2COMPILERBIN=])
|
AC_ARG_WITH(d2-compiler, [ --with-d2-compiler=path Set location of D2 compiler (DMD compatible)],[D2COMPILERBIN="$withval"], [D2COMPILERBIN=])
|
||||||
|
|
||||||
|
|
||||||
# First, check for "--without-d" or "--with-d=no".
|
# First, check for "--without-d" or "--with-d=no".
|
||||||
if test x"${with_d}" = xno -o x"${with_alllang}" = xno ; then
|
if test x"${with_d}" = xno -o x"${with_alllang}" = xno ; then
|
||||||
AC_MSG_NOTICE([Disabling D])
|
AC_MSG_NOTICE([Disabling D])
|
||||||
D1COMPILER=
|
D1COMPILER=
|
||||||
D2COMPILER=
|
D2COMPILER=
|
||||||
else
|
else
|
||||||
|
old_ac_ext=$ac_ext
|
||||||
|
ac_ext=d
|
||||||
|
|
||||||
if test -z "$D1COMPILERBIN" ; then
|
if test -z "$D1COMPILERBIN" ; then
|
||||||
AC_CHECK_PROGS(D1COMPILER, dmd ldmd gdmd)
|
AC_CHECK_PROGS(D1COMPILER, dmd ldmd gdmd)
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(whether the D1/Tango compiler works)
|
||||||
|
cat > conftest.$ac_ext <<_ACEOF
|
||||||
|
import tango.io.Stdout;
|
||||||
|
void main() {
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext
|
||||||
|
AS_IF(
|
||||||
|
[_AC_DO_STDERR($D1COMPILER conftest.$ac_ext) && test ! -s conftest.err && test -s conftest.$ac_objext],
|
||||||
|
[AC_MSG_RESULT([yes])],
|
||||||
|
[_AC_MSG_LOG_CONFTEST AC_MSG_RESULT([no])
|
||||||
|
D1COMPILER=]
|
||||||
|
)
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
else
|
else
|
||||||
D1COMPILER="$D1COMPILERBIN"
|
D1COMPILER="$D1COMPILERBIN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$D2COMPILERBIN" ; then
|
if test -z "$D2COMPILERBIN" ; then
|
||||||
AC_CHECK_PROGS(D2COMPILER, dmd gdmd)
|
AC_CHECK_PROGS(D2COMPILER, dmd gdmd)
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(whether the D2 compiler works)
|
||||||
|
cat > conftest.$ac_ext <<_ACEOF
|
||||||
|
import std.algorithm;
|
||||||
|
void main() {
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext
|
||||||
|
AS_IF(
|
||||||
|
[_AC_DO_STDERR($D2COMPILER conftest.$ac_ext) && test ! -s conftest.err && test -s conftest.$ac_objext],
|
||||||
|
[AC_MSG_RESULT([yes])],
|
||||||
|
[_AC_MSG_LOG_CONFTEST AC_MSG_RESULT([no])
|
||||||
|
D2COMPILER=]
|
||||||
|
)
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
else
|
else
|
||||||
D2COMPILER="$D2COMPILERBIN"
|
D2COMPILER="$D2COMPILERBIN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ac_ext=$old_ac_ext
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -n "$D1COMPILER"; then
|
||||||
|
DDEFAULTVERSION=1
|
||||||
|
elif test -n "$D2COMPILER"; then
|
||||||
|
DDEFAULTVERSION=2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Do not prefix library file names with "lib" on Windows.
|
# Do not prefix library file names with "lib" on Windows.
|
||||||
|
|
@ -2057,6 +2100,7 @@ esac
|
||||||
|
|
||||||
AC_SUBST(D1COMPILER)
|
AC_SUBST(D1COMPILER)
|
||||||
AC_SUBST(D2COMPILER)
|
AC_SUBST(D2COMPILER)
|
||||||
|
AC_SUBST(DDEFAULTVERSION)
|
||||||
AC_SUBST(DLIBPREFIX)
|
AC_SUBST(DLIBPREFIX)
|
||||||
|
|
||||||
#----------------------------------------------------------------
|
#----------------------------------------------------------------
|
||||||
|
|
@ -2216,7 +2260,7 @@ fi
|
||||||
AC_SUBST(SKIP_GO)
|
AC_SUBST(SKIP_GO)
|
||||||
|
|
||||||
SKIP_D=
|
SKIP_D=
|
||||||
if test -z "$D1COMPILER" && test -z "$D2COMPILER" ; then
|
if test -z "$DDEFAULTVERSION" ; then
|
||||||
SKIP_D="1"
|
SKIP_D="1"
|
||||||
fi
|
fi
|
||||||
AC_SUBST(SKIP_D)
|
AC_SUBST(SKIP_D)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue