From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1521) id 0BD5F385781A; Thu, 20 Jan 2022 02:19:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0BD5F385781A Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Frysinger To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] newlib: switch newlib.h to autoheader X-Act-Checkin: newlib-cygwin X-Git-Author: Mike Frysinger X-Git-Refname: refs/heads/master X-Git-Oldrev: b86dc2dab4981ba92d683b866badc0b32be39120 X-Git-Newrev: 0a67325726577e189c65e7c190f3f9e0874143a6 Message-Id: <20220120021900.0BD5F385781A@sourceware.org> Date: Thu, 20 Jan 2022 02:19:00 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jan 2022 02:19:00 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D0a673257265= 77e189c65e7c190f3f9e0874143a6 commit 0a67325726577e189c65e7c190f3f9e0874143a6 Author: Mike Frysinger Date: Mon Jan 17 20:10:38 2022 -0500 newlib: switch newlib.h to autoheader =20 Now that newlib.hin has been brought up to date and all of its defines are produced by configure, we can switch it to using autoheader without manual editing. This relies on a few pieces: * Moving the header & footer into configure.ac via AH_TOP & AH_BOTTOM. * Running a post-process step on newlib.h to delete all the defines we didn't export ourselves. Basically, anything without a _ prefix. =20 This will leave behind some spurious comments in newlib.h related to the defines we filtered out, but should be harmless, so it's probably not worth the effort to construct a more complicated sed expression to also strip those out. Diff: --- newlib/Makefile.in | 26 +++++++++++----------- newlib/configure | 15 +++++++++---- newlib/configure.ac | 18 ++++++++++++++- newlib/newlib.hin | 63 +++++++++++++++++++++++++++++++++++++++++++++++++= ---- 4 files changed, 100 insertions(+), 22 deletions(-) diff --git a/newlib/Makefile.in b/newlib/Makefile.in index a662b4e78..05abe50e9 100644 --- a/newlib/Makefile.in +++ b/newlib/Makefile.in @@ -112,7 +112,7 @@ DIST_COMMON =3D $(srcdir)/Makefile.am $(top_srcdir)/con= figure \ am__CONFIG_DISTCLEAN_FILES =3D config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs =3D $(SHELL) $(top_srcdir)/../mkinstalldirs -CONFIG_HEADER =3D _newlib_version.h newlib.h +CONFIG_HEADER =3D newlib.h _newlib_version.h CONFIG_CLEAN_FILES =3D CONFIG_CLEAN_VPATH_FILES =3D am__vpath_adj_setup =3D srcdirstrip=3D`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -234,7 +234,7 @@ am__recursive_targets =3D \ AM_RECURSIVE_TARGETS =3D $(am__recursive_targets:-recursive=3D) TAGS CTAGS= \ cscope am__tagged_files =3D $(HEADERS) $(SOURCES) $(TAGS_FILES) \ - $(LISP)_newlib_version.hin newlib.hin + $(LISP)newlib.hin _newlib_version.hin # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. @@ -548,7 +548,7 @@ MAKEOVERRIDES =3D # dejagnu support RUNTESTFLAGS =3D=20 @HAVE_DOC_TRUE@MKDOC =3D doc/makedoc$(EXEEXT_FOR_BUILD) -all: _newlib_version.h newlib.h +all: newlib.h _newlib_version.h $(MAKE) $(AM_MAKEFLAGS) all-recursive =20 .SUFFIXES: @@ -588,28 +588,28 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m= 4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): =20 -_newlib_version.h: stamp-h1 +newlib.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 =20 -stamp-h1: $(srcdir)/_newlib_version.hin $(top_builddir)/config.status +stamp-h1: $(srcdir)/newlib.hin $(top_builddir)/config.status @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status _newlib_version.h -$(srcdir)/_newlib_version.hin: @MAINTAINER_MODE_TRUE@ $(am__configure_deps= )=20 + cd $(top_builddir) && $(SHELL) ./config.status newlib.h +$(srcdir)/newlib.hin: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)=20 ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ =20 -newlib.h: stamp-h2 +_newlib_version.h: stamp-h2 @test -f $@ || rm -f stamp-h2 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h2 =20 -stamp-h2: $(srcdir)/newlib.hin $(top_builddir)/config.status +stamp-h2: $(srcdir)/_newlib_version.hin $(top_builddir)/config.status @rm -f stamp-h2 - cd $(top_builddir) && $(SHELL) ./config.status newlib.h + cd $(top_builddir) && $(SHELL) ./config.status _newlib_version.h =20 distclean-hdr: - -rm -f _newlib_version.h stamp-h1 newlib.h stamp-h2 + -rm -f newlib.h stamp-h1 _newlib_version.h stamp-h2 install-toollibLIBRARIES: $(toollib_LIBRARIES) @$(NORMAL_INSTALL) @list=3D'$(toollib_LIBRARIES)'; test -n "$(toollibdir)" || list=3D; \ @@ -852,8 +852,8 @@ distclean-DEJAGNU: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU check: check-recursive -all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) _newlib_version.h \ - newlib.h +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) newlib.h \ + _newlib_version.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(toollibdir)" "$(DESTDIR)$(toollibdir)" "$(DESTDIR= )$(toollibdir)"; do \ diff --git a/newlib/configure b/newlib/configure index 5a0993c85..879392da8 100755 --- a/newlib/configure +++ b/newlib/configure @@ -2251,7 +2251,13 @@ ac_compiler_gnu=3D$ac_cv_c_compiler_gnu =20 =20 =20 -ac_config_headers=3D"$ac_config_headers _newlib_version.h:_newlib_version.= hin newlib.h:newlib.hin" + +ac_config_headers=3D"$ac_config_headers newlib.h:newlib.hin" + + + + +ac_config_headers=3D"$ac_config_headers _newlib_version.h:_newlib_version.= hin" =20 =20 ac_aux_dir=3D @@ -11974,7 +11980,7 @@ else lt_dlunknown=3D0; lt_dlno_uscore=3D1; lt_dlneed_uscore=3D2 lt_status=3D$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11977 "configure" +#line 11983 "configure" #include "confdefs.h" =20 #if HAVE_DLFCN_H @@ -12080,7 +12086,7 @@ else lt_dlunknown=3D0; lt_dlno_uscore=3D1; lt_dlneed_uscore=3D2 lt_status=3D$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12083 "configure" +#line 12089 "configure" #include "confdefs.h" =20 #if HAVE_DLFCN_H @@ -14451,8 +14457,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=3D1 for ac_config_target in $ac_config_targets do case $ac_config_target in - "_newlib_version.h") CONFIG_HEADERS=3D"$CONFIG_HEADERS _newlib_version= .h:_newlib_version.hin" ;; "newlib.h") CONFIG_HEADERS=3D"$CONFIG_HEADERS newlib.h:newlib.hin" ;; + "_newlib_version.h") CONFIG_HEADERS=3D"$CONFIG_HEADERS _newlib_version= .h:_newlib_version.hin" ;; "depfiles") CONFIG_COMMANDS=3D"$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS=3D"$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES=3D"$CONFIG_FILES Makefile" ;; @@ -15051,6 +15057,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} =20 =20 case $ac_file$ac_mode in + "newlib.h":H) sed -i.tmp -e '/^#define [^_]/d' -e '/^\/\* #undef [^_]/= d' newlib.h && rm -f newlib.h.tmp ;; "depfiles":C) test x"$AMDEP_TRUE" !=3D x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval diff --git a/newlib/configure.ac b/newlib/configure.ac index d95000db9..b4d11f5e3 100644 --- a/newlib/configure.ac +++ b/newlib/configure.ac @@ -3,7 +3,23 @@ dnl Process this file with autoconf to produce a configure= script. =20 AC_INIT([newlib],[NEWLIB_VERSION]) AC_CONFIG_SRCDIR([libc]) -AC_CONFIG_HEADERS([_newlib_version.h:_newlib_version.hin newlib.h:newlib.h= in]) + +dnl Since we can't control what defines autoheader picks up (various autoc= onf +dnl macros will add their own), filter out all the ones w/out a _ prefix. = All +dnl the ones we want to export use a _ prefix, and all the rest we don't w= ant +dnl to export as it'll pollute the namespace of newlib users. +dnl NB: newlib.h must be the first AC_CONFIG_HEADERS call for autoheader. +AC_CONFIG_HEADERS([newlib.h:newlib.hin], [sed -i.tmp -e '/^#define [^_]/d'= -e '/^\/\* #undef [^_]/d' newlib.h && rm -f newlib.h.tmp]) +AH_TOP([/* NB: The contents are filtered before being installed. */ + +#ifndef __NEWLIB_H__ +#define __NEWLIB_H__ 1 + +/* Newlib version */ +#include <_newlib_version.h>]) +AH_BOTTOM([#endif /* !__NEWLIB_H__ */]) + +AC_CONFIG_HEADERS([_newlib_version.h:_newlib_version.hin]) =20 dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.=20 AC_CONFIG_AUX_DIR(..) diff --git a/newlib/newlib.hin b/newlib/newlib.hin index 15543f403..69a7cb7a7 100644 --- a/newlib/newlib.hin +++ b/newlib/newlib.hin @@ -1,13 +1,68 @@ -/* newlib.hin. Manually edited from the output of autoheader to - remove all PACKAGE_ macros which will collide with any user - package using newlib header files and having its own package name, - version, etc... */ +/* newlib.hin. Generated from configure.ac by autoheader. */ + +/* NB: The contents are filtered before being installed. */ + #ifndef __NEWLIB_H__ #define __NEWLIB_H__ 1 =20 /* Newlib version */ #include <_newlib_version.h> =20 +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled librari= es. + */ +#undef LT_OBJDIR + +/* Define to the address where bug reports for this package should be sent= . */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + /* If atexit() may dynamically allocate space for cleanup functions. */ #undef _ATEXIT_DYNAMIC_ALLOC