Lines Matching +full:disable +full:- +full:timing +full:- +full:generator
3 # SPDX-License-Identifier: BSD-2-Clause
5 # Copyright (c) 2018-2025 Gavin D. Howard and contributors.
42 if [ $# -gt 0 ]; then
53 printf ' %s -h\n' "$script"
54 printf ' %s --help\n' "$script"
55 printf ' %s [-a|-bD|-dB|-c] [-CeEfgGHilmMNPrtTvz] [-O OPT_LEVEL] [-k KARATSUBA_LEN]\\\n' "$script"
56 printf ' [-s SETTING] [-S SETTING] [-p TYPE]\n'
58 printf ' [--library|--bc-only --disable-dc|--dc-only --disable-bc] \\\n'
59 printf ' [--force --debug --disable-extra-math --disable-generated-tests] \\\n'
60 printf ' [--disable-history --disable-man-pages --disable-nls --disable-strip] \\\n'
61 printf ' [--enable-editline] [--enable-readline] [--enable-internal-history] \\\n'
62 printf ' [--disable-problematic-tests] [--install-all-locales] \\\n'
63 printf ' [--opt=OPT_LEVEL] [--karatsuba-len=KARATSUBA_LEN] \\\n'
64 printf ' [--set-default-on=SETTING] [--set-default-off=SETTING] \\\n'
65 printf ' [--predefined-build-type=TYPE] \\\n'
66 printf ' [--prefix=PREFIX] [--bindir=BINDIR] [--datarootdir=DATAROOTDIR] \\\n'
67 printf ' [--datadir=DATADIR] [--mandir=MANDIR] [--man1dir=MAN1DIR] \\\n'
68 printf ' [--man3dir=MAN3DIR]\n'
70 if [ "$_usage_val" -ne 0 ]; then
75 printf ' -a, --library\n'
80 printf ' -b, --bc-only\n'
81 printf ' Build bc only. It is an error if "-d", "--dc-only", "-B", or\n'
82 printf ' "--disable-bc" are specified too.\n'
83 printf ' -B, --disable-bc\n'
84 printf ' Disable bc. It is an error if "-b", "--bc-only", "-D", or "--disable-dc"\n'
86 printf ' -C, --disable-clean\n'
87 printf ' Disable the clean that configure.sh does before configure.\n'
88 printf ' -d, --dc-only\n'
89 printf ' Build dc only. It is an error if "-b", "--bc-only", "-D", or\n'
90 printf ' "--disable-dc" are specified too.\n'
91 printf ' -D, --disable-dc\n'
92 printf ' Disable dc. It is an error if "-d", "--dc-only", "-B", or "--disable-bc"\n'
94 printf ' -e, --enable-editline\n'
96 printf ' want vi-like or Emacs-like behavior in history. This option is ignored\n'
97 printf ' if history is disabled. If the -r or -i options are given with this\n'
99 printf ' -E, --disable-extra-math\n'
100 printf ' Disable extra math. This includes: "$" operator (truncate to integer),\n'
104 printf ' -f, --force\n'
108 printf ' -g, --debug\n'
109 printf ' Build in debug mode. Adds the "-g" flag, and if there are no\n'
110 printf ' other CFLAGS, and "-O" was not given, this also adds the "-O0"\n'
111 printf ' flag. If this flag is *not* given, "-DNDEBUG" is added to CPPFLAGS\n'
113 printf ' -G, --disable-generated-tests\n'
114 printf ' Disable generating tests. This is for platforms that do not have a\n'
115 printf ' GNU bc-compatible bc to generate tests.\n'
116 printf ' -h, --help\n'
118 printf ' -H, --disable-history\n'
119 printf ' Disable history.\n'
120 printf ' -i, --enable-internal-history\n'
123 printf ' If this option is given along with -e and -r, the last occurrence of\n'
125 printf ' -k KARATSUBA_LEN, --karatsuba-len KARATSUBA_LEN\n'
128 printf ' -l, --install-all-locales\n'
132 printf ' -M, --disable-man-pages\n'
133 printf ' Disable installing manpages.\n'
134 printf ' -N, --disable-nls\n'
135 printf ' Disable POSIX locale (NLS) support.\n'
138 printf ' to happen, you must disable locales (NLS) completely.\n'
139 printf ' -O OPT_LEVEL, --opt OPT_LEVEL\n'
143 printf ' -p TYPE, --predefined-build-type=TYPE\n'
153 printf ' -P, --disable-problematic-tests\n'
156 printf ' -r, --enable-readline\n'
158 printf ' that want vi-like or Emacs-like behavior in history. This option is\n'
159 printf ' ignored if history is disabled. If this option is given along with -e\n'
160 printf ' and -i, the last occurrence of all of the three is used.\n'
161 printf ' -s SETTING, --set-default-on SETTING\n'
163 printf ' for SETTING. For multiple instances of the -s or -S for the the same\n'
165 printf ' -S SETTING, --set-default-off SETTING\n'
167 printf ' for SETTING. For multiple instances of the -s or -S for the the same\n'
169 printf ' -T, --disable-strip\n'
170 printf ' Disable stripping symbols from the compiled binary or binaries.\n'
172 printf ' --prefix PREFIX\n'
178 printf ' happen, you must disable locales (NLS) completely.\n'
179 printf ' --bindir BINDIR\n'
182 printf ' --includedir INCLUDEDIR\n'
185 printf ' --libdir LIBDIR\n'
188 printf ' --datarootdir DATAROOTDIR\n'
191 printf ' --datadir DATADIR\n'
194 printf ' --mandir MANDIR\n'
197 printf ' --man1dir MAN1DIR\n'
200 printf ' --man3dir MAN3DIR\n'
226 printf ' want that to happen, you must disable locales (NLS) completely.\n'
243 printf ' PC_PATH The location to install pkg-config files to. Must be a\n'
245 printf ' output of `pkg-config --variable=pc_path pkg-config`.\n'
258 printf ' except that 32-bit platforms with 64-bit longs may want to set\n'
272 printf ' most production-ready compilers, this limit probably is not\n'
277 printf ' non-existent value, will cause the build system to compile and\n'
279 printf ' GEN_EMU Emulator to run string generator code under (leave empty if not\n'
294 printf 'environment variables users can use to change them. (For the defaults, non-zero\n'
303 printf '| --------------- | -------------------- | ------------ | -------------------- |\n'
308 printf '| --------------- | -------------------- | ------------ | -------------------- |\n'
313 printf '| --------------- | -------------------- | ------------ | -------------------- |\n'
317 printf '| --------------- | -------------------- | ------------ | -------------------- |\n'
321 printf '| --------------- | -------------------- | ------------ | -------------------- |\n'
325 printf '| --------------- | -------------------- | ------------ | -------------------- |\n'
329 printf '| --------------- | -------------------- | ------------ | -------------------- |\n'
333 printf '| | given with the -e or | | |\n'
334 printf '| | -f options. | | |\n'
335 printf '| --------------- | -------------------- | ------------ | -------------------- |\n'
339 printf '| | given with the -e or | | |\n'
340 printf '| | -f options. | | |\n'
341 printf '| --------------- | -------------------- | ------------ | -------------------- |\n'
348 printf '| --------------- | -------------------- | ------------ | -------------------- |\n'
355 printf '| --------------- | -------------------- | ------------ | -------------------- |\n'
373 if [ "$#" -ne 3 ]; then
387 # a space-separated list of words, so filenames are expected to *not* have
390 # @param files The list of space-separated filenames to replace extensions for.
395 if [ "$#" -ne 3 ]; then
424 if [ "$#" -ne 3 ]; then
442 if [ "$#" -ge 1 ] && [ "$1" != "" ]; then
444 while [ "$#" -ge 1 ]; do
452 _find_src_files_files=$(find "$scriptdir/src" -depth -name "*.c" -print | LC_ALL=C sort)
477 if [ "$#" -lt 1 ]; then
484 if [ "$#" -ge 1 ]; then
520 # non-collision avoidance that the other variables do is that we *do* want
547 # non-collision avoidance that the other variables do is that we *do* want
609 CFLAGS="-Weverything -Wno-padded -Wno-unsafe-buffer-usage -Wno-poison-system-directories"
610 CFLAGS="$CFLAGS -Wno-unknown-warning-option -Wno-switch-default -Wno-pre-c11-compat"
611 CFLAGS="$CFLAGS -Werror -pedantic -std=c11"
640 CFLAGS="-Weverything -Wno-padded -Wno-unsafe-buffer-usage -Wno-poison-system-directories"
641 CFLAGS="$CFLAGS -Wno-unknown-warning-option -Wno-switch-default -Wno-pre-c11-compat"
642 CFLAGS="$CFLAGS -Werror -pedantic -std=c11"
714 while getopts "abBcdDeEfgGhHik:lMNO:p:PrS:s:T-" opt; do
742 -)
744 arg="${arg#--}"
749 bc-only) bc_only=1 ;;
750 dc-only) dc_only=1 ;;
755 if [ "$#" -lt 2 ]; then
756 usage "No argument given for '--$arg' option"
762 if [ "$#" -lt 2 ]; then
763 usage "No argument given for '--$arg' option"
769 if [ "$#" -lt 2 ]; then
770 usage "No argument given for '--$arg' option"
776 if [ "$#" -lt 2 ]; then
777 usage "No argument given for '--$arg' option"
783 if [ "$#" -lt 2 ]; then
784 usage "No argument given for '--$arg' option"
790 if [ "$#" -lt 2 ]; then
791 usage "No argument given for '--$arg' option"
797 if [ "$#" -lt 2 ]; then
798 usage "No argument given for '--$arg' option"
804 if [ "$#" -lt 2 ]; then
805 usage "No argument given for '--$arg' option"
811 if [ "$#" -lt 2 ]; then
812 usage "No argument given for '--$arg' option"
816 karatsuba-len=?*) karatsuba_len="$LONG_OPTARG" ;;
817 karatsuba-len)
818 if [ "$#" -lt 2 ]; then
819 usage "No argument given for '--$arg' option"
825 if [ "$#" -lt 2 ]; then
826 usage "No argument given for '--$arg' option"
830 set-default-on=?*) set_default 1 "$LONG_OPTARG" ;;
831 set-default-on)
832 if [ "$#" -lt 2 ]; then
833 usage "No argument given for '--$arg' option"
837 set-default-off=?*) set_default 0 "$LONG_OPTARG" ;;
838 set-default-off)
839 if [ "$#" -lt 2 ]; then
840 usage "No argument given for '--$arg' option"
844 predefined-build-type=?*) predefined_build "$LONG_OPTARG" ;;
845 predefined-build-type)
846 if [ "$#" -lt 2 ]; then
847 usage "No argument given for '--$arg' option"
851 disable-bc) dc_only=1 ;;
852 disable-dc) bc_only=1 ;;
853 disable-clean) clean=0 ;;
854 disable-extra-math) extra_math=0 ;;
855 disable-generated-tests) generate_tests=0 ;;
856 disable-history) hist=0 ;;
857 disable-man-pages) install_manpages=0 ;;
858 disable-nls) nls=0 ;;
859 disable-strip) strip_bin=0 ;;
860 disable-problematic-tests) problematic_tests=0 ;;
861 enable-editline) hist_impl="editline" ;;
862 enable-readline) hist_impl="readline" ;;
863 enable-internal-history) hist_impl="internal" ;;
864 install-all-locales) all_locales=1 ;;
865 help* | bc-only* | dc-only* | debug*)
866 usage "No arg allowed for --$arg option" ;;
867 disable-bc* | disable-dc* | disable-clean*)
868 usage "No arg allowed for --$arg option" ;;
869 disable-extra-math*)
870 usage "No arg allowed for --$arg option" ;;
871 disable-history*)
872 usage "No arg allowed for --$arg option" ;;
873 disable-man-pages* | disable-nls* | disable-strip*)
874 usage "No arg allowed for --$arg option" ;;
875 disable-problematic-tests*)
876 usage "No arg allowed for --$arg option" ;;
877 install-all-locales*)
878 usage "No arg allowed for --$arg option" ;;
879 enable-editline* | enable-readline*)
880 usage "No arg allowed for --$arg option" ;;
881 enable-internal-history*)
882 usage "No arg allowed for --$arg option" ;;
883 '') break ;; # "--" terminates argument processing
895 if [ "$clean" -ne 0 ]; then
896 if [ -f ./Makefile ]; then
902 if [ "$bc_only" -eq 1 ] && [ "$dc_only" -eq 1 ]; then
903 usage "Can only specify one of -b(-D) or -d(-B)"
908 if [ "$library" -ne 0 ]; then
909 if [ "$bc_only" -eq 1 ] || [ "$dc_only" -eq 1 ]; then
910 usage "Must not specify -b(-D) or -d(-B) when building the library"
916 (*[!0-9]*|'') usage "KARATSUBA_LEN is not a number" ;;
920 if [ "$karatsuba_len" -lt 16 ]; then
924 set -e
926 if [ -z "${LONG_BIT+set}" ]; then
928 elif [ "$LONG_BIT" -lt 32 ]; then
931 LONG_BIT_DEFINE="-DBC_LONG_BIT=$LONG_BIT"
934 if [ -z "$CC" ]; then
960 if [ -z "$HOSTCC" ] && [ -z "$HOST_CC" ]; then
962 elif [ -z "$HOSTCC" ]; then
987 if [ -z "${HOSTCFLAGS+set}" ] && [ -z "${HOST_CFLAGS+set}" ]; then
989 elif [ -z "${HOSTCFLAGS+set}" ]; then
1008 default_target_cmd="\$(CC) \$(CFLAGS) \$(OBJS) \$(LDFLAGS) -o \$(EXEC)"
1017 if [ "$library" -ne 0 ]; then
1026 default_target_cmd="ar -r -cu \$(LIBBC) \$(OBJ)"
1034 elif [ "$bc_only" -eq 1 ]; then
1051 elif [ "$dc_only" -eq 1 ]; then
1078 if [ "$library" -eq 0 ]; then
1097 if [ "$debug" -eq 1 ]; then
1099 if [ -z "$CFLAGS" ] && [ -z "$optimization" ]; then
1100 CFLAGS="-O0"
1103 CFLAGS="-g $CFLAGS"
1106 CPPFLAGS="-DNDEBUG $CPPFLAGS"
1110 if [ -n "$optimization" ]; then
1111 CFLAGS="-O$optimization $CFLAGS"
1115 if [ -z "${DESTDIR+set}" ]; then
1122 if [ -z "${PREFIX+set}" ]; then
1129 if [ -z "${BINDIR+set}" ]; then
1133 if [ -z "${INCLUDEDIR+set}" ]; then
1137 if [ -z "${LIBDIR+set}" ]; then
1141 if [ -z "${PC_PATH+set}" ]; then
1145 command -v pkg-config > /dev/null
1148 set -e
1150 if [ "$err" -eq 0 ]; then
1151 PC_PATH=$(pkg-config --variable=pc_path pkg-config)
1162 if [ "$install_manpages" -ne 0 ] || [ "$nls" -ne 0 ]; then
1163 if [ -z "${DATAROOTDIR+set}" ]; then
1169 if [ "$install_manpages" -ne 0 ]; then
1171 if [ -z "${DATADIR+set}" ]; then
1175 if [ -z "${MANDIR+set}" ]; then
1179 if [ -z "${MAN1DIR+set}" ]; then
1183 if [ -z "${MAN3DIR+set}" ]; then
1195 if [ "$nls" -ne 0 ]; then
1201 flags="-DBC_ENABLE_NLS=1 -DBC_ENABLED=$bc -DDC_ENABLED=$dc"
1202 flags="$flags -DBC_ENABLE_HISTORY=$hist -DBC_ENABLE_LIBRARY=0 -DBC_ENABLE_AFL=0"
1203 flags="$flags -DBC_ENABLE_EXTRA_MATH=$extra_math -DBC_ENABLE_OSSFUZZ=0"
1204 flags="$flags -I$scriptdir/include/ -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700"
1209 flags="$flags -Wno-unreachable-code"
1212 "$CC" $CPPFLAGS $CFLAGS $flags -c "$scriptdir/src/vm.c" -E > /dev/null
1216 rm -rf "./vm.o"
1219 # and NLS is not supported on Windows or musl, so disable it.
1220 if [ "$err" -ne 0 ]; then
1222 if [ $force -eq 0 ]; then
1236 rm -rf "./en_US.cat"
1238 if [ "$err" -ne 0 ]; then
1240 if [ $force -eq 0 ]; then
1254 printf 'Cross-compile detected.\n\n'
1259 if [ -z "$NLSPATH" ]; then
1270 set -e
1278 if [ "$nls" -ne 0 ] && [ "$all_locales" -ne 0 ]; then
1279 install_locales="\$(LOCALE_INSTALL) -l \$(NLSPATH) \$(MAIN_EXEC) \$(DESTDIR)"
1285 if [ "$hist" -eq 1 ]; then
1302 flags="-DBC_ENABLE_HISTORY=1 -DBC_ENABLED=$bc -DDC_ENABLED=$dc"
1303 flags="$flags -DBC_ENABLE_NLS=$nls -DBC_ENABLE_LIBRARY=0 -DBC_ENABLE_AFL=0"
1304 flags="$flags -DBC_ENABLE_EDITLINE=$editline -DBC_ENABLE_READLINE=$readline"
1305 flags="$flags -DBC_ENABLE_EXTRA_MATH=$extra_math -DBC_ENABLE_OSSFUZZ=0"
1306 flags="$flags -I$scriptdir/include/ -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700"
1308 "$CC" $CPPFLAGS $CFLAGS $flags -c "$scriptdir/src/history.c" -E > /dev/null
1312 rm -rf "./history.o"
1315 # and history is not supported on Windows, so disable it.
1316 if [ "$err" -ne 0 ]; then
1318 if [ $force -eq 0 ]; then
1328 set -e
1337 if [ "$hist" -eq 0 ]; then
1338 CFLAGS="$CFLAGS -DBC_ENABLE_EDITLINE=0 -DBC_ENABLE_READLINE=0"
1342 if [ "$editline" -ne 0 ]; then
1343 LDFLAGS="$LDFLAGS -ledit"
1344 CPPFLAGS="$CPPFLAGS -DBC_ENABLE_EDITLINE=1 -DBC_ENABLE_READLINE=0"
1345 elif [ "$readline" -ne 0 ]; then
1346 LDFLAGS="$LDFLAGS -lreadline"
1347 CPPFLAGS="$CPPFLAGS -DBC_ENABLE_EDITLINE=0 -DBC_ENABLE_READLINE=1"
1349 CPPFLAGS="$CPPFLAGS -DBC_ENABLE_EDITLINE=0 -DBC_ENABLE_READLINE=0"
1361 flags="-DBC_TEST_FREEBSD -DBC_ENABLE_AFL=0"
1362 "$CC" $CPPFLAGS $CFLAGS $flags "-I$scriptdir/include" -E "$scriptdir/scripts/os.c" > /dev/null
1366 if [ "$err" -ne 0 ]; then
1370 CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700"
1378 flags="-DBC_TEST_APPLE -DBC_ENABLE_AFL=0"
1379 "$CC" $CPPFLAGS $CFLAGS $flags "-I$scriptdir/include" -E "$scriptdir/scripts/os.c" > /dev/null
1383 if [ "$err" -ne 0 ]; then
1385 apple="-D_DARWIN_C_SOURCE"
1392 if [ "$debug" -eq 0 ] && [ "$apple" = "" ] && [ "$strip_bin" -ne 0 ]; then
1393 LDFLAGS="-s $LDFLAGS"
1400 # have to check at configure time and set it on the compiler command-line. And
1406 flags="-DBC_TEST_OPENBSD -DBC_ENABLE_AFL=0"
1407 "$CC" $CPPFLAGS $CFLAGS $flags "-I$scriptdir/include" -E "$scriptdir/scripts/os.c" > /dev/null
1411 if [ "$err" -ne 0 ]; then
1414 bsd="-D_BSD_SOURCE"
1417 if [ "$readline" -ne 0 ]; then
1426 set -e
1428 if [ "$library" -eq 1 ]; then
1432 if [ "$extra_math" -eq 1 ] && [ "$bc" -ne 0 ] && [ "$library" -eq 0 ]; then
1443 GEN_EXEC_TARGET="\$(HOSTCC) -DBC_ENABLE_AFL=0 -DBC_ENABLE_OSSFUZZ=0 -I$scriptdir/include/ \$(HOSTCFLAGS) -o \$(GEN_EXEC) \$(GEN_C)"
1446 if [ -z "${GEN_HOST+set}" ]; then
1449 if [ "$GEN_HOST" -eq 0 ]; then
1461 if [ "$extra_math" -eq 0 ]; then
1473 if [ "$hist" -eq 0 ]; then
1480 if [ "$nls" -eq 0 ]; then
1484 if [ "$bc" -eq 0 ]; then
1490 if [ "$dc" -eq 0 ]; then
1496 version=$(cat "$scriptdir/VERSION.txt" | head -n1)
1498 if [ "$library" -ne 0 ]; then
1517 pkg_config_uninstall="\$(RM) -f \"\$(DESTDIR)\$(PC_PATH)/\$(BCL_PC)\""
1560 if [ "$bc" -ne 0 ]; then
1565 if [ "$dc" -ne 0 ]; then
1621 if [ "$nls" -ne 0 ] && [ "${NLSPATH#$PREFIX}" = "${NLSPATH}" ] && [ "$defprefix" -eq 0 ]; then
1629 printf ' locales outside of $PREFIX, you must disable NLS with the -N or the\n'
1630 printf ' --disable-nls options.\n'
1661 SRC_TARGETS=$(printf '%s\n\nsrc/%s: src %s %s\n\t$(CC) $(CFLAGS) -o src/%s -c %s\n' \
1766 mkdir -p manuals
1767 cp -f "$scriptdir/manuals/bc/$manpage_args.1.md" manuals/bc.1.md
1768 cp -f "$scriptdir/manuals/bc/$manpage_args.1" manuals/bc.1
1769 cp -f "$scriptdir/manuals/dc/$manpage_args.1.md" manuals/dc.1.md
1770 cp -f "$scriptdir/manuals/dc/$manpage_args.1" manuals/dc.1