summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure186
1 files changed, 0 insertions, 186 deletions
diff --git a/configure b/configure
deleted file mode 100755
index 47be6631..00000000
--- a/configure
+++ /dev/null
@@ -1,186 +0,0 @@
-#!/bin/sh
-
-set -e
-
-CONFIGDIR="$(dirname $0)/mk"
-
-show_help() {
- cat <<-EOF
- usage: ./configure [options...]
-
- Options:
- -d Enable debugging symbols and asserts
-
- -I dir Set the directory to use for #include files
-
- -a arch Choose the underlying architecture to build for:
- $(awk '{ printf("\t%s\n", $0); }' ${CONFIGDIR}/architecture.conf)
-
- -c version Conform to:
- $(awk '{ printf("\t%s\n", $0); }' ${CONFIGDIR}/c.conf)
-
- -p version Conform to:
- $(awk '{ printf("\t%s\n", $0); }' ${CONFIGDIR}/posix.conf)
-
- -w wordsize Choose a word size for the architecuture:
- $(awk '{ printf("\t%s\n", $0); }' ${CONFIGDIR}/wordsize.conf)
-
- -x version Conform to:
- $(awk '{ printf("\t%s\n", $0); }' ${CONFIGDIR}/xopen.conf)
-
- -X number Enable C Extension:
- $(awk '{ printf("\t%s\n", $0); }' ${CONFIGDIR}/cext.conf)
-
- EOF
-}
-
-validate_option() {
- option="${CONFIGDIR}/$1.conf"
-
- for opt in $(awk '/^[0-9]/ { print $1 }' "${option}"); do
- if [ "$2" = "${opt}" ]; then
- echo "$2"
- return 0
- fi
- done
-
- printf 'Invalid option '%s'. Valid options are:\n' "$2" >&2
- cat "${option}" >&2
- exit 1
-}
-
-option=
-
-architecture=x86
-wordsize=64
-debug=0
-include=
-
-standard_c=
-posix=
-xopen=
-cext=
-
-while getopts dhc:p:x:I:X: option; do
- case ${option} in
- a) architecture=$(validate_option architecture ${OPTARG}) ;;
- c) standard_c=$(validate_option c ${OPTARG}) ;;
- p) posix=$(validate_option posix ${OPTARG}) ;;
- w) wordsize=$(validate_option wordsize ${OPTARG}) ;;
- x) xopen=$(validate_option xopen ${OPTARG}) ;;
- X) cext=$(validate_option cext ${OPTARG}) ;;
- I) include=${OPTARG} ;;
- d) debug=1 ;;
-
- h) show_help
- exit 0
- ;;
-
- ?) printf 'Unknown option "%c". Try "-h" for help.\n' $option
- exit 1
- ;;
- esac
-done
-
-if [ -z "${standard_c}" ] && [ -z "${posix}" ] && [ -z "${xopen}" ]; then
- xopen=700
-fi
-
-if [ -n "${posix}" ] && [ -n "${xopen}" ]; then
- printf 'Specify only one of "-x" or "-p".\n'
- exit 1
-fi
-
-if [ -n "${xopen}" ]; then
- if [ $xopen -eq 700 ]; then
- posix=200809
- elif [ $xopen -eq 600 ]; then
- posix=200112
- elif [ $xopen -eq 500 ]; then
- posix=199506
- else
- posix=2
- fi
-fi
-
-if [ -z "${standard_c}" ] && [ -n "${posix}" ]; then
- if [ $posix -ge 200112 ]; then
- standard_c=199901
- else
- standard_c=1
- fi
-fi
-
-if [ ${posix:-0} -ge 200112 ] && [ $standard_c -lt 199901 ]; then
- printf 'POSIX.1-2001 and newer require C99 or newer.\n'
- exit 1
-fi
-
-if [ -n "${cext}" ] && [ ${standard_c:-1} -lt 201112 ]; then
- printf 'C Extension 1 requires at least C11.\n'
- exit 1
-fi
-
-printf 'Building C library for %d-bit %s conforming to:\n' "${wordsize}" "${architecture}"
-printf 'ISO C: %d' ${standard_c}
-test -n "${cext}" && printf ' (Extensions: %s)' ${cext}
-printf '\n'
-test -n "${posix}" && printf 'POSIX: %d\n' ${posix}
-test -n "${xopen}" && printf 'X/OPEN: %d\n' ${xopen}
-
-cat <<-EOF > .config.mk
- .POSIX:
-
- ARCHITECTURE=${architecture}
- WORDSIZE=${wordsize}
- TOPDIR=$(dirname $0)
- SRCDIR=\$(TOPDIR)/src
- INCDIR=${include}
- OBJDIR=./obj
-
-EOF
-
-if [ ${standard_c:-1} -lt 199901 ]; then
- printf 'CC=c89\n' >> .config.mk
-else
- printf 'CC=c%02d\n' $(( (standard_c / 100) % 100 )) >> .config.mk
-fi
-
-CFLAGS="${CFLAGS}"
-
-if [ $debug -eq 1 ]; then
- CFLAGS="${CFLAGS} -g"
-else
- CFLAGS="${CFLAGS} -DNDEBUG"
-fi
-
-if [ -n "${xopen}" ]; then
- if [ $xopen -eq 400 ]; then
- CFLAGS="${CFLAGS} -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
- else
- CFLAGS="${CFLAGS} -D_XOPEN_SOURCE=${xopen}"
- fi
-elif [ -n "${posix}" ]; then
- CFLAGS="${CFLAGS} -D_POSIX_C_SOURCE=${posix}"
-fi
-
-printf 'CFLAGS=$(BASE_CFLAGS) %s\n\n' "${CFLAGS}" >> .config.mk
-
-#
-# TODO: C extentsion
-#
-for lib in $(cat $(dirname $0)/mk/*.d | grep 'lib.*_[CPX]\.' | cut -d: -f1 | sort -u); do
- ver=$(echo $lib | cut -d. -f2)
- if (echo $lib | grep -q _C) && [ "$ver" -le ${standard_c:-1} ]; then
- printf 'all: %s\n' $lib >> .config.mk
- elif (echo $lib | grep -q _P) && [ "$ver" -le ${posix:-0} ]; then
- printf 'all: %s\n' $lib >> .config.mk
- elif (echo $lib | grep -q _X) && [ "$ver" -le ${xopen:-0} ]; then
- printf 'all: %s\n' $lib >> .config.mk
- fi
-done
-
-### generate main Makefile
-if ! [ -f Makefile ]; then
- cp "$(dirname $0)/Makefile" .
-fi