forked from AdaCore/PolyORB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathidlcpp.m4
79 lines (72 loc) · 2.44 KB
/
idlcpp.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
dnl IDL preprocessor handling
dnl $Id$
dnl Usage: AM_GCC_XIDL
dnl Test whether the GNAT IDL preprocessor command line switch is available
AC_DEFUN([AM_GCC_XIDL],
[AC_REQUIRE([AM_PROG_ADA])
AC_MSG_CHECKING([if GNAT provides an IDL preprocessor])
mkdir conftest
echo "interface Foo {};" > conftest/input.idl
ac_try="cd conftest && $ADA -E -x idl -o input.I input.idl && cat input.I > /dev/null"
if AC_TRY_EVAL(ac_try); then
HAVE_GCC_XIDL=yes
else
HAVE_GCC_XIDL=no
fi
AC_MSG_RESULT($HAVE_GCC_XIDL)
rm -fr conftest])
dnl Usage: AM_PROG_IDLCPP
dnl Find an appropriate IDL preprocessor
AC_DEFUN([AM_PROG_IDLCPP],
[AC_REQUIRE([AM_GCC_XIDL])
AC_MSG_CHECKING([what IDL preprocessor to use])
if test "${IDLCPP+set}" = set; then
: IDLCPP set by the user
elif test "$HAVE_GCC_XIDL" = yes; then
# IDLCPP provided by GNAT gcc driver
IDLCPP="$ADA -E -x idl"
else
# IDLCPP provided by C++ compiler
AC_PROG_CXXCPP
IDLCPP="$CXXCPP"
case "$CXXCPP" in
*g++*)
if test "${CXXCPPFLAGS}" = ""; then
IDLCPPFLAGS="-x c++ -ansi -ffreestanding"
# Options to use GNU C++ preprocessor as IDL preprocessor
# -x c++ force C++ preprocessor mode (even though it cannot be
# inferred from filename extension .idl)
# -ansi disable GCC-specific behaviour
# -ffreestanding disable stdc-predef.h preinclude
else
IDLCPPFLAGS="${CXXCPPFLAGS}"
fi
;;
esac
fi
AC_MSG_RESULT([$IDLCPP $IDLCPPFLAGS])
AC_SUBST(IDLCPP)
AC_SUBST(IDLCPPFLAGS)
])
dnl Usage: AM_IDLCPP_NEEDS_DOT
dnl Check whether it is necessary to add a trailing dot for the C++
dnl preprocessor to create an output file without extension. On Windows,
dnl a default extension ".exe" is appended if no trailing dot is present.
AC_DEFUN([AM_IDLCPP_NEEDS_DOT],
[AC_REQUIRE([AM_PROG_IDLCPP])
AC_MSG_CHECKING([if the IDL preprocessor -o option requires a dot])
mkdir conftest
touch conftest/input
dnl Note: We test for presence of "output.exe", not absence of "output",
dnl becuse as of Cygwin 1.7, if "output.exe" is present and "output" is
dnl missing, then shell tools from coreutils append the .exe extension
dnl automagically, and make it appear as though "output" was present.
ac_try="cd conftest && $IDLCPP $IDLCPPFLAGS -o output input && cat output.exe > /dev/null"
if AC_TRY_EVAL(ac_try); then
AC_MSG_RESULT(yes)
AC_SUBST(IDLCPP_OUTPUT_SUFFIX, ".")
else
AC_MSG_RESULT(no)
AC_SUBST(IDLCPP_OUTPUT_SUFFIX, "")
fi
rm -fr conftest])