4 #renice +19 -p $$; ionice -c3 -p $$
5 renice +10 -p $$; ionice -c3 -p $$
7 # Do not use for ctags - it would override $PATH:
9 function ctags {(unset ctags; PS1=x; . ~/.bashrc; ctags; );}
11 customss="--enable-static --disable-shared"
15 configure="./configure"
16 # >=4.7 has small macros section.
17 if gcc --version|perl -ne 'exit(!(/(\d+)\.(\d+)/&&($1>4||($1==4&&$2>=7))));';then
23 asan="-fsanitize=address"
28 disablebinutils="--disable-binutils --disable-gas --disable-gold --disable-gprof --disable-ld"
32 if [ "$1" = "--origss" ];then
37 if [ "$1" = "--fast" ];then
42 if [ "$1" = "--shared" ];then
43 customss="--disable-static --enable-shared"
48 if [ "$1" = "-m" ];then
53 if [ "$1" = "-m32" ];then
56 i?86|x86_64|ia64) target=i386-unknown-linux-gnu ;;
57 ppc*) target=powerpc64-unknown-linux-gnu ;;
58 s390*) target=s390-unknown-linux-gnu ;;
64 if [ "${1#*/configure}" != "$1" ];then
70 if [ "$1" = "-s" ];then
71 # -O0 is important to override GCC -O2.
77 if [ "$1" = "--asan" ];then
78 asan="-fsanitize=address"
83 if [ "$1" = "--noasan" ];then
89 if [ "$1" = "--nomcheck" ];then
95 if [ "$1" = "--binutils" ];then
107 find -name config.cache|xargs rm -f
110 if test -f `dirname $configure`/bfd/elf64-x86-64.c \
111 -o -f `dirname $configure`/gcc/reload.c;then
115 # maintainer="--enable-maintainer-mode"
117 if test -f `dirname $configure`/bfd/elf64-x86-64.c;then
118 test -f g77 || (test -f /usr/bin/gfortran && ln -s /usr/bin/gfortran g77)
121 targets="$targets --enable-64-bit-bfd"
123 if ! $fast && test -f `dirname $configure`/bfd/elf64-x86-64.c -a '(' -d CVS -o -d .git ')';then
124 targets="$targets --enable-targets=all"
126 if test ! -d readline;then # $fast ||
127 targets="$targets --with-system-readline"
130 if test -f `dirname $configure`/gcc/reload.c;then
131 werror="--disable-werror"
133 # --disable-static would fail on finding built libstdc++ due to -static-libstdc++.
134 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49829
136 customss="--disable-static --enable-shared"
141 if test -d readline/doc && ! test -e readline/readline.c;then
142 # Fedora gdb.spec prep.
143 readline="--with-system-readline"
146 test -z "$CC" && CC=gcc
148 # -Wp,-D_FORTIFY_SOURCE=2: /usr/include/features.h:329:3: error: #warning _FORTIFY_SOURCE requested but disabled [-Werror=cpp]
150 "$debug -pipe -Wall -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -ftrack-macro-expansion=0 -fno-diagnostics-show-caret $asan" \
151 "$debug -pipe -Wall -fexceptions -fstack-protector --param=ssp-buffer-size=4 -ftrack-macro-expansion=0 -fno-diagnostics-show-caret $asan" \
152 "$debug -pipe -Wall -fexceptions -fstack-protector --param=ssp-buffer-size=4 -ftrack-macro-expansion=0 -fno-diagnostics-show-caret" \
153 "$debug -pipe -Wall -fexceptions -fstack-protector --param=ssp-buffer-size=4" \
154 "$debug -pipe -Wall -fexceptions" \
157 if [ -z "$flags" ];then
159 echo >&2 "flags error"
163 # cc1: warnings being treated as errors
164 # archive.c:1: error: -fstack-protector not supported for this target
165 "$CC" $flags -Werror -c errs1.c -o /dev/null && break
167 if test -n "$customm" && "$CC" $customm -c errs1.c -o /dev/null;then
168 flags="$customm $flags"
171 if ! echo "$flags"|grep -q 'fsanitize=address';then
174 export CFLAGS="$flags"
175 export CXXFLAGS="$flags"
176 export GCJFLAGS="$flags"
177 export CFLAGS_FOR_TARGET="$flags"
178 export CXXFLAGS_FOR_TARGET="$flags"
179 export LDFLAGS="$mcheck $asan"
181 time nice "$configure" $target $targets $customss $readline $disablebinutils --enable-debug --disable-sim $maintainer $werror --with-separate-debug-dir=/usr/lib/debug --without-guile "$@"
182 # --enable-gold --enable-plugins
184 (ctags; test -d gdb && (cd gdb; ctags; cd testsuite; ctags; cd ../gdbserver; ctags)) &