toybox/configure
<<
>>
Prefs
   1#!/bin/bash
   2
   3# This sets environment variables used by scripts/make.sh
   4
   5# People run ./configure out of habit, so do "defconfig" for them.
   6
   7if [ "$(basename "$0")" == configure ]
   8then
   9  echo "Assuming you want 'make defconfig', but you should probably check the README."
  10  make defconfig
  11  exit $?
  12fi
  13
  14# CFLAGS and OPTIMIZE are different so you can add extra CFLAGS without
  15# disabling default optimizations
  16[ -z "$CFLAGS" ] && CFLAGS="-Wall -Wundef -Wno-char-subscripts -Werror=implicit-function-declaration"
  17# Required for our expected ABI. we're 8-bit clean thus "char" must be unsigned.
  18CFLAGS="$CFLAGS -funsigned-char"
  19[ -z "$OPTIMIZE" ] && OPTIMIZE="-Os -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables -fno-strict-aliasing"
  20# set ASAN=1 to enable "address sanitizer" and debuggable backtraces
  21[ -z "$ASAN" ] || { CFLAGS="$CFLAGS -O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address"; NOSTRIP=1; }
  22
  23# We accept LDFLAGS, but by default don't have anything in it
  24if [ "$(uname)" != "Darwin" ]
  25then
  26  [ -z "$LDOPTIMIZE" ] && LDOPTIMIZE="-Wl,--gc-sections"
  27  LDASNEEDED="-Wl,--as-needed"
  28fi
  29
  30# The makefile provides defaults for these, so this only gets used if
  31# you call scripts/make.sh and friends directly.
  32
  33[ -z "$CC" ] && CC=cc
  34[ -z "$STRIP" ] && STRIP=strip
  35
  36# If HOSTCC needs CFLAGS or LDFLAGS, just add them to the variable
  37# ala HOSTCC="blah-cc --static"
  38[ -z "$HOSTCC" ] && HOSTCC=cc
  39
  40[ -z "$GENERATED" ] && GENERATED=generated
  41