-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·197 lines (163 loc) · 3.84 KB
/
configure
File metadata and controls
executable file
·197 lines (163 loc) · 3.84 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/bin/bash
#
# pidvbip configure script
#
# Copyright (c) 2013 Adam Sutton <dev@adamsutton.me.uk>
#
# ###########################################################################
# Setup
# ###########################################################################
#
# Defaults
#
ROOTDIR=$(cd "$(dirname "$0")"; pwd)
CC=${CC:-gcc}
CFLAGS="$CFLAGS -pipe -Wall -I."
LDFLAGS="-lm -lpthread"
VC_SDK_PATH="${VC_SDK_PATH-/opt/vc}"
#
# Options
#
OPTIONS=(
"libavformat:auto"
"libavcodec:auto"
"libavutil:auto"
"avahi:auto"
"debug:no"
)
#
# Begin
#
. "$ROOTDIR/support/configure.inc"
parse_args $*
# TODO: add --vc-sdk-path into command line flags
# ###########################################################################
# Checks
# ###########################################################################
echo "Checking support/features"
#
# Compiler
#
check_cc\
|| die 'Failed to locate C compiler'
check_cc_header pthread\
|| die 'Failed to locate pthreads'
#
# Raspberry PI checks
#
CFLAGS="$CFLAGS -I$VC_SDK_PATH/include"
CFLAGS="$CFLAGS -I$VC_SDK_PATH/include/interface/vcos/pthreads"
CFLAGS="$CFLAGS -I$VC_SDK_PATH/include/interface/vmcs_host/linux"
LDFLAGS="$LDFLAGS -L$VC_SDK_PATH/lib -lbcm_host -lvcos -lvchiq_arm"
check_cc_snippet "fpu" "" "-mfloat-abi=hard -mfpu=vfp" && \
CFLAGS="$CFLAGS -mfloat-abi=hard -mfpu=vfp"
CFLAGS="$CFLAGS -DUSE_VCHIQ_ARM"
check_cc_snippet "bcm_host" '#include <bcm_host.h>;
void t(){bcm_host_init();}' ||\
die "Failed to locate bcm_host"
check_cc_snippet "vcos" '#include <interface/vcos/vcos.h>;
void t(){vcos_malloc_aligned(0,0,0);}' ||\
die "Failed to locate vcos"
LDFLAGS="$LDFLAGS -lEGL -lGLESv2"
check_cc_snippet "gles" '#include <EGL/egl.h>;
void t(){eglCreateContext(0,0,0,0);}' ||\
die "Failed to locate GLES"
CFLAGS="$CFLAGS -DOMX_SKIP64BIT"
LDFLAGS="$LDFLAGS -lopenmaxil"
check_cc_snippet "openmax" 'void t(){OMX_Init();}' ||\
die "Failed to locate OpenMAX"
#
# FreeType
#
if ! check_pkg freetype2; then
die "Failed to locate FreeType"
fi
#
# LibavFormat
#
if enabled_or_auto libavformat; then
if check_pkg libavformat; then
enable libavformat
elif enabled libavformat; then
die "Failed to locate libavformat"
fi
fi
#
# LibavCodec
#
if enabled_or_auto libavcodec; then
if check_pkg libavcodec; then
enable libavcodec
elif enabled libavcodec; then
die "Failed to locate libavcodec"
fi
fi
#
# LibavUtil
#
if enabled_or_auto libavutil; then
if check_pkg libavutil; then
enable libavutil
elif enabled libavutil; then
die "Failed to locate libavutil"
fi
fi
#
# Avahi
#
if enabled_or_auto avahi; then
if check_pkg avahi-client; then
enable avahi
elif check_cc_snippet "avahi" '#include <avahi-client/client.h>
void t(){avahi_client_new(0,0,0,0,0);' "-lavahi-client -lavahi-common"; then
LDFLAGS="$LDFLAGS -lavahi-client -lavahi-common"
enable avahi
elif enabled avahi; then
die "Failed to locate avahi"
fi
fi
#
# Libmpg123
#
if check_pkg libmpg123; then
enable libmpg123
elif check_cc_snippet "libmpg123" '#include <mpg123.h>
void t(){mpg123_init();}' "-lmpg123"; then
LDFLAGS="$LDFLAGS -lmpg123"
enable libmpg123
else
die "Failed to locate libmpg123"
fi
#
# NeAAC
#
LDFLAGS="$LDFLAGS -lfaad"
check_cc_snippet "faad" '#include <neaacdec.h>
void t(){NeAACDecOpen();}' ||\
die "Failed to locate faad"
#
# A52
#
LDFLAGS="$LDFLAGS -la52"
check_cc_snippet "a52" '#include <stdint.h>
#include <a52dec/a52.h>
void t(){a52_init(0);}' ||\
die "Failed to locate a52dec"
#
# Debug
#
if enabled debug; then
CFLAGS="$CFLAGS -O0 -g3"
else
CFLAGS="$CFLAGS -O3 -DNDEBUG"
fi
# ###########################################################################
# Write config
# ###########################################################################
# Write config
write_config
# Output config
print_config
echo "Final Binary:"
echo " $ROOTDIR/pidvbip"
echo ""