Files
PolyORB/support/idlcpp.m4
Thomas Quinot 954fca187c Do not abort if no C++ preprocessor is present, as long as GNAT provides
an IDL preprocessor.

Subversion-branch: /trunk/polyorb
Subversion-revision: 124293
2008-04-25 15:45:42 +00:00

72 lines
1.9 KiB
Plaintext

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"
# 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
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
dnl C++ preprocessor to create an output file without extension.
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
ac_try="cd conftest && $IDLCPP $IDLCPPFLAGS -o output input && cat output > /dev/null"
if AC_TRY_EVAL(ac_try); then
AC_MSG_RESULT(no)
AC_SUBST(IDLCPP_OUTPUT_SUFFIX, "")
else
AC_MSG_RESULT(yes)
AC_SUBST(IDLCPP_OUTPUT_SUFFIX, ".")
fi
rm -fr conftest])