From f81280cb69f1a438bb962390816a7e3b33724d77 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Sat, 11 Jun 2022 13:53:45 +0300 Subject: [PATCH] Use Libtool --- .gitignore | 8 ++++++++ Makefile.am | 6 ++++-- configure.ac | 51 +++++++++++++++++++++++++++++++++++++++++++-------- m4/.keep | 0 4 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 m4/.keep diff --git a/.gitignore b/.gitignore index aeae0d6..4500f41 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,13 @@ *.a *.c.d +*.la +*.lo *.o .deps/ .dirstamp +.libs/ ############################ # Always generated in root # @@ -28,9 +31,13 @@ /configure~ /depcomp /install-sh +/ltmain.sh /missing /test-driver +/m4/* +!/m4/.keep + # Custom /Makefile.in @@ -43,6 +50,7 @@ /config.h /config.log /config.status +/libtool /stamp-h1 /test-suite.log diff --git a/Makefile.am b/Makefile.am index d9a0fcb..5e20d08 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,5 @@ +ACLOCAL_AMFLAGS = -I m4 + SUBDIRS = include AM_CFLAGS = \ @@ -9,10 +11,10 @@ AM_CFLAGS = \ -I$(top_srcdir)/include bin_PROGRAMS = autotools-project -lib_LIBRARIES = libautotools-project.a +lib_LTLIBRARIES = libautotools-project.la autotools_project_SOURCES = \ src/main.c -libautotools_project_a_SOURCES = \ +libautotools_project_la_SOURCES = \ src/lib.c diff --git a/configure.ac b/configure.ac index 80f6b02..a670389 100644 --- a/configure.ac +++ b/configure.ac @@ -1,34 +1,69 @@ +############################ +# Specify program versions # +############################ + AC_PREREQ([2.68]) +LT_PREREQ([2.4.6]) + + + +####################### +# Initialize Autoconf # +####################### + AC_INIT([autotools-project], [0.0.0], [https://github.com/tailix/autotools-project/issues], [autotools-project], [https://github.com/tailix/autotools-project]) -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_SRCDIR([src/main.c]) - AC_CANONICAL_BUILD AC_CANONICAL_HOST - - -AM_INIT_AUTOMAKE([1.9 subdir-objects]) - +AC_CONFIG_MACRO_DIRS([m4]) +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_SRCDIR([src/main.c]) AC_CONFIG_FILES([ Makefile include/Makefile ]) + + +####################### +# Initialize Automake # +####################### + +AM_INIT_AUTOMAKE([1.16 subdir-objects]) + + + +############## +# Run checks # +############## + AC_LANG([C]) AM_PROG_AR AM_PROG_AS AC_PROG_CC AC_PROG_CC_C99 -AC_PROG_RANLIB AC_C_INLINE AC_CHECK_HEADER_STDBOOL AC_CHECK_HEADERS([stdarg.h stddef.h stdint.h]) + + +###################### +# Initialize Libtool # +###################### + +LT_INIT([disable-shared]) + + + +########## +# Finish # +########## + AC_OUTPUT diff --git a/m4/.keep b/m4/.keep new file mode 100644 index 0000000..e69de29