This is the mail archive of the mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

repost of "tiny winsup config patch"

Cygwin developers,

I've re-posting this patch because it fixes some annoying problems when 
you try to build winsup snapshots with incompatible version of newlib 
installed. Please consider it for inclusion. 

It solves two problems when building the utils:

- makes sure that the INCLUDES point to the current tree before looking
  at the installed copy which may be incompatible.

- never use LDFLAGS in a sub-Makefile. 

Winsup checks for newlib in the build tree, and if it's there, it always
adds the -B arg to EXE_LDFLAGS. My opinion however is unchanged from the 
last time we discussed this -- winsup should never be built without 
corresponding newlib in the same source tree and we should take measures 
to prevent it. That is, configure should balk if it can't find newlib in 
the build tree instead of just warning you.

Patch against ss-1999-04-27. Patches to auto-generated configure not added.

Thu Apr 29 11:06:37 1999  Mumit Khan  <>

	* (EXE_LDFLAGS): Always add newlib if part of the
	build tree.

	* utils/ (INCLUDES): Add newlib include directories.
	(LDFLAGS): Replace this with
	(ALL_LDFLAGS): this to avoid being overridden from higher level 

---	Thu Apr 29 10:50:58 1999
+++	Thu Apr 29 10:55:44 1999
@@ -140,26 +140,36 @@ dnl     program_transform_name="$program
 dnl   fi
 dnl fi
-dnl If CC can't create a .exe, which can happen when building from scratch
-dnl because crt0.o hasn't been installed yet, set up EXE_LDFLAGS to find
-dnl newlib.  Newlib is ../newlib when configure runs, but is ../../newlib
-dnl from the perspective of subdirectory makes.
+dnl If newlib is part of build tree, always set EXE_LDFLAGS to point to
+dnl it; this is important in cases where the installed newlib is perhaps
+dnl not compatible. Check and warn for installed newlib only if it's not 
+dnl part of the build tree. 
+AC_MSG_CHECKING([if newlib is part of the build tree])
-AC_MSG_CHECKING([if newlib needed])
-	[/* main already defined */]
-	,
-	,
-	if test -d ../newlib
-	then
-		EXE_LDFLAGS="-B../../newlib/ -L.."
-	else
-		AC_MSG_WARN(newlib not found - utility .exe's may not link)
-	fi
+if test -d ../newlib
+  EXE_LDFLAGS="-B../../newlib/ -B../"
+if test x"$EXE_LDFLAGS" = x
+  AC_MSG_CHECKING([if installed newlib needed])
+    [/* main already defined */]
+    ,
+    AC_MSG_RESULT(no)
+    ,
+    AC_MSG_RESULT(yes)
+    AC_MSG_WARN(newlib not found - utility .exe's may not link))
 case "$target_cpu" in
--- utils/	Fri Jan 22 10:48:29 1999
+++ utils/	Thu Apr 29 10:57:27 1999
@@ -30,13 +30,15 @@ CC = @CC@
-INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../include
+INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../include \
+	   -I$(srcdir)/../../newlib/libc/sys/cygwin \
+	   -I$(srcdir)/../../newlib/libc/include
 # Passed in from ../Makefile.
-LDFLAGS:=$(EXE_LDFLAGS) ../libcygwin.a
+ALL_LDFLAGS = $(EXE_LDFLAGS) $(LDFLAGS) ../libcygwin.a
 PROGS = mount$(EXEEXT) umount$(EXEEXT) ps$(EXEEXT) kill$(EXEEXT) \
 	mkpasswd$(EXEEXT) mkgroup$(EXEEXT) cygpath$(EXEEXT) cygcheck$(EXEEXT) \
@@ -48,34 +50,34 @@ WINSUP_DEPS = $(srcdir)/../winsup.h
 all: $(PROGS)
-	$(CC) -o $@ $(srcdir)/ $(ALL_CXXFLAGS) $(LDFLAGS)
+	$(CC) -o $@ $(srcdir)/ $(ALL_CXXFLAGS) $(ALL_LDFLAGS)
 umount$(EXEEXT): $(WINSUP_DEPS)
-	$(CC) -o $@ $(srcdir)/ $(ALL_CXXFLAGS) $(LDFLAGS)
+	$(CC) -o $@ $(srcdir)/ $(ALL_CXXFLAGS) $(ALL_LDFLAGS)
-	$(CC) -o $@ $(srcdir)/ $(ALL_CXXFLAGS) $(LDFLAGS)
+	$(CC) -o $@ $(srcdir)/ $(ALL_CXXFLAGS) $(ALL_LDFLAGS)
-	$(CC) -o $@ $(srcdir)/ $(ALL_CXXFLAGS) $(LDFLAGS)
+	$(CC) -o $@ $(srcdir)/ $(ALL_CXXFLAGS) $(ALL_LDFLAGS)
 cygwin$(EXEEXT): $(WINSUP_DEPS)
-	$(CC) -o $@ $(srcdir)/ $(ALL_CXXFLAGS) $(LDFLAGS)
+	$(CC) -o $@ $(srcdir)/ $(ALL_CXXFLAGS) $(ALL_LDFLAGS)
 mkpasswd$(EXEEXT): mkpasswd.c $(WINSUP_DEPS)
-	$(CC) -o $@ $(srcdir)/mkpasswd.c $(ALL_CXXFLAGS) $(LDFLAGS) -lnetapi32 -ladvapi32
+	$(CC) -o $@ $(srcdir)/mkpasswd.c $(ALL_CXXFLAGS) $(ALL_LDFLAGS) -lnetapi32 -ladvapi32
 mkgroup$(EXEEXT): mkgroup.c $(WINSUP_DEPS)
-	$(CC) -o $@ $(srcdir)/mkgroup.c $(ALL_CXXFLAGS) $(LDFLAGS) -lnetapi32 -ladvapi32
+	$(CC) -o $@ $(srcdir)/mkgroup.c $(ALL_CXXFLAGS) $(ALL_LDFLAGS) -lnetapi32 -ladvapi32
 cygpath$(EXEEXT): $(WINSUP_DEFS)
-	$(CC) -o $@ $(srcdir)/ $(ALL_CXXFLAGS) $(LDFLAGS)
+	$(CC) -o $@ $(srcdir)/ $(ALL_CXXFLAGS) $(ALL_LDFLAGS)
 cygcheck$(EXEEXT): $(WINSUP_DEPS)
-	$(CC) -o $@ $(srcdir)/ $(ALL_CXXFLAGS) $(LDFLAGS)
+	$(CC) -o $@ $(srcdir)/ $(ALL_CXXFLAGS) $(ALL_LDFLAGS)
 passwd$(EXEEXT): passwd.c $(WINSUP_DEPS)
-	$(CC) -o $@ $(srcdir)/passwd.c $(ALL_CXXFLAGS) $(LDFLAGS) -lnetapi32
+	$(CC) -o $@ $(srcdir)/passwd.c $(ALL_CXXFLAGS) $(ALL_LDFLAGS) -lnetapi32
 	rm -f *.o $(PROGS)