blob: f9facbee7dca440cb45996385e50094e9dddde68 (
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
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
|
#!/bin/sh
dvdread_sh_version=4.2.0
dvdread_sh_major=`echo $dvdread_sh_version | awk -F. '{print $1}'`
cc=gcc
make=make
# find source path
source_path="`dirname \"$0\"`"
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
source_path="`pwd`"
source_path_used="no"
else
source_path="`cd \"$source_path\" && pwd`"
echo "$source_path" | grep -q '[[:blank:]]' &&
die "Out of tree builds are impossible with whitespace in source path."
fi
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 " --libdir=DIR install libs in DIR [PREFIX/lib]"
echo " --shlibdir=DIR install shared libs in DIR [PREFIX/lib]"
echo " --incdir=DIR install includes in DIR [PREFIX/include/libdvdread]"
echo " --enable-static build static libraries [default=yes]"
echo " --disable-static do not build static libraries [default=no]"
echo " --enable-shared build shared libraries [default=no]"
echo " --disable-shared do not build shared libraries [default=yes]"
echo " --enable-debug compile with debug symbols [default=yes]"
echo " --disable-debug compile without debug symbols [default=no]"
echo "Advanced options (experts only):"
echo " --cc=CC use C compiler CC [$cc]"
echo " --make=MAKE use specified make [$make]"
echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS"
echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS"
echo "Developer options:"
echo " --disable-strip disable stripping of executables and shared libraries"
echo " --disable-opts disable compiler optimizations"
exit 1
}
SHARED=yes
STATIC=yes
PREFIX=/usr/local/
INSTALLSTRIP=-s
USEDEBUG=-g
optimizations="-O3"
for opt do
optval=`echo $opt | cut -d '=' -f 2-`
case "$opt" in
--enable-shared) SHARED=yes
;;
--disable-shared) SHARED=no
;;
--enable-static) STATIC=yes
;;
--disable-static) STATIC=no
;;
--prefix=*) PREFIX="$optval"
;;
--libdir=*) libdir="$optval"
;;
--shlibdir=*) shlibdir="$optval"
;;
--incdir=*) incdir="$optval"
;;
--cc=*) cc="$optval"
;;
--make=*) make="$optval"
;;
--extra-cflags=*) cflags="$cflags $optval"
;;
--extra-ldflags=*) ldflags="$ldflags $optval"
;;
--disable-strip) INSTALLSTRIP=
;;
--disable-opts) optimizations=""
;;
--disable-debug) USEDEBUG=""
;;
--enable-debug) USEDEBUG="-g"
;;
--help) show_help
;;
esac
done
PREFIX=`cd $PREFIX && pwd`
test -z "$libdir" && libdir=$PREFIX/lib
test -z "$shlibdir" && shlibdir=$PREFIX/lib
test -z "$incdir" && dvdread_incdir=$PREFIX/include/dvdread
targetos=`uname -s`
case $targetos in
Darwin)
SHLDFLAGS="-dynamiclib -Wl,-single_module -Wl,-read_only_relocs,suppress"
;;
*)
SHLDFLAGS="-shared"
;;
esac
echo -n "Checking if we're big-endian... "
bigendian=no
TMPD=`mktemp -d`
TMPC=$TMPD/endian.c
TMPO=$TMPD/endian.o
cat > $TMPC <<EOF
unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
EOF
$cc $optimizations $cflags -c -o $TMPO $TMPC
od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && bigendian=yes
rm -rf $TMPD
echo "$bigendian"
cat > config.mak << EOF
# Automatically generated by configure, do not edit
PREFIX=$PREFIX
libdir=$libdir
shlibdir=$shlibdir
incdir=$incdir
dvdread_incdir=$dvdread_incdir
BUILD_SHARED=$SHARED
BUILD_STATIC=$STATIC
SHLIB_VERSION=$dvdread_sh_version
SHLIB_MAJOR=$dvdread_sh_major
CC=$cc
MAKE=$make
CFLAGS=$optimizations $cflags
LDFLAGS=$ldflags
SHLDFLAGS=$SHLDFLAGS
INSTALLSTRIP=$INSTALLSTRIP
USEDEBUG=$USEDEBUG
SRC_PATH="$source_path"
SRC_PATH_BARE=$source_path
EOF
cat > config.h << EOF
/* Automatically generated by configure, do not edit */
#include "version.h"
EOF
test "$bigendian" = "yes" && echo "#define WORDS_BIGENDIAN" || echo "#undef WORDS_BIGENDIAN" >> config.h
# build tree in object directory if source path is different from current one
if test "$source_path_used" != "no"; then
FILES="\
Makefile \
misc \
"
for f in $FILES ; do
ln -sf "$source_path/$f" $f
done
fi
[ -d obj ] || mkdir -p obj
echo
echo "Done, type 'make install' to build and install"
|