[Ffmpeg-devel] bash substitutions
Jacob Meuser
jakemsr
Sun Dec 18 01:50:26 CET 2005
On Sat, Dec 17, 2005 at 07:08:56PM -0500, Rich Felker wrote:
> On Sat, Dec 17, 2005 at 03:28:30PM -0800, Jacob Meuser wrote:
> > revision 1.217 of configure added some shell substitutions.
> > these apparently only work with bash, which is _not_ the /bin/sh
> > on all systems.
> >
> > specifically:
> >
> > echo "SPPMAJOR=${lavc_version/.*/}" >> config.mak
> > echo "LAVCMAJOR=${lavc_version/.*/}" >> config.mak
> > echo "LAVFMAJOR=${lavf_version/.*/}" >> config.mak
> > echo "LAVUMAJOR=${lavu_version/.*/}" >> config.mak
> >
> > this not work with pdksh, which is the /bin/sh on OpenBSD.
> > I doubt it works with ash, which is the /bin/sh on NetBSD.
> >
> > I suggest the following patch.
>
> bashisms must die!!!!!
> btw, $() is not safe/proper either. `` should be used instead for full
> portability.
hmm, I thought backticks wouldn't work in this situation, but they do
seem to do the trick here.
updated patch below.
--
<jakemsr at jakemsr.com>
--- configure.orig Sat Dec 17 15:00:08 2005
+++ configure Sat Dec 17 15:26:44 2005
@@ -1457,13 +1457,13 @@ lavu_version=`grep '#define LIBAVUTIL_VE
if test "$lshared" = "yes" ; then
echo "BUILD_SHARED=yes" >> config.mak
echo "PIC=-fPIC -DPIC" >> config.mak
- echo "SPPMAJOR=${lavc_version/.*/}" >> config.mak
+ echo "SPPMAJOR=`echo $lavc_version | sed 's/\..*//'`" >> config.mak
echo "SPPVERSION=$lavc_version" >> config.mak
- echo "LAVCMAJOR=${lavc_version/.*/}" >> config.mak
+ echo "LAVCMAJOR=`echo $lavc_version | sed 's/\..*//'`" >> config.mak
echo "LAVCVERSION=$lavc_version" >> config.mak
- echo "LAVFMAJOR=${lavf_version/.*/}" >> config.mak
+ echo "LAVFMAJOR=`echo $lavf_version | sed 's/\..*//'`" >> config.mak
echo "LAVFVERSION=$lavf_version" >> config.mak
- echo "LAVUMAJOR=${lavu_version/.*/}" >> config.mak
+ echo "LAVUMAJOR=`echo $lavu_version | sed s'/\..*//'`" >> config.mak
echo "LAVUVERSION=$lavu_version" >> config.mak
fi
echo "EXTRALIBS=$extralibs" >> config.mak
More information about the ffmpeg-devel
mailing list