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

134 lines
3.1 KiB
Diff
Raw Normal View History

Replace the compile time check for the scalar types required
to replace BYTE, WORD and DWORD with stdint.h types.
--- configure.inc 2017-01-19 03:42:06.000000000 +0100
+++ configure.inc 2018-01-01 18:49:05.494530670 +0100
@@ -895,86 +895,28 @@
rc=1
LOGN "defining WORD & DWORD scalar types"
-
-# --- is this needed anymore? ---
-# if AC_QUIET AC_CHECK_HEADERS WinDef.h; then
-# # windows machine; BYTE, WORD, DWORD already
-# # defined
-#
-# for x in $@; do
-# case "$x" in
-# sub)AC_SUB DWORD DWORD
-# AC_SUB WORD WORD
-# AC_SUB BYTE BYTE
-# ;;
-# *)
-# echo "#include <WinDef.h>" >> "$__cwd"/config.h
-# ;;
-# esac
-# done
-# 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);
-}
-
-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
- exit(1);
-
- if (sizeof v_int == 2)
- say("WORD", "unsigned int");
- else if (sizeof v_short == 2)
- say("WORD", "unsigned short");
- else
- exit(2);
- say("BYTE", "unsigned char");
- exit(0);
-}
-EOF
- if $AC_CC ngc$$.c -o ngc$$; 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
- if [ "$rc" != 0 ]; then
- if ./ngc$$ >> "$__cwd"/config.h; then
- rc=1
- 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 **" ;;
@@ -1548,7 +1548,7 @@
}
EOF
- $AC_CC -o config.sed ngc$$.c
+ cc -o config.sed ngc$$.c
status=$?
rm -f ngc$$.c
--- 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;