Re: [Anjuta-list] Newbie Question: Checking for Libs
- From: Biswapesh Chattopadhyay <biswapesh_chatterjee tcscal co in>
- To: Anjuta List <anjuta-list lists sourceforge net>
- Cc: Anjuta devel <anjuta-devel lists sourceforge net>
- Subject: Re: [Anjuta-list] Newbie Question: Checking for Libs
- Date: Wed Jan 22 21:06:02 2003
This is a pretty good question and I'm afraid the answer is: we do a
pretty shitty job of making the user's autotools handling pain easier.
This is mainly due to two reasons:
1) Limitations of our project manager. It does not understand
hierarchies, cannot parse configure.in/Makefile.am, etc., cannot handle
multiple targets, etc. We are hoping to correct this in Anjuta2 and in a
future GNOME2 port of Anjuta1.
2) There is no standard way to check for a particular library, header
file, etc. The GNOME (and KDE I think) teams are trying to standardize
on pkg-config but currently, there are various ways to check for package
installation. The main ways are:
a) pkg-config. Supported my all GNOME2 (and probably KDE3) packages +
many current libraries. To check for a package which supports
pkg-config, you need to add this to your configure.in:
PKG_CHECK_MODULES(YOURPACKAGE, yourpackage >= versionnrequired)
AC_SUBST(YOURPACKAGE_CFLAGS)
AC_SUBST(YOURPACKAGE_LIBS)
Then in your Makefile.am, you'll need to add:
INCLUDES += $(YOURPACKAGE_CFLAGS)
LDFLAGS += $(YOURPACKAGE_LIBS)
(Substitute YOURPACKAGE with your package name in caps and yourpackage
with your package name in lowercase)
b) The various package-config scripts. These are available for GNOME
1.x, wxWIndows, PCRE, curl and various other packages. If a package does
not support pkg-config, it is very likely that it will support a package
specific config script. For example, if you want to use GLib in your
program, you add this to your configure.in:
AC_PATH_PROG(GLIB_CONFIG, glib-config,no)
if test x$GLIB_CONFIG = xno; then
AC_MSG_ERROR(Couldn't find glib-config, please install the GLib
package.)
fi
GLIB_CFLAGS=`glib-config --cflags`
GLIB_LIBS=`glib-config --libs`
AC_SUBST(GLIB_LIBS)
AC_SUBST(GLIB_CFLAGS)
Then, in your Makefile.am, you'll need to add:
INCLUDES += $(GLIB_CFLAGS)
LDFLAGS += $(GLIB_LIBS)
c) If you want to check for a library header file, you can use the
AC_CHECK_HEADERS macro like this:
AC_CHECK_HEADER(myheader.h)
This will work provided the headers are in the standard path.
d) To check is a particular library function is available, you can use
AC_CHECK_LIB. For example, add this to your configure.in to check if you
have a sufficiently recent version of aspell:
AC_CHECK_LIB(pspell, new_pspell_manager,,[AC_MSG_ERROR("some error")])
(Example taken directly for balsa)
e) To simply check for a function, you can use AC_CHECK_FUNCS in your
configure.in like this:
AC_CHECK_FUNCS(fnmatch)
f) To check whether something compiles and works, you can use
AC_TRY_COMPILE
There are lots of other ways, most of which have already been made easy
for you through autoconf macros. You can find out more by reading the
macros in /usr/share/aclocal.
The best way to do it is to just copy what others before you have done.
I find it very handy to have the entire GNOME2 CVS on my disk. When I
need to know/use something, I just grep for it and copy-paste it. It is
the fastest and the best way.
Finally, a warning: Since you'll have to make these changes by hand,
make sure that you've set the overwriting of configure.in and
Makefile.am off in Project->Configure.
Hope this helps.
Rgds,
Biswa.
>
> Hi,
>
> I would like to know, how to control the automake/autoconf stuff with
> anjuta.
> I do not really know much about this, so I hope that anjuta makes it
> somehow
> easier for me.
> How do I tell anjuta to check for a special library, header file, program
> and so
> on. I go to the project explorer, rightclick->configure project:
> Now what I have to type?
> If its too basic, please give me an example and/or some info-sources.
>
> Thanks in advance,
> Andre.
>
>
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Scholarships for Techies!
> Can't afford IT training? All 2003 ictp students receive scholarships.
> Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
> www.ictp.com/training/sourceforge.asp
> _______________________________________________
> Anjuta-list mailing list
> Anjuta-list lists sourceforge net
> https://lists.sourceforge.net/lists/listinfo/anjuta-list
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]