summaryrefslogtreecommitdiffstats
path: root/configure
blob: 54435a004a7f3322a76feaaa17e2518c27d15374 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/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"
  ;;
  armv4l)
    cpu="armv4l"
    mmx="no"
  ;;
  *)
    mmx="no"
  ;;
esac
gprof="no"
mp3lib="yes"
grab="yes"

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]"
echo "  --disable-mp3lib        disable mp3 lib compiling"
echo "  --disable-grab          disable audio/video grabbing code"
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"
  ;;
  --disable-mp3lib) mp3lib="no"
  ;;
  --disable-grab) grab="no"
  ;;
  esac
done

echo "Install prefix   $prefix"
echo "C compiler       $cc"
echo "CPU              $cpu"
echo "MMX enabled      $mmx"
echo "gprof enabled    $gprof"
echo "grab enabled     $grab"

echo "Creating config.mak and config.h"

echo "# Automatically generated by configure - do not modify" > config.mak
echo "/* Automatically generated by configure - do not modify */" > config.h

# Checking for CFLAGS
if test -z "$CFLAGS"; then
 CFLAGS="-O2"
fi

echo "prefix=$prefix" >> config.mak
echo "MAKE=make" >> config.mak
echo "CC=$cc" >> config.mak
echo "AR=$ar" >> config.mak
echo "OPTFLAGS=$CFLAGS" >> config.mak
if [ "$cpu" = "x86" ] ; then
  echo "TARGET_ARCH_X86=yes" >> config.mak
  echo "#define ARCH_X86 1" >> config.h
fi
if [ "$cpu" = "armv4l" ]; then
  echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
  echo "#define ARCH_ARMV4L 1" >> config.h
fi
if [ "$mmx" = "yes" ] ; then
  echo "TARGET_MMX=yes" >> config.mak
  echo "#define HAVE_MMX 1" >> config.h
fi
if [ "$gprof" = "yes" ] ; then
  echo "TARGET_GPROF=yes" >> config.mak
  echo "#define HAVE_GPROF 1" >> config.h
fi

# if you do not want to use encoders, disable that.
echo "#define CONFIG_ENCODERS 1" >> config.h
echo "CONFIG_ENCODERS=yes" >> config.mak

# if you do not want to use decoders, disable that.
echo "#define CONFIG_DECODERS 1" >> config.h
echo "CONFIG_DECODERS=yes" >> config.mak

# special AC3 and MPGLIB enabling stuff in case you already have it
# without libavcodec.
echo "#define CONFIG_AC3 1" >> config.h
echo "CONFIG_AC3=yes" >> config.mak

if [ "$mp3lib" = "yes" ] ; then
  echo "#define CONFIG_MPGLIB 1" >> config.h
  echo "CONFIG_MPGLIB=yes" >> config.mak
fi

if [ "$grab" = "yes" ] ; then
  echo "#define CONFIG_GRAB 1" >> config.h
  echo "CONFIG_GRAB=yes" >> config.mak
fi
OpenPOWER on IntegriCloud