diff --git a/build/aclocal/bakefile-lang.m4 b/build/aclocal/bakefile-lang.m4 index 9b9607fcde..0d7f4c1be9 100644 --- a/build/aclocal/bakefile-lang.m4 +++ b/build/aclocal/bakefile-lang.m4 @@ -42,14 +42,14 @@ AC_LANG_POP(C++) dnl Based on autoconf _AC_LANG_COMPILER_GNU AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_XLC], [AC_CACHE_CHECK([whether we are using the IBM xlC _AC_LANG compiler], - [wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc], + [bakefile_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 + [bakefile_compiler_xlc=yes], + [bakefile_compiler_xlc=no]) + bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_xlc=$bakefile_compiler_xlc ]) ]) @@ -57,7 +57,7 @@ dnl Loosely based on autoconf AC_PROG_CC AC_DEFUN([AC_BAKEFILE_PROG_XLCC], [AC_LANG_PUSH(C) _AC_BAKEFILE_LANG_COMPILER_XLC -XLCC=`test $wx_cv_c_compiler_xlc = yes && echo yes` +XLCC=`test $bakefile_cv_c_compiler_xlc = yes && echo yes` AC_LANG_POP(C) ]) @@ -65,7 +65,7 @@ dnl Loosely based on autoconf AC_PROG_CXX AC_DEFUN([AC_BAKEFILE_PROG_XLCXX], [AC_LANG_PUSH(C++) _AC_BAKEFILE_LANG_COMPILER_XLC -XLCXX=`test $wx_cv_cxx_compiler_xlc = yes && echo yes` +XLCXX=`test $bakefile_cv_cxx_compiler_xlc = yes && echo yes` AC_LANG_POP(C++) ]) @@ -97,6 +97,10 @@ AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER], fi ]) +dnl recent versions of SGI mipsPro compiler define _SGI_COMPILER_VERSION +dnl +dnl NB: old versions define _COMPILER_VERSION but this could probably be +dnl defined by other compilers too so don't test for it to be safe AC_DEFUN([AC_BAKEFILE_PROG_SGICC], [ _AC_BAKEFILE_LANG_COMPILER(SGI, C, _SGI_COMPILER_VERSION, SGICC=yes) @@ -107,18 +111,49 @@ AC_DEFUN([AC_BAKEFILE_PROG_SGICXX], _AC_BAKEFILE_LANG_COMPILER(SGI, C++, _SGI_COMPILER_VERSION, SGICXX=yes) ]) -dnl Loosely based on autoconf AC_PROG_CC +dnl Sun compiler defines __SUNPRO_C/__SUNPRO_CC AC_DEFUN([AC_BAKEFILE_PROG_SUNCC], [ _AC_BAKEFILE_LANG_COMPILER(Sun, C, __SUNPRO_C, SUNCC=yes) ]) -dnl Loosely based on autoconf AC_PROG_CC AC_DEFUN([AC_BAKEFILE_PROG_SUNCXX], [ _AC_BAKEFILE_LANG_COMPILER(Sun, C++, __SUNPRO_CC, SUNCXX=yes) ]) +dnl Intel icc compiler defines __INTEL_COMPILER for both C and C++ +AC_DEFUN([AC_BAKEFILE_PROG_INTELCC], +[ + _AC_BAKEFILE_LANG_COMPILER(Intel, C, __INTEL_COMPILER, INTELCC=yes) +]) + +AC_DEFUN([AC_BAKEFILE_PROG_INTELCXX], +[ + _AC_BAKEFILE_LANG_COMPILER(Intel, C++, __INTEL_COMPILER, INTELCXX=yes) +]) + +dnl HP-UX aCC: see http://docs.hp.com/en/6162/preprocess.htm#macropredef +AC_DEFUN([AC_BAKEFILE_PROG_HPCC], +[ + _AC_BAKEFILE_LANG_COMPILER(HP, C, __HP_cc, HPCC=yes) +]) + +AC_DEFUN([AC_BAKEFILE_PROG_HPCXX], +[ + _AC_BAKEFILE_LANG_COMPILER(HP, C++, __HP_aCC, HPCXX=yes) +]) + +dnl Tru64 cc and cxx +AC_DEFUN([AC_BAKEFILE_PROG_COMPAQCC], +[ + _AC_BAKEFILE_LANG_COMPILER(Compaq, C, __DECC, COMPAQCC=yes) +]) + +AC_DEFUN([AC_BAKEFILE_PROG_COMPAQCXX], +[ + _AC_BAKEFILE_LANG_COMPILER(Compaq, C++, __DECCXX, COMPAQCXX=yes) +]) dnl =========================================================================== dnl macros to detect specialty compiler options @@ -126,7 +161,7 @@ dnl =========================================================================== dnl Figure out if we need to pass -ext o to compiler (MetroWerks) AC_DEFUN([AC_BAKEFILE_METROWERKS_EXTO], -[AC_CACHE_CHECK([if the _AC_LANG compiler requires -ext o], wx_cv_[]_AC_LANG_ABBREV[]_exto, +[AC_CACHE_CHECK([if the _AC_LANG compiler requires -ext o], bakefile_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 @@ -137,7 +172,7 @@ 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" + bakefile_cv_[]_AC_LANG_ABBREV[]_exto="-ext o" ;; *) ;; @@ -149,12 +184,12 @@ done], 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 "x$bakefile_cv_[]_AC_LANG_ABBREV[]_exto" '!=' "x"; then if test "[]_AC_LANG_ABBREV[]" = "c"; then - CFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CFLAGS" + CFLAGS="$bakefile_cv_[]_AC_LANG_ABBREV[]_exto $CFLAGS" fi if test "[]_AC_LANG_ABBREV[]" = "cxx"; then - CXXFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CXXFLAGS" + CXXFLAGS="$bakefile_cv_[]_AC_LANG_ABBREV[]_exto $CXXFLAGS" fi fi ]) dnl AC_DEFUN @@ -163,33 +198,61 @@ fi dnl =========================================================================== dnl Macros to do all of the compiler detections as one macro dnl =========================================================================== + +dnl check for different proprietary compilers depending on target platform +dnl _AC_BAKEFILE_PROG_COMPILER(LANG) +AC_DEFUN([_AC_BAKEFILE_PROG_COMPILER], +[ + AC_PROG_$1 + AC_BAKEFILE_PROG_INTEL$1 + dnl if we're using gcc, we can't be using any of incompatible compilers + if test "x$G$1" != "xyes"; then + if test "x$1" = "xC"; then + AC_BAKEFILE_METROWERKS_EXTO + if test "x$bakefile_cv_c_exto" '!=' "x"; then + unset ac_cv_prog_cc_g + _AC_PROG_CC_G + fi + fi + + dnl most of these compilers are only used under well-defined OS so + dnl don't waste time checking for them on other ones + case `uname -s` in + AIX*) + AC_BAKEFILE_PROG_XL$1 + ;; + + Darwin) + AC_BAKEFILE_PROG_MW$1 + AC_BAKEFILE_PROG_XL$1 + ;; + + IRIX*) + AC_BAKEFILE_PROG_SGI$1 + ;; + + HP-UX*) + AC_BAKEFILE_PROG_HP$1 + ;; + + OSF1) + AC_BAKEFILE_PROG_COMPAQ$1 + ;; + + SunOS) + AC_BAKEFILE_PROG_SUN$1 + ;; + esac + fi +]) + AC_DEFUN([AC_BAKEFILE_PROG_CC], [ - AC_PROG_CC - AC_BAKEFILE_METROWERKS_EXTO - dnl By the time we find out that we need -ext o some tests have failed. - if test "x$wx_cv_c_exto" '!=' "x"; then - unset ac_cv_prog_cc_g - _AC_PROG_CC_G - fi - AC_BAKEFILE_PROG_MWCC - AC_BAKEFILE_PROG_XLCC - AC_BAKEFILE_PROG_SGICC - AC_BAKEFILE_PROG_SUNCC + _AC_BAKEFILE_PROG_COMPILER(CC) ]) AC_DEFUN([AC_BAKEFILE_PROG_CXX], [ - AC_PROG_CXX - AC_BAKEFILE_METROWERKS_EXTO - dnl By the time we find out that we need -ext o some tests have failed. - 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_BAKEFILE_PROG_XLCXX - AC_BAKEFILE_PROG_SGICXX - AC_BAKEFILE_PROG_SUNCXX + _AC_BAKEFILE_PROG_COMPILER(CXX) ]) diff --git a/build/aclocal/bakefile.m4 b/build/aclocal/bakefile.m4 index ec92515635..b221ec0464 100644 --- a/build/aclocal/bakefile.m4 +++ b/build/aclocal/bakefile.m4 @@ -287,7 +287,7 @@ AC_DEFUN([AC_BAKEFILE_SHARED_LD], AC_TRY_COMPILE([], [ #ifndef __INTEL_COMPILER - #error Not icc + This is not ICC #endif ], bakefile_cv_prog_icc=yes, @@ -309,6 +309,12 @@ AC_DEFUN([AC_BAKEFILE_SHARED_LD], ;; *-*-darwin* ) + AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH + chmod +x shared-ld-sh + + SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o" + SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC" + dnl Most apps benefit from being fully binded (its faster and static dnl variables initialized at startup work). dnl This can be done either with the exe linker flag -Wl,-bind_at_load @@ -316,39 +322,32 @@ AC_DEFUN([AC_BAKEFILE_SHARED_LD], dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved dnl If using newer dev tools then there is a -single_module flag that - dnl we can use to do this, otherwise we'll need to use a helper + dnl we can use to do this for dylibs, otherwise we'll need to use a helper dnl script. Check the version of gcc to see which way we can go: - AC_CACHE_CHECK([for gcc 3.1 or later], wx_cv_gcc31, [ + AC_CACHE_CHECK([for gcc 3.1 or later], bakefile_cv_gcc31, [ AC_TRY_COMPILE([], [ #if (__GNUC__ < 3) || \ ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)) - #error old gcc + This is old gcc #endif ], [ - wx_cv_gcc31=yes + bakefile_cv_gcc31=yes ], [ - wx_cv_gcc31=no + bakefile_cv_gcc31=no ] ) ]) - if test "$wx_cv_gcc31" = "no"; then - AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH - chmod +x shared-ld-sh - + if test "$bakefile_cv_gcc31" = "no"; then dnl Use the shared-ld-sh helper script SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o" - SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o" SHARED_LD_CXX="$SHARED_LD_CC" - SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC" else dnl Use the -single_module flag and let the linker do it for us SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o" - SHARED_LD_MODULE_CC="\${CC} -bundle -single_module -headerpad_max_install_names -o" SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o" - SHARED_LD_MODULE_CXX="\${CXX} -bundle -single_module -headerpad_max_install_names -o" fi if test "x$GCC" == "xyes"; then @@ -360,20 +359,32 @@ AC_DEFUN([AC_BAKEFILE_SHARED_LD], ;; *-*-aix* ) - dnl at least gcc 2.95 warns that -fPIC is ignored when compiling - dnl each and every file under AIX which is annoying, so don't use - dnl it there (it's useless as AIX runs on position-independent - dnl architectures only anyhow) if test "x$GCC" = "xyes"; then - PIC_FLAG="" - SHARED_LD_CC="\$(CC) -shared ${PIC_FLAG} -o" - SHARED_LD_CXX="\$(CXX) -shared ${PIC_FLAG} -o" - else - dnl the abs path below used to be hardcoded here so I guess it must - dnl be some sort of standard location under AIX? + dnl at least gcc 2.95 warns that -fPIC is ignored when + dnl compiling each and every file under AIX which is annoying, + dnl so don't use it there (it's useless as AIX runs on + dnl position-independent architectures only anyhow) + PIC_FLAG="" + + dnl -bexpfull is needed by AIX linker to export all symbols (by + dnl default it doesn't export any and even with -bexpall it + dnl doesn't export all C++ support symbols, e.g. vtable + dnl pointers) but it's only available starting from 5.1 (with + dnl maintenance pack 2, whatever this is), see + dnl http://www-128.ibm.com/developerworks/eserver/articles/gnu.html + case "${BAKEFILE_HOST}" in + *-*-aix5* ) + LD_EXPFULL="-Wl,-bexpfull" + ;; + esac + + SHARED_LD_CC="\$(CC) -shared $LD_EXPFULL -o" + SHARED_LD_CXX="\$(CXX) -shared $LD_EXPFULL -o" + else + dnl FIXME: makeC++SharedLib is obsolete, what should we do for + dnl recent AIX versions? AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib, makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib) - dnl FIXME - what about makeCSharedLib? SHARED_LD_CC="$AIX_CC_LD -p 0 -o" SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o" fi @@ -392,7 +403,7 @@ AC_DEFUN([AC_BAKEFILE_SHARED_LD], PIC_FLAG="-KPIC" fi ;; - + *-*-cygwin* | *-*-mingw32* ) PIC_FLAG="" SHARED_LD_CC="\$(CC) -shared -o" @@ -407,7 +418,7 @@ AC_DEFUN([AC_BAKEFILE_SHARED_LD], AC_BAKEFILE_CREATE_FILE_DLLAR_SH chmod +x dllar.sh ;; - + powerpc-apple-macos* | \ *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | *-*-k*bsd*-gnu | \ *-*-sunos4* | \ @@ -503,44 +514,63 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE_DEPS], [ - AC_MSG_CHECKING([for dependency tracking method]) - DEPS_TRACKING=1 - - if test "x$GCC" = "xyes"; then - DEPSMODE=gcc - case "${BAKEFILE_HOST}" in - *-*-darwin* ) - dnl -cpp-precomp (the default) conflicts with -MMD option - dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html) - DEPSFLAG="-no-cpp-precomp -MMD" - ;; - * ) - DEPSFLAG="-MMD" - ;; - esac - AC_MSG_RESULT([gcc]) - elif test "x$MWCC" = "xyes"; then - DEPSMODE=mwcc - DEPSFLAG="-MM" - AC_MSG_RESULT([mwcc]) - elif test "x$SUNCC" = "xyes"; then - DEPSMODE=unixcc - DEPSFLAG="-xM1" - AC_MSG_RESULT([Sun cc]) - elif test "x$SGICC" = "xyes"; then - DEPSMODE=unixcc - DEPSFLAG="-M" - AC_MSG_RESULT([SGI cc]) - else - DEPS_TRACKING=0 - AC_MSG_RESULT([none]) - fi - - if test $DEPS_TRACKING = 1 ; then - AC_BAKEFILE_CREATE_FILE_BK_DEPS - chmod +x bk-deps - fi + AC_ARG_ENABLE([dependency-tracking], + AS_HELP_STRING([--disable-dependency-tracking], + [don't use dependency tracking even if the compiler can]), + [bk_use_trackdeps="$enableval"]) + AC_MSG_CHECKING([for dependency tracking method]) + + if test "x$bk_use_trackdeps" = "xno" ; then + DEPS_TRACKING=0 + AC_MSG_RESULT([disabled]) + else + DEPS_TRACKING=1 + + if test "x$GCC" = "xyes"; then + DEPSMODE=gcc + case "${BAKEFILE_HOST}" in + *-*-darwin* ) + dnl -cpp-precomp (the default) conflicts with -MMD option + dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html) + DEPSFLAG="-no-cpp-precomp -MMD" + ;; + * ) + DEPSFLAG="-MMD" + ;; + esac + AC_MSG_RESULT([gcc]) + elif test "x$MWCC" = "xyes"; then + DEPSMODE=mwcc + DEPSFLAG="-MM" + AC_MSG_RESULT([mwcc]) + elif test "x$SUNCC" = "xyes"; then + DEPSMODE=unixcc + DEPSFLAG="-xM1" + AC_MSG_RESULT([Sun cc]) + elif test "x$SGICC" = "xyes"; then + DEPSMODE=unixcc + DEPSFLAG="-M" + AC_MSG_RESULT([SGI cc]) + elif test "x$HPCC" = "xyes"; then + DEPSMODE=unixcc + DEPSFLAG="+make" + AC_MSG_RESULT([HP cc]) + elif test "x$COMPAQCC" = "xyes"; then + DEPSMODE=gcc + DEPSFLAG="-MD" + AC_MSG_RESULT([Compaq cc]) + else + DEPS_TRACKING=0 + AC_MSG_RESULT([none]) + fi + + if test $DEPS_TRACKING = 1 ; then + AC_BAKEFILE_CREATE_FILE_BK_DEPS + chmod +x bk-deps + fi + fi + AC_SUBST(DEPS_TRACKING) ]) @@ -592,26 +622,20 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE_RES_COMPILERS], [ - RESCOMP= - SETFILE= - case ${BAKEFILE_HOST} in *-*-cygwin* | *-*-mingw32* ) dnl Check for win32 resources compiler: - if test "$build" != "$host" ; then - RESCOMP=$host_alias-windres - else - AC_CHECK_PROG(RESCOMP, windres, windres, windres) - fi + AC_CHECK_TOOL(WINDRES, windres) ;; *-*-darwin* | powerpc-apple-macos* ) - AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez) + AC_CHECK_PROG(REZ, Rez, Rez, /Developer/Tools/Rez) AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile) ;; esac - AC_SUBST(RESCOMP) + AC_SUBST(WINDRES) + AC_SUBST(REZ) AC_SUBST(SETFILE) ]) @@ -630,6 +654,17 @@ AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS], [bk_use_pch="$enableval"]) GCC_PCH=0 + ICC_PCH=0 + USE_PCH=0 + + case ${BAKEFILE_HOST} in + *-*-cygwin* ) + dnl PCH support is broken in cygwin gcc because of unportable + dnl assumptions about mmap() in gcc code which make PCH generation + dnl fail erratically; disable PCH completely until this is fixed + bk_use_pch="no" + ;; + esac if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then if test "x$GCC" = "xyes"; then @@ -638,15 +673,16 @@ AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS], AC_TRY_COMPILE([], [ #if !defined(__GNUC__) || !defined(__GNUC_MINOR__) - #error "no pch support" + There is no PCH support #endif #if (__GNUC__ < 3) - #error "no pch support" + There is no PCH support #endif #if (__GNUC__ == 3) && \ ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \ - ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3))) - #error "no pch support" + ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3))) || \ + ( defined(__INTEL_COMPILER) ) + There is no PCH support #endif ], [ @@ -654,9 +690,23 @@ AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS], GCC_PCH=1 ], [ - AC_MSG_RESULT([no]) + AC_TRY_COMPILE([], + [ + #if !defined(__INTEL_COMPILER) || \ + (__INTEL_COMPILER < 800) + There is no PCH support + #endif + ], + [ + AC_MSG_RESULT([yes]) + ICC_PCH=1 + ], + [ + AC_MSG_RESULT([no]) + ]) ]) - if test $GCC_PCH = 1 ; then + if test $GCC_PCH = 1 -o $ICC_PCH = 1 ; then + USE_PCH=1 AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH chmod +x bk-make-pch fi @@ -664,6 +714,7 @@ AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS], fi AC_SUBST(GCC_PCH) + AC_SUBST(ICC_PCH) ]) @@ -694,6 +745,10 @@ AC_DEFUN([AC_BAKEFILE], AC_PREREQ(2.58) if test "x$BAKEFILE_HOST" = "x"; then + if test "x${host}" = "x" ; then + AC_MSG_ERROR([You must call the autoconf "CANONICAL_HOST" macro in your configure.ac (or .in) file.]) + fi + BAKEFILE_HOST="${host}" fi @@ -709,7 +764,7 @@ AC_DEFUN([AC_BAKEFILE], AC_BAKEFILE_DEPS AC_BAKEFILE_RES_COMPILERS - BAKEFILE_BAKEFILE_M4_VERSION="0.1.9" + BAKEFILE_BAKEFILE_M4_VERSION="0.2.0" dnl includes autoconf_inc.m4: $1 @@ -1259,7 +1314,12 @@ if test ${D}DEPSMODE = gcc ; then sed -e "s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d rm -f ${D}depfile else + # "g++ -MMD -o fooobj.o foosrc.cpp" produces fooobj.d depfile=\`basename ${D}objfile | sed -e 's/\\..*${D}/.d/g'\` + if test ! -f ${D}depfile ; then + # "cxx -MD -o fooobj.o foosrc.cpp" creates fooobj.o.d (Compaq C++) + depfile="${D}objfile.d" + fi if test -f ${D}depfile ; then sed -e "/^${D}objfile/!s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d rm -f ${D}depfile @@ -1267,11 +1327,7 @@ if test ${D}DEPSMODE = gcc ; then fi exit 0 elif test ${D}DEPSMODE = mwcc ; then - ${D}* - status=${D}? - if test ${D}{status} != 0 ; then - exit ${D}{status} - fi + ${D}* || exit ${D}? # Run mwcc again with -MM and redirect into the dep file we want # NOTE: We can't use shift here because we need ${D}* to be valid prevarg= @@ -1292,7 +1348,7 @@ elif test ${D}DEPSMODE = mwcc ; then ${D}* ${D}DEPSFLAG >${D}{DEPSDIR}/${D}{objfile}.d exit 0 elif test ${D}DEPSMODE = unixcc; then - ${D}* || exit + ${D}* || exit ${D}? # Run compiler again with deps flag and redirect into the dep file. # It doesn't work if the '-o FILE' option is used, but without it the # dependency file will contain the wrong name for the object. So it is @@ -1441,9 +1497,11 @@ header="${D}{2}" shift shift -compiler= -headerfile= +compiler="" +headerfile="" + while test ${D}{#} -gt 0; do + add_to_cmdline=1 case "${D}{1}" in -I* ) incdir=\`echo ${D}{1} | sed -e 's/-I\\(.*\\)/\\1/g'\` @@ -1451,13 +1509,19 @@ while test ${D}{#} -gt 0; do headerfile="${D}{incdir}/${D}{header}" fi ;; + -use-pch|-use_pch ) + shift + add_to_cmdline=0 + ;; esac - compiler="${D}{compiler} ${D}{1}" + if test ${D}add_to_cmdline = 1 ; then + compiler="${D}{compiler} ${D}{1}" + fi shift done if test "x${D}{headerfile}" = "x" ; then - echo "error: can't find header ${D}{header} in include paths" >2 + echo "error: can't find header ${D}{header} in include paths" >&2 else if test -f ${D}{outfile} ; then rm -f ${D}{outfile} @@ -1466,8 +1530,21 @@ else fi depsfile=".deps/\`echo ${D}{outfile} | tr '/.' '__'\`.d" mkdir -p .deps - # can do this because gcc is >= 3.4: - ${D}{compiler} -o ${D}{outfile} -MMD -MF "${D}{depsfile}" "${D}{headerfile}" + if test "x${GCC_PCH}" = "x1" ; then + # can do this because gcc is >= 3.4: + ${D}{compiler} -o ${D}{outfile} -MMD -MF "${D}{depsfile}" "${D}{headerfile}" + elif test "x${ICC_PCH}" = "x1" ; then + filename=pch_gen-${D}${D} + file=${D}{filename}.c + dfile=${D}{filename}.d + cat > ${D}file < ${D}depsfile && \\ + rm -f ${D}file ${D}dfile ${D}{filename}.o + fi exit ${D}{?} fi EOF