X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2eef85139b69a67ca067e5eba6b85336d21ad0dc..ef316e23c9a67ab20180f3a07bd78476a6caa69a:/build/aclocal/bakefile.m4 diff --git a/build/aclocal/bakefile.m4 b/build/aclocal/bakefile.m4 index be50aa5d17..944b485467 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,15 +309,18 @@ 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 dnl or with a double stage link in order to create a single module dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved - SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o" - SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC" - dnl If using newer dev tools then there is a -single_module flag that 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: @@ -326,7 +329,7 @@ AC_DEFUN([AC_BAKEFILE_SHARED_LD], [ #if (__GNUC__ < 3) || \ ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)) - #error old gcc + This is old gcc #endif ], [ @@ -338,9 +341,6 @@ AC_DEFUN([AC_BAKEFILE_SHARED_LD], ) ]) if test "$bakefile_cv_gcc31" = "no"; then - AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH - chmod +x shared-ld-sh - dnl Use the shared-ld-sh helper script SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o" SHARED_LD_CXX="$SHARED_LD_CC" @@ -360,29 +360,29 @@ AC_DEFUN([AC_BAKEFILE_SHARED_LD], *-*-aix* ) if test "x$GCC" = "xyes"; then - 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? + 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) SHARED_LD_CC="$AIX_CC_LD -p 0 -o" @@ -403,7 +403,7 @@ AC_DEFUN([AC_BAKEFILE_SHARED_LD], PIC_FLAG="-KPIC" fi ;; - + *-*-cygwin* | *-*-mingw32* ) PIC_FLAG="" SHARED_LD_CC="\$(CC) -shared -o" @@ -418,9 +418,10 @@ 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 | \ + *-*-mirbsd* | \ *-*-sunos4* | \ *-*-osf* | \ *-*-dgux5* | \ @@ -430,7 +431,8 @@ AC_DEFUN([AC_BAKEFILE_SHARED_LD], ;; *) - AC_MSG_ERROR(unknown system type $BAKEFILE_HOST.) + dnl wxWidgets-specific: allow unknown Unix systems + dnl AC_MSG_ERROR(unknown system type $BAKEFILE_HOST.) esac if test "x$PIC_FLAG" != "x" ; then @@ -514,53 +516,69 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE_DEPS], [ + 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]) - 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 + BK_DEPS="" + if test "x$bk_use_trackdeps" = "xno" ; then DEPS_TRACKING=0 - AC_MSG_RESULT([none]) - fi + AC_MSG_RESULT([disabled]) + else + DEPS_TRACKING=1 - if test $DEPS_TRACKING = 1 ; then - AC_BAKEFILE_CREATE_FILE_BK_DEPS - chmod +x bk-deps + 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 + dnl FIXME: make this $(top_builddir)/bk-deps once autoconf-2.60 + dnl is required (and so top_builddir is never empty): + BK_DEPS="`pwd`/bk-deps" + fi fi AC_SUBST(DEPS_TRACKING) + AC_SUBST(BK_DEPS) ]) dnl --------------------------------------------------------------------------- @@ -579,7 +597,19 @@ AC_DEFUN([AC_BAKEFILE_CHECK_BASIC_STUFF], AC_PROG_MAKE_SET AC_SUBST(MAKE_SET) - AC_CHECK_TOOL(AR, ar, ar) + if test "x$SUNCXX" = "xyes"; then + dnl Sun C++ compiler requires special way of creating static libs; + dnl see here for more details: + dnl https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1229751&group_id=9863 + AR=${AR:-"$CXX"} + AC_SUBST(AR) + AROPTIONS=${AROPTIONS:-"-xar -o"} + else + AC_CHECK_TOOL(AR, ar, ar) + AROPTIONS=rcu + fi + AC_SUBST(AROPTIONS) + AC_CHECK_TOOL(STRIP, strip, :) AC_CHECK_TOOL(NM, nm, :) @@ -589,7 +619,10 @@ AC_DEFUN([AC_BAKEFILE_CHECK_BASIC_STUFF], dnl use it there INSTALL_DIR="mkdir -p" ;; - *) INSTALL_DIR="$INSTALL -d" + * ) + dnl we must refer to makefile's $(INSTALL) variable and not + dnl current value of shell variable, hence the single quoting: + INSTALL_DIR='$(INSTALL) -d' ;; esac AC_SUBST(INSTALL_DIR) @@ -611,26 +644,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) ]) @@ -649,6 +676,18 @@ AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS], [bk_use_pch="$enableval"]) GCC_PCH=0 + ICC_PCH=0 + USE_PCH=0 + BK_MAKE_PCH="" + + 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 @@ -657,15 +696,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 ], [ @@ -673,16 +713,36 @@ 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 + dnl FIXME: make this $(top_builddir)/bk-make-pch once + dnl autoconf-2.60 is required (and so top_builddir is + dnl never empty): + BK_MAKE_PCH="`pwd`/bk-make-pch" fi fi fi AC_SUBST(GCC_PCH) + AC_SUBST(ICC_PCH) + AC_SUBST(BK_MAKE_PCH) ]) @@ -710,9 +770,13 @@ dnl --------------------------------------------------------------------------- AC_DEFUN([AC_BAKEFILE], [ - AC_PREREQ(2.58) + 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 @@ -728,7 +792,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.1" dnl includes autoconf_inc.m4: $1 @@ -1461,9 +1525,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'\` @@ -1471,13 +1537,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} @@ -1486,8 +1558,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