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

Ludwig Nussel ludwig.nussel at suse.de
Thu Feb 25 10:02:15 UTC 2010


---
 Makefile.am      |    1 +
 configure.ac     |   35 +++++++++++++++++++++++++++++++++++
 docs/Makefile.am |    2 ++
 src/Makefile.am  |   11 +++++++++++
 src/lockdev.c    |    4 ++++
 src/sample.c     |    4 ++++
 6 files changed, 57 insertions(+), 0 deletions(-)
 create mode 100644 Makefile.am
 create mode 100644 configure.ac
 create mode 100644 docs/Makefile.am
 create mode 100644 src/Makefile.am

diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..d229a00
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = src docs
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..72e50b0
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,35 @@
+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])
+
+dnl Checks for programs.
+AC_PROG_CC
+
+dnl Checks for header files.
+AC_HEADER_STDC
+
+LT_INIT([disable-static])
+
+dnl check if user wants debug
+AC_MSG_CHECKING([whether to enable debug output])
+AC_ARG_ENABLE(debug,AS_HELP_STRING([--enable-debug],[turn on debugging code]),,enable_debug=no)
+if test x$enable_debug != xno; then
+	test x$enable_debug != xyes || enable_debug=1
+	AC_MSG_RESULT([yes, level $enable_debug])
+else
+	enable_debug=0
+	AC_MSG_RESULT([no])
+fi
+AC_DEFINE_UNQUOTED([DEBUG], $enable_debug, [set default debug level])
+
+AC_CONFIG_FILES([
+	Makefile
+	src/Makefile
+	docs/Makefile
+])
+AC_OUTPUT
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
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
+lockdev_LDADD = liblockdev.la
+
+lib_LTLIBRARIES = liblockdev.la
+liblockdev_la_SOURCES = lockdev.c
+
+liblockdev_la_LDFLAGS = -version-info 1:3:0
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
+
 #include <errno.h>
 #include <signal.h>
 #include <stdio.h>
diff --git a/src/sample.c b/src/sample.c
index b2dd095..a1a67e3 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
-- 
1.6.4.2




More information about the lockdev-devel mailing list