summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2009-05-30 17:46:50 +0200
committerBruno Haible <bruno@clisp.org>2009-05-30 17:47:15 +0200
commita0defa9cce5b4a7ea6028584288cde169fbb4ef3 (patch)
treea9ba2ce3b8643301fac3c1b4dc94e05c55c48ce8 /lib
parent7b1da5a4bf287395e2ae49e70096b2b6ebd45728 (diff)
downloadlibunistring-a0defa9cce5b4a7ea6028584288cde169fbb4ef3.tar.gz
Produce a compiler independent <unistring/stdint.h>.
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am52
1 files changed, 34 insertions, 18 deletions
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 <stdint.h>.
+# 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 <stdint.h>'; \
- } > $@-t; \
- fi
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ echo '#include <stddef.h>'; \
+ echo '#if __GLIBC__ >= 2'; \
+ echo '#include <stdint.h>'; \
+ 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''@|<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