void-packages/srcpkgs/discount/patches/cross-configure_inc.patch

128 lines
3.2 KiB
Diff

Replace the compile time check for the scalar types required
to replace BYTE, WORD and DWORD with stdint.h types.
--- configure.inc.orig
+++ configure.inc
@@ -948,81 +948,27 @@
rc=1
LOGN "defining WORD & DWORD scalar types"
-# if AC_QUIET AC_CHECK_HEADERS WinDef.h; then
-# # windows machine; BYTE, WORD, DWORD already
-# # defined
-# echo "#include <WinDef.h>" >> "$__cwd"/config.h
-# TLOG " (defined in WinDef.h)"
-# return 0
-# fi
-
- cat > ngc$$.c << EOF
-#include <stdio.h>
-#include <string.h>
-
-int pound_define = 1;
-
-void
-say(char *w, char *v)
-{
- printf(pound_define ? "#define %s %s\n"
- : "s:@%s@:%s:g\n", w, v);
-}
-
-int
-main(argc, argv)
-char **argv;
-{
- unsigned long v_long;
- unsigned int v_int;
- unsigned short v_short;
-
- if ( argc > 1 && strcmp(argv[1], "sub") == 0 )
- pound_define = 0;
-
- if (sizeof v_long == 4)
- say("DWORD", "unsigned long");
- else if (sizeof v_int == 4)
- say("DWORD", "unsigned int");
- else
- return 1;
-
- if (sizeof v_int == 2)
- say("WORD", "unsigned int");
- else if (sizeof v_short == 2)
- say("WORD", "unsigned short");
- else
- return 2;
-
- say("BYTE", "unsigned char");
- fprintf(stderr, "OK!");
- return 0;
-}
-EOF
-
- if $AC_CC ngc$$.c -o ngc$$; then
- if [ $# -gt 0 ]; then
- while [ "$1" ]; do
- case "$1" in
- sub)if ./ngc$$ sub >> "$__cwd"/config.sub; then
- rc=0
- fi;;
- *) if ./ngc$$ >> "$__cwd"/config.h; then
- rc=0
- fi ;;
- esac
- shift
- done
- elif ./ngc$$ >> "$__cwd"/config.h; then
- rc=0
- fi
- if [ "$rc" != 0 ]; then
- if ./ngc$$ >> "$__cwd"/config.h; then
- rc=0
- fi
- fi
- fi
- __remove ngc$$ ngc$$.c
+ while [ "$1" ]; do
+ case "$1" in
+ sub) # substitution strings for BYTE, WORD, DWORD
+ echo "s:@DWORD@:uint32_t:g" >> "$__cwd"/config.sub
+ echo "s:@WORD@:uint16_t:g" >> "$__cwd"/config.sub
+ echo "s:@BYTE@:uint8_t:g" >> "$__cwd"/config.sub
+ rc=0
+ ;;
+ hdr) # config.h definitions for BYTE, WORD, DWORD
+ echo "#include <stdint.h>" >> "$__cwd"/config.h
+ echo "#define BYTE uint8_t" >> "$__cwd"/config.h
+ echo "#define WORD uint16_t" >> "$__cwd"/config.h
+ echo "#define DWORD uint32_t" >> "$__cwd"/config.h
+ rc=0
+ ;;
+ *) # unknown parameter
+ LOGN "(unknown: $1)"
+ ;;
+ esac
+ shift
+ done
case "$rc" in
0) TLOG "" ;;
*) AC_FAIL " ** FAILED **" ;;
@@ -1703,7 +1649,7 @@
}
EOF
- if $AC_CC -o config.sed ngc$$.c; then
+ if cc -o config.sed ngc$$.c; then
rm -f ngc$$.c
__config_files="$__config_files config.sed"
else
--- mkdio.h.in 2017-01-19 03:42:06.000000000 +0100
+++ mkdio.h.in 2018-01-01 18:52:22.871544747 +0100
@@ -2,6 +2,7 @@
#define _MKDIO_D
#include <stdio.h>
+#include <stdint.h>
typedef void MMIOT;