On Tuesday 27 May 2008 10:42, Katarina Machalkova wrote:
> What about adding some autoconf check to perl-bindings, such as:
>
> AC_CHECK_HEADERS([ arbitrary-ycp-ui-header.h ], [],
>                  [ AC_MSG_ERROR([Go and install yast2-libyui-devel. Now! ]
> )
>
> I saw a svn check-in adding header check like this in ncurses recently, and
> was thinking about adding similar ones with appropriate error msgs to
> ncurses-pkg, too, just to make a life of those who hand-compile things from
> svn a bit easier :)

From ncurses/configure.in.in:


## check for libyui includes
AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([YaST2/yui/YWidgetFactory.h],
                 [],
                 [AC_MSG_ERROR([libyui headers not found - install package 
yast2-libyui-devel!])])
AC_LANG_POP



AC_LANG_PUSH([C++]) tells "autoconf" to use C++ for the next checks; otherwise 
you'll get complaints about STL headers (std::string, std::map, etc.). There 
is also AC_LANG(), but that one changes the current programming language 
without any chance to set it back to what was used before (typically C). 
AC_LANG_PUSH() OTOH pushes the previous one on a stack, AC_LANG_POP restores 
the previous one.

AC_CHECK_HEADERS() above has 3 arguments:

- What header file to look for (should be unique in that package, and should 
not need anything else)

- Action if found - none in this case:  []   is autoconf/m4 for "empty string"

- Action if not found - in this case, throw an error with AC_MSG_ERROR and 
stop "configure" at that point. Otherwise nobody will notice that anything is 
wrong with all that blurb the "configure" scripts dump to stdout.

See also "info autoconf".

It's no rocket science. It just has a weird syntax. ;-)



CU
-- 
Stefan Hundhammer <[EMAIL PROTECTED]>                Penguin by conviction.
YaST2 Development
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
Nürnberg, Germany
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to