[lockdev-devel] [PATCH 18/19] use automake/autoconf/libtool

Karel Zak kzak at redhat.com
Fri Feb 26 00:28:01 UTC 2010


 Good work! Some ideas comes to mind:

On Thu, Feb 25, 2010 at 11:02:15AM +0100, Ludwig Nussel wrote:
> +AC_INIT([lockdev],[1.0.3],[lockdev-devel at lists.alioth.debian.org])
> +AC_CONFIG_SRCDIR([src/lockdev.c])
> +AM_CONFIG_HEADER([config.h])
> +AC_CONFIG_MACRO_DIR([m4])
> +
> +AC_PREREQ(2.53)
> +AC_CANONICAL_HOST
> +AM_INIT_AUTOMAKE([1.6 foreign no-dist-gzip dist-bzip2 silent-rules -Wall])
                     ^^^                                  ^^^^^^^^^^
 I think silent-rules are supported since AM 1.11. It's maybe more
 robust to use

m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
                            [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])


> diff --git a/docs/Makefile.am b/docs/Makefile.am
> new file mode 100644
> index 0000000..99df3db
> --- /dev/null
> +++ b/docs/Makefile.am
> @@ -0,0 +1,2 @@
> +dist_man3_MANS = lockdev.3
> +dist_man8_MANS = lockdev.8

it should be enough to use 

    dist_man_MANS = lockdev.8 lockdev.3

(note that some automake versions have a problem here when the dist_man_MANS is
used inside conditionals, then

  dist_noinst_DATA = $(dist_man_MANS)

is necessary.)

> diff --git a/src/Makefile.am b/src/Makefile.am
> new file mode 100644
> index 0000000..0584304
> --- /dev/null
> +++ b/src/Makefile.am
> @@ -0,0 +1,11 @@
> +sbin_PROGRAMS = lockdev
> +
> +include_HEADERS = lockdev.h baudboy.h ttylock.h
> +
> +lockdev_SOURCES = sample.c
                     ^^^^^^^
 the name of this file is ugly. It would be better to use lockdev.c
 for the util and liblockdev.c for the library (or so).

> +lockdev_LDADD = liblockdev.la
> +
> +lib_LTLIBRARIES = liblockdev.la
> +liblockdev_la_SOURCES = lockdev.c
> +
> +liblockdev_la_LDFLAGS = -version-info 1:3:0

 what about symbols versioning, so:

   -Wl,--version-script=lockdev.sym

 it's seems like the best way how to maintain shared library ABI
 without soname changes. (For more details see 
 http://people.redhat.com/drepper/dsohowto.pdf)

> diff --git a/src/lockdev.c b/src/lockdev.c
> index f36cfb0..148813d 100644
> --- a/src/lockdev.c
> +++ b/src/lockdev.c
> @@ -102,6 +102,10 @@
>   *
>   */
>  
> +#ifdef HAVE_CONFIG_H
> +#  include <config.h>
> +#endif

 or add 

    AM_CPPFLAGS = -include $(top_builddir)/config.h

 to Makefile.am and you don't have to care about config.h at all.

    Karel

-- 
 Karel Zak  <kzak at redhat.com>



More information about the lockdev-devel mailing list