summaryrefslogtreecommitdiff
path: root/builtins
diff options
context:
space:
mode:
authorAndrew Shadura <andrew@shadura.me>2015-07-25 14:44:54 +0200
committerAndrew Shadura <andrew@shadura.me>2015-07-25 14:44:54 +0200
commit7bea690e43ee009efc9e8f6a45504496348cd3ee (patch)
tree4e958845f208f3398e3a5bbf7532199ee49a4989 /builtins
parent8d15cbf39b8aa01eaabfa3167e6ce3dc9f9e0af8 (diff)
Imported Upstream version 0.28.0
Diffstat (limited to 'builtins')
-rw-r--r--builtins/Makefile5
-rwxr-xr-xbuiltins/endianness62
-rwxr-xr-xbuiltins/prog_bison17
-rwxr-xr-xbuiltins/prog_flex18
-rwxr-xr-xbuiltins/prog_gawk19
-rwxr-xr-xbuiltins/prog_gm418
-rwxr-xr-xbuiltins/prog_gmake18
-rwxr-xr-xbuiltins/prog_mkdep39
-rwxr-xr-xbuiltins/prog_nbmkdep16
9 files changed, 212 insertions, 0 deletions
diff --git a/builtins/Makefile b/builtins/Makefile
new file mode 100644
index 0000000..0b350bc
--- /dev/null
+++ b/builtins/Makefile
@@ -0,0 +1,5 @@
+SCRIPTS = endianness prog_bison prog_flex prog_gawk prog_gm4 prog_gmake
+
+SCRIPTSDIR = ${BUILTINSDIR}
+
+.include <mkc.mk>
diff --git a/builtins/endianness b/builtins/endianness
new file mode 100755
index 0000000..fb7d76e
--- /dev/null
+++ b/builtins/endianness
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+############################################################
+# Copyright (c) 2009 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+set -e
+
+LC_ALL=C
+export LC_ALL
+
+##################################################
+
+pathpart=endianness
+. mkc_check_common.sh
+
+trap "rm -f $tmpc $tmpo" 0
+
+CFLAGS="$CFLAGS -D_GNU_SOURCE -D_ALL_SOURCE"
+
+check_me (){
+ cat > "$tmpc" <<EOF
+$3
+
+int main (int argc, char **argv)
+{
+ #if $1 == $2
+ return 0;
+#else
+ error
+#endif
+}
+EOF
+ if $CC -o "$tmpo" -c $CFLAGS $CPPFLAGS "$tmpc" 2>/dev/null; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+if check_me BYTE_ORDER LITTLE_ENDIAN '
+#include <sys/types.h>
+#include <sys/param.h>
+';
+then
+ echo little
+ exit 0
+fi
+
+if check_me BYTE_ORDER BIG_ENDIAN '
+#include <sys/types.h>
+#include <sys/param.h>
+';
+then
+ echo big
+ exit 0
+fi
+
+echo unknown
+exit 0
diff --git a/builtins/prog_bison b/builtins/prog_bison
new file mode 100755
index 0000000..dd7867f
--- /dev/null
+++ b/builtins/prog_bison
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+############################################################
+# Copyright (c) 2009 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+LC_ALL=C
+export LC_ALL
+
+pathpart=' ' # fake
+. mkc_check_common.sh
+
+find_n_match bison --version 'bison'
+
+echo ''
diff --git a/builtins/prog_flex b/builtins/prog_flex
new file mode 100755
index 0000000..d8cc5a8
--- /dev/null
+++ b/builtins/prog_flex
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+############################################################
+# Copyright (c) 2009 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+LC_ALL=C
+export LC_ALL
+
+pathpart=' ' # fake
+. mkc_check_common.sh
+
+find_n_match flex --version 'flex'
+find_n_match lex --version 'flex'
+
+echo ''
diff --git a/builtins/prog_gawk b/builtins/prog_gawk
new file mode 100755
index 0000000..d0403a7
--- /dev/null
+++ b/builtins/prog_gawk
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+############################################################
+# Copyright (c) 2009 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+LC_ALL=C
+export LC_ALL
+
+pathpart=' ' # fake
+. mkc_check_common.sh
+
+find_n_match gawk --version 'gnu awk'
+find_n_match nawk --version 'gnu awk'
+find_n_match awk --version 'gnu awk'
+
+echo ''
diff --git a/builtins/prog_gm4 b/builtins/prog_gm4
new file mode 100755
index 0000000..e82dc55
--- /dev/null
+++ b/builtins/prog_gm4
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+############################################################
+# Copyright (c) 2009 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+LC_ALL=C
+export LC_ALL
+
+pathpart=' ' # fake
+. mkc_check_common.sh
+
+find_n_match gm4 --version 'gnu m4'
+find_n_match m4 --version 'gnu m4'
+
+echo ''
diff --git a/builtins/prog_gmake b/builtins/prog_gmake
new file mode 100755
index 0000000..b942600
--- /dev/null
+++ b/builtins/prog_gmake
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+############################################################
+# Copyright (c) 2014 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+LC_ALL=C
+export LC_ALL
+
+pathpart=' ' # fake
+. mkc_check_common.sh
+
+find_n_match make --version 'gnu make'
+find_n_match gmake --version 'gnu make'
+
+echo ''
diff --git a/builtins/prog_mkdep b/builtins/prog_mkdep
new file mode 100755
index 0000000..c2e1b94
--- /dev/null
+++ b/builtins/prog_mkdep
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+############################################################
+# Copyright (c) 2013 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+LC_ALL=C
+export LC_ALL
+
+extra_args="$*"
+
+pathpart='custom_nbmkdep'
+. mkc_check_common.sh
+
+trap "rm -f $tmpc $tmpo" 0
+
+cat > "$tmpc" <<'EOF'
+#include <stdio.h>
+EOF
+
+if test -n "$MKDEP_CC"; then
+ CC="$MKDEP_CC"
+ export CC
+fi
+
+check_mkdep (){
+ "$1" -f "$tmpo" $extra_args -I . -I `pwd` "$tmpc"
+}
+
+for i in bmkdep nbmkdep mkdep; do
+ if test -z "`check_mkdep $i 2>&1 > /dev/null`"; then
+ mkc_which $i
+ exit 0
+ fi
+done
+
+echo ''
diff --git a/builtins/prog_nbmkdep b/builtins/prog_nbmkdep
new file mode 100755
index 0000000..aad3716
--- /dev/null
+++ b/builtins/prog_nbmkdep
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+############################################################
+# Copyright (c) 2013 by Aleksey Cheusov
+#
+# See LICENSE file in the distribution.
+############################################################
+
+# workround for crappylaris
+if test -z "$CRAPPYLIS" -a -x /usr/xpg4/bin/sh; then
+ CRAPPYLIS=1
+ export CRAPPYLIS
+ exec /usr/xpg4/bin/sh "$0" "$@"
+fi
+
+${0%%/prog_nbmkdep}/prog_mkdep --