Skip to content
Snippets Groups Projects
configure 1.72 KiB
Newer Older
  • Learn to ignore specific revisions
  • Fabrice Bellard's avatar
    Fabrice Bellard committed
    #!/bin/sh
    
    # default parameters
    prefix="/usr/local"
    cc="gcc"
    ar="ar"
    cpu=`uname -m`
    case "$cpu" in
      i386|i486|i586|i686)
        cpu="x86"
        mmx="yes"
      ;;
      *)
        mmx="no"
      ;;
    esac
    gprof="no"
    
    if [ "$1" = "-h" -o "$1" = "--help" ] ; then
    cat << EOF
    
    Usage: configure [options]
    Options: [defaults in brackets after descriptions]
    
      --help                  print this message
    EOF
    echo "  --prefix=PREFIX         install in PREFIX [$prefix]"
    echo "  --cc=CC                 use C compiler CC [$cc]"
    echo "  --cpu=CPU               force cpu to CPU  [$cpu]"
    echo "  --disable-mmx           disable mmx usage"
    echo "  --enable-gprof          enable profiling with gprof [$gprof]"
    exit 1
    fi
    
    for opt do
      case "$opt" in
      --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
      ;;
      --cc=*) cc=`echo $opt | cut -d '=' -f 2`
      ;;
      --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
      ;;
      --disable-mmx) mmx="no"
      ;;
      --enable-gprof) gprof="yes"
      ;;
      esac
    done
    
    echo "Install prefix   $prefix"
    echo "C compiler       $cc"
    echo "CPU              $cpu"
    echo "MMX enabled      $mmx"
    echo "gprof enabled    $gprof"
    
    
    echo "Creating config.mak and config.h"
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    
    
    echo "# Automatically generated by configure - do not modify" > config.mak
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    echo "/* Automatically generated by configure - do not modify */" > config.h
    
    
    echo "prefix=$prefix" >> config.mak
    echo "CC=$cc" >> config.mak
    echo "AR=$ar" >> config.mak
    echo "OPTFLAGS=-O2" >> config.mak
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    if [ "$cpu" = "x86" ] ; then
    
      echo "TARGET_ARCH_X86=yes" >> config.mak
      echo "#define ARCH_X86 1" >> config.h
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    fi
    if [ "$mmx" = "yes" ] ; then
    
      echo "TARGET_MMX=yes" >> config.mak
      echo "#define HAVE_MMX 1" >> config.h
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    fi
    if [ "$gprof" = "yes" ] ; then
    
      echo "TARGET_GPROF=yes" >> config.mak
      echo "#define HAVE_GPROF 1" >> config.h
    
    Fabrice Bellard's avatar
    Fabrice Bellard committed
    fi