autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom source configuration


From: Ralf Wildenhues
Subject: Re: Custom source configuration
Date: Tue, 13 Nov 2007 13:36:23 +0100
User-agent: Mutt/1.5.17 (2007-11-08)

Hello Yvan,

* Yvan Barthélemy wrote on Tue, Nov 13, 2007 at 12:56:41PM CET:
> I am new to autoconf and I would want to do the following uses :
>
> - I have made a m4 macro to check the Qt environment of a user. Now I would 
> like to check the sources in order to correctly set compiler and linker 
> flags. Is that sort of thing (source scanning) already performed somewhere 
> ?

Do you know <http://autoconf-archive.cryp.to/bnv_have_qt.html>?
We're using an older version of this macro in some code, with
something like this (you also need pkg.m4 for it):

  PKG_CHECK_MODULES(QT, [qt-mt >= 3.1],
    [CPPFLAGS="$CPPFLAGS $QT_CFLAGS"
     LIBS="$QT_LIBS $LIBS"
     AC_PATH_PROG([MOC], [moc], [:])],
    [BNV_HAVE_QT
     CPPFLAGS="$CPPFLAGS $QT_CXXFLAGS"
     LIBS="$QT_LIBS $LIBS"
     MOC="$QT_MOC"])

(improvements and bug reports welcome).

> - The previous use was mostly been thought to be performed at configure 
> time, but it maybe be interesting to perform this at autoreconf time. For 
> example, I would want to generate myself all code with Qt uic, and Qt moc, 
> and distribute the generated code rather than asking the user to do it 
> again (assuming there is no difference in the generated code when generated 
> on different environment).

This is what we do in Makefile.am:

  bin_PROGRAMS            = foo
  foo_SOURCES             = bar.cpp bar.h baz.cpp baz.h ...
  nodist_foo_SOURCES      = $(MOC_SRC) ...
  BUILT_SOURCES           = $(MOC_SRC) ...
  CLEANFILES              = $(MOC_SRC) ...
  SUFFIXES = .cpp .moc .h
  MOC_SRC = bar.moc baz.moc ...

If you want to distribute .moc files, you can probably just move
them from nodist_foo_SOURCES to foo_SOURCES.  And from CLEANFILES
to MAINTAINERCLEANFILES.

If the list of .moc files matches the list of header files, you can
further factor and simplify to:
  foo_hdrs = bar.h baz.h
  foo_SOURCES = $(foo_hdrs) bar.cpp baz.cpp ...
  MOC_SRC = $(foo_hdrs:.h=.moc)

We don't use uic, though.

FWIW, yes, I know the SUFFIXES list is not crucially necessary.
It is not wrong though, either, and I think it helps being clear.

Cheers,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]