| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | usage () { |
| 4 | cat <<EOF |
| Rich Felker | 278883d | 2012-06-03 16:22:13 -0400 | [diff] [blame] | 5 | Usage: $0 [OPTION]... [VAR=VALUE]... [TARGET] |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 6 | |
| 7 | To assign environment variables (e.g., CC, CFLAGS...), specify them as |
| 8 | VAR=VALUE. See below for descriptions of some of the useful variables. |
| 9 | |
| 10 | Defaults for the options are specified in brackets. |
| 11 | |
| 12 | Installation directories: |
| 13 | --prefix=PREFIX main installation prefix [/usr/local/musl] |
| 14 | --exec-prefix=EPREFIX installation prefix for executable files [PREFIX] |
| 15 | |
| 16 | Fine tuning of the installation directories: |
| 17 | --bindir=DIR user executables [EPREFIX/bin] |
| 18 | --libdir=DIR library files for the linker [PREFIX/lib] |
| 19 | --includedir=DIR include files for the C compiler [PREFIX/include] |
| 20 | --syslibdir=DIR location for the dynamic linker [/lib] |
| 21 | |
| 22 | System types: |
| 23 | --target=TARGET configure to run on target TARGET [detected] |
| Rich Felker | 278883d | 2012-06-03 16:22:13 -0400 | [diff] [blame] | 24 | --host=HOST same as --target |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 25 | |
| 26 | Optional features: |
| 27 | --enable-debug build with debugging information [disabled] |
| 28 | --enable-warnings build with recommended warnings flags [disabled] |
| 29 | --enable-gcc-wrapper build musl-gcc toolchain wrapper [auto] |
| 30 | --disable-shared inhibit building shared library [enabled] |
| 31 | --disable-static inhibit building static library [enabled] |
| 32 | |
| 33 | Some influential environment variables: |
| 34 | CC C compiler command [detected] |
| 35 | CFLAGS C compiler flags [-Os -pipe ...] |
| Rich Felker | 94e920d | 2012-08-14 22:50:16 -0400 | [diff] [blame] | 36 | CROSS_COMPILE prefix for cross compiler and tools [none] |
| Rich Felker | 2c1cd23 | 2012-09-10 15:30:52 -0400 | [diff] [blame] | 37 | LIBCC compiler runtime library [detected] |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 38 | |
| 39 | Use these variables to override the choices made by configure. |
| 40 | |
| 41 | EOF |
| 42 | exit 0 |
| 43 | } |
| 44 | |
| 45 | # Helper functions |
| 46 | |
| 47 | echo () { printf "%s\n" "$*" ; } |
| 48 | fail () { echo "$*" ; exit 1 ; } |
| 49 | fnmatch () { eval "case \"\$2\" in $1) return 0 ;; *) return 1 ;; esac" ; } |
| 50 | cmdexists () { type "$1" >/dev/null 2>&1 ; } |
| 51 | trycc () { test -z "$CC" && cmdexists "$1" && CC=$1 ; } |
| 52 | |
| Rich Felker | 3d9e3a3 | 2012-11-08 17:20:50 -0500 | [diff] [blame] | 53 | stripdir () { |
| 54 | while eval "fnmatch '*/' \"\${$1}\"" ; do eval "$1=\${$1%/}" ; done |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 55 | } |
| 56 | |
| Rich Felker | 3e7f186 | 2013-07-18 20:30:58 -0400 | [diff] [blame] | 57 | trycppif () { |
| 58 | printf "checking preprocessor condition %s... " "$1" |
| Rich Felker | df06578 | 2013-07-18 20:37:19 -0400 | [diff] [blame^] | 59 | echo "typedef int x;" > "$tmpc" |
| 60 | echo "#if $1" >> "$tmpc" |
| Rich Felker | 3e7f186 | 2013-07-18 20:30:58 -0400 | [diff] [blame] | 61 | echo "#error yes" >> "$tmpc" |
| 62 | echo "#endif" >> "$tmpc" |
| 63 | if $CC $2 -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then |
| 64 | printf "false\n" |
| 65 | return 1 |
| 66 | else |
| 67 | printf "true\n" |
| 68 | return 0 |
| 69 | fi |
| 70 | } |
| 71 | |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 72 | tryflag () { |
| 73 | printf "checking whether compiler accepts %s... " "$2" |
| 74 | echo "typedef int x;" > "$tmpc" |
| Rich Felker | cd31a1f | 2012-10-26 18:15:51 -0400 | [diff] [blame] | 75 | if $CC "$2" -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 76 | printf "yes\n" |
| 77 | eval "$1=\"\${$1} \$2\"" |
| 78 | eval "$1=\${$1# }" |
| 79 | return 0 |
| 80 | else |
| 81 | printf "no\n" |
| 82 | return 1 |
| 83 | fi |
| 84 | } |
| 85 | |
| Rich Felker | 08f70a3 | 2012-06-06 20:45:52 -0400 | [diff] [blame] | 86 | tryldflag () { |
| 87 | printf "checking whether linker accepts %s... " "$2" |
| Rich Felker | 67a0383 | 2012-06-07 00:23:58 -0400 | [diff] [blame] | 88 | echo "typedef int x;" > "$tmpc" |
| Rich Felker | cd31a1f | 2012-10-26 18:15:51 -0400 | [diff] [blame] | 89 | if $CC -nostdlib -shared "$2" -o /dev/null "$tmpc" >/dev/null 2>&1 ; then |
| Rich Felker | 08f70a3 | 2012-06-06 20:45:52 -0400 | [diff] [blame] | 90 | printf "yes\n" |
| 91 | eval "$1=\"\${$1} \$2\"" |
| 92 | eval "$1=\${$1# }" |
| 93 | return 0 |
| 94 | else |
| 95 | printf "no\n" |
| 96 | return 1 |
| 97 | fi |
| 98 | } |
| 99 | |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 100 | |
| 101 | |
| 102 | # Beginning of actual script |
| 103 | |
| Rich Felker | 08f70a3 | 2012-06-06 20:45:52 -0400 | [diff] [blame] | 104 | CFLAGS_C99FSE= |
| 105 | CFLAGS_AUTO= |
| 106 | LDFLAGS_AUTO= |
| Rich Felker | 3d9e3a3 | 2012-11-08 17:20:50 -0500 | [diff] [blame] | 107 | prefix=/usr/local/musl |
| 108 | exec_prefix='$(prefix)' |
| 109 | bindir='$(exec_prefix)/bin' |
| 110 | libdir='$(prefix)/lib' |
| 111 | includedir='$(prefix)/include' |
| 112 | syslibdir='/lib' |
| Rich Felker | 278883d | 2012-06-03 16:22:13 -0400 | [diff] [blame] | 113 | target= |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 114 | debug=no |
| Rich Felker | 3d9e3a3 | 2012-11-08 17:20:50 -0500 | [diff] [blame] | 115 | warnings=no |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 116 | shared=yes |
| 117 | static=yes |
| 118 | |
| 119 | for arg ; do |
| 120 | case "$arg" in |
| 121 | --help) usage ;; |
| 122 | --prefix=*) prefix=${arg#*=} ;; |
| 123 | --exec-prefix=*) exec_prefix=${arg#*=} ;; |
| 124 | --bindir=*) bindir=${arg#*=} ;; |
| 125 | --libdir=*) libdir=${arg#*=} ;; |
| 126 | --includedir=*) includedir=${arg#*=} ;; |
| 127 | --syslibdir=*) syslibdir=${arg#*=} ;; |
| 128 | --enable-shared|--enable-shared=yes) shared=yes ;; |
| 129 | --disable-shared|--enable-shared=no) shared=no ;; |
| 130 | --enable-static|--enable-static=yes) static=yes ;; |
| 131 | --disable-static|--enable-static=no) static=no ;; |
| 132 | --enable-debug|--enable-debug=yes) debug=yes ;; |
| 133 | --disable-debug|--enable-debug=no) debug=no ;; |
| 134 | --enable-warnings|--enable-warnings=yes) warnings=yes ;; |
| 135 | --disable-warnings|--enable-warnings=no) warnings=no ;; |
| 136 | --enable-gcc-wrapper|--enable-gcc-wrapper=yes) wrapper=yes ;; |
| 137 | --disable-gcc-wrapper|--enable-gcc-wrapper=no) wrapper=no ;; |
| Rich Felker | 278883d | 2012-06-03 16:22:13 -0400 | [diff] [blame] | 138 | --enable-*|--disable-*|--with-*|--without-*|--*dir=*|--build=*) ;; |
| 139 | --host=*|--target=*) target=${arg#*=} ;; |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 140 | -* ) echo "$0: unknown option $arg" ;; |
| 141 | CC=*) CC=${arg#*=} ;; |
| 142 | CFLAGS=*) CFLAGS=${arg#*=} ;; |
| 143 | CPPFLAGS=*) CPPFLAGS=${arg#*=} ;; |
| 144 | LDFLAGS=*) LDFLAGS=${arg#*=} ;; |
| Rich Felker | 94e920d | 2012-08-14 22:50:16 -0400 | [diff] [blame] | 145 | CROSS_COMPILE=*) CROSS_COMPILE=${arg#*=} ;; |
| Rich Felker | 2c1cd23 | 2012-09-10 15:30:52 -0400 | [diff] [blame] | 146 | LIBCC=*) LIBCC=${arg#*=} ;; |
| Rich Felker | 278883d | 2012-06-03 16:22:13 -0400 | [diff] [blame] | 147 | *=*) ;; |
| 148 | *) target=$arg ;; |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 149 | esac |
| 150 | done |
| 151 | |
| Rich Felker | 3d9e3a3 | 2012-11-08 17:20:50 -0500 | [diff] [blame] | 152 | for i in prefix exec_prefix bindir libdir includedir syslibdir ; do |
| 153 | stripdir $i |
| 154 | done |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 155 | |
| 156 | # |
| 157 | # Get a temp filename we can use |
| 158 | # |
| 159 | i=0 |
| 160 | set -C |
| 161 | while : ; do i=$(($i+1)) |
| 162 | tmpc="./conf$$-$PPID-$i.c" |
| Rich Felker | 6c0cba8 | 2012-11-18 23:15:47 -0500 | [diff] [blame] | 163 | 2>|/dev/null > "$tmpc" && break |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 164 | test "$i" -gt 50 && fail "$0: cannot create temporary file $tmpc" |
| 165 | done |
| 166 | set +C |
| 167 | trap 'rm "$tmpc"' EXIT INT QUIT TERM HUP |
| 168 | |
| 169 | # |
| 170 | # Find a C compiler to use |
| 171 | # |
| 172 | printf "checking for C compiler... " |
| Rich Felker | 94e920d | 2012-08-14 22:50:16 -0400 | [diff] [blame] | 173 | trycc ${CROSS_COMPILE}gcc |
| 174 | trycc ${CROSS_COMPILE}c99 |
| 175 | trycc ${CROSS_COMPILE}cc |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 176 | printf "%s\n" "$CC" |
| 177 | test -n "$CC" || { echo "$0: cannot find a C compiler" ; exit 1 ; } |
| 178 | |
| 179 | # |
| 180 | # Only build musl-gcc wrapper if toolchain does not already target musl |
| 181 | # |
| 182 | if test -z "$wrapper" ; then |
| 183 | printf "checking whether compiler is gcc... " |
| Rich Felker | 01e5a1b | 2012-10-18 23:02:53 -0400 | [diff] [blame] | 184 | if fnmatch '*gcc\ version*' "$($CC -v 2>&1)" ; then |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 185 | echo yes |
| 186 | printf "checking whether to build musl-gcc wrapper... " |
| 187 | wrapper=yes |
| 188 | while read line ; do |
| 189 | case "$line" in */ld-musl-*) wrapper=no ;; esac |
| 190 | done <<EOF |
| 191 | $($CC -dumpspecs) |
| 192 | EOF |
| 193 | echo $wrapper |
| 194 | else |
| 195 | echo no |
| 196 | fi |
| 197 | fi |
| 198 | |
| 199 | |
| 200 | |
| 201 | # |
| Rich Felker | 278883d | 2012-06-03 16:22:13 -0400 | [diff] [blame] | 202 | # Find the target architecture |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 203 | # |
| Rich Felker | 278883d | 2012-06-03 16:22:13 -0400 | [diff] [blame] | 204 | printf "checking target system type... " |
| Rich Felker | 01e5a1b | 2012-10-18 23:02:53 -0400 | [diff] [blame] | 205 | test -n "$target" || target=$($CC -dumpmachine 2>/dev/null) || target=unknown |
| Rich Felker | 278883d | 2012-06-03 16:22:13 -0400 | [diff] [blame] | 206 | printf "%s\n" "$target" |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 207 | |
| 208 | # |
| 209 | # Convert to just ARCH |
| 210 | # |
| Rich Felker | 278883d | 2012-06-03 16:22:13 -0400 | [diff] [blame] | 211 | case "$target" in |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 212 | arm*) ARCH=arm ;; |
| 213 | i?86*) ARCH=i386 ;; |
| 214 | x86_64*) ARCH=x86_64 ;; |
| Rich Felker | 721564a | 2012-08-05 17:23:38 -0400 | [diff] [blame] | 215 | mips-*|mipsel-*) ARCH=mips ;; |
| Rich Felker | 8c0a3d9 | 2012-09-29 01:05:31 -0400 | [diff] [blame] | 216 | microblaze-*) ARCH=microblaze ;; |
| rofl0r | 1c8eb8b | 2012-11-09 23:36:55 +0100 | [diff] [blame] | 217 | powerpc-*) ARCH=powerpc ;; |
| Rich Felker | 278883d | 2012-06-03 16:22:13 -0400 | [diff] [blame] | 218 | unknown) fail "$0: unable to detect target arch; try $0 --target=..." ;; |
| 219 | *) fail "$0: unknown or unsupported target \"$target\"" ;; |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 220 | esac |
| 221 | |
| 222 | # |
| 223 | # Try to get a conforming C99 freestanding environment |
| 224 | # |
| 225 | tryflag CFLAGS_C99FSE -std=c99 |
| 226 | tryflag CFLAGS_C99FSE -nostdinc |
| 227 | tryflag CFLAGS_C99FSE -ffreestanding \ |
| 228 | || tryflag CFLAGS_C99FSE -fno-builtin |
| 229 | tryflag CFLAGS_C99FSE -fexcess-precision=standard \ |
| Rich Felker | 2121b8a | 2012-07-03 23:53:05 -0400 | [diff] [blame] | 230 | || { test "$ARCH" = i386 && tryflag CFLAGS_C99FSE -ffloat-store ; } |
| Rich Felker | b4ccc3c | 2012-05-05 17:18:31 -0400 | [diff] [blame] | 231 | tryflag CFLAGS_C99FSE -frounding-math |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 232 | |
| 233 | # |
| 234 | # Setup basic default CFLAGS: debug, optimization, and -pipe |
| 235 | # |
| 236 | if fnmatch '-O*|*\ -O*' "$CFLAGS_AUTO $CFLAGS" ; then : |
| 237 | else |
| 238 | tryflag CFLAGS_AUTO -Os || tryflag CFLAGS_AUTO -O2 |
| 239 | fi |
| 240 | test "x$debug" = xyes && CFLAGS_AUTO="-g" |
| 241 | tryflag CFLAGS_AUTO -pipe |
| 242 | |
| 243 | # |
| Rich Felker | b439c05 | 2012-08-29 09:36:02 -0400 | [diff] [blame] | 244 | # If debugging is disabled, omit frame pointer. Modern GCC does this |
| 245 | # anyway on most archs even when debugging is enabled since the frame |
| 246 | # pointer is no longer needed for debugging. |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 247 | # |
| 248 | if fnmatch '-g*|*\ -g*' "$CFLAGS_AUTO $CFLAGS" ; then : |
| 249 | else |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 250 | tryflag CFLAGS_AUTO -fomit-frame-pointer |
| 251 | fi |
| 252 | |
| 253 | # |
| Rich Felker | b439c05 | 2012-08-29 09:36:02 -0400 | [diff] [blame] | 254 | # Modern GCC wants to put DWARF tables (used for debugging and |
| 255 | # unwinding) in the loaded part of the program where they are |
| 256 | # unstrippable. These options force them back to debug sections (and |
| 257 | # cause them not to get generated at all if debugging is off). |
| 258 | # |
| 259 | tryflag CFLAGS_AUTO -fno-unwind-tables |
| 260 | tryflag CFLAGS_AUTO -fno-asynchronous-unwind-tables |
| 261 | |
| 262 | # |
| Rich Felker | adefe83 | 2012-10-03 11:49:58 -0400 | [diff] [blame] | 263 | # The GNU toolchain defaults to assuming unmarked files need an |
| 264 | # executable stack, potentially exposing vulnerabilities in programs |
| 265 | # linked with such object files. Fix this. |
| 266 | # |
| 267 | tryflag CFLAGS_AUTO -Wa,--noexecstack |
| 268 | |
| 269 | # |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 270 | # Some optimization levels add bloated alignment that hurt performance |
| 271 | # |
| 272 | tryflag CFLAGS_AUTO -falign-functions=1 |
| 273 | tryflag CFLAGS_AUTO -falign-labels=1 |
| 274 | tryflag CFLAGS_AUTO -falign-loops=1 |
| 275 | tryflag CFLAGS_AUTO -falign-jumps=1 |
| 276 | |
| 277 | # |
| 278 | # On x86, make sure we don't have incompatible instruction set |
| 279 | # extensions enabled by default. This is bad for making static binaries. |
| 280 | # We cheat and use i486 rather than i386 because i386 really does not |
| 281 | # work anyway (issues with atomic ops). |
| 282 | # |
| 283 | if test "$ARCH" = "i386" ; then |
| Rich Felker | 80a4545 | 2012-10-25 14:52:12 -0400 | [diff] [blame] | 284 | fnmatch '-march=*|*\ -march=*' "$CFLAGS" || tryldflag CFLAGS_AUTO -march=i486 |
| 285 | fnmatch '-mtune=*|*\ -mtune=*' "$CFLAGS" || tryldflag CFLAGS_AUTO -mtune=generic |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 286 | fi |
| 287 | |
| Rich Felker | 2384f27 | 2012-12-11 23:28:31 -0500 | [diff] [blame] | 288 | # |
| 289 | # Even with -std=c99, gcc accepts some constructs which are constraint |
| 290 | # violations. We want to treat these as errors regardless of whether |
| 291 | # other purely stylistic warnings are enabled -- especially implicit |
| 292 | # function declarations, which are a dangerous programming error. |
| 293 | # |
| 294 | tryflag CFLAGS_AUTO -Werror=implicit-function-declaration |
| 295 | tryflag CFLAGS_AUTO -Werror=implicit-int |
| 296 | tryflag CFLAGS_AUTO -Werror=pointer-sign |
| 297 | tryflag CFLAGS_AUTO -Werror=pointer-arith |
| 298 | |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 299 | if test "x$warnings" = xyes ; then |
| 300 | tryflag CFLAGS_AUTO -Wall |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 301 | tryflag CFLAGS_AUTO -Wcast-align |
| 302 | tryflag CFLAGS_AUTO -Wno-parentheses |
| 303 | tryflag CFLAGS_AUTO -Wno-uninitialized |
| 304 | tryflag CFLAGS_AUTO -Wno-missing-braces |
| 305 | tryflag CFLAGS_AUTO -Wno-unused-value |
| 306 | tryflag CFLAGS_AUTO -Wno-unused-but-set-variable |
| 307 | tryflag CFLAGS_AUTO -Wno-unknown-pragmas |
| 308 | fi |
| 309 | |
| Rich Felker | 0c5efde | 2012-06-06 22:00:08 -0400 | [diff] [blame] | 310 | # Some patched GCC builds have these defaults messed up... |
| 311 | tryflag CFLAGS_AUTO -fno-stack-protector |
| Rich Felker | 2bd05a4 | 2012-08-25 17:13:28 -0400 | [diff] [blame] | 312 | tryldflag LDFLAGS_AUTO -Wl,--hash-style=both |
| Rich Felker | 08f70a3 | 2012-06-06 20:45:52 -0400 | [diff] [blame] | 313 | |
| Rich Felker | 498a100 | 2012-06-07 00:32:22 -0400 | [diff] [blame] | 314 | # Disable dynamic linking if ld is broken and can't do -Bsymbolic-functions |
| 315 | LDFLAGS_DUMMY= |
| 316 | tryldflag LDFLAGS_DUMMY -Wl,-Bsymbolic-functions || { |
| 317 | printf "warning: disabling dynamic linking support\n" |
| 318 | shared=no |
| 319 | } |
| 320 | |
| Rich Felker | 2c1cd23 | 2012-09-10 15:30:52 -0400 | [diff] [blame] | 321 | # Find compiler runtime library |
| 322 | test -z "$LIBCC" && tryldflag LIBCC -lgcc && tryldflag LIBCC -lgcc_eh |
| 323 | test -z "$LIBCC" && tryldflag LIBCC -lcompiler_rt |
| Rich Felker | cd31a1f | 2012-10-26 18:15:51 -0400 | [diff] [blame] | 324 | test -z "$LIBCC" && try_libcc=`$CC -print-file-name=libpcc.a 2>/dev/null` \ |
| 325 | && tryldflag LIBCC "$try_libcc" |
| Rich Felker | 2c1cd23 | 2012-09-10 15:30:52 -0400 | [diff] [blame] | 326 | printf "using compiler runtime libraries: %s\n" "$LIBCC" |
| Rich Felker | a1546e8 | 2012-07-12 14:24:10 -0400 | [diff] [blame] | 327 | |
| Rich Felker | 3e7f186 | 2013-07-18 20:30:58 -0400 | [diff] [blame] | 328 | # Figure out arch variants for archs with variants |
| 329 | SUBARCH= |
| 330 | t="$CFLAGS_C99FSE $CPPFLAGS $CFLAGS_AUTO $CFLAGS" |
| 331 | |
| 332 | if test "$ARCH" = "arm" ; then |
| 333 | trycppif __ARMEB__ "$t" && SUBARCH=${SUBARCH}eb |
| 334 | trycppif __SOFTFP__ "$t" || SUBARCH=${SUBARCH}hf |
| 335 | fi |
| 336 | |
| 337 | test "$ARCH" = "mips" && trycppif "_MIPSEL || __MIPSEL || __MIPSEL__" "$t" \ |
| 338 | && SUBARCH=${SUBARCH}el |
| 339 | |
| 340 | test "$ARCH" = "microblaze" && trycppif __MICROBLAZEEL__ "$t" \ |
| 341 | && SUBARCH=${SUBARCH}el |
| 342 | |
| 343 | test "$SUBARCH" \ |
| 344 | && printf "configured for %s variant: %s\n" "$ARCH" "$ARCH$SUBARCH" |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 345 | |
| 346 | printf "creating config.mak... " |
| 347 | |
| 348 | exec 3>&1 1>config.mak |
| 349 | |
| 350 | |
| 351 | cat << EOF |
| 352 | # This version of config.mak was generated by configure |
| 353 | # Any changes made here will be lost if configure is re-run |
| 354 | ARCH = $ARCH |
| Rich Felker | 3e7f186 | 2013-07-18 20:30:58 -0400 | [diff] [blame] | 355 | SUBARCH = $SUBARCH |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 356 | prefix = $prefix |
| 357 | exec_prefix = $exec_prefix |
| 358 | bindir = $bindir |
| 359 | libdir = $libdir |
| 360 | includedir = $includedir |
| 361 | syslibdir = $syslibdir |
| 362 | CC = $CC |
| 363 | CFLAGS= $CFLAGS_AUTO $CFLAGS |
| 364 | CFLAGS_C99FSE = $CFLAGS_C99FSE |
| 365 | CPPFLAGS = $CPPFLAGS |
| Rich Felker | 08f70a3 | 2012-06-06 20:45:52 -0400 | [diff] [blame] | 366 | LDFLAGS = $LDFLAGS_AUTO $LDFLAGS |
| Rich Felker | 94e920d | 2012-08-14 22:50:16 -0400 | [diff] [blame] | 367 | CROSS_COMPILE = $CROSS_COMPILE |
| Rich Felker | 2c1cd23 | 2012-09-10 15:30:52 -0400 | [diff] [blame] | 368 | LIBCC = $LIBCC |
| Rich Felker | 64d2f8e | 2012-05-04 23:24:51 -0400 | [diff] [blame] | 369 | EOF |
| 370 | test "x$static" = xno && echo "STATIC_LIBS =" |
| 371 | test "x$shared" = xno && echo "SHARED_LIBS =" |
| 372 | test "x$wrapper" = xno && echo "ALL_TOOLS =" |
| 373 | test "x$wrapper" = xno && echo "TOOL_LIBS =" |
| 374 | exec 1>&3 3>&- |
| 375 | |
| 376 | printf "done\n" |