tr00per / googletest

Automatically exported from code.google.com/p/googletest
0 stars 0 forks source link

Faulty M4 Macro #92

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Simply use GTEST_LIB_CHECK in a configure.ac
2. run autoreconf
3. launch configure

What is the expected output? What do you see instead?
Having installed Gtest and being able to compile using standard Makefile
and gtest-config, I should have a "checking for 'gtest-config'... yes" as
the output of configure. I actually have instead : 

checking for 'gtest-config'... no
configure: error: Unable to locate either a built or installed Google Test.
The specific location '' was provided for a built or installed
Google Test, but no 'gtest-config' script could be found at this location.

Using ./configure  --enable-gtest yes is a workaround to this issue.

But there you got a syntax error in the configure script : 

checking for 'gtest-config'... checking for gtest-config...
/usr/local/bin/gtest-config
/usr/local/bin/gtest-config
checking for Google Test... yes
./configure: line 3897: syntax error near unexpected token `else'
./configure: line 3897: `else'

which corresponds to : 

 if test "x$HAVE_GTEST" = "xyes"; then
  HAVE_GTEST_TRUE=
  HAVE_GTEST_FALSE='#'
else
  HAVE_GTEST_TRUE='#'
  HAVE_GTEST_FALSE=
fi

if test "x$HAVE_GTEST" = "xyes"; then

else

fi

line 3897 is the second "else" statement.

Using GTEST_LIB_CHECK(,AC_MSG_WARN(foo),AC_MSG_WARN(bar)) in configure.ac
is a simple workaround to this issue.

What version of the product are you using? On what operating system?
I am using Gentoo Linux.

Linux mycomputer 2.6.24-gentoo-r4 #6 SMP Tue Nov 4 23:05:32 CET 2008 i686
Intel(R) Core(TM)2 CPU T5600 @ 1.83GHz GenuineIntel GNU/Linux

Please provide any additional information below.

There may be 2 different issues there, but they all seem to be related to 
a faulty gtest.m4. I am a very beginner with autotools suite, so it may
very well be my fault... I Hope I'm not wasting your time here!

Original issue reported on code.google.com by zeta....@gmail.com on 21 Dec 2008 at 11:59

GoogleCodeExporter commented 9 years ago
I missed to say that I'm using  gtest-1.2.1 downloaded via gtest-1.2.1.tar.bz2

The attached patch seem to be correcting those issues on my installation. 
Beware it's
stripping out the ability to have personalized messages

Original comment by zeta....@gmail.com on 22 Dec 2008 at 12:17

Attachments:

GoogleCodeExporter commented 9 years ago
Chandler, could you take a look when you have time?  Or would you like Benoit 
to take
it?  Thanks.

Original comment by shiq...@gmail.com on 22 Dec 2008 at 8:15

GoogleCodeExporter commented 9 years ago
I'm happy to look at it. Should get to it tomorrow evening. It doesn't look bad,
likely a typo or two that are buried in the M4.

Original comment by chandl...@gmail.com on 22 Dec 2008 at 9:01

GoogleCodeExporter commented 9 years ago
We won't spend more time on improving the autotools scripts.

Original comment by w...@google.com on 23 Dec 2009 at 7:01

GoogleCodeExporter commented 9 years ago
This is unfortunate, autotools are widely used.  I was able to fix this problem 
by commenting out the lines in gtest.m4 that generate the broken if else code.

Original comment by redp...@gmail.com on 28 Sep 2011 at 3:07

GoogleCodeExporter commented 9 years ago
If you won't maintain gtest.m4, then at least then remove it. A faulty gtest.m4 
is more annoying than helpful.

Original comment by Frej.Soya on 27 Dec 2011 at 10:34