-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·184 lines (163 loc) · 4.28 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
#!/bin/sh
#
# configure
#
# This script should be started before 'make'.
# It should detect your personal configuration.
#
OS=`uname`
case $OS in
Linux) OSDEF=_LINUX ;;
*BSD) OSDEF=_BSD ;;
SunOS) OSDEF=_SUNOS ;;
*) OSDEF=_UNKNOWN ;;
esac
echo "System define: $OSDEF"
echo -n "Looking for Xorg headers... "
X11PATH=""
test -r /usr/local/include/X11/Xlib.h && X11PATH=/usr/local
test -r /usr/X11R6/include/X11/Xlib.h && X11PATH=/usr/X11R6
if [ -z "$X11PATH" ]; then
echo "not found (CONFIGURE ERROR!)."
exit 1
else
echo "found in $X11PATH"
fi
echo "Setting up prefixes..."
PREFIXSETUPBSD="\
.if !defined(PREFIX)\n\
PREFIX = \/usr\/local\n\
.endif\n\
\n\
.if !defined(X11BASE)\n\
X11BASE = $X11PATH\n\
.endif\n\
"
PREFIXSETUPGNU="\
ifndef PREFIX\n\
PREFIX = /usr/local\n\
endif\n\
\n\
ifndef X11BASE\n\
X11BASE = X11PATH\n\
endif\n\
"
rm -f ./conftest ./Makefile ./GNUmakefile
printf "Testing compiler ... ";
cc -Wall -Wstrict-prototypes -o conftest conftest.c
if [ $? -ne 0 ]; then
echo "Compilation failed."
exit 1
fi
./conftest
case $? in
0) printf "cc: test FAILED.\n";exit 1;;
1) ENDIANSTR="";;
2) ENDIANSTR="-DUSE_LITTLE_ENDIAN";;
esac
OS=`uname`
case $OS in
*BSD) printf "Using -pthread.\n"; PTHREAD="-pthread";;
*) printf "Using -lpthread.\n"; PTHREAD="-lpthread";;
esac
printf "Searching special header files ...\n"
printf "fb.h: "
if test -r /usr/include/linux/fb.h ; then
printf "found.\n";
if test ! -e "/dev/fb0" ; then
printf "Warning: /dev/fb0 doesn't exist.\n";
fi
FBSTR="-DFRAMEBUFFER"
else
printf "not found.\n";
unset FBSTR;
fi
printf "joystick.h: "
if test -r /usr/include/linux/joystick.h || test -r /usr/include/sys/joystick.h ; then
printf "found.\n";
if test ! -e "/dev/js0" ; then
if test ! -e "/dev/joy0"; then
printf "Warning: /dev/js0 and /dev/joy0 don't exist.\n";
printf " Setting device to /dev/js0.\n";
fi
case $OS in
*BSD) printf "Using BSD joystick.\n"; JOYSTR="-DBSD_JOYSTICK";;
*) printf "Using Linux joystick.\n"; JOYSTR="-DJOYSTICK";;
esac
else
JOYSTR="-DJOYSTICK"
fi
printf "Compiling joy-button configuration ... "
JOYCONF="conf"
JOYINST="install -m 755 -s .\/cingb_conf \/usr\/local\/bin\/cingb_conf"
printf "ok\n";
else
printf "not found.\n";
unset JOYSTR;
fi
printf "soundcard.h: "
if test -r /usr/include/linux/soundcard.h || test -r /usr/include/sys/soundcard.h ; then
printf "found.\n";
SNDSTR="-DSOUND";
else
printf "not found.\n";
printf "audioio.h: "
if test -r /usr/include/sys/audioio.h ; then
printf "found.\n";
SNDSTR="-DSOUND -DAUDIO";
else
printf "not found.\n";
unset SNDSTR;
fi
fi
printf "Xvlib.h: "
if test -r $X11PATH/include/X11/extensions/Xvlib.h ; then
printf "found.\n";
XVIDEODEF="-DWITH_XVIDEO";
LIBXV="-lXv"
else
printf "not found.\n";
unset XVIDEODEF
unset LIBXV
fi
printf "XShm.h: "
if test -r $X11PATH/include/X11/extensions/XShm.h ; then
printf "found.\n";
SHMSTR="-DMIT_SHM";
LIBSHM="-lXext";
else
printf "not found.\n";
unset SHMSTR;
unset LIBSHM;
fi
printf "Checking libraries ...\n"
printf "libsocket ... "
if test -r /lib/libsocket.a || test -r /usr/lib/libsocket.a ; then
printf "found.\n";
LIBSOCK="-lsocket";
else
printf "not found.\n"
unset LIBSOCK;
fi
printf "libnsl ... "
if test -r /lib/libnsl.a || test -r /usr/lib/libnsl.a ; then
printf "found.\n";
LIBNSL="-lnsl";
else
printf "not found.\n";
unset LIBNSL;
fi
printf "Creating Makefile ... "
sed "s/%%%endian%%%/$ENDIANSTR/;s/%%%joystick%%%/$JOYSTR/;s/%%%framebuffer%%%/$FBSTR/;s/%%%sound%%%/$SNDSTR/;s/%%%libnsl%%%/$LIBNSL/;s/%%%libsocket%%%/$LIBSOCK/;s/%%%mitshm%%%/$SHMSTR/;s/%%%libext%%%/$LIBSHM/;s/%%%pthread%%%/$PTHREAD/;s/%%%joyconf%%%/$JOYCONF/;s/%%%joyinst%%%/$JOYINST/; s/%%%XVDEF%%%/$XVIDEODEF/; s/%%%LIBXV%%%/$LIBXV/; s/%%%OSDEF%%%/-D$OSDEF/" Makefile.templ > Makefile.pre
awk "/%%%prefix-setup%%%/ { print \"$PREFIXSETUPBSD\";next};{ print \$0 }" Makefile.pre > Makefile
awk "/%%%prefix-setup%%%/ { print \"$PREFIXSETUPGNU\";next};{ print \$0 }" Makefile.pre > GNUmakefile
if test "$?"="0"; then
printf "ok\n";
else
printf "FAILED\n";
exit 1;
fi
if test -n "$JOYPATH" ; then
printf "\n................................................\n";
printf "Now run 'make'.\n";
fi