Check to see if -ext o option is required to get compiler to write

foo.o instead of foo.c.o or foo.cc.o.  (MetroWerks)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32168 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott 2005-02-19 07:14:14 +00:00
parent 4d7ec9f1e7
commit 480ccd2194
4 changed files with 354 additions and 0 deletions

View File

@ -8,6 +8,46 @@ dnl
dnl Version: $Id$
dnl ---------------------------------------------------------------------------
dnl ===========================================================================
dnl macros to detect specialty compiler options
dnl ===========================================================================
dnl Figure out if we need to pass -ext o to compiler (MetroWerks)
AC_DEFUN([AC_WX_METROWERKS_EXTO],
[AC_CACHE_CHECK([if the _AC_LANG compiler requires -ext o], wx_cv_[]_AC_LANG_ABBREV[]_exto,
dnl First create an empty conf test
[AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
dnl Now remove .o and .c.o or .cc.o
rm -f conftest.$ac_objext conftest.$ac_ext.o
dnl Now compile the test
AS_IF([AC_TRY_EVAL(ac_compile)],
dnl If the test succeeded look for conftest.c.o or conftest.cc.o
[for ac_file in `(ls conftest.* 2>/dev/null)`; do
case $ac_file in
conftest.$ac_ext.o)
wx_cv_[]_AC_LANG_ABBREV[]_exto="-ext o"
;;
*)
;;
esac
done],
[AC_MSG_FAILURE([cannot figure out if compiler needs -ext o: cannot compile])
]) dnl AS_IF
rm -f conftest.$ac_ext.o conftest.$ac_objext conftest.$ac_ext
]) dnl AC_CACHE_CHECK
if test "x$wx_cv_[]_AC_LANG_ABBREV[]_exto" '!=' "x"; then
if test "[]_AC_LANG_ABBREV[]" = "c"; then
CFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CFLAGS"
fi
if test "[]_AC_LANG_ABBREV[]" = "cxx"; then
CXXFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CXXFLAGS"
fi
fi
]) dnl AC_DEFUN
dnl ===========================================================================
dnl macros to find the a file in the list of include/lib paths
dnl ===========================================================================

40
aclocal.m4 vendored
View File

@ -21,6 +21,46 @@ dnl
dnl Version: $Id$
dnl ---------------------------------------------------------------------------
dnl ===========================================================================
dnl macros to detect specialty compiler options
dnl ===========================================================================
dnl Figure out if we need to pass -ext o to compiler (MetroWerks)
AC_DEFUN([AC_WX_METROWERKS_EXTO],
[AC_CACHE_CHECK([if the _AC_LANG compiler requires -ext o], wx_cv_[]_AC_LANG_ABBREV[]_exto,
dnl First create an empty conf test
[AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
dnl Now remove .o and .c.o or .cc.o
rm -f conftest.$ac_objext conftest.$ac_ext.o
dnl Now compile the test
AS_IF([AC_TRY_EVAL(ac_compile)],
dnl If the test succeeded look for conftest.c.o or conftest.cc.o
[for ac_file in `(ls conftest.* 2>/dev/null)`; do
case $ac_file in
conftest.$ac_ext.o)
wx_cv_[]_AC_LANG_ABBREV[]_exto="-ext o"
;;
*)
;;
esac
done],
[AC_MSG_FAILURE([cannot figure out if compiler needs -ext o: cannot compile])
]) dnl AS_IF
rm -f conftest.$ac_ext.o conftest.$ac_objext conftest.$ac_ext
]) dnl AC_CACHE_CHECK
if test "x$wx_cv_[]_AC_LANG_ABBREV[]_exto" '!=' "x"; then
if test "[]_AC_LANG_ABBREV[]" = "c"; then
CFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CFLAGS"
fi
if test "[]_AC_LANG_ABBREV[]" = "cxx"; then
CXXFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CXXFLAGS"
fi
fi
]) dnl AC_DEFUN
dnl ===========================================================================
dnl macros to find the a file in the list of include/lib paths
dnl ===========================================================================

264
configure vendored
View File

@ -11450,6 +11450,138 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
echo "$as_me:$LINENO: checking if the C compiler requires -ext o" >&5
echo $ECHO_N "checking if the C compiler requires -ext o... $ECHO_C" >&6
if test "${wx_cv_c_exto+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest.$ac_ext.o
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
for ac_file in `(ls conftest.* 2>/dev/null)`; do
case $ac_file in
conftest.$ac_ext.o)
wx_cv_c_exto="-ext o"
;;
*)
;;
esac
done
else
{ { echo "$as_me:$LINENO: error: cannot figure out if compiler needs -ext o: cannot compile
See \`config.log' for more details." >&5
echo "$as_me: error: cannot figure out if compiler needs -ext o: cannot compile
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f conftest.$ac_ext.o conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $wx_cv_c_exto" >&5
echo "${ECHO_T}$wx_cv_c_exto" >&6
if test "x$wx_cv_c_exto" '!=' "x"; then
if test "c" = "c"; then
CFLAGS="$wx_cv_c_exto $CFLAGS"
fi
if test "c" = "cxx"; then
CXXFLAGS="$wx_cv_c_exto $CXXFLAGS"
fi
fi
if test "x$wx_cv_c_exto" '!=' "x"; then
unset ac_cv_prog_cc_g
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
CFLAGS="-g"
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cc_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_prog_cc_g=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_prog_cc_g=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-g"
fi
else
if test "$GCC" = yes; then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@ -12191,6 +12323,138 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
echo "$as_me:$LINENO: checking if the C++ compiler requires -ext o" >&5
echo $ECHO_N "checking if the C++ compiler requires -ext o... $ECHO_C" >&6
if test "${wx_cv_cxx_exto+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest.$ac_ext.o
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
for ac_file in `(ls conftest.* 2>/dev/null)`; do
case $ac_file in
conftest.$ac_ext.o)
wx_cv_cxx_exto="-ext o"
;;
*)
;;
esac
done
else
{ { echo "$as_me:$LINENO: error: cannot figure out if compiler needs -ext o: cannot compile
See \`config.log' for more details." >&5
echo "$as_me: error: cannot figure out if compiler needs -ext o: cannot compile
See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
rm -f conftest.$ac_ext.o conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $wx_cv_cxx_exto" >&5
echo "${ECHO_T}$wx_cv_cxx_exto" >&6
if test "x$wx_cv_cxx_exto" '!=' "x"; then
if test "cxx" = "c"; then
CFLAGS="$wx_cv_cxx_exto $CFLAGS"
fi
if test "cxx" = "cxx"; then
CXXFLAGS="$wx_cv_cxx_exto $CXXFLAGS"
fi
fi
if test "x$wx_cv_cxx_exto" '!=' "x"; then
unset ac_cv_prog_cxx_g
ac_test_CXXFLAGS=${CXXFLAGS+set}
ac_save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="-g"
echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cxx_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_cxx_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_prog_cxx_g=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_prog_cxx_g=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS=$ac_save_CXXFLAGS
elif test $ac_cv_prog_cxx_g = yes; then
if test "$GXX" = yes; then
CXXFLAGS="-g -O2"
else
CXXFLAGS="-g"
fi
else
if test "$GXX" = yes; then
CXXFLAGS="-O2"
else
CXXFLAGS=
fi
fi
fi
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'

View File

@ -1361,6 +1361,11 @@ dnl default CFLAGS (something like "-g -O2") -- we don't need this as we add
dnl -g and -O flags ourselves below
CFLAGS=${CFLAGS:=}
AC_PROG_CC
AC_WX_METROWERKS_EXTO
if test "x$wx_cv_c_exto" '!=' "x"; then
unset ac_cv_prog_cc_g
_AC_PROG_CC_G
fi
AC_BAKEFILE_PROG_MWCC
dnl is -traditional needed for correct compilations
@ -1379,6 +1384,11 @@ dnl
dnl see CFLAGS line above
CXXFLAGS=${CXXFLAGS:=}
AC_PROG_CXX
AC_WX_METROWERKS_EXTO
if test "x$wx_cv_cxx_exto" '!=' "x"; then
unset ac_cv_prog_cxx_g
_AC_PROG_CXX_G
fi
AC_BAKEFILE_PROG_MWCXX
AC_LANG_RESTORE