1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

check whether system type is the same as stored in the cache (full

stand-alone macro, candidate for inclusion in the next release of autoconf)

create configure flag --enable-maintainer-mode, that enables automatic
rebuilding of configure from configure.in and aclocal.m4, and of
config.h.in based on acconfig.h.  This assumes autoconf and autoheader
are available.  Maintainer mode also introduces automatic dependency
tracking of include files, but it depends on features provided by gcc
and GNU make, so you must not enable maintainer mode if you are not
using any of these
This commit is contained in:
Alexandre Oliva -
parent f123172c42
commit 64cba1cc8e
4 changed files with 475 additions and 330 deletions

View File

@ -201,9 +201,12 @@ CHECK:
@echo "Using FLAGS = $(FLAGS)"
@echo "Using LIBS = $(LIBS)"
.c.o: $(INCLUDES)
.c.o: @MAINT@ .deps/.dummy
@echo Compiling $*.c
@$(CC) -I. -I$(srcdir) $(FLAGS) -c $< -o $@
@$(CC) -I. -I$(srcdir) $(FLAGS) -c $< -o $@ \
@MAINT@ -Wp,-MD,.deps/`echo $* | sed s,/,_,g`.P && : >.deps/.stamp
# the line above is for atomatic dependency tracking
# it will only work with GNU make, gcc and --enable-maintainer-mode
bin/smbd: $(SMBD_OBJ)
@echo Linking $@
@ -301,7 +304,7 @@ uninstallcp:
@$(SHELL) $(srcdir)/script/uninstallcp.sh $(CODEPAGEDIR) $(CODEPAGELIST)
clean:
-rm -f core */*~ *~ */*.o
-rm -f core */*~ *~ */*.o
proto:
@echo rebuilding include/proto.h
@ -319,6 +322,7 @@ realclean: clean
distclean: realclean
-rm -f include/config.h include/stamp-h */dummy Makefile
-rm -f config.status config.cache
-rm -rf .deps
# this target is really just for my use. It only works on a limited
# range of machines and is used to produce a list of potentially
@ -328,6 +332,14 @@ finddead:
nm */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt
comm -13 nmused.txt nmfns.txt
# Rules for maintainers (--enable-maintainer-mode)
AUTOCONF=@AUTOCONF@
AUTOHEADER=@AUTOHEADER@
# when configure.in is updated, reconfigure
$(srcdir)/configure: @MAINT@ $(srcdir)/configure.in $(srcdir)/aclocal.m4
cd $(srcdir) && $(AUTOCONF)
config.status: $(srcdir)/configure
$(SHELL) ./config.status --recheck
@ -341,10 +353,24 @@ include/config.h: include/stamp-h
include/stamp-h: $(srcdir)/include/config.h.in config.status
CONFIG_FILES= CONFIG_HEADERS=include/config.h $(SHELL) ./config.status
@ls -l config.status $(srcdir)/include/config.h.in > include/stamp-h
@echo > include/stamp-h
$(srcdir)/include/config.h.in: $(srcdir)/include/stamp-h.in
@:
$(srcdir)/include/stamp-h.in: $(srcdir)/acconfig.h $(srcdir)/configure.in
@cd $(srcdir) && ls -l acconfig.h configure.in > include/stamp-h.in
$(srcdir)/include/stamp-h.in: @MAINT@ $(srcdir)/acconfig.h $(srcdir)/configure.in
cd $(srcdir) && $(AUTOHEADER)
@cd $(srcdir) && echo > include/stamp-h.in
# automatic dependency tracking rules
.deps/.dummy:
@-if test ! -d .deps; then rm -rf .deps; mkdir .deps; fi
@: >$@
.deps/.stamp: .deps/.dummy
@:
.deps/.P: .deps/.stamp
@-cat .deps/*.P >$@ 2>/dev/null
@MAINT@-include .deps/.P

36
source/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,36 @@
dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)]
dnl if the cache file is inconsistent with the current host,
dnl target and build system types, execute CMD or print a default
dnl error message.
AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [
AC_REQUIRE([AC_CANONICAL_SYSTEM])
AC_MSG_CHECKING([config.cache system type])
if { test x"${ac_cv_host_system_type+set}" = x"set" &&
test x"$ac_cv_host_system_type" != x"$host"; } ||
{ test x"${ac_cv_build_system_type+set}" = x"set" &&
test x"$ac_cv_build_system_type" != x"$build"; } ||
{ test x"${ac_cv_target_system_type+set}" = x"set" &&
test x"$ac_cv_target_system_type" != x"$target"; }; then
AC_MSG_RESULT([different])
ifelse($#, 1, [$1],
[AC_MSG_ERROR(["you must remove config.cache and restart configure"])])
else
AC_MSG_RESULT([same])
fi
ac_cv_host_system_type="$host"
ac_cv_build_system_type="$build"
ac_cv_target_system_type="$target"
])
dnl based on Automake's maintainer mode
AC_DEFUN(SAMBA_MAINTAINER_MODE,[
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable some make rules for maintainers],
maint_mode=$enableval, maint_mode=no)
if test x"$maint_mode" = x"yes"; then MAINT=; else MAINT='#'; fi
AC_SUBST(MAINT)
AC_PATH_PROG(AUTOCONF, autoconf, autoconf)
AC_SUBST(AUTOCONF)
AC_PATH_PROG(AUTOHEADER, autoheader, autoheader)
AC_SUBST(AUTOHEADER)
])

721
source/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -22,13 +22,8 @@ case "$host_os" in
*next2*) AC_DEFINE(NEXT2);;
esac
if test x"$ac_cv_canonical_host" != x &&
test x"$ac_cv_canonical_host" != x"$host"; then
echo "system config has changed - remove config.cache"; exit 1;
fi
AC_CACHE_VAL(ac_cv_canonical_host, ac_cv_canonical_host=$host;)
AC_VALIDATE_CACHE_SYSTEM_TYPE
SAMBA_MAINTAINER_MODE
AC_INLINE
AC_HEADER_STDC
@ -810,7 +805,6 @@ AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
echo "configure OK";,
AC_MSG_ERROR([summary failure. Aborting config]),:)
AC_OUTPUT(Makefile tests/dummy client/dummy lib/dummy ubiqx/dummy
web/dummy param/dummy nmbd/dummy smbd/dummy rpc_server/dummy
rpc_client/dummy rpc_parse/dummy locking/dummy passdb/dummy