File: configure

package info (click to toggle)
mpgtx 1.3.1-6
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, stretch
  • size: 932 kB
  • ctags: 891
  • sloc: cpp: 5,678; sh: 1,372; makefile: 109
file content (371 lines) | stat: -rwxr-xr-x 11,483 bytes parent folder | download
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
#!/bin/sh

#################################################
#                                               #
#        Assign/reset vars we will use          #
#                                               #
#################################################

prefix="/usr/local"
manprefix='$(PREFIX)'
#compiler flags
CC="g++"
common_cflags="-Wall"
devel_cflags="-g -Werror -fno-builtin"
optimization_cflags="-O3"
release_cflags=$optimization_cflags
OFLAGS="-ansi"
cflags=$common_cflags

#linker flags

lflags=""

#state vars
debug="no"
devel="no"
parachute="no"
static="no"
LFS="yes"

# cp flags
cpflags="d"

# some stuff for MacOSX -----------------------------
HOSTNAME=`./config.guess`

if [ "${HOSTNAME}" = "powerpc-apple-darwin6.0" ]; then
#compiler flags
CC="c++"
common_cflags="-pedantic -Wall"
#devel_cflags="-g -Werror -fno-builtin"
devel_cflags="-g -fno-builtin"
optimization_cflags="-O0"
release_cflags=$optimization_cflags
cflags=$common_cflags
OFLAGS="-D_MACOSX"
#linker flags
lflags="-x"
#state vars
debug="no"
devel="no"
parachute="no"
static="no"
LFS="yes"

#cp flags macosx does not know about cp -d !
cpflags=""

fi

# IRIX support (thank to Eric Sokolowsky)
if [ "${HOSTNAME}" = "mips-sgi-irix6.5" ]; then
  OFLAGS="";
fi

# cygwin support
if [ "${HOSTNAME}" = "i686-pc-cygwin" ]; then
  OFLAGS="";
fi

#################################################
#                                               #
#        Process command line arguments         #
#                                               #
#################################################




for option in $* ;
do
     case "$option" in
     -debug | --debug) debug="yes";;
	 -man=* | --man=* | -manprefix=* | --manprefix=*) manprefix=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
	 -devel | --devel) devel="yes";;
	 -no-LFS | --no-LFS | -no-lfs | --no-lfs) LFS="no";;
	 -stat | -static | --stat | --static) static="yes";;
	 -par | -parachute | --par | --parachute) parachute="yes";;
	 -prefix=* | --prefix=*) prefix=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
	 -dist | dist | --distrib | -distrib) rm -f Makefile && cat << EOF >makefile && exit 0;;
# Dummy Makefile, please run ./configure
default:
	@echo ""
	@echo " -----------------------------------------------------------------------------"
	@echo "    Hello !"
	@echo "    I'm afraid I'm a dummy Makefile."
	@echo ""
	@echo " My goal in life is to politely ask you to run the configure script to actual-"
	@echo " ly generate a real Makefile."
	@echo " Would you be kind enough to type \"./configure --help\" to see the options that"
	@echo " will suit your needs ?   Please note that typing \"./configure\" without option"
	@echo " will generate a Makefile that will suit most people needs."
	@echo ""
	@echo " I wish you a good day. Please don't drive to fast."
	@echo " -----------------------------------------------------------------------------"
	@echo ""
EOF
	 -h | -help | --help) cat << EOF && exit 0;;

This dumb piece of script is NOT the standard GNU configure script.
Use this to generate a Makefile that suits your needs.

The default target is to use shared libraries, disable builtin parachute,
enable Large File support (i.e. files > 2/4 Go) whenever possible, disable
debugging facility and install mpgtx with prefix /usr/local

Options you can use to change this dramatically standard behaviour are :
     --no-LFS         Do not try to include Large File support.
     --static         Link statically. Usefull if you plan to use mpgtx on
                      the multiple systems with different libraries.
     --parachute      Enable a builtin parachute that can catch segmentation
                      faults and tell the user who to call and what to tell.
     --manprefix=MPTH Set the manual page installation directory to a different
                      path from the regular installation directory.
     --devel          Add some debugger facility and disable optimizations.
     --debug          Same as above but changes mpgtx output to something
                      ugly and usefull.
     --prefix=PREFIX  Set the installation directory to PREFIX.

     --distrib        Try to make the source files distribution ready.
                      You can not build anything with this option

EOF
     *)    echo "the option [$option] is not known try \"configure --help\" for known options."; exit 1;
     esac
done


#################################################
#                                               #
#        Check some things here                 #
#                                               #
#################################################

# test if compiler is gcc version 3.0 or 3.1
# if so change optimization flags to -O2
# they do not seem to like -O3 with mpgtx very much

gcc_major=`gcc --version 2>&1 | head -n1 | sed 's/^[^0-9]*//' | cut -d. -f1`
gcc_minor=`gcc --version 2>&1 | head -n1 | sed 's/^[^0-9]*//' | cut -d. -f2`

if test "$gcc_major" = "3"; then
    if test "$gcc_minor" = "0" -o "$gcc_minor" = "1"; then
	optimization_cflags="-O2";
    fi
fi

# Now check if the system handles large file support
# unless user has specified not to do so
if test $LFS = "yes"; then
	echo -n  "Checking Large File Support ... ";
	cat << EOF >__LFStest.cpp
		#include <stdio.h>
		int main(){
		return (int)(fseeko(stdin,0,SEEK_SET));
		}
EOF
	$CC __LFStest.cpp -o __LFStestPASSED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 1>__LFSout 2>__LFSerror
	if test -f __LFStestPASSED; then
		echo "PASSED";
		cflags="$cflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE";
	else
		echo "FAILED";
		LFS="no (not supported)"
	fi 
	rm -rf __LFStest.cpp __LFStestPASSED __LFSerror __LFSout;
fi


#################################################
#                                               #
#        Format CFLAGS and LFAGS                #
#                                               #
#################################################


if test  $parachute = "no"; then
	cflags="$cflags -DNOSIGNAL_H";
fi


if test $debug = "yes"; then
	if test $devel = "yes"; then
		cflags="$cflags -D_DEBUG_";
	else
		cflags="$cflags $devel_cflags -D_DEBUG_";
	fi
fi

if test $devel = "yes"; then
	cflags="$cflags $devel_cflags";
fi

if test $static = "yes"; then
	lflags="$lflags -static";
fi

if test $devel = "no" -a $debug = "no"; then
lflags="$lflags -s";
cflags="$cflags $optimization_cflags";
fi




#################################################
#                                               #
#        Actually generate makefile             #
#                                               #
#################################################

makefilename="Makefile"

echo "Generating $makefilename ..."
# remove dumb makefile
rm -f makefile
# generate actual Makefile
cat << EOF >$makefilename
###################################################
# Hi.                                             #
# This file was generated by the configure script #
# but you may want to edit it at your convenience #
# If unsure, try a ./configure --help to see if   #
# standard options suit your needs.               #
# Have a nice day.                        laureck #
###################################################

# Installation directories. Edit at your convenience

EOF

echo "PREFIX=$prefix" >> $makefilename
echo "OFLAGS=$OFLAGS" >> $makefilename
echo "manprefix=$manprefix" >> $makefilename
echo "cpflags=$cpflags" >> $makefilename

cat << EOF >>$makefilename
INSTALLDIR=\$(PREFIX)/bin
MANDIR=\$(manprefix)/man/man1
# Compilation and linker flags

EOF

echo "CFLAGS+=$cflags" >> $makefilename
echo "LDFLAGS+=$lflags" >> $makefilename

cat << EOF >>$makefilename

# Now onto the targets

default: warn mpgtx
	@echo "----------------------------------------------------------------------"
	@echo "Success building mpgtx. Now type \"make install\" to install it"
	@echo "----------------------------------------------------------------------"

warn:
	@echo "----------------------------------------------------------------------"
	@echo "I'm building mpgtx with following options :"
	@echo ""
EOF

if test $devel = "no" -a $debug = "no"; then
		echo -e "\t@echo \"    Target                    : RELEASE\"" >> $makefilename
else
	if test $debug = "yes"; then
		echo -e "\t@echo \"    Target                    : DEBUG\"" >> $makefilename
	else
		echo -e "\t@echo \"    Target                    : DEVELOPMENT\"" >> $makefilename
	fi
fi

echo -e "\t@echo \"    Manual installation prefix: $manprefix\"" >>$makefilename
echo -e "\t@echo \"    Large File support        : $LFS\"" >>$makefilename
echo -e "\t@echo \"    Link statically           : $static\"" >>$makefilename
echo -e "\t@echo \"    Support builtin parachute : $parachute\"" >>$makefilename
echo -e "\t@echo \"    Install prefix            : $prefix\"" >>$makefilename

cat << EOF >>$makefilename
	@echo ""
	@echo "Type \"./configure --help\" to see available options."
	@echo "----------------------------------------------------------------------"
	@echo ""

mpgtx : commandline.cxx mpegOut.o mpeg.o chunkTab.o id3command.o common.hh
	$CC \$(CFLAGS) \$(OFLAGS) -o mpgtx commandline.cxx mpegOut.o mpeg.o chunkTab.o id3command.o \$(LDFLAGS)
mpegOut.o : mpegOut.cxx mpegOut.hh mpeg.hh common.hh
	$CC \$(CFLAGS) \$(OFLAGS) -c mpegOut.cxx 
mpeg.o : mpeg.cxx mpeg.hh mpegOut.hh common.hh
	$CC \$(CFLAGS) \$(OFLAGS) -c mpeg.cxx 
chunkTab.o : chunkTab.cxx chunkTab.hh common.hh
	$CC \$(CFLAGS) \$(OFLAGS) -c chunkTab.cxx
id3command.o : id3command.cxx id3command.hh common.hh
	$CC \$(CFLAGS) \$(OFLAGS) -c id3command.cxx



clean :
	rm -f *.o mpgtx mpgjoin mpgcat mpgsplit mpginfo mpgdemux tagmp3 man/mpginfo.1 man/mpgsplit.1 man/mpgcat.1 man/mpgjoin.1 man/mpgdemux.1


install:
	ln -sf mpgtx mpgjoin
	ln -sf mpgtx mpgsplit
	ln -sf mpgtx mpgcat
	ln -sf mpgtx mpginfo
	ln -sf mpgtx mpgdemux
	ln -sf mpgtx tagmp3
	install -d -m 755  \$(INSTALLDIR)
	install -d -m 755  \$(MANDIR)
	install -s -m 755 mpgtx \$(INSTALLDIR)
	cp -\$(cpflags)f mpgdemux mpgjoin mpgcat mpginfo mpgsplit tagmp3 \$(INSTALLDIR)
	install -m 644 man/mpgtx.1 man/tagmp3.1 \$(MANDIR) 
	cd man ; make
	cd ..
	cp -\$(cpflags)f ./man/mpgdemux.1 ./man/mpgjoin.1 man/mpgsplit.1 man/mpgcat.1 man/mpginfo.1 \$(MANDIR)


uninstall:
	rm -f   \$(INSTALLDIR)/mpgtx
	rm -f	\$(INSTALLDIR)/mpgjoin
	rm -f	\$(INSTALLDIR)/mpgsplit
	rm -f	\$(INSTALLDIR)/mpgcat
	rm -f	\$(INSTALLDIR)/mpginfo
	rm -f   \$(INSTALLDIR)/mpgdemux
	rm -f   \$(INSTALLDIR)/tagmp3

	rm -f   \$(MANDIR)/mpgtx.1
	rm -f	\$(MANDIR)/mpgjoin.1
	rm -f	\$(MANDIR)/mpgsplit.1
	rm -f	\$(MANDIR)/mpgcat.1
	rm -f	\$(MANDIR)/mpginfo.1
	rm -f   \$(MANDIR)/mpgdemux.1
	rm -f   \$(MANDIR)/tagmp3.1

EOF

#################################################
#                                               #
#        Tell Mr X what he'll have              #
#                                               #
#################################################

echo ""
echo "Here are the options you choosed : "
if test $devel = "no" -a $debug = "no"; then
		echo "  Target                    : RELEASE"
else
	if test $debug = "yes"; then
		echo "  Target                    : DEBUG"
	else
		echo "  Target                    : DEVELOPMENT"
	fi
fi
echo "  Large File support        : $LFS"
echo "  Link statically           : $static"
echo "  Support builtin parachute : $parachute"
echo "  Install prefix            : $prefix"
echo ""
echo "Now Type \"make\" to build mpgtx (and have a nice day by the way) "

exit 0