By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,570 Members | 1,208 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,570 IT Pros & Developers. It's quick & easy.

C library package design

P: n/a
Hi!

I know this question is more suitable for gnu.utils group but im
posting here, since that group looks almost dead (last post 1 May with
no reply yet) and I need the answer much faster.

I am going to release an ANSI C library soon but I am still confused
about the automake package design I should use. The main trouble is
that I am also distributing some example programs to show the use of
library but don't really know how / where the compilation of those
should take place.

First thing that troubles me is, whether I should build the examples
in the same run as the library itself, using a single configure script
with an additional --with-examples argument added to conditionally run
the makefile in the examples directory?

Or should I rather use another configure script inside the examples
directory and invoke it from the main script via AC_CONFIGURE_SUBDIRS?
Would this mean I would need to run automake, autoheader, autoconf in
the examples folder separately? Would I also need then to maintain the
examples subfolder as a complete separate package and add standard
files for an automake package there as well (COPYING, AUTHORS,
NEWS...)?

The design of the package is quite important because the examples
depend on the library being built so the library must be built first
and maybe there should be another check in the configuration of
example to see if the library was really built. Furthermore, should
the examples link to the uninstalled library file and include the
uninstalled headers directly from the source or should they use the
installed files?

Moreover, one of the examples requires some additional libraries to
link to. This means that the configuration should also check whether
that one is installed in the system. And now I'm puzzled because it
seems like the AC_CHECK_LIB always adds the library it found to the
LIBS string automatically and thus the library only required by one
example would be used when linking the library itself as well. Does
this mean I should definitely use another configure script for
examples?

Basically, I am just asking which of these ways is the usual one, the
one that a user would expect from a library package and is common
among existing libraries. What I want is to give the user of the
library a choice whether to build the examples or not and there should
be additional configuration checks in case the examples are going to
be built. I am just asking about the most common way to achieve this.

thanks,
Ivan Leben

May 15 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a

<iv********@gmail.comwrote in message
news:11**********************@h2g2000hsg.googlegro ups.com...
I am going to release an ANSI C library soon but I am still confused
about the automake package design I should use.
Basically, I am just asking which of these ways is the usual one, the
one that a user would expect from a library package and is common
among existing libraries.
The code is ANSI C. So just put the source files, uncompressed (:-() on a
website somewhere and let people download them.
gcc *.c will build the library under unix, under MS Win you've got to mess
about with project files, but Windows programmers are used to that.
--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

May 15 '07 #2

P: n/a
In article <11**********************@h2g2000hsg.googlegroups. com>,
<iv********@gmail.comwrote:
>I am going to release an ANSI C library soon but I am still confused
about the automake package design I should use. The main trouble is
that I am also distributing some example programs to show the use of
library but don't really know how / where the compilation of those
should take place.
>First thing that troubles me is, whether I should build the examples
in the same run as the library itself, using a single configure script
with an additional --with-examples argument added to conditionally run
the makefile in the examples directory?
>The design of the package is quite important because the examples
depend on the library being built so the library must be built first
and maybe there should be another check in the configuration of
example to see if the library was really built. Furthermore, should
the examples link to the uninstalled library file and include the
uninstalled headers directly from the source or should they use the
installed files?
Traditionally they would use the uninstalled versions, and they
would be built via 'make test', so that people can check that
everything is working before they install the new version
(thus possibly overwriting the old working version)
--
I was very young in those days, but I was also rather dim.
-- Christopher Priest
May 15 '07 #3

P: n/a
iv********@gmail.com writes:
I know this question is more suitable for gnu.utils group but im
posting here, since that group looks almost dead (last post 1 May with
no reply yet) and I need the answer much faster.
I'd recommend asking automake questions at au******@gnu.org.
--
Ben Pfaff
http://benpfaff.org
May 15 '07 #4

P: n/a
iv********@gmail.com writes:
I know this question is more suitable for gnu.utils group but im
posting here, since that group looks almost dead (last post 1 May with
no reply yet) and I need the answer much faster.
[...]

Your question isn't really about the C programming language.

Maybe comp.unix.programmer would be more suitable?

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
May 15 '07 #5

P: n/a
Malcolm McLean said:

<snip>
The code is ANSI C. So just put the source files, uncompressed (:-()
on a website somewhere and let people download them.
gcc *.c will build the library under unix,
No, it won't. But gcc -c *.c will compile all the files, and then you
need to build the library using a tool such as ar.
under MS Win you've got to
mess about with project files, but Windows programmers are used to
that.
Actually, you don't have to mess about with project files at all. That's
just a myth.

See http://www.cpax.org.uk/prg/portable/c/statlibs.php for instructions
on how to build a static library under Linux, Windows (Borland and
Microsoft), and OS X (although my OS X info is second-hand, so I can't
actually vouch for its accuracy). And not a project file in sight.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
May 15 '07 #6

P: n/a
<iv********@gmail.comschrieb im Newsbeitrag
news:11**********************@h2g2000hsg.googlegro ups.com...
Hi!

I know this question is more suitable for gnu.utils group but im
posting here, since that group looks almost dead (last post 1 May with
no reply yet) and I need the answer much faster.
If you haven't seen a post in this group for more than 2 weks, you most
probably won't see replies to your post as your newsfeed seems to be severly
broken.

Other than that your post in this group is utterly off-topic.

Bye, Jojo
May 16 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.