-
Notifications
You must be signed in to change notification settings - Fork 41
/
configure
executable file
·156 lines (135 loc) · 3.63 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
#!/bin/sh
##
## fbv configuration script
##
# See TGT's ./configure script for in-depth comments, becouse this
# one is delivered from it...
# If You touch anything below, You're asking for trouble
BASENAME=$(basename "$0")
unset prefix
unset infodir
unset mandir
unset srcdir
unset bindir
unset libs
unset jpeg
unset png
unset bmp
unset dfb
help(){
cat << EOF >&2
Usage: ./configure [options]
Options: [defaults in brackets after descriptions]
If a long option shows an argument as mandatory, then it is mandatory
for the equivalent short option also. Similarly for optional arguments.
General:
--help print this message
--libs=LIBS additional libraries required
Directory and file names:
--prefix=PREFIX install files in PREFIX [/usr/local]
--bindir=DIR binary executable in DIR [PREFIX/lib]
--infodir=DIR info documentation in DIR [PREFIX/info]
--mandir=DIR man documentation in DIR [PREFIX/man]
Features and packages:
--without-libjpeg disable libjpeg support even if found
--without-libpng disable libpng support even if found
--without-bmp disable bmp support
EOF
}
# get options
TEMP=$(getopt -o h \
--long help,\
prefix:,srcdir:,bindir:,\
infodir:,mandir:,\
without-libjpeg,without-libpng,without-bmp,libs: \
-n "$BASENAME" -- "$@")
if [ $? != 0 ] ; then help ; exit 1 ; fi
#
eval set -- "$TEMP"
# process options
while true ; do
case "$1" in
-h|--help) help ; exit 0 ;;
--libs) libs="$2"; shift 2 ;;
--prefix) prefix="$2" ; shift 2 ;;
--srcdir) srcdir="$2" ; shift 2 ;;
--bindir) bindir="$2" ; shift 2 ;;
--infodir) infodir="$2" ; shift 2 ;;
--mandir) mandir="$2" ; shift 2 ;;
--without-libjpeg) jpeg="disabled" ; shift ;;
--without-libpng) png="disabled" ; shift ;;
--without-bmp) bmp="disabled" ; shift ;;
--) shift ; break ;;
*) help ; exit 1 ;;
esac
done
[ -z "$CC" ] && CC=cc
[ -z "$prefix" ] && prefix="/usr/local"
[ -z "$bindir" ] && bindir="${prefix}/bin"
[ -z "$mandir" ] && mandir="${prefix}/man"
[ -z "$infodir" ] && infodir="${prefix}/info"
cat << EOF | tee ./config.log >Make.conf
prefix = $prefix
bindir = $bindir
mandir = $mandir
infodir = $infodir
EOF
# tests
rm -f \$\$~test \$\$~test.c
cat > \$\$~test.c << EOF
main()
{
}
EOF
###
echo -n "checking for libjpeg presence... "
if [ "$jpeg" != "disabled" ]; then
jpeg="no"
$CC 2>>./config.log >>./config.log -o \$\$~test \$\$~test.c -ljpeg $libs
if [ -e \$\$~test ]; then
libs="-ljpeg $libs" ; jpeg="yes"
fi
fi
echo $jpeg
echo "libjpeg: $jpeg" >> ./config.log
###
echo -n "checking for libpng presence... "
if [ "$png" != "disabled" ]; then
png="no"
$CC 2>>./config.log >>./config.log -o \$\$~test \$\$~test.c -lpng $libs
if [ -e \$\$~test ]; then
libs="-lpng $libs" ; png="yes"
fi
fi
echo $png
echo "libpng: $png" >> ./config.log
###
echo -n "building with bmp support... "
if [ "$bmp" != "disabled" ]; then
bmp="yes"
fi
echo $bmp
echo "bmp: $bmp" >> ./config.log
###
rm -f \$\$~test \$\$~test.c
###
echo -n "checking for DEFAULT_FRAMEBUFFER... "
if [ -n "$FRAMEBUFFER" ]; then
dfb="$FRAMEBUFFER"
else
dfb="/dev/fb0"
fi
echo $dfb
echo "fb: $dfb" >> ./config.log
###
echo >> Make.conf
echo "LIBS = $libs" | tee -a ./config.log >>Make.conf
echo "#define IDSTRING \"fbv "`cat VERSION`"\"" | tee -a ./config.log >config.h
echo "#define DEFAULT_FRAMEBUFFER \"$dfb\"" | tee -a ./config.log >>config.h
[ "$jpeg" != "disabled" ] && echo "#define FBV_SUPPORT_JPEG" | tee -a ./config.log >>config.h
[ "$png" != "disabled" ] && echo "#define FBV_SUPPORT_PNG" | tee -a ./config.log >>config.h
[ "$bmp" != "disabled" ] && echo "#define FBV_SUPPORT_BMP" | tee -a ./config.log >>config.h
echo "installation dir: $bindir"
echo "manuals dir: $mandir"
exit 0
## EOF