From a0defa9cce5b4a7ea6028584288cde169fbb4ef3 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 30 May 2009 17:46:50 +0200 Subject: Produce a compiler independent . --- lib/Makefile.am | 52 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/Makefile.am b/lib/Makefile.am index 5b322b9..dc386ed 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -86,27 +86,43 @@ BUILT_SOURCES += unistring/stdbool.h MOSTLYCLEANFILES += unistring/stdbool.h-t CLEANFILES += unistring/stdbool.h +# Produce an unistring/stdint.h that is not compiler dependent. +# Glibc >= 2 has . +# On most other platforms that have it, it is buggy in one way or the other. unistring/stdint.h : $(STDINT_H) stdint.mini.h @MKDIR_P@ unistring rm -f $@-t $@ - if test -n '$(STDINT_H)'; then \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ - -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ - -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ - -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ - -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ - -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ - -e 's/include_next/include/' \ - < $(srcdir)/stdint.mini.h; \ - } > $@-t; \ - else \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - echo '#include '; \ - } > $@-t; \ - fi + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + echo '#include '; \ + echo '#if __GLIBC__ >= 2'; \ + echo '#include '; \ + echo '#else'; \ + if test -f /usr/include/stdint.h; then \ + HAVE_STDINT_H='1'; \ + else \ + HAVE_STDINT_H='defined __MINGW32__ || defined __HAIKU__'; \ + fi; \ + if test -f /usr/include/inttypes.h; then \ + HAVE_INTTYPES_H='1'; \ + else \ + HAVE_INTTYPES_H='defined __MINGW32__ || defined __HAIKU__'; \ + fi; \ + if test -f /usr/include/sys/inttypes.h; then \ + HAVE_SYS_INTTYPES_H='1'; \ + else \ + HAVE_SYS_INTTYPES_H='0'; \ + fi; \ + sed -e 's/@''HAVE_STDINT_H''@/'"$$HAVE_STDINT_H"'/g' \ + -e 's|@''INCLUDE_NEXT''@|include|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@||g' \ + -e 's|@''NEXT_STDINT_H''@||g' \ + -e 's/@''HAVE_SYS_TYPES_H''@/1/g' \ + -e 's/@''HAVE_INTTYPES_H''@/'"$$HAVE_INTTYPES_H"'/g' \ + -e 's/@''HAVE_SYS_INTTYPES_H''@/'"$$HAVE_SYS_INTTYPES_H"'/g' \ + -e 's/@''HAVE_SYS_BITYPES_H''@/0/g' \ + < $(srcdir)/stdint.mini.h; \ + echo '#endif'; \ + } > $@-t mv $@-t $@ BUILT_SOURCES += unistring/stdint.h MOSTLYCLEANFILES += unistring/stdint.h-t -- cgit v1.2.1