forked from tvheadend/tvheadend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·191 lines (158 loc) · 3.7 KB
/
configure
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
#!/bin/bash
#
# HTS configure script
#
# Copyright (c) 2005-2009 Andreas Öman
#
# Based on FFmpeg's configure script:
#
# Copyright (c) 2000-2002 Fabrice Bellard
# Copyright (c) 2005-2008 Diego Biurrun
# Copyright (c) 2005-2008 Mans Rullgard
#
PLATFORM=`uname`
source support/configure.inc
CPU=generic
ARCH=`uname -m`
OSENV="posix"
PREFIX=/usr/local
show_help(){
echo "Usage: configure [options]"
echo "Options: [defaults in brackets after descriptions]"
echo
echo "Standard options:"
echo " --help print this message"
echo " --prefix=PREFIX install in PREFIX [$PREFIX]"
echo " --arch=arch Build for this architecture [$ARCH]"
echo " --cpu=cpu Build and optimize for specific CPU"
echo " --cc=CC Build using the given compiler"
echo " --release Stage for release"
exit 1
}
enable cwc
enable avahi
enable linuxdvb
enable v4l
for opt do
optval="${opt#*=}"
case "$opt" in
--prefix=*) PREFIX="$optval"
;;
--cpu=*) CPU="$optval"
;;
--help) show_help
;;
--release)
RELEASE=yes
;;
--cc=*) CC="$optval"
;;
--enable-?*|--disable-?*)
eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
$action $option
;;
esac
done
setup_env
#
# c compiler
#
checkcc() {
cat >$TMPDIR/1.c <<EOF
int main() {
return 0;
}
EOF
$CC 2>/dev/null $TMPDIR/1.c -o $TMPDIR/1.bin
}
checkccarg() {
cat >$TMPDIR/1.c <<EOF
int main() {
return 0;
}
EOF
$CC 2>/dev/null $TMPDIR/1.c -o $TMPDIR/1.bin $1
}
if [ "x$CC" != "x" ]; then
echo >${CONFIG_MAK} "CC=$CC"
else
CC=cc
fi
if checkcc; then
echo "Using C compiler: $CC"
else
echo "C compiler ($CC) is not working"
die
fi
if checkccarg "-mmmx"; then
enable mmx
fi
if checkccarg "-msse2"; then
enable sse2
fi
check_header_c() {
cat >$TMPDIR/1.c <<EOF
#include <$1>
int main() {
return 0;
}
EOF
$CC 2>/dev/null $TMPDIR/1.c -o $TMPDIR/1.bin
}
check_header_c "execinfo.h" && enable execinfo
echo >>${CONFIG_MAK} $CC_CONFIG_MAK
#
# AVAHI
#
if enabled avahi; then
if pkg-config avahi-client; then
# CFLAGS are included by Makefile
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs avahi-client`
echo >>${CONFIG_MAK} "CFLAGS_cfg += "`pkg-config --cflags avahi-client`
echo "Using AVAHI client: `pkg-config --modversion avahi-client`"
else
echo "avahi-client not found. Unable to build with AVAHI support."
echo "To compile without it, configure with: --disable-avahi"
die
fi
fi
if pkg-config libssl; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs libssl`
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags libssl`
echo "Using libssl: `pkg-config --modversion libssl`"
elif pkg-config openssl; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg-config --libs openssl`
echo >>${CONFIG_MAK} "CFLAGS_cfg += " `pkg-config --cflags openssl`
echo "Using openssl: `pkg-config --modversion openssl`"
else
echo "libssl or openssl not found"
die
fi
#
# Configure paths, etc
#
if [ ${RELEASE} != yes ]; then
echo NOTE:
echo NOTE: Development build.
echo NOTE: The generated binary will contained compild-in paths to
echo NOTE: the current build tree. If you plan to install or move
echo NOTE: the binary, please reconfigure with '--release'.
echo NOTE:
cat >> ${CONFIG_H} << EOF
#define TVHEADEND_CONTENT_PATH "${TOPDIR}"
EOF
else
echo >>${CONFIG_MAK} "BUNDLES += docs/html docs/docresources src/webui/static"
cat >> ${CONFIG_H} << EOF
#define TVHEADEND_CONTENT_PATH NULL
EOF
fi
#
# Finalize
#
cat >> ${CONFIG_MAK} << EOF
ARCH=$ARCH
INSTALLPREFIX=$PREFIX
LDFLAGS_cfg += -lpthread
EOF
finalize