]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/aclocal/ax_dmd.m4
buildsys: switch source download to quincy
[ceph.git] / ceph / src / jaegertracing / thrift / aclocal / ax_dmd.m4
1 dnl @synopsis AX_DMD
2 dnl
3 dnl Test for the presence of a DMD-compatible D2 compiler, and (optionally)
4 dnl specified modules on the import path.
5 dnl
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.
8 dnl
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
14 dnl backslash).
15 dnl
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".
19 dnl
20 dnl @category D
21 dnl @version 2011-05-31
22 dnl @license AllPermissive
23 dnl
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.
29
30
31 AC_DEFUN([AX_DMD],
32 [
33 dnl Hard-coded default commands to test.
34 DMD_PROGS="dmd,gdmd,ldmd"
35
36 dnl Allow the user to specify an alternative.
37 if test -n "$DMD" ; then
38 DMD_PROGS="$DMD"
39 fi
40
41 AC_MSG_CHECKING(for DMD)
42
43 # std.algorithm as a quick way to check for D2/Phobos.
44 echo "import std.algorithm; void main() {}" > configtest_ax_dmd.d
45 success=no
46 oIFS="$IFS"
47
48 IFS=","
49 for DMD in $DMD_PROGS ; do
50 IFS="$oIFS"
51
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
54 success=yes
55 break
56 fi
57 done
58
59 if test "$success" != "yes" ; then
60 AC_MSG_RESULT(no)
61 DMD=""
62 else
63 AC_MSG_RESULT(yes)
64 fi
65
66 ax_dmd="$success"
67
68 # Test whether OPTLINK is used by trying if DMD accepts -L/? without
69 # erroring out.
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
74 AC_MSG_RESULT(yes)
75 dmd_optlink="yes"
76
77 # This actually produces double slashes in the final configure
78 # output, but at least it works.
79 dmd_of_dirsep="\\\\"
80 else
81 AC_MSG_RESULT(no)
82 dmd_optlink="no"
83 dmd_of_dirsep="/"
84 fi
85 fi
86
87 rm -f configtest_ax_dmd*
88 ])
89
90
91 AC_DEFUN([AX_CHECK_D_MODULE],
92 [
93 AC_MSG_CHECKING(for D module [$1])
94
95 echo "import $1; void main() {}" > configtest_ax_dmd.d
96
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
99 AC_MSG_RESULT(yes)
100 success=yes
101 else
102 AC_MSG_RESULT(no)
103 success=no
104 fi
105
106 rm -f configtest_ax_dmd*
107 ])