Complete.Org: Mailing Lists: Archives: freeciv-dev: December 1998:
[Freeciv-Dev] configure and dependencies
Home

[Freeciv-Dev] configure and dependencies

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] configure and dependencies
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Sun, 13 Dec 1998 16:57:26 +1100

The configure build process has a problem with the CVS versions
that you essentially need to be using gcc and gmake, else the 
rules to calculate source dependencies create problems.  (Maybe 
some other make's and cc's work, but eg Solaris make and cc don't.)  
(I believe this problem is essentially a deficiency with automake.)

For the release tar, the dependencies are folded into the Makefile.in
files, so there is no requirement for users of the release versions 
to use gcc and gmake, but its a bit annoying to have this requirement 
for the CVS and shapshot versions.

The attached patch adds a configure option --disable-cvs-deps
which mangles the Makefiles to remove the offending parts.
(Tested with Solaris make and cc.)  If you don't specify this
option, configure decides based on whether gcc is being used or
not.  In principle it should probably also check for gmake, but
that's more difficult; the user must specify --disbale-cvs-deps
manually in the case that an unsificient make is being used 
with gcc.

Note that with this patch, if the dependencies are disabled, then
if the .h files change for any reason, the user should do a 
"make clean" before doing "make" to ensure everything is 
compiled correctly.  If --disable-cvs-deps is used with a release 
distribution, the makefiles (which are already ok) are not actually 
changed because the sed regex's don't match.

-- David

(You need to have and re-reun autoconf etc after applying this patch.)
diff -u -r --exclude-from exclude_auto -N freeciv-cvs/configure.in 
freeciv-mod/configure.in
--- freeciv-cvs/configure.in    Sat Dec 12 15:18:03 1998
+++ freeciv-mod/configure.in    Sun Dec 13 16:17:20 1998
@@ -74,6 +74,12 @@
 esac], [server=true])
 AM_CONDITIONAL(SERVER, test x$server = xtrue)
 
+AC_ARG_ENABLE(cvs_deps,
+       [  --disable-cvs-deps      remove cvs-source deps calcs (require 
gmake,gcc)],,
+       enable_cvs_deps="maybe"
+)
+CVS_DEPS=$enable_cvs_deps
+AC_SUBST(CVS_DEPS)
 
 dnl Checks for programs.
 AC_PROG_AWK
@@ -91,6 +97,15 @@
    CFLAGS="$CFLAGS -Wall"
 fi
 
+if test "$CVS_DEPS" = "maybe"; then
+   dnl Should also check for gmake?
+   if test -n "$GCC"; then
+      CVS_DEPS="yes"
+   else
+      CVS_DEPS="no"
+   fi
+fi
+
 if test x$client = xtrue; then
     dnl Checks for X:
     AC_PATH_XTRA
@@ -182,4 +197,4 @@
 FC_EXPAND_DIR(FREECIV_DATADIR, "$datadir/freeciv")
 AC_DEFINE_UNQUOTED(FREECIV_DATADIR, "$FREECIV_DATADIR")
 
-AC_OUTPUT(Makefile data/Makefile common/Makefile ai/Makefile client/Makefile 
server/Makefile)
+AC_OUTPUT(Makefile data/Makefile common/Makefile ai/Makefile client/Makefile 
server/Makefile undep.sh, [ chmod +x undep.sh ; ./undep.sh ])
diff -u -r --exclude-from exclude_auto -N freeciv-cvs/undep.sh.in 
freeciv-mod/undep.sh.in
--- freeciv-cvs/undep.sh.in     Thu Jan  1 10:00:00 1970
+++ freeciv-mod/undep.sh.in     Sun Dec 13 16:27:17 1998
@@ -0,0 +1,52 @@
+#!/bin/sh
+# @configure_input@
+
+# Modifies Makefile's (as produced by configure for CVS sources) 
+# in source subdirs to remove deps stuff which can upset some make 
+# programs and C compilers.  (GNU make and gcc work, maybe some 
+# others work too...)
+# To get the original Makefile's back, just re-run configure.
+# Running this on a "release" distribution (where the deps are
+# done differently) should safely do nothing. 
+
+CVS_DEPS=@CVS_DEPS@
+
+if test "$CVS_DEPS" = "yes"; then
+    exit
+fi
+
+@CLIENT_TRUE@CSUBDIRS="client"
+@CLIENT_FALSE@CSUBDIRS=""
+
+@SERVER_TRUE@SSUBDIRS="ai server"
+@SERVER_FALSE@SSUBDIRS=""
+
+SUBDIRS="common $SSUBDIRS $CSUBDIRS"
+
+for subdir in $SUBDIRS ; do
+
+if test ! -d $subdir; then
+   echo "No directory $subdir"
+   continue
+fi
+
+name=$subdir/Makefile
+
+if test ! -r $name; then
+    echo "No file $name"
+    continue
+fi
+
+echo "removing cvs-deps from $name"
+
+mv -f $name $name.bak
+
+sed '
+s/^DEPS_MAGIC.*//
+s/^-include $(DEP_FILES)//
+s/^%\.o: %\.c/.c.o:/
+s/\@echo\ '"'"'$(COMPILE) -c $<'"'"'; \\/$(COMPILE) -c $</
+s/$(COMPILE) -Wp,-MD,\.deps\/$(\*F)\.P -c $<//
+' $name.bak > $name
+
+done

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] configure and dependencies, David Pfitzner <=