3 dnl Test for the presence of a DMD-compatible D2 compiler, and (optionally)
4 dnl specified modules on the import path.
6 dnl If "DMD" is defined in the environment, that will be the only
7 dnl dmd command tested. Otherwise, a hard-coded list will be used.
9 dnl After AX_DMD runs, the shell variables "success" and "ax_dmd" are set to
10 dnl "yes" or "no", and "DMD" is set to the appropriate command. Furthermore,
11 dnl "dmd_optlink" will be set to "yes" or "no" depending on whether OPTLINK is
12 dnl used as the linker (DMD/Windows), and "dmd_of_dirsep" will be set to the
13 dnl directory separator to use when passing -of to DMD (OPTLINK requires a
16 dnl AX_CHECK_D_MODULE must be run after AX_DMD. It tests for the presence of a
17 dnl module in the import path of the chosen compiler, and sets the shell
18 dnl variable "success" to "yes" or "no".
21 dnl @version 2011-05-31
22 dnl @license AllPermissive
24 dnl Copyright (C) 2009 David Reiss
25 dnl Copyright (C) 2011 David Nadlinger
26 dnl Copying and distribution of this file, with or without modification,
27 dnl are permitted in any medium without royalty provided the copyright
28 dnl notice and this notice are preserved.
33 dnl Hard-coded default commands to test.
34 DMD_PROGS="dmd,gdmd,ldmd"
36 dnl Allow the user to specify an alternative.
37 if test -n "$DMD" ; then
41 AC_MSG_CHECKING(for DMD)
43 # std.algorithm as a quick way to check for D2/Phobos.
44 echo "import std.algorithm; void main() {}" > configtest_ax_dmd.d
49 for DMD in $DMD_PROGS ; do
52 echo "Running \"$DMD configtest_ax_dmd.d\"" >&AS_MESSAGE_LOG_FD
53 if $DMD configtest_ax_dmd.d >&AS_MESSAGE_LOG_FD 2>&1 ; then
59 if test "$success" != "yes" ; then
68 # Test whether OPTLINK is used by trying if DMD accepts -L/? without
70 if test "$success" == "yes" ; then
71 AC_MSG_CHECKING(whether DMD uses OPTLINK)
72 echo "Running \”$DMD -L/? configtest_ax_dmd.d\"" >&AS_MESSAGE_LOG_FD
73 if $DMD -L/? configtest_ax_dmd.d >&AS_MESSAGE_LOG_FD 2>&1 ; then
77 # This actually produces double slashes in the final configure
78 # output, but at least it works.
87 rm -f configtest_ax_dmd*
91 AC_DEFUN([AX_CHECK_D_MODULE],
93 AC_MSG_CHECKING(for D module [$1])
95 echo "import $1; void main() {}" > configtest_ax_dmd.d
97 echo "Running \"$DMD configtest_ax_dmd.d\"" >&AS_MESSAGE_LOG_FD
98 if $DMD -c configtest_ax_dmd.d >&AS_MESSAGE_LOG_FD 2>&1 ; then
106 rm -f configtest_ax_dmd*