SHARED_LD_MODULE_CC="$SHARED_LD_CC"
fi
if test "x$SHARED_LD_MODULE_CXX" = "x" ; then
- SHARED_LD_MODULE_CC="$SHARED_LD_CXX"
+ SHARED_LD_MODULE_CXX="$SHARED_LD_CXX"
fi
AC_SUBST(SHARED_LD_CC)
cat <<EOF >bk-deps
#!/bin/sh
-# This script is part of Bakefile (http://bakefile.sf.net) autoconf script.
-# It is used to track C/C++ files dependencies in portable way.
+# This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
+# script. It is used to track C/C++ files dependencies in portable way.
#
# Permission is given to use this file in any way.
AC_SUBST(SETFILE)
])
+dnl ---------------------------------------------------------------------------
+dnl AC_BAKEFILE_PRECOMP_HEADERS
+dnl
+dnl Check for precompiled headers support (GCC >= 3.4)
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN(AC_BAKEFILE_PRECOMP_HEADERS,
+[
+
+ AC_ARG_ENABLE([precomp-headers],
+ [ --disable-precomp-headers don't use precompiled headers even if compiler can],
+ [bk_use_pch="$enableval"])
+
+ GCC_PCH=0
+
+ if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then
+ if test "x$GCC" = "xyes"; then
+ dnl test if we have gcc-3.4:
+ AC_MSG_CHECKING([if the compiler supports precompiled headers])
+ AC_TRY_COMPILE([],
+ [
+ #if !defined(__GNUC__) || !defined(__GNUC_MINOR__) || \
+ (__GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
+ #error "no pch support"
+ #endif
+ ],
+ [
+ AC_MSG_RESULT([yes])
+ dnl FIXME - this is temporary, till .gch dependencies
+ dnl are fixed in generated Makefiles
+ CPPFLAGS="-fpch-deps $CPPFLAGS"
+ GCC_PCH=1
+ ],
+ [
+ AC_MSG_RESULT([no])
+ ])
+ if test $GCC_PCH = 1 ; then
+ cat <<EOF >bk-make-pch
+#!/bin/sh
+
+# This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf
+# script. It is used to generated precompiled headers.
+#
+# Permission is given to use this file in any way.
+
+outfile="\${1}"
+header="\${2}"
+shift
+shift
+
+compiler=
+headerfile=
+while test \${#} -gt 0; do
+ case "\${1}" in
+ -I* )
+ incdir=\`echo \${1} | sed -e 's/-I\(.*\)/\1/g'\`
+ if test "x\${headerfile}" = "x" -a -f "\${incdir}/\${header}" ; then
+ headerfile="\${incdir}/\${header}"
+ fi
+ ;;
+ esac
+ compiler="\${compiler} \${1}"
+ shift
+done
+
+if test "x\${headerfile}" = "x" ; then
+ echo "error: can't find header \${header} in include paths" >2
+else
+ if test -f \${outfile} ; then
+ rm -f \${outfile}
+ else
+ mkdir -p \`dirname \${outfile}\`
+ fi
+ depsfile=".deps/\`basename \${outfile}\`.d"
+ mkdir -p .deps
+ # can do this because gcc is >= 3.4:
+ \${compiler} -o \${outfile} -MMD -MF "\${depsfile}" "\${headerfile}"
+ exit \${?}
+fi
+EOF
+ chmod +x bk-make-pch
+ fi
+ fi
+ fi
+
+ AC_SUBST(GCC_PCH)
+])
+
+
+
dnl ---------------------------------------------------------------------------
dnl AC_BAKEFILE
dnl