autotools version check in autogen.sh (Re: [ft-devel] Mac install instructions don't seem to exist)

2007-01-30 Thread mpsuzuki
Dear Sir,

I thank Turner for his quick fix of autogen.sh for Mac OS X's
glibtool issue, on 2007-01-11.

On Fri, 29 Dec 2006 00:57:12 +0900
[EMAIL PROTECTED] wrote:
 In my personal opinion, putting some hooks to check autotools
 versions into autogen.sh is not bad idea.

I don't object, but it doesn't have a high priority for me.

Of course, it's task of me who proposed. I will write version
checking hooks for autogen.sh, after 2007-01-15. Please wait.

Following is my first manuscript patch to add the version checking
feature to autogen.sh. In addition to basic aclocal/libtoolize/autoconf,
it scans aclocal-1.9, glibtoolize, libtoolize-1.5, autoconf-2.59
for fallbacking.

This is too lengthy for other developers to maintain, possibly
I can reduce to 50% shorter. If more compression is essential,
please let me know.

Regards,
mpsuzuki

--

Index: autogen.sh
===
RCS file: /sources/freetype/freetype2/autogen.sh,v
retrieving revision 1.6
diff -u -r1.6 autogen.sh
--- autogen.sh  12 Jan 2007 09:28:44 -  1.6
+++ autogen.sh  31 Jan 2007 06:43:31 -
@@ -20,6 +20,123 @@
   fi
 }
 
+compare_version_number ()
+{
+  r=`( echo $1 ; echo $2 ) | tr ',' ' ' |  \
+  awk 'BEGIN{getline;vn=split($0,v, )}\
+   {\
+ for(i=1;i=NF;i++)\
+ {\
+   if(v[i]  $i){print no;exit}\
+   if($i  v[i]){print yes;exit}\
+ }\
+ if ( length( v[NF + 1] )  0 ) { print no } \
+ else { print yes } \
+   }'`
+
+  if test x${r} = xyes ; then
+return 0
+  else
+return 1
+  fi
+}
+
+
+check_program_version ()
+{
+  prog_name=$1
+  min_version=$2
+  vendor_keyword=$3
+
+  matched_prog=
+
+  p=
+  for d in `echo ${PATH} | tr ':' ' '`
+  do
+if test -x ${d}/${prog_name} ; then
+  p=${d}/${prog_name}
+  break;
+fi
+  done
+
+  if test x = x${p} ; then
+return 1
+  fi
+
+  echo -n 'Checking version of '${p}' (= '${min_version}')... '
+
+  v=`${p} --version 2/dev/null | head -1`
+  if test x != x${v} ; then
+v=`${p} --version 21 | head -1`
+  fi
+  case `echo ${v} | wc -w` in
+  0) # cannot extract program version
+;;
+
+  1) # assumed format: [version]
+echo -n ${v}, 
+vn=`echo ${v} | sed 's/[^0-9 ][^0-9 ]*/  /g;s/  */,/g;s/\.,//g' `
+vm=`echo ${min_version} | sed 's/\./ /g;s/[^0-9 ]/ /g;s/  */,/g' `
+compare_version_number ${vm} ${vn}
+if test 0 != $? ; then
+  echo too old
+else
+  echo ok
+  matched_prog=${p}
+fi
+;;
+
+  3) # assumed format: [progname] version [version]
+vn=`echo ${v} | sed 's/^.* //' `
+echo -n ${vn}, 
+vn=`echo ${vn} | sed 's/[^0-9 ][^0-9 ]*/  /g;s/  */,/g;s/\.,//g' `
+vm=`echo ${min_version} | sed 's/\./ /g;s/[^0-9 ]/ /g;s/  */,/g' `
+compare_version_number ${vm} ${vn}
+if test 0 != $? ; then
+  echo too old
+else
+  echo ok
+  matched_prog=${p}
+fi
+;;
+
+  *) # assumed format: [progname] ([vendor]) [version] [extra-comment]
+v=`echo ${v} | sed 's/  */ /g;s/ /_/g;s/_(/ (/g;s/)_/) /g;s/\.,//g'`
+vn=`echo ${v} | cut -d  -f3`
+echo -n ${vn}, 
+vn=`echo ${vn} | sed 's/[^0-9 ][^0-9 ]*/  /g;s/  */,/g;;s/\.,//g' `
+vm=`echo ${min_version} | sed 's/\./ /g;s/[^0-9 ]/ /g;s/  */,/g' `
+compare_version_number ${vm} ${vn}
+if test 0 != $? ; then
+  echo too old
+else
+  echo ok
+
+  vendor=`echo ${v} | cut -d  -f2`
+  if test x != x${vendor} -a x != x${vendor_keyword}; then
+echo -n 'Checking ${p}...'
+case ${vendor} in
+*${vendor_keyword}* )
+  echo ' '${vendor_keyword}' '${prog_name}
+  ;;
+*)
+  echo ' not '${vendor_keyword}' '${prog_name}
+  exit 1
+  ;;
+esac
+  fi
+  matched_prog=${p}
+fi
+;;
+  esac
+
+  if test x != x${matched_prog} ; then
+return 0
+  else
+return 1
+  fi
+}
+
 if test ! -f ./builds/unix/configure.raw; then
   echo You must be in the same directory as \`autogen.sh'.
   echo Bootstrapping doesn't work if srcdir != builddir.
@@ -40,16 +157,50 @@
 sed -e s;@VERSION@;$freetype_major$freetype_minor$freetype_patch; \
  configure.raw  configure.ac
 
-# On MacOS X, the GNU libtool is named `glibtool'.
-HOSTOS=`uname`
-LIBTOOLIZE=libtoolize
-if test $HOSTOSx = Darwinx; then
-  LIBTOOLIZE=glibtoolize
+
+# autotool version check
+for p in aclocal aclocal-1.9
+do
+  if test x = x${ACLOCAL} ; then
+check_program_version $p 1.9.6
+if test 0 = $? ; then
+  ACLOCAL=$p
+fi
+  fi
+done
+if test x = x${ACLOCAL} ; then
+  exit 1
+fi
+
+for p in libtoolize libtoolize-1.5 glibtoolize
+do
+  if test x = x${LIBTOOLIZE} ; then
+check_program_version $p 1.5.22
+if test 0 = $? ; then
+  LIBTOOLIZE=$p
+fi
+  fi
+done
+if test x = x${LIBTOOLIZE} ; then
+  exit 1
+fi
+
+for p in autoconf autoconf-2.59
+do
+  if test x = x${AUTOCONF} ; then
+

Re: [ft-devel] Mac install instructions don't seem to exist

2007-01-03 Thread Sean McBride
Happy New Year everyone!


On 2006-12-22 23:05, Werner LEMBERG said:

 Could autogen.sh be conditionalised to include Chirstian's hack?

No.  You are actually using a developer's version (the CVS), thus you
have to be prepared to use the latest tools in case .  On the other
hand, a `public' tarball comes with a generated configure script; in
that case you neither need automake nor autoconf at all.

I see.  I did not realise that the problem only exists with the CVS
version and not the public version.  I had incorrectly assumed they were
more similar.  As I said, I am largely ignorant of the whole configure/
automake method of building things.


On 2006-12-25 03:11, [EMAIL PROTECTED] said:

Sean, except of GNU make version, there's any issues that
configure, builds/unix/configure and INSTALL.UNIX have not
covered yet?

No.  After I used Christian's hack everything built without problems.

Thanks all,

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada




___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] Mac install instructions don't seem to exist

2006-12-28 Thread mpsuzuki
Hi,

I think Turner and Werner gave me comment to proceed the work,
thank you.

On Mon, 25 Dec 2006 10:29:30 +0100 (CET)
Werner LEMBERG [EMAIL PROTECTED] wrote:
 At present, configure (not builds/unix/configure) has a hook to
 ascertain whether make is GNU make /or not. I think, putting
 detailed version check into configure is the simplest improvement.

Yep.  This has benefits for other platforms too.

 Or, the documentation improvement is better? Werner, please
 let me know your thought.

Both.  A small `README.Darwin' or something similar doesn't hurt -- it
would be sufficient that it contains a pointer to another README file.

I see, I will start from the improvement of configure,
README.Darwin will be later.

 In my personal opinion, putting some hooks to check autotools
 versions into autogen.sh is not bad idea.

I don't object, but it doesn't have a high priority for me.

Of course, it's task of me who proposed. I will write version
checking hooks for autogen.sh, after 2007-01-15. Please wait.

Regards,
mpsuzuki


___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] Mac install instructions don't seem to exist

2006-12-26 Thread Werner LEMBERG
 At present, configure (not builds/unix/configure) has a hook to
 ascertain whether make is GNU make /or not. I think, putting
 detailed version check into configure is the simplest improvement.

Yep.  This has benefits for other platforms too.

 Or, the documentation improvement is better? Werner, please
 let me know your thought.

Both.  A small `README.Darwin' or something similar doesn't hurt -- it
would be sufficient that it contains a pointer to another README file.

 In my personal opinion, putting some hooks to check autotools
 versions into autogen.sh is not bad idea.

I don't object, but it doesn't have a high priority for me.


Werner


___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] Mac install instructions don't seem to exist

2006-12-22 Thread Christian Demmer
Hi,

I, too saw problems with freetype2 CVS some weeks ago. Downloading the
2.2.1 release did build with ./configure, make, make install out of the
box.

I tried it today your way and it fails as you describe on my Intel
10.4.8.

Sean McBride wrote:
mkdir -p ~/Desktop/freetype2/CVS
cd ~/Desktop/freetype2/CVS
cvs -d:pserver:[EMAIL PROTECTED]:/sources/freetype login
cvs -z3 -d:pserver:[EMAIL PROTECTED]:/sources/freetype
co -P freetype2
cd ~/Desktop/freetype2/CVS/freetype2

At this point edit autogen.sh and remove the --force option in line 43.
Also rename libtoolize to glibtoolize in line 44. Then:

sh autogen.sh
./configure
make

did the job for me.

Hope this helps

Christian


___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] Mac install instructions don't seem to exist

2006-12-22 Thread Sean McBride
On 2006-12-22 10:12, [EMAIL PROTECTED] said:


generating `configure.ac'
running `aclocal -I . --force'
aclocal: unrecognized option -- `--force'
Try `aclocal --help' for more information.
error while running `aclocal -I . --force'


The autotools (automake, autoconf) bundled in Xcode
are legacy. You have to install newer autotools
out of Xcode. I use automake-1.9.6  autoconf-2.59.

Thanks everyone for your replies!

Xcode 2.4.1 (newest) appears to include only 1.6.3 and 2.59.  I will
file a bug with Apple asking them to update to something newer.

I don't think I really want to install a different automake, I'm worried
it might interfere with the one I already have.

But this brings me back to the reason I started this thread. :)  Mac
install instructions don't seem to exist.  It would be nice to have an
INSTALL.MAC file explaining, well, basically a summary of this discussion. :)


On 2006-12-22 16:41, Christian Demmer said:

At this point edit autogen.sh and remove the --force option in line 43.
Also rename libtoolize to glibtoolize in line 44. Then:

sh autogen.sh
./configure
make

did the job for me.

Worked for me too, thanks!

I must say it's pretty strange that a project like freetype (which
includes Mac-specific code) does not build with the development tools
that come with the OS.

Could autogen.sh be conditionalised to include Chirstian's hack?  (I am
admittedly very ignorant about automake/autoconf style build systems,
and ignorant of freetype in general really, so forgive me if I'm not
making sense.)

Thanks,

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada




___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] Mac install instructions don't seem to exist

2006-12-21 Thread Werner LEMBERG

 Can some please explain how I build freetype2?

From the CVS, building a shared library:

  sh autogen.sh
  ./configure
  make

The developer version:

  make devel
  make


Werner


___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] Mac install instructions don't seem to exist

2006-12-21 Thread mpsuzuki
Hi,

On Thu, 21 Dec 2006 16:04:07 -0500
Sean McBride [EMAIL PROTECTED] wrote:

generating `configure.ac'
running `aclocal -I . --force'
aclocal: unrecognized option -- `--force'
Try `aclocal --help' for more information.
error while running `aclocal -I . --force'


The autotools (automake, autoconf) bundled in Xcode
are legacy. You have to install newer autotools
out of Xcode. I use automake-1.9.6  autoconf-2.59.

Regards,
mpsuzuki


___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel