* C Compiler:: Checking its characteristics
* C++ Compiler:: Likewise
* Objective C Compiler:: Likewise
+* Objective C++ Compiler:: Likewise
* Erlang Compiler and Interpreter:: Likewise
* Fortran Compiler:: Likewise
@defvar CPPFLAGS
@evindex CPPFLAGS
@ovindex CPPFLAGS
-Preprocessor options for the C, C++, and Objective C preprocessors and
-compilers. If
+Preprocessor options for the C, C++, Objective C, and Objective C++
+preprocessors and compilers. If
it is not set in the environment when @command{configure} runs, the default
value is empty. @command{configure} uses this variable when preprocessing
-or compiling programs to test for C, C++, and Objective C features.
+or compiling programs to test for C, C++, Objective C, and Objective C++
+features.
This variable's contents should contain options like @option{-I},
@option{-D}, and @option{-U} that affect only the behavior of the
Options for the linker. If it is not set
in the environment when @command{configure} runs, the default value is empty.
@command{configure} uses this variable when linking programs to test for
-C, C++, Objective C, and Fortran features.
+C, C++, Objective C, Objective C++, and Fortran features.
This variable's contents should contain options like @option{-s} and
@option{-L} that affect only the behavior of the linker. Please see the
but some Autoconf macros may prepend extra libraries to this variable if
those libraries are found and provide necessary functions, see
@ref{Libraries}. @command{configure} uses this variable when linking
-programs to test for C, C++, and Fortran features.
+programs to test for C, C++, Objective C, Objective C++, and Fortran
+features.
@end defvar
@defvar OBJCFLAGS
acts like @code{CFLAGS}, but for Objective C instead of C.
@end defvar
+@defvar OBJCXXFLAGS
+@evindex OBJCXXFLAGS
+@ovindex OBJCXXFLAGS
+Debugging and optimization options for the Objective C++ compiler. It
+acts like @code{CXXFLAGS}, but for Objective C++ instead of C++.
+@end defvar
+
@defvar builddir
@ovindex builddir
Rigorously equal to @samp{.}. Added for symmetry only.
* C Compiler:: Checking its characteristics
* C++ Compiler:: Likewise
* Objective C Compiler:: Likewise
+* Objective C++ Compiler:: Likewise
* Erlang Compiler and Interpreter:: Likewise
* Fortran Compiler:: Likewise
@end menu
@end defmac
+@node Objective C++ Compiler
+@subsection Objective C++ Compiler Characteristics
+
+
+@defmac AC_PROG_OBJCXX (@ovar{compiler-search-list})
+@acindex{PROG_OBJCXX}
+@evindex OBJCXX
+@evindex OBJCXXFLAGS
+@ovindex OBJCXX
+@ovindex OBJCXXFLAGS
+Determine an Objective C++ compiler to use. If @code{OBJCXX} is not already
+set in the environment, check for Objective C++ compilers. Set output
+variable @code{OBJCXX} to the name of the compiler found.
+
+This macro may, however, be invoked with an optional first argument
+which, if specified, must be a blank-separated list of Objective C++ compilers
+to search for. This just gives the user an opportunity to specify an
+alternative search list for the Objective C++ compiler. For example, if you
+didn't like the default order, then you could invoke @code{AC_PROG_OBJCXX}
+like this:
+
+@example
+AC_PROG_OBJCXX([gcc g++ objcc++ objcxx])
+@end example
+
+If using the @acronym{GNU} Objective C++ compiler, set shell variable
+@code{GOBJCXX} to @samp{yes}. If output variable @code{OBJCXXFLAGS} was not
+already set, set it to @option{-g -O2} for the @acronym{GNU} Objective C++
+compiler (@option{-O2} on systems where @command{gcc} does not accept
+@option{-g}), or @option{-g} for other compilers.
+@end defmac
+
+@defmac AC_PROG_OBJCXXCPP
+@acindex{PROG_OBJCXXCPP}
+@evindex OBJCXXCPP
+@ovindex OBJCXXCPP
+Set output variable @code{OBJCXXCPP} to a command that runs the Objective C++
+preprocessor. If @samp{$OBJCXX -E} doesn't work, @file{/lib/cpp} is used.
+@end defmac
+
+
@node Erlang Compiler and Interpreter
@subsection Erlang Compiler and Interpreter Characteristics
@cindex Erlang
extension @file{.m} for test programs. Use compilation flags:
@code{CPPFLAGS} with @code{OBJCPP}, and both @code{CPPFLAGS} and
@code{OBJCFLAGS} with @code{OBJC}.
+
+@item Objective C++
+Do compilation tests using @code{OBJCXX} and @code{OBJCXXCPP} and use
+extension @file{.mm} for test programs. Use compilation flags:
+@code{CPPFLAGS} with @code{OBJCXXCPP}, and both @code{CPPFLAGS} and
+@code{OBJCXXFLAGS} with @code{OBJCXX}.
@end table
@end defmac
# 1a. C 2a. C
# 1b. C++
# 1c. Objective C
+# 1d. Objective C++
#
# 3. Looking for a compiler
# And possibly the associated preprocessor.
-# 3a. C 3b. C++ 3c. Objective C
+# 3a. C 3b. C++ 3c. Objective C 3d. Objective C++
#
# 4. Compilers' characteristics.
# 4a. C
+## -------------------------------- ##
+## 1d. The Objective C++ language. ##
+## -------------------------------- ##
+
+
+# AC_LANG(Objective C++)
+# ----------------------
+AC_LANG_DEFINE([Objective C++], [objcxx], [OBJCXX], [C++],
+[ac_ext=mm
+ac_cpp='$OBJCXXCPP $CPPFLAGS'
+ac_compile='$OBJCXX -c $OBJCXXFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
+ac_link='$OBJCXX -o conftest$ac_exeext $OBJCXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
+ac_compiler_gnu=$ac_cv_objcxx_compiler_gnu
+])
+
+
+
## -------------------------------------------- ##
## 3. Looking for Compilers and Preprocessors. ##
## -------------------------------------------- ##
# _AC_ARG_VAR_CPPFLAGS
# --------------------
# Document and register CPPFLAGS, which is used by
-# AC_PROG_{CC, CPP, CXX, CXXCPP, OBJC, OBJCPP}.
+# AC_PROG_{CC, CPP, CXX, CXXCPP, OBJC, OBJCPP, OBJCXX, OBJCXXCPP}.
AC_DEFUN([_AC_ARG_VAR_CPPFLAGS],
[AC_ARG_VAR([CPPFLAGS],
- [C/C++/Objective C preprocessor flags, e.g. -I<include dir>
+ [(Objective) C/C++ preprocessor flags, e.g. -I<include dir>
if you have headers in a nonstandard directory <include dir>])])
# _AC_ARG_VAR_LDFLAGS
# -------------------
# Document and register LDFLAGS, which is used by
-# AC_PROG_{CC, CXX, F77, FC, OBJC}.
+# AC_PROG_{CC, CXX, F77, FC, OBJC, OBJCXX}.
AC_DEFUN([_AC_ARG_VAR_LDFLAGS],
[AC_ARG_VAR([LDFLAGS],
[linker flags, e.g. -L<lib dir> if you have libraries in a
# _AC_ARG_VAR_LIBS
# ----------------
# Document and register LIBS, which is used by
-# AC_PROG_{CC, CXX, F77, FC, OBJS}.
+# AC_PROG_{CC, CXX, F77, FC, OBJC, OBJCXX}.
AC_DEFUN([_AC_ARG_VAR_LIBS],
[AC_ARG_VAR([LIBS],
[libraries to pass to the linker, e.g. -l<library>])])
+# -------------------------------- #
+# 3d. The Objective C++ compiler. #
+# -------------------------------- #
+
+
+# AC_LANG_PREPROC(Objective C++)
+# ------------------------------
+# Find the Objective C++ preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_PREPROC(Objective C++)],
+[AC_REQUIRE([AC_PROG_OBJCXXCPP])])
+
+
+# AC_PROG_OBJCXXCPP
+# -----------------
+# Find a working Objective C++ preprocessor.
+AC_DEFUN([AC_PROG_OBJCXXCPP],
+[AC_REQUIRE([AC_PROG_OBJCXX])dnl
+AC_ARG_VAR([OBJCXXCPP], [Objective C++ preprocessor])dnl
+_AC_ARG_VAR_CPPFLAGS()dnl
+AC_LANG_PUSH(Objective C++)dnl
+AC_MSG_CHECKING([how to run the Objective C++ preprocessor])
+if test -z "$OBJCXXCPP"; then
+ AC_CACHE_VAL(ac_cv_prog_OBJCXXCPP,
+ [dnl
+ # Double quotes because OBJCXXCPP needs to be expanded
+ for OBJCXXCPP in "$OBJCXX -E" "/lib/cpp"
+ do
+ _AC_PROG_PREPROC_WORKS_IFELSE([break])
+ done
+ ac_cv_prog_OBJCXXCPP=$OBJCXXCPP
+ ])dnl
+ OBJCXXCPP=$ac_cv_prog_OBJCXXCPP
+else
+ ac_cv_prog_OBJCXXCPP=$OBJCXXCPP
+fi
+AC_MSG_RESULT([$OBJCXXCPP])
+_AC_PROG_PREPROC_WORKS_IFELSE([],
+ [AC_MSG_FAILURE([Objective C++ preprocessor "$OBJCXXCPP" fails sanity check])])
+AC_SUBST(OBJCXXCPP)dnl
+AC_LANG_POP(Objective C++)dnl
+])# AC_PROG_OBJCXXCPP
+
+
+# AC_LANG_COMPILER(Objective C++)
+# -------------------------------
+# Find the Objective C++ compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_COMPILER(Objective C++)],
+[AC_REQUIRE([AC_PROG_OBJCXX])])
+
+
+
+# AC_PROG_OBJCXX([LIST-OF-COMPILERS])
+# ---------------------------------
+# LIST-OF-COMPILERS is a space separated list of Objective C++ compilers to
+# search for (if not specified, a default list is used). This just gives
+# the user an opportunity to specify an alternative search list for the
+# Objective C++ compiler.
+# FIXME: this list is pure guesswork
+# objc++ StepStone Objective-C++ compiler (also "standard" name for OBJCXX)
+# objcxx David Stes' POC. If you installed this, you likely want it.
+# c++ Native C++ compiler (for instance, Apple).
+# CXX You never know.
+AN_MAKEVAR([OBJCXX], [AC_PROG_OBJCXX])
+AN_PROGRAM([objcxx], [AC_PROG_OBJCXX])
+AC_DEFUN([AC_PROG_OBJCXX],
+[AC_LANG_PUSH(Objective C++)dnl
+AC_ARG_VAR([OBJCXX], [Objective C++ compiler command])dnl
+AC_ARG_VAR([OBJCXXFLAGS], [Objective C++ compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+_AC_ARG_VAR_LIBS()dnl
+_AC_ARG_VAR_CPPFLAGS()dnl
+_AC_ARG_VAR_PRECIOUS([OBJCXX])dnl
+AC_CHECK_TOOLS(OBJCXX,
+ [m4_default([$1], [g++ objc++ objcxx c++ CXX])],
+ g++)
+# Provide some information about the compiler.
+_AS_ECHO_LOG([checking for _AC_LANG compiler version])
+set X $ac_compile
+ac_compiler=$[2]
+for ac_option in --version -v -V -qversion; do
+ _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
+done
+
+m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
+m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
+_AC_LANG_COMPILER_GNU
+if test $ac_compiler_gnu = yes; then
+ GOBJCXX=yes
+else
+ GOBJCXX=
+fi
+_AC_PROG_OBJCXX_G
+AC_LANG_POP(Objective C++)dnl
+])# AC_PROG_OBJCXX
+
+
+# _AC_PROG_OBJCXX_G
+# -----------------
+# Check whether -g works, even if OBJCFLAGS is set, in case the package
+# plays around with OBJCFLAGS (such as to build both debugging and
+# normal versions of a library), tasteless as that idea is.
+# Don't consider -g to work if it generates warnings when plain compiles don't.
+m4_define([_AC_PROG_OBJCXX_G],
+[ac_test_OBJCXXFLAGS=${OBJCXXFLAGS+set}
+ac_save_OBJCXXFLAGS=$OBJCXXFLAGS
+AC_CACHE_CHECK(whether $OBJCXX accepts -g, ac_cv_prog_objcxx_g,
+ [ac_save_objcxx_werror_flag=$ac_objcxx_werror_flag
+ ac_objcxx_werror_flag=yes
+ ac_cv_prog_objcxx_g=no
+ OBJCXXFLAGS="-g"
+ _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+ [ac_cv_prog_objcxx_g=yes],
+ [OBJCXXFLAGS=""
+ _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+ [],
+ [ac_objcxx_werror_flag=$ac_save_objcxx_werror_flag
+ OBJCXXFLAGS="-g"
+ _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+ [ac_cv_prog_objcxx_g=yes])])])
+ ac_objcxx_werror_flag=$ac_save_objcx_werror_flag])
+if test "$ac_test_OBJCXXFLAGS" = set; then
+ OBJCXXFLAGS=$ac_save_OBJCXXFLAGS
+elif test $ac_cv_prog_objcxx_g = yes; then
+ if test "$GOBJCXX" = yes; then
+ OBJCXXFLAGS="-g -O2"
+ else
+ OBJCXXFLAGS="-g"
+ fi
+else
+ if test "$GOBJCXX" = yes; then
+ OBJCXXFLAGS="-O2"
+ else
+ OBJCXXFLAGS=
+ fi
+fi[]dnl
+])# _AC_PROG_OBJCXX_G
+
+
+
## ------------------------------- ##
## 4. Compilers' characteristics. ##
## ------------------------------- ##