summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAndrew Shadura <andrew@shadura.me>2015-07-25 14:49:59 +0200
committerAndrew Shadura <andrew@shadura.me>2015-07-25 14:49:59 +0200
commitb18e0171dd55b61131734f2f68f33dfc4e9c35db (patch)
tree50b66160071c179678384aff5ef4a71655f299c0 /scripts
parent7bea690e43ee009efc9e8f6a45504496348cd3ee (diff)
Imported Upstream version 0.29.0
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mk-configure.7.in15
-rwxr-xr-xscripts/mkc_check_custom48
-rw-r--r--scripts/mkc_check_custom.111
3 files changed, 49 insertions, 25 deletions
diff --git a/scripts/mk-configure.7.in b/scripts/mk-configure.7.in
index ab6c9da..74d2518 100644
--- a/scripts/mk-configure.7.in
+++ b/scripts/mk-configure.7.in
@@ -18,7 +18,7 @@
.sp
..
.\" ------------------------------------------------------------------
-.TH MK-CONFIGURE 7 "Aug 21, 2014" "" ""
+.TH MK-CONFIGURE 7 "Nov 30, 2014" "" ""
.SH NAME
mk-configure \- lightweight replacement for GNU autotools
.SH DESCRIPTION
@@ -1547,6 +1547,19 @@ The same as MKC_CHECK_PROTOTYPES, but incorrect prototype is
treated as a fatal error (See
.B errorcheck
target.
+.IP MKC_CHECK_CC_OPTS
+A list of C compiler options to check.
+If ${CC} -c support the specified option, variable
+HAVE_CC_OPT.<option:S/=/_/g> is set to 1 and 0 otherwise.
+.VS
+Ex.
+ MKC_CHECK_CC_OPTS = -Wall -errwarn=%all
+Res.
+ HAVE_CC_OPT.-Wall=1
+ HAVE_CC_OPT.-errwarn_%all=0
+.VE
+.IP "MKC_CHECK_CXX_OPTS and HAVE_CXX_OPT.<option>"
+The same as MKC_CHECK_CC_OPTS and HAVE_CC_OPT but for C++ compiler.
.IP MKC_NOAUTO_FUNCLIBS
See MKC_CHECK_FUNCLIBS
.IP MKC_NOAUTO
diff --git a/scripts/mkc_check_custom b/scripts/mkc_check_custom
index e0d32d1..f3f587d 100755
--- a/scripts/mkc_check_custom
+++ b/scripts/mkc_check_custom
@@ -25,14 +25,16 @@ Usage:
mkc_check_custom [OPTIONS] cmd [args...]
OPTIONS:
- -h display this help
- -r build application and run it
- -p text prefix for cache filename, defaults to "custom"
- -n text a part of cache filename, defaults to
- `basename <source_file>` without extension
- -m text A part of verbose message, defaults to -n args
- -s exit status of executable will be check
- -d delete cache files
+ -h display this help
+ -r build application and run it
+ -p text prefix for cache filename, defaults to "custom"
+ -n text a part of cache filename, defaults to
+ `basename <source_file>` without extension
+ -m text A part of verbose message, defaults to -n args
+ -s exit status of executable will be check
+ -d delete cache files
+ -e print 0 if compiler/cmd print something to stderr
+ -b print yes/no instead of 1/0
Examples:
mkc_check_custom my_custom_test.c
mkc_check_custom -r mmap_works_perfectly.c
@@ -65,6 +67,10 @@ while test $# -ne 0; do
check_status=1;;
-d)
delcache=1;;
+ -e)
+ empty_stderr=1;;
+ -b)
+ boolean=1;;
-*)
echo "Bad option $1" 1>&2
exit 1;;
@@ -102,9 +108,8 @@ done
##################################################
# functions
-
compile (){
- if $CC -c -o "$tmpo" $CPPFLAGS $CFLAGS "$src_or_exe" 2>"$tmperr"; then
+ if $CC -c $CARGS -o "$tmpo" $CPPFLAGS $CFLAGS "$src_or_exe" 2>"$tmperr"; then
echo 1
else
echo 0
@@ -147,34 +152,31 @@ check_itself (){
return 1
fi
- if $compiler $flags; then
- echo 1
- else
+ if ! $compiler $CARGS $flags; then
+ echo 0
+ elif test -n "$empty_stderr" -a -s "$tmperr"; then
echo 0
+ else
+ echo 1
fi
}
##################################################
# test
msg=${msg-"custom test $basefn"}
-check_and_cache "checking for ${msg}" "$cache"
+check_and_cache "checking ${msg}" "$cache"
##################################################
# clean-ups
-
KEEP_SOURCE=1 # do not delete user's source file!
cleanup
##################################################
# finishing
-
-case "$ret" in
- 1)
- printme '1 (yes)\n' 1>&2;;
- 0)
- printme '0 (no)\n' 1>&2;;
- *)
- printme '%s\n' "$ret" 1>&2;;
+case "${boolean}_$ret" in
+ 1_0) printme 'no\n' 1>&2;;
+ 1_1) printme 'yes\n' 1>&2;;
+ *) printme '%s\n' "$ret" 1>&2;;
esac
echo $ret
diff --git a/scripts/mkc_check_custom.1 b/scripts/mkc_check_custom.1
index 8655577..fbe6784 100644
--- a/scripts/mkc_check_custom.1
+++ b/scripts/mkc_check_custom.1
@@ -1,6 +1,6 @@
.\" $NetBSD$
.\"
-.\" Copyright (c) 2009-2010 by Aleksey Cheusov (vle@gmx.net)
+.\" Copyright (c) 2009-2014 by Aleksey Cheusov (vle@gmx.net)
.\" Absolutely no warranty.
.\"
.\" ------------------------------------------------------------------
@@ -74,6 +74,12 @@ outputs an exit status of
.TP
.BI -d
Delete cache files.
+.TP
+.BI -e
+Print 0 if compiler/cmd print something to stderr.
+.TP
+.B -b
+Print yes/no instead of 1/0.
.SH ENVIRONMENT
.TP
.B CC
@@ -82,6 +88,9 @@ C compiler
.B CXX
C++ compiler
.TP
+.B CARGS
+Options passed to compiler (CC, CXX or FC)
+.TP
.B FC
Fortran compiler
.TP