Mercurial > emacs
changeset 106009:e6af95c4c862
Use gcc-generated dependency files if we can (GNU Make and gcc required).
* Makefile.in: If AUTO_DEPEND is defined, make gcc generate
dependency files in deps/. Include those files into Makefile.
* config.in: Generated (AUTO_DEPEND).
* configure.in: --enable-autodepend is new. Check for GNU Make
and that gcc supports -MMD -MF. Define AUTO_DEPEND if we can use
gcc and GNU make to generate dependencies.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Sat, 14 Nov 2009 15:17:38 +0000 |
parents | 38f236a275ca |
children | feb898981e9a |
files | ChangeLog configure configure.in src/ChangeLog src/Makefile.in src/config.in |
diffstat | 6 files changed, 182 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Nov 14 15:15:32 2009 +0000 +++ b/ChangeLog Sat Nov 14 15:17:38 2009 +0000 @@ -1,3 +1,9 @@ +2009-11-14 Jan Djärv <jan.h.d@swipnet.se> + + * configure.in: --enable-autodepend is new. Check for GNU Make + and that gcc supports -MMD -MF. Define AUTO_DEPEND if we can use + gcc and GNU make to generate dependencies. + 2009-10-27 Glenn Morris <rgm@gnu.org> * make-dist: Make links to doc/lispintro/*.pdf.
--- a/configure Sat Nov 14 15:15:32 2009 +0000 +++ b/configure Sat Nov 14 15:17:38 2009 +0000 @@ -802,6 +802,7 @@ enable_locallisppath enable_checking enable_profiling +enable_autodepend enable_largefile with_x ' @@ -1465,6 +1466,9 @@ stringfreelist, xmallocoverrun, conslist --enable-profiling build emacs with profiling support. This might not work on all platforms + --enable-autodepend automatically generate dependencies to .h-files. + Requires GNU Make and Gcc. Enabled if GNU Make and + Gcc is found --disable-largefile omit support for large files Optional Packages: @@ -2424,6 +2428,14 @@ PROFILING_LDFLAGS= fi +# Check whether --enable-autodepend was given. +if test "${enable_autodepend+set}" = set; then + enableval=$enable_autodepend; ac_enable_autodepend="${enableval}" +else + ac_enable_autodepend=yes +fi + + #### Make srcdir absolute, if it isn't already. It's important to #### avoid running the path through pwd unnecessarily, since pwd can #### give you automounter prefixes, which can go away. We do all this @@ -9124,6 +9136,80 @@ fi +if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then + { $as_echo "$as_me:$LINENO: checking whether we are using GNU Make" >&5 +$as_echo_n "checking whether we are using GNU Make... " >&6; } + HAVE_GNU_MAKE=no + testval=`make --version 2>/dev/null | grep 'GNU Make'` + if test "x$testval" != x; then + HAVE_GNU_MAKE=yes + else + ac_enable_autodepend=no + fi + { $as_echo "$as_me:$LINENO: result: $HAVE_GNU_MAKE" >&5 +$as_echo "$HAVE_GNU_MAKE" >&6; } + if test $HAVE_GNU_MAKE = yes; then + { $as_echo "$as_me:$LINENO: checking whether gcc understands -MMD -MF" >&5 +$as_echo_n "checking whether gcc understands -MMD -MF... " >&6; } + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -MMD -MF deps.d" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_enable_autodepend=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$SAVE_CFLAGS" + test -f deps.d || ac_enable_autodepend=no + rm -rf deps.d + { $as_echo "$as_me:$LINENO: result: $ac_enable_autodepend" >&5 +$as_echo "$ac_enable_autodepend" >&6; } + fi + if test $ac_enable_autodepend = yes; then + +cat >>confdefs.h <<\_ACEOF +#define AUTO_DEPEND 1 +_ACEOF + + fi +fi + { $as_echo "$as_me:$LINENO: checking for long file names" >&5 $as_echo_n "checking for long file names... " >&6; } if test "${ac_cv_sys_long_file_names+set}" = set; then
--- a/configure.in Sat Nov 14 15:15:32 2009 +0000 +++ b/configure.in Sat Nov 14 15:17:38 2009 +0000 @@ -286,6 +286,13 @@ PROFILING_LDFLAGS= fi +AC_ARG_ENABLE(autodepend, +[AS_HELP_STRING([--enable-autodepend], + [automatically generate dependencies to .h-files. + Requires GNU Make and Gcc. Enabled if GNU Make and Gcc is + found])], +[ac_enable_autodepend="${enableval}"],[ac_enable_autodepend=yes]) + #### Make srcdir absolute, if it isn't already. It's important to #### avoid running the path through pwd unnecessarily, since pwd can #### give you automounter prefixes, which can go away. We do all this @@ -1229,6 +1236,32 @@ dnl check for Make feature AC_PROG_MAKE_SET +dnl check for GNU Make if we have GCC and autodepend is on. +if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then + AC_MSG_CHECKING([whether we are using GNU Make]) + HAVE_GNU_MAKE=no + testval=`make --version 2>/dev/null | grep 'GNU Make'` + if test "x$testval" != x; then + HAVE_GNU_MAKE=yes + else + ac_enable_autodepend=no + fi + AC_MSG_RESULT([$HAVE_GNU_MAKE]) + if test $HAVE_GNU_MAKE = yes; then + AC_MSG_CHECKING([whether gcc understands -MMD -MF]) + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -MMD -MF deps.d" + AC_TRY_COMPILE([], [], , ac_enable_autodepend=no) + CFLAGS="$SAVE_CFLAGS" + test -f deps.d || ac_enable_autodepend=no + rm -rf deps.d + AC_MSG_RESULT([$ac_enable_autodepend]) + fi + if test $ac_enable_autodepend = yes; then + AC_DEFINE(AUTO_DEPEND, 1, [Generate dependencies with gcc.]) + fi +fi + dnl checks for operating system services AC_SYS_LONG_FILE_NAMES
--- a/src/ChangeLog Sat Nov 14 15:15:32 2009 +0000 +++ b/src/ChangeLog Sat Nov 14 15:17:38 2009 +0000 @@ -1,3 +1,10 @@ +2009-11-14 Jan Djärv <jan.h.d@swipnet.se> + + * Makefile.in: If AUTO_DEPEND is defined, make gcc generate + dependency files in deps/. Include those files into Makefile. + + * config.in: Generated (AUTO_DEPEND). + 2009-11-13 Michael Albinus <michael.albinus@gmx.de> * dbusbind.c (Vdbus_registered_objects_table): Renamed from
--- a/src/Makefile.in Sat Nov 14 15:15:32 2009 +0000 +++ b/src/Makefile.in Sat Nov 14 15:17:38 2009 +0000 @@ -79,6 +79,10 @@ #define NOT_C_CODE #include "config.h" +#ifdef AUTO_DEPEND +DEPFLAGS = -MMD -MF deps/$*.d +#endif + /* Do not let the file name mktime.c get messed up. */ #ifdef mktime #undef mktime @@ -257,13 +261,19 @@ /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM since it may have -I options that should override those two. */ -ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${DBUS_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ +ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${DBUS_CFLAGS} ${CFLAGS} @FREETYPE_CFLAGS@ @FONTCONFIG_CFLAGS@ @LIBOTF_CFLAGS@ @M17N_FLT_CFLAGS@ ${DEPFLAGS} ALL_OBJC_CFLAGS=$(ALL_CFLAGS) @GNU_OBJC_CFLAGS@ .SUFFIXES: .m .c.o: +#ifdef AUTO_DEPEND + @test -d deps || mkdir deps +#endif $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< .m.o: +#ifdef AUTO_DEPEND + @test -d deps || mkdir deps +#endif $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $< #ifndef LIBX11_SYSTEM @@ -958,7 +968,7 @@ /* We do not use ALL_LDFLAGS because LD_SWITCH_SYSTEM and LD_SWITCH_MACHINE often contain options that have to do with using Emacs''s crt0, which are only good with temacs. */ -prefix-args${EXEEXT}: prefix-args.c $(config_h) +prefix-args${EXEEXT}: prefix-args.o $(config_h) $(CC) $(ALL_CFLAGS) $(LDFLAGS) ${srcdir}/prefix-args.c -o prefix-args #if defined (HAVE_X_WINDOWS) && defined (HAVE_X11) && defined (HAVE_MENUS) && ! defined (USE_GTK) @@ -1024,6 +1034,11 @@ @echo "Please run the `configure' script again." exit 1 +ecrt0.o: ecrt0.c $(config_h) + CRT0_COMPILE ${srcdir}/ecrt0.c +doc.o: buildobj.h + +#ifndef AUTO_DEPEND /* Nearly all the following files depend on lisp.h, but it is not included as a dependency because it is so often changed in ways that do not require any recompilation @@ -1056,8 +1071,6 @@ cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h $(config_h) \ msdos.h dispextern.h keyboard.h keymap.h pre-crt0.o: pre-crt0.c -ecrt0.o: ecrt0.c $(config_h) - CRT0_COMPILE ${srcdir}/ecrt0.c dbusbind.o: dbusbind.c termhooks.h frame.h keyboard.h lisp.h $(config_h) dired.o: dired.c commands.h buffer.h lisp.h $(config_h) character.h charset.h \ coding.h regex.h systime.h blockinput.h atimer.h @@ -1066,8 +1079,7 @@ disptab.h indent.h $(INTERVALS_H) \ xterm.h blockinput.h atimer.h character.h msdos.h composite.h keyboard.h \ syssignal.h lisp.h $(config_h) -doc.o: doc.c lisp.h $(config_h) epaths.h buffer.h keyboard.h keymap.h character.h \ - buildobj.h +doc.o: doc.c lisp.h $(config_h) epaths.h buffer.h keyboard.h keymap.h character.h doprnt.o: doprnt.c character.h lisp.h $(config_h) dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \ msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \ @@ -1252,6 +1264,8 @@ textprop.o: textprop.c buffer.h window.h dispextern.h $(INTERVALS_H) \ lisp.h $(config_h) +#endif /* ! AUTO_DEPEND */ + /* System-specific programs to be made. OTHER_FILES select which of these should be compiled. */ @@ -1287,6 +1301,7 @@ rm -f buildobj.h clean: mostlyclean rm -f emacs-*.*.*${EXEEXT} emacs${EXEEXT} + -rm -rf deps #ifdef HAVE_NS rm -fr ${ns_appdir} #endif @@ -1385,3 +1400,8 @@ #endif /* ! defined (CANNOT_DUMP) */ @: Compile some files earlier to speed up further compilation. cd ../lisp; $(MAKE) $(MFLAGS) compile-first EMACS=${bootstrap_exe} + +#ifdef AUTO_DEPEND +ALLOBJS=$(STARTFILES) ${obj} ${otherobj} prefix-args.o +-include $(ALLOBJS:%.o=deps/%.d) +#endif
--- a/src/config.in Sat Nov 14 15:15:32 2009 +0000 +++ b/src/config.in Sat Nov 14 15:17:38 2009 +0000 @@ -27,6 +27,9 @@ #define EMACS_CONFIG_H +/* Generate dependencies with gcc. */ +#undef AUTO_DEPEND + /* Define to 1 if the mktime function is broken. */ #undef BROKEN_MKTIME @@ -828,6 +831,9 @@ /* Define to 1 if you don't have struct exception in math.h. */ #undef NO_MATHERR +/* Define to 1 if `NSInteger' is defined. */ +#undef NS_HAVE_NSINTEGER + /* Define to 1 if you are using NS windowing under MacOS X. */ #undef NS_IMPL_COCOA @@ -921,21 +927,9 @@ XPointer or XPointer*. */ #undef XRegisterIMInstantiateCallback_arg6 -/* Define to 1 if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif - /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif - /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ #undef _LARGEFILE_SOURCE @@ -952,16 +946,27 @@ /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE -/* Enable extensions on Solaris. */ +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif + /* Define to rpl_ if the getopt replacement functions and variables should be used. */