From 9273ffba9bc2a3e18d5a0ce4611e100593b4a5f0 Mon Sep 17 00:00:00 2001 From: David Elliott Date: Sat, 19 Feb 2005 08:16:00 +0000 Subject: [PATCH] Check for xlC and add -qunique to CXXFLAGS if we're using it. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32169 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- acinclude.m4 | 31 +++++++++++ aclocal.m4 | 31 +++++++++++ configure | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 9 +++ 4 files changed, 222 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index 18ea55aad3..05197a1d7c 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -48,6 +48,37 @@ fi ]) dnl AC_DEFUN +dnl Based on autoconf _AC_LANG_COMPILER_GNU +AC_DEFUN([_AC_WX_LANG_COMPILER_XLC], +[AC_CACHE_CHECK([whether we are using the IBM xlC _AC_LANG compiler], + [wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc], + [AC_TRY_COMPILE([],[#ifndef __xlC__ + choke me +#endif +], + [wx_compiler_xlc=yes], + [wx_compiler_xlc=no]) + wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc=$wx_compiler_xlc + ]) +]) + +dnl Loosely based on autoconf AC_PROG_CC +AC_DEFUN([AC_WX_PROG_XLCC], +[AC_LANG_PUSH(C) +_AC_WX_LANG_COMPILER_XLC +XLCC=`test $wx_compiler_xlc = yes && echo yes` +AC_LANG_POP(C) +]) + +dnl Loosely based on autoconf AC_PROG_CXX +AC_DEFUN([AC_WX_PROG_XLCXX], +[AC_LANG_PUSH(C++) +_AC_WX_LANG_COMPILER_XLC +XLCXX=`test $wx_compiler_xlc = yes && echo yes` +AC_LANG_POP(C++) +]) + + dnl =========================================================================== dnl macros to find the a file in the list of include/lib paths dnl =========================================================================== diff --git a/aclocal.m4 b/aclocal.m4 index 5bcaf0d3b9..e1a2a8af65 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -61,6 +61,37 @@ fi ]) dnl AC_DEFUN +dnl Based on autoconf _AC_LANG_COMPILER_GNU +AC_DEFUN([_AC_WX_LANG_COMPILER_XLC], +[AC_CACHE_CHECK([whether we are using the IBM xlC _AC_LANG compiler], + [wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc], + [AC_TRY_COMPILE([],[#ifndef __xlC__ + choke me +#endif +], + [wx_compiler_xlc=yes], + [wx_compiler_xlc=no]) + wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc=$wx_compiler_xlc + ]) +]) + +dnl Loosely based on autoconf AC_PROG_CC +AC_DEFUN([AC_WX_PROG_XLCC], +[AC_LANG_PUSH(C) +_AC_WX_LANG_COMPILER_XLC +XLCC=`test $wx_compiler_xlc = yes && echo yes` +AC_LANG_POP(C) +]) + +dnl Loosely based on autoconf AC_PROG_CXX +AC_DEFUN([AC_WX_PROG_XLCXX], +[AC_LANG_PUSH(C++) +_AC_WX_LANG_COMPILER_XLC +XLCXX=`test $wx_compiler_xlc = yes && echo yes` +AC_LANG_POP(C++) +]) + + dnl =========================================================================== dnl macros to find the a file in the list of include/lib paths dnl =========================================================================== diff --git a/configure b/configure index 42fe59d96a..e871b34181 100755 --- a/configure +++ b/configure @@ -11656,6 +11656,79 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +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 whether we are using the IBM xlC C compiler" >&5 +echo $ECHO_N "checking whether we are using the IBM xlC C compiler... $ECHO_C" >&6 +if test "${wx_cv_c_compiler_xlc+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 () +{ +#ifndef __xlC__ + choke me +#endif + + ; + 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 + wx_compiler_xlc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +wx_compiler_xlc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + wx_cv_c_compiler_xlc=$wx_compiler_xlc + +fi +echo "$as_me:$LINENO: result: $wx_cv_c_compiler_xlc" >&5 +echo "${ECHO_T}$wx_cv_c_compiler_xlc" >&6 + +XLCC=`test $wx_compiler_xlc = yes && echo yes` +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +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 + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -12529,6 +12602,79 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +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 whether we are using the IBM xlC C++ compiler" >&5 +echo $ECHO_N "checking whether we are using the IBM xlC C++ compiler... $ECHO_C" >&6 +if test "${wx_cv_cxx_compiler_xlc+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 () +{ +#ifndef __xlC__ + choke me +#endif + + ; + 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 + wx_compiler_xlc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +wx_compiler_xlc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + wx_cv_cxx_compiler_xlc=$wx_compiler_xlc + +fi +echo "$as_me:$LINENO: result: $wx_cv_cxx_compiler_xlc" >&5 +echo "${ECHO_T}$wx_cv_cxx_compiler_xlc" >&6 + +XLCXX=`test $wx_compiler_xlc = yes && echo yes` +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +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 + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -12890,6 +13036,11 @@ fi +if test "x$XLCXX" = "xyes"; then + CXXFLAGS="$CXXFLAGS -qunique" +fi + + case "${host}" in powerpc-*-darwin* ) echo "$as_me:$LINENO: checking if __POWERPC__ is already defined" >&5 diff --git a/configure.in b/configure.in index 107823cab3..b887677eb9 100644 --- a/configure.in +++ b/configure.in @@ -1367,6 +1367,7 @@ if test "x$wx_cv_c_exto" '!=' "x"; then _AC_PROG_CC_G fi AC_BAKEFILE_PROG_MWCC +AC_WX_PROG_XLCC dnl is -traditional needed for correct compilations dnl adds -traditional for gcc if needed @@ -1390,6 +1391,7 @@ if test "x$wx_cv_cxx_exto" '!=' "x"; then _AC_PROG_CXX_G fi AC_BAKEFILE_PROG_MWCXX +AC_WX_PROG_XLCXX AC_LANG_RESTORE @@ -1504,6 +1506,13 @@ dnl ------------------------------------------------------------------------ dnl Platform specific tests dnl ------------------------------------------------------------------------ +dnl xlC needs -qunique (at least on AIX) so that one source file can be +dnl compiled to multiple object files and safely linked together. +if test "x$XLCXX" = "xyes"; then + CXXFLAGS="$CXXFLAGS -qunique" +fi + + dnl This case is for OS X vs. everything else case "${host}" in powerpc-*-darwin* ) -- 2.47.2