Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com X-Authentication-Warning: hp2.xraylith.wisc.edu: khan owned process doing -bs Date: Fri, 7 Jan 2000 17:14:26 -0600 (CST) From: Mumit Khan To: cygwin-developers AT sourceware DOT cygnus DOT com Subject: patch for config changes [Re: use of __builtin_memset] In-Reply-To: <20000107151545.B2705@cygnus.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Here's a first try to start using config.h instead of passing everything from the command line. I just saw a note about the winsup reorg, so this is probably already useless to try and apply. However, I would like some input on how folks feel about this change. I've deleted the change to configure, but you can simply run autoconf for that. If you change acconfig.h to add new macros, make sure you regenerate config.h.in: $ autoheader I didn't automate this via Makefile to avoid adding another "stamp" file (see autoconf manual for more info). Bootstrap tested, but do please watch out for bugs ... 2000-01-07 Mumit Khan * acconfig.h: New file. * configure.in Add check for memset builtin. (AC_CONFIG_HEADER): Use. (STRACE_HHMMSS): Define instead of substituting. (_MT_SAFE): Likewise. (_CYG_THREAD_FAILSAFE): Likewise. (DEBUGGING): Likewise. (MT_SAFE): Substitute as a yes/no variable. * Makefile.in: Remove DEBUGGING, STRACE_HHMMSS, and THREAD_FAILSAFE variables and add DEFS. Update usage of MT_SAFE to reflect yes/no values. Add config.h to winsup.h dependency. (CFLAGS_CONFIG): Update. (INCLUDES): Prepend `-I.'. * utils/Makefile.in (INCLUDES): Likewise. * winsup.h: Conditionally include config.h. * thread.cc: Likewise. * config.h.in: Generate new file. * configure: Regenerate. Index: acconfig.h =================================================================== RCS file: acconfig.h diff -N acconfig.h --- /dev/null Tue May 5 15:32:27 1998 +++ acconfig.h Fri Jan 7 16:04:13 2000 @@ -0,0 +1,15 @@ +/* Define if DEBUGGING support is requested. */ +#undef DEBUGGING + +/* Define if building "extra" thread-safe Cygwin DLL. */ +#undef _CYG_THREAD_FAILSAFE + +/* Define if GCC supports builtin memset. */ +#undef HAVE_BUILTIN_MEMSET + +/* Define if building thread-safe Cygwin DLL. */ +#undef _MT_SAFE + +/* Define if strace log output has date/time stamp. */ +#undef STRACE_HHMMSS + Index: configure.in =================================================================== RCS file: /homes/khan/src/CVSROOT/cygwin-dev/winsup/configure.in,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 configure.in --- configure.in 2000/01/07 21:18:31 1.1.1.1 +++ configure.in 2000/01/07 23:05:41 @@ -11,6 +11,7 @@ dnl Process this file with autoconf to p AC_PREREQ(2.12)dnl AC_INIT(init.cc) +AC_CONFIG_HEADER(config.h) AC_PROG_INSTALL @@ -76,44 +77,88 @@ AC_ALLOCA AC_CONFIG_SUBDIRS(regexp mingw utils doc) AC_PROG_MAKE_SET +dnl check whether gcc supports __builtin_memset. +# Test for builtin mem* functions. +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_TRY_COMPILE([ +#include +void foo(char *s, int c, size_t n) +{ + __builtin_memset(s, c, n); +} +], [ ], +use_builtin_memset=yes, use_builtin_memset=no) +if test $use_builtin_memset = "yes"; then + AC_DEFINE(HAVE_BUILTIN_MEMSET) +fi +AC_LANG_RESTORE + AC_ARG_ENABLE(strace-hhmmss, [ --enable-strace-hhmmss strace log output has date/time stamp], [case "${enableval}" in -yes) STRACE_HHMMSS='-DSTRACE_HHMMSS' ;; -no) STRACE_HHMMSS= ;; -*) AC_MSG_ERROR(bad value ${enableval} given for enable-strace-hhmmss option) ;; +yes) + AC_DEFINE(STRACE_HHMMSS) + ;; +no) + ;; +*) + AC_MSG_ERROR(bad value ${enableval} given for enable-strace-hhmmss option) + ;; esac -AC_SUBST(STRACE_HHMMSS) ]) -AC_SUBST(PTH_ALLOW) -MT_SAFE='-D_MT_SAFE=1' PTH_ALLOW= +dnl set default mt safeness and then process the options. +mt_safe_val=1 +MT_SAFE=yes +PTH_ALLOW='' + AC_ARG_ENABLE(threadsafe, [ --enable-threadsafe=[runtime] Build a cygwin DLL which is thread safe], [case "${enableval}" in -yes) MT_SAFE='-D_MT_SAFE=1' PTH_ALLOW= ;; -runtime) MT_SAFE='-D_MT_SAFE=2' PTH_ALLOW= ;; -no) MT_SAFE= PTH_ALLOW=';' ;; +yes) + dnl default. + ;; +runtime) + mt_safe_val=2 + MT_SAFE=yes + ;; +no) + mt_safe_val=0 + MT_SAFE=no + PTH_ALLOW=';' + ;; esac -AC_SUBST(MT_SAFE) ]) AC_ARG_ENABLE(extra-threadsafe-checking, [ --enable-extra-threadsafe-checking Build a cygwin DLL which is thread safe with extra consistency checking], [case "${enableval}" in -yes) : ${MT_SAFE='-D_MT_SAFE=1'}; THREAD_FAILSAFE=-D_CYG_THREAD_FAILSAFE ;; -no) MT_SAFE= ;; +yes) + mt_safe_val=1 + MT_SAFE=yes + AC_DEFINE(_CYG_THREAD_FAILSAFE) + ;; +no) + dnl Don't do anything here to avoid overriding --enable-threadsafe. + ;; esac -AC_SUBST(THREAD_FAILSAFE) ]) +if test "$MT_SAFE" = "yes"; then + AC_DEFINE_UNQUOTED(_MT_SAFE,$mt_safe_val) +fi + +dnl Makefile uses MT_SAFE, so we subst as well as defining it. +AC_SUBST(MT_SAFE) +AC_SUBST(PTH_ALLOW) + AC_ARG_ENABLE(debugging, [ --enable-debugging Build a cygwin DLL which has more consistency checking for debugging], [case "${enableval}" in -yes) DEBUGGING='-DDEBUGGING' ;; -no) DEBUGGING= ;; +yes) AC_DEFINE(DEBUGGING) ;; +no) ;; esac -AC_SUBST(DEBUGGING) ]) @@ -181,3 +226,4 @@ AC_SUBST(DEF_DLL_ENTRY) AC_SUBST(ALLOCA) AC_SUBST(CONFIG_DIR) AC_OUTPUT(Makefile cygwin.def:cygwin.din) + Index: Makefile.in =================================================================== RCS file: /homes/khan/src/CVSROOT/cygwin-dev/winsup/Makefile.in,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 Makefile.in --- Makefile.in 2000/01/07 21:18:31 1.1.1.1 +++ Makefile.in 2000/01/07 22:55:55 @@ -43,10 +43,8 @@ INSTALL_PROGRAM:=@INSTALL_PROGRAM@ # # --enable options from configure # -DEBUGGING:=@DEBUGGING@ -MT_SAFE:=@MT_SAFE@ -STRACE_HHMMSS:=@STRACE_HHMMSS@ -THREAD_FAILSAFE:=@THREAD_FAILSAFE@ +MT_SAFE = @MT_SAFE@ +DEFS = @DEFS@ CC:=@CC@ # FIXME: Which is it, CC or CC_FOR_TARGET? @@ -54,8 +52,7 @@ CC_FOR_TARGET:=$(CC) CFLAGS:=@CFLAGS@ CXXFLAGS:=@CXXFLAGS@ CFLAGS_COMMON:=-Wall -Wwrite-strings # -finline-functions -CFLAGS_CONFIG:=$(DEBUGGING) $(STRACE_HHMMSS) \ - $(MT_SAFE) $(THREAD_FAILSAFE) +CFLAGS_CONFIG:=$(DEFS) MALLOC_DEBUG:=#-DMALLOC_DEBUG -I/gotham/src/comp-tools/winsup/dlmalloc MALLOC_OBJ:=#/gotham/src/comp-tools/winsup/dlmalloc/malloc.o @@ -65,7 +62,9 @@ else updir:=$(srcdir)/.. endif -INCLUDES:=-I$(srcdir)/include -I$(srcdir) -I$(updir)/newlib/libc/sys/cygwin -I$(updir)/newlib/libc/include -I$(srcdir)/config/@CONFIG_DIR@ -nostdinc++ +INCLUDES:=-I. -I$(srcdir)/include -I$(srcdir) \ + -I$(updir)/newlib/libc/sys/cygwin -I$(updir)/newlib/libc/include \ + -I$(srcdir)/config/@CONFIG_DIR@ -nostdinc++ ALL_CFLAGS:=$(MALLOC_DEBUG) $(CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_CONFIG) $(INCLUDES) ALL_CXXFLAGS:=$(MALLOC_DEBUG) $(CXXFLAGS) $(CFLAGS_COMMON) $(CFLAGS_CONFIG) $(INCLUDES) @@ -97,7 +96,7 @@ RUNTEST = `if [ -f $${srcdir}/../dejagnu RUNTESTFLAGS = DEP:=mkdep -ifdef MT_SAFE +ifeq ($(strip $(MT_SAFE)),yes) MT_SAFE_HEADERS:=thread.h MT_SAFE_OBJECTS:=pthread.o thread.o endif @@ -483,6 +482,7 @@ WINSUP_H:=winsup.h fhandler.h path.h sha sigproc.h include/cygwin/version.h \ $(MT_SAFE_HEADERS) +winsup.h: config.h assert.o: $(WINSUP_H) dcrt0.o: $(WINSUP_H) include/exceptions.h include/glob.h dll_init.h autoload.h debug.o: $(WINSUP_H) debug.h sync.h @@ -554,3 +554,4 @@ uname.o: $(WINSUP_H) wait.o: $(WINSUP_H) window.o: $(WINSUP_H) thread.o: $(WINSUP_H) + Index: winsup.h =================================================================== RCS file: /homes/khan/src/CVSROOT/cygwin-dev/winsup/winsup.h,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 winsup.h --- winsup.h 2000/01/07 21:18:31 1.1.1.1 +++ winsup.h 2000/01/07 22:00:30 @@ -8,6 +8,10 @@ This software is a copyrighted work lice Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #define __INSIDE_CYGWIN__ #define alloca(x) __builtin_alloca (x) @@ -15,7 +19,9 @@ details. */ #define strcpy __builtin_strcpy #define memcpy __builtin_memcpy #define memcmp __builtin_memcmp -#define memset __builtin_memset +#ifdef HAVE_BUILTIN_MEMSET +# define memset __builtin_memset +#endif #include #include Index: thread.cc =================================================================== RCS file: /homes/khan/src/CVSROOT/cygwin-dev/winsup/thread.cc,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 thread.cc --- thread.cc 2000/01/07 21:18:31 1.1.1.1 +++ thread.cc 2000/01/07 22:22:34 @@ -10,6 +10,10 @@ This software is a copyrighted work lice Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #ifdef _MT_SAFE #include #include "winsup.h" Index: config.h.in =================================================================== RCS file: config.h.in diff -N config.h.in --- /dev/null Tue May 5 15:32:27 1998 +++ config.h.in Fri Jan 7 16:04:16 2000 @@ -0,0 +1,38 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define if using alloca.c. */ +#undef C_ALLOCA + +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +#undef CRAY_STACKSEG_END + +/* Define if you have alloca, as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define if you have and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown + */ +#undef STACK_DIRECTION + +/* Define if DEBUGGING support is requested. */ +#undef DEBUGGING + +/* Define if building "extra" thread-safe Cygwin DLL. */ +#undef _CYG_THREAD_FAILSAFE + +/* Define if GCC supports builtin memset. */ +#undef HAVE_BUILTIN_MEMSET + +/* Define if building thread-safe Cygwin DLL. */ +#undef _MT_SAFE + +/* Define if strace log output has date/time stamp. */ +#undef STRACE_HHMMSS Index: utils/Makefile.in =================================================================== RCS file: /homes/khan/src/CVSROOT/cygwin-dev/winsup/utils/Makefile.in,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 Makefile.in --- Makefile.in 2000/01/07 21:18:31 1.1.1.1 +++ Makefile.in 2000/01/07 22:27:40 @@ -32,7 +32,7 @@ CXXFLAGS = @CXXFLAGS@ MINGW_INCLUDES = -I$(srcdir)/../mingw/include -I$(srcdir)/../include -INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../include \ +INCLUDES = -I.. -I$(srcdir)/.. -I$(srcdir)/../include \ -I$(srcdir)/../../newlib/libc/sys/cygwin \ -I$(srcdir)/../../newlib/libc/include @@ -91,3 +91,4 @@ Makefile: Makefile.in $(srcdir)/configur config.status: configure $(SHELL) config.status --recheck +