Unix Programming - New Problem

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > July 2006 > New Problem





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author New Problem
Jonathan Lamothe

2006-07-17, 1:22 am

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Glenn wrote:
> Well, there's an automake target called 'install-exec-local' which you
> could use to "manually" install the library; then the 'make uninstall'
> command would know nothing about it and leave it alone. But (1) it's
> adding extra complexity, and (2) when users type 'make uninstall' they
> expect it to be the complete inverse of 'make install', and not leave
> stuff lying around. The only gain is a slightly smaller executable.
> I'd stick with the static library.
>
> Glenn


Okay, I changed it over to a static library, but now I'm faced with a
new problem. This probably stems from the fact that I'm fairly new to
Autotools.

For some reason, when I try to link libxio.a into my program, it works
just fine when I run make, but it chokes on a make distcheck. It
complains that there is no xio.h file.

I've created an example tar/bz2ball which can be found here:
ftp://linserv.homeip.net/src/prog

If you don't care to download it, here's a general overview of the
relevant stuff:

*configure.in*
AC_INIT(src/prog.c)
AM_INIT_AUTOMAKE(prog,1.0)
AC_CONFIG_HEADER(config.h)
AC_PROG_INSTALL
AC_LANG_C
AC_PROG_CC
AC_HEADER_STDC
AC_CHECK_HEADER(stdio.h,,AC_MSG_ERROR([
Missing stdio.h]))
AC_CONFIG_SUBDIRS(libxio)
AC_OUTPUT(Makefile src/Makefile)

*Makefile.am*
SUBDIRS = libxio src

*src/Makefile.am*
INCLUDES = ../libxio/src
bin_PROGRAMS = prog
prog_SOURCES = prog.c
prog_LDADD = ../libxio/src/libxio.a

*libxio/configure.in*
dnl You get the idea...
AC_OUTPUT(Makefile src/Makefile)

*libxio/Makefile.am*
SUBDIRS = src

*libxio/src/Makefile.am*
lib_LIBRARIES = libxio.a
libxio_a_SOURCES = libxio.c
include_HEADERS = xio.h

The xio.h is included in the src/prog.c file with the line
#include <xio.h>

If anyone can point out what I'm doing wrong, I'd greatly appreciate it.

- --
Regards,
Jonathan Lamothe

/*
* Oops. The kernel tried to access some bad page. We'll have to
* terminate things with extreme prejudice.
*/

die_if_kernel("Oops", regs, error_code);
-- From linux/arch/i386/mm/fault.c
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEuvjXNrv4JaRC3JsRAmTqAJsEQ7KvEM/WANvD3Ddd5ALlBQZMAQCcCvYM
h41F4Z618k8u7Ibf2O2kAFY=
=xbpK
-----END PGP SIGNATURE-----
Glenn

2006-07-17, 7:19 pm

Jonathan Lamothe wrote:
> For some reason, when I try to link libxio.a into my program, it works
> just fine when I run make, but it chokes on a make distcheck. It
> complains that there is no xio.h file.


There are a couple of problems in this bit:

> *src/Makefile.am*
> INCLUDES = ../libxio/src
> bin_PROGRAMS = prog
> prog_SOURCES = prog.c
> prog_LDADD = ../libxio/src/libxio.a


The autotools build a configure script that lets users specify where
the sources are, and where they want things to be built. The 'make
distcheck' target uses this feature to check the distribution. As a
result, your makefile can't use relative pathnames to find things.

Instead, you should use two variables provided by automake: top_srcdir,
which points to the top-level source directory, and top_builddir, which
points to the top-level build directory. So if you rewrite things like
this...

INCLUDES = $(top_srcdir)/libxio/src
bin_PROGRAMS = prog
prog_SOURCES = prog.c
prog_LDADD = $(top_builddir)/libxio/src/libxio.a

then 'make distcheck' should work just fine!

Regards,

Glenn

Jonathan Lamothe

2006-07-18, 7:23 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Glenn wrote:
> Jonathan Lamothe wrote:
>
>
>
> There are a couple of problems in this bit:
>
>
>
>
> The autotools build a configure script that lets users specify where
> the sources are, and where they want things to be built. The 'make
> distcheck' target uses this feature to check the distribution. As a
> result, your makefile can't use relative pathnames to find things.
>
> Instead, you should use two variables provided by automake: top_srcdir,
> which points to the top-level source directory, and top_builddir, which
> points to the top-level build directory. So if you rewrite things like
> this...
>
> INCLUDES = $(top_srcdir)/libxio/src
> bin_PROGRAMS = prog
> prog_SOURCES = prog.c
> prog_LDADD = $(top_builddir)/libxio/src/libxio.a
>
> then 'make distcheck' should work just fine!
>
> Regards,
>
> Glenn
>


Hmm. I was not aware of that.

Thanks again.

- --
Regards,
Jonathan Lamothe

/*
* Oops. The kernel tried to access some bad page. We'll have to
* terminate things with extreme prejudice.
*/

die_if_kernel("Oops", regs, error_code);
-- From linux/arch/i386/mm/fault.c
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEvWQ2Nrv4JaRC3JsRAvcCAJ94HLxtArNm
ugXl2IWGCHitH3z+EgCdEcGJ
+XiSFhZKYvxEKsUoELIK/U8=
=wzCv
-----END PGP SIGNATURE-----
Jonathan Lamothe

2006-07-18, 7:23 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I actually got an error when I tried this, but I think I figured out
what was wrong.

I changed this line:
INCLUDES = $(top_srcdir)/libxio/src

To read:
INCLUDES = -I$(top_srcdir)/libxio/src

....and everything runs fine.

I'm assuming that's what you meant.

Anyway, thanks again.

- --
Regards,
Jonathan Lamothe

/*
* Oops. The kernel tried to access some bad page. We'll have to
* terminate things with extreme prejudice.
*/

die_if_kernel("Oops", regs, error_code);
-- From linux/arch/i386/mm/fault.c
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEvWktNrv4JaRC3JsRAitoAJ0SYQiRAJgD
IfvvGtPdKsLLo+4F/gCggsdP
PjSBQGoeBxmwc1ZK9rUc0zo=
=eGfl
-----END PGP SIGNATURE-----
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com