xlc: avoid preprocessor definition usage when linking

pull/6/head
Yang Tse 14 years ago
parent f9b24e590c
commit 45ec020795
  1. 34
      m4/cares-compilers.m4

@ -1,7 +1,6 @@
#*************************************************************************** #***************************************************************************
# $Id$
# #
# Copyright (C) 2009-2010 by Daniel Stenberg et al # Copyright (C) 2009-2011 by Daniel Stenberg et al
# #
# Permission to use, copy, modify, and distribute this software and its # Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided # documentation for any purpose and without fee is hereby granted, provided
@ -16,7 +15,7 @@
#*************************************************************************** #***************************************************************************
# File version for 'aclocal' use. Keep it a single number. # File version for 'aclocal' use. Keep it a single number.
# serial 65 # serial 66
dnl CARES_CHECK_COMPILER dnl CARES_CHECK_COMPILER
@ -36,6 +35,8 @@ AC_DEFUN([CARES_CHECK_COMPILER], [
flags_opt_yes="unknown" flags_opt_yes="unknown"
flags_opt_off="unknown" flags_opt_off="unknown"
# #
flags_prefer_cppflags="no"
#
CARES_CHECK_COMPILER_DEC_C CARES_CHECK_COMPILER_DEC_C
CARES_CHECK_COMPILER_HPUX_C CARES_CHECK_COMPILER_HPUX_C
CARES_CHECK_COMPILER_IBM_C CARES_CHECK_COMPILER_IBM_C
@ -206,6 +207,7 @@ AC_DEFUN([CARES_CHECK_COMPILER_IBM_C], [
flags_opt_all="$flags_opt_all -qoptimize=5" flags_opt_all="$flags_opt_all -qoptimize=5"
flags_opt_yes="-O2" flags_opt_yes="-O2"
flags_opt_off="-qnooptimize" flags_opt_off="-qnooptimize"
flags_prefer_cppflags="yes"
else else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
fi fi
@ -582,15 +584,15 @@ AC_DEFUN([CARES_SET_COMPILER_BASIC_OPTS], [
IBM_C) IBM_C)
# #
dnl Ensure that compiler optimizations are always thread-safe. dnl Ensure that compiler optimizations are always thread-safe.
tmp_CFLAGS="$tmp_CFLAGS -qthreaded" tmp_CPPFLAGS="$tmp_CPPFLAGS -qthreaded"
dnl Disable type based strict aliasing optimizations, using worst dnl Disable type based strict aliasing optimizations, using worst
dnl case aliasing assumptions when compiling. Type based aliasing dnl case aliasing assumptions when compiling. Type based aliasing
dnl would restrict the lvalues that could be safely used to access dnl would restrict the lvalues that could be safely used to access
dnl a data object. dnl a data object.
tmp_CFLAGS="$tmp_CFLAGS -qnoansialias" tmp_CPPFLAGS="$tmp_CPPFLAGS -qnoansialias"
dnl Force compiler to stop after the compilation phase, without dnl Force compiler to stop after the compilation phase, without
dnl generating an object code file when compilation has errors. dnl generating an object code file when compilation has errors.
tmp_CFLAGS="$tmp_CFLAGS -qhalt=e" tmp_CPPFLAGS="$tmp_CPPFLAGS -qhalt=e"
;; ;;
# #
INTEL_UNIX_C) INTEL_UNIX_C)
@ -716,8 +718,13 @@ AC_DEFUN([CARES_SET_COMPILER_DEBUG_OPTS], [
tmp_options="$flags_dbg_off" tmp_options="$flags_dbg_off"
fi fi
# #
if test "$flags_prefer_cppflags" = "yes"; then
CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
CFLAGS="$tmp_CFLAGS"
else
CPPFLAGS="$tmp_CPPFLAGS" CPPFLAGS="$tmp_CPPFLAGS"
CFLAGS="$tmp_CFLAGS $tmp_options" CFLAGS="$tmp_CFLAGS $tmp_options"
fi
squeeze CPPFLAGS squeeze CPPFLAGS
squeeze CFLAGS squeeze CFLAGS
CARES_COMPILER_WORKS_IFELSE([ CARES_COMPILER_WORKS_IFELSE([
@ -792,8 +799,13 @@ AC_DEFUN([CARES_SET_COMPILER_OPTIMIZE_OPTS], [
AC_MSG_CHECKING([if compiler accepts optimizer disabling options]) AC_MSG_CHECKING([if compiler accepts optimizer disabling options])
tmp_options="$flags_opt_off" tmp_options="$flags_opt_off"
fi fi
if test "$flags_prefer_cppflags" = "yes"; then
CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
CFLAGS="$tmp_CFLAGS"
else
CPPFLAGS="$tmp_CPPFLAGS" CPPFLAGS="$tmp_CPPFLAGS"
CFLAGS="$tmp_CFLAGS $tmp_options" CFLAGS="$tmp_CFLAGS $tmp_options"
fi
squeeze CPPFLAGS squeeze CPPFLAGS
squeeze CFLAGS squeeze CFLAGS
CARES_COMPILER_WORKS_IFELSE([ CARES_COMPILER_WORKS_IFELSE([
@ -943,11 +955,17 @@ AC_DEFUN([CARES_SET_COMPILER_WARNING_OPTS], [
tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement" tmp_CFLAGS="$tmp_CFLAGS -Wdeclaration-after-statement"
fi fi
# #
dnl Only gcc 4.2 or later
if test "$compiler_num" -ge "402"; then
tmp_CFLAGS="$tmp_CFLAGS -Wcast-align"
fi
#
dnl Only gcc 4.3 or later dnl Only gcc 4.3 or later
if test "$compiler_num" -ge "403"; then if test "$compiler_num" -ge "403"; then
tmp_CFLAGS="$tmp_CFLAGS -Wtype-limits -Wold-style-declaration" tmp_CFLAGS="$tmp_CFLAGS -Wtype-limits -Wold-style-declaration"
tmp_CFLAGS="$tmp_CFLAGS -Wmissing-parameter-type -Wempty-body" tmp_CFLAGS="$tmp_CFLAGS -Wmissing-parameter-type -Wempty-body"
tmp_CFLAGS="$tmp_CFLAGS -Wclobbered -Wignored-qualifiers" tmp_CFLAGS="$tmp_CFLAGS -Wclobbered -Wignored-qualifiers"
tmp_CFLAGS="$tmp_CFLAGS -Wconversion -Wno-sign-conversion -Wvla"
fi fi
# #
fi fi
@ -1225,12 +1243,12 @@ AC_DEFUN([CARES_CHECK_CURLDEBUG], [
if test "$want_curldebug" = "yes"; then if test "$want_curldebug" = "yes"; then
dnl TODO: Verify if the BUILDING_LIBCURL definition is still required. dnl TODO: Verify if the BUILDING_LIBCURL definition is still required.
AC_DEFINE(BUILDING_LIBCURL, 1, [when building as static part of libcurl]) AC_DEFINE(BUILDING_LIBCURL, 1, [when building as static part of libcurl])
CPPFLAGS="$CPPFLAGS -DCURLDEBUG" CPPFLAGS="-DCURLDEBUG $CPPFLAGS"
squeeze CPPFLAGS squeeze CPPFLAGS
fi fi
# #
if test "$want_debug" = "yes"; then if test "$want_debug" = "yes"; then
CPPFLAGS="$CPPFLAGS -DDEBUGBUILD" CPPFLAGS="-DDEBUGBUILD $CPPFLAGS"
squeeze CPPFLAGS squeeze CPPFLAGS
fi fi
]) ])

Loading…
Cancel
Save