ifeq/else/endif problem

2000-10-27 Thread Patrick Guio


Dear all
I am trying to insert a conditional part in a Makefile.am in the following
way :

## 2-dimensions library
libmudfas2d_la_SOURCES = $(MUDSRC)
ifeq ($(CXX),cxx)
  libmudfas2d_la_CXXFLAGS = -ptr mudfas2d -DDIM=2
  libmudfas2d_la_LDFLAGS = mudfas2d/*.o -version-info 0:0:0
else
  libmudfas2d_la_CXXFLAGS = -DDIM=2
  libmudfas2d_la_LDFLAGS = -version-info 0:0:0
endif

But when running automake I get

% automake -a -c --include-deps 
src/Makefile.am:24: endif without if
src/Makefile.am:31: else without if
src/Makefile.am:34: endif without if
src/Makefile.am:41: else without if
src/Makefile.am:44: endif without if

If I look at Makefile.in, I get

ifeq ($(CXX),cxx)
  libmudfas2d_la_CXXFLAGS = -ptr mudfas2d -DDIM=2
  libmudfas2d_la_LDFLAGS = mudfas2d/*.o -version-info 0:0:0
  libmudfas2d_la_CXXFLAGS = -DDIM=2
  libmudfas2d_la_LDFLAGS = -version-info 0:0:0

Does automake not recognise GNU make instructions ?! 

Sincerely

Patrick 

==
  Patrick Guio
Institute of Physics, University of Oslo
  P.O. box 1048, Blindern, N-0316 Oslo
   Tel : (+47) 22 84 40 60 - Fax : (+47) 22 85 56 71
E-mail : [EMAIL PROTECTED] 
  URL : http://www.fys.uio.no





Re: How to install config.h

2000-10-27 Thread Mark Galassi


 And use `#include your-package-name/config.h' in all other
 headers that include it.

Ossama BTW, I do exactly what Alexandre suggests in some of my
Ossama own packages.  It works out quite nicely.

But be careful: if any of the C code in the package itself includes
your-package-name/config.h you might be in for a nasty surprise: if
a version is already installed and a user is compiling a new version
from source, that user will pick up the installed .h files which will
not be consistent with the source.  I've seen this happen.




Re: ifeq/else/endif problem

2000-10-27 Thread Raja R Harinath

Patrick Guio [EMAIL PROTECTED] writes:
 I am trying to insert a conditional part in a Makefile.am in the following
 way :
 
 ## 2-dimensions library
 libmudfas2d_la_SOURCES = $(MUDSRC)
 ifeq ($(CXX),cxx)
   libmudfas2d_la_CXXFLAGS = -ptr mudfas2d -DDIM=2
   libmudfas2d_la_LDFLAGS = mudfas2d/*.o -version-info 0:0:0
 else
   libmudfas2d_la_CXXFLAGS = -DDIM=2
   libmudfas2d_la_LDFLAGS = -version-info 0:0:0
 endif
 
 But when running automake I get
 
 % automake -a -c --include-deps 
 src/Makefile.am:24: endif without if
 src/Makefile.am:31: else without if
 src/Makefile.am:34: endif without if
 src/Makefile.am:41: else without if
 src/Makefile.am:44: endif without if

Automake has its own conditional, which, unfortunately, share keywords
with GNU make conditionals.  If you can convert your checks above to
automake conditionals, that would be good.

In configure.in, do

   AM_CONDITIONAL(COMPILER_IS_COMPAQ_CXX, [test x"$CXX" = xcxx])

and in Makefile.am, do

   if COMPILER_IS_COMPAQ_CXX
 foo
   else
 bar
   endif

Otherwise, in case of extreme duress, try this (untested):

In configure.in, 

   MK=''; AC_SUBST(MK)

And in Makefile.am:

   @MK@ifeq ...
foo
   @MK@else
bar
   @MK@endif

However, you cannot put in automake magic variables (things like
foo_SOURCES, foo_LDFLAGS, etc) inside an ifeq/else/endif.  Rather, you
can, but automake will get extremely confused if you do ;-)

- Hari
-- 
Raja R Harinath -- [EMAIL PROTECTED]
"When all else fails, read the instructions."  -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash




Re: How to install config.h

2000-10-27 Thread Ossama Othman

Hi,

On Fri, Oct 27, 2000 at 09:30:47PM +0200, Simon Richter wrote:
 On 27 Oct 2000, Mark Galassi wrote:
 
 [Installing config.h]
 
  But be careful: if any of the C code in the package itself includes
  your-package-name/config.h you might be in for a nasty surprise: if
  a version is already installed and a user is compiling a new version
  from source, that user will pick up the installed .h files which will
 
 Even more evil: These files will contain definitions for PACKAGE and
 VERSION.

Not if you give AM_INIT_AUTOMAKE the dummy third argument.

-Ossama
-- 
Ossama Othman [EMAIL PROTECTED]
Distributed Object Computing Laboratory, Univ. of California at Irvine
1024D/F7A394A8 - 84ED AA0B 1203 99E4 1068  70E6 5EB7 5E71 F7A3 94A8




Re: How to install config.h

2000-10-27 Thread Raja R Harinath

Simon Richter [EMAIL PROTECTED] writes:
 On 27 Oct 2000, Mark Galassi wrote:
 [Installing config.h]
 
  But be careful: if any of the C code in the package itself includes
  your-package-name/config.h you might be in for a nasty surprise: if
  a version is already installed and a user is compiling a new version
  from source, that user will pick up the installed .h files which will
 
 Even more evil: These files will contain definitions for PACKAGE and
 VERSION.

And unless the configure.in tests are exactly the same, you'll have
HAVE_* conflicts.

Compare (on Solaris)

  AC_CHECK_LIB(resolv, inet_aton) #define HAVE_RESOLV 1
  AC_CHECK_FUNC(inet_ntoa)#define HAVE_INET_NTOA

vs.

  AC_CHECK_LIB(resolv, inet_aton, RESOLV_LIB=-lresolv) #define HAVE_RESOLV 1
  AC_CHECK_FUNC(inet_ntoa) #undef HAVE_INET_NTOA

(I know, in "reasonable" circumstances, this example won't really
cause problems, even with both config.h being included.)

And, then we have the problem of having anything depending on the
output of config.status going into $prefix rather than $exec_prefix.

- Hari
-- 
Raja R Harinath -- [EMAIL PROTECTED]
"When all else fails, read the instructions."  -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash




Re: PATCH: patsubst support

2000-10-27 Thread Alexandre Oliva

On Oct 27, 2000, Akim Demaille [EMAIL PROTECTED] wrote:

 Yep, by default Automake must not let the users do nonportable
 things.

I tend to agree.  But I wouldn't say `must not', I'd say `should not'.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicampoliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist*Please* write to mailing lists, not to me