Test commit - dynamic lib links
This commit is contained in:
parent
732abb2e64
commit
bbce30caa0
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -34,3 +34,4 @@ full-package-name-VERSION/
|
||||||
*-coverage/
|
*-coverage/
|
||||||
*.gcda
|
*.gcda
|
||||||
*.gcno
|
*.gcno
|
||||||
|
libtool
|
||||||
|
|
22
Makefile.am
22
Makefile.am
|
@ -1,24 +1,22 @@
|
||||||
AM_CFLAGS = # CFLAGS applicable to all executables (products)
|
AM_CFLAGS = # CFLAGS applicable to all executables (products)
|
||||||
AM_CPPFLAGS = -I$(top_srcdir)/src # so that tests also find header files
|
AM_CPPFLAGS = -I$(top_srcdir)/src # so that tests also find header files
|
||||||
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
# Convenience library so that it can be resued
|
# libtool library definition
|
||||||
# between my_executable and the tests
|
lib_LTLIBRARIES = libtest.la
|
||||||
noinst_LIBRARIES = libcommon.a
|
libtest_la_SOURCES = src/test.h src/test.c
|
||||||
libcommon_a_SOURCES = src/common.h src/common.c
|
libtest_la_LDFLAGS = -version-info 0:0:0
|
||||||
# src/common.h appear in SOURCES to that it gets copied to
|
|
||||||
# distribution tgz.
|
|
||||||
|
|
||||||
# The main product
|
bin_PROGRAMS = main_executable
|
||||||
bin_PROGRAMS = myexecutable # make all will generate ./my_executable
|
|
||||||
|
|
||||||
#include .c and .h in SOURCES so that both appear in dist
|
#include .c and .h in SOURCES so that both appear in dist
|
||||||
myexecutable_SOURCES = \
|
main_executable_SOURCES = \
|
||||||
src/add.c \
|
src/add.c \
|
||||||
src/add.h \
|
src/add.h \
|
||||||
src/main.c
|
src/main.c
|
||||||
myexecutable_CFLAGS = $(AM_CFLAGS) $(CODE_COVERAGE_CFLAGS) #--std=c11 # CFLAGS applicable to myexecutable_SOURCES
|
main_executable_CFLAGS = $(AM_CFLAGS) $(CODE_COVERAGE_CFLAGS) #--std=c11 # CFLAGS applicable to myexecutable_SOURCES
|
||||||
myexecutable_LDADD = libcommon.a
|
main_executable_LDADD = libtest.la
|
||||||
myexecutable_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
|
main_executable_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
|
||||||
# myexecutable_CFLAGS = $(CODE_COVERAGE_CFLAGS)
|
# myexecutable_CFLAGS = $(CODE_COVERAGE_CFLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
# autoreconf runs all the autotool configuration tools in the right order
|
# autoreconf runs all the autotool configuration tools in the right order
|
||||||
# and will avoid regenerating files.
|
# and will avoid regenerating files.
|
||||||
#
|
#
|
||||||
autoreconf --install --make # install missing files
|
autoreconf --install
|
||||||
# automake --add-missing --copy >/dev/null 2>&1 # add install-sh
|
# automake --add-missing --copy >/dev/null 2>&1 # add install-sh
|
||||||
|
|
70
configure.ac
70
configure.ac
|
@ -1,81 +1,39 @@
|
||||||
# -*- Autoconf -*-
|
|
||||||
# Process this file with autoconf to produce a configure script.
|
|
||||||
|
|
||||||
AC_PREREQ([2.69])
|
AC_PREREQ([2.69])
|
||||||
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
|
AC_INIT([test_automake_shared], [0.9.1], [https://github.com/valicek1])
|
||||||
AC_CONFIG_AUX_DIR([build-aux])
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
AM_INIT_AUTOMAKE([foreign subdir-objects]) # Does not require NEWS, COPYING, AUTHORS, ChangeLog or README
|
AM_INIT_AUTOMAKE([foreign subdir-objects]) # Does not require NEWS, COPYING, AUTHORS, ChangeLog or README
|
||||||
|
|
||||||
# silent make https://autotools.io/automake/silent.html
|
AM_SILENT_RULES([yes]) # silent rules, for make -s use just [] as arg
|
||||||
# silent rules enabled by default with 'yes'
|
|
||||||
# disable silent runles with ./configure --disable-silent-rules
|
|
||||||
AM_SILENT_RULES([yes]) # less verbose make output
|
|
||||||
# AM_SILENT_RULES() # use make -s to get silent output
|
|
||||||
|
|
||||||
AC_CONFIG_SRCDIR([src/main.c])
|
AC_CONFIG_SRCDIR([src/main.c]) # main src dir
|
||||||
AC_CONFIG_HEADERS([config.h]) # use config.h instead of passing -D in the command line
|
AC_CONFIG_HEADERS([config.h]) # use config.h instead of passing -D in the command line
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
AC_LANG([C]) # Use C not C++
|
AC_LANG([C]) # use C
|
||||||
|
|
||||||
# Checks for programs.
|
AC_PROG_CC # Checks for programs
|
||||||
AC_PROG_CC
|
AC_PROG_CC_C99 # C99 standard
|
||||||
|
|
||||||
# In case that you want to check for specific versions of gcc
|
|
||||||
# For example in case that you need C11 support you want to
|
|
||||||
# check for gcc-4.9
|
|
||||||
#AC_PROG_CC([gcc-4.9 gcc cc])
|
|
||||||
|
|
||||||
AC_PROG_CC_C99 # or AC_PROG_CC_89 to force C89 mode or AC_PROG_CC_STDC to go to latest supported standard (currently C99)
|
|
||||||
|
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_CC_C_O # Need to have per product flags myexecutable_CFLAG
|
AC_PROG_CC_C_O # Need to have per product flags myexecutable_CFLAG
|
||||||
AC_PROG_RANLIB # Need for to create libraries: .a
|
AC_PROG_LIBTOOL # libtool init
|
||||||
|
|
||||||
|
|
||||||
# Checks for libraries.
|
|
||||||
|
|
||||||
# Found libraries are automatically addded to LIBS
|
|
||||||
# AC_SEARCH_LIBS([pthread_cond_wait], [pthread],[],[
|
|
||||||
# AC_MSG_ERROR([You need to install pthreads library.])
|
|
||||||
# ])
|
|
||||||
|
|
||||||
# AC_SEARCH_LIBS([g_test_init], [glib-2.0],[],[
|
|
||||||
# AC_MSG_ERROR([You need to install glib-2.0 library.])
|
|
||||||
# ])
|
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_HEADER_ASSERT # ./configure --disable-assert to define NDEBUG
|
AC_HEADER_ASSERT # ./configure --disable-assert to define NDEBUG
|
||||||
AC_CHECK_HEADER([stdlib.h])
|
AC_CHECK_HEADER([stdlib.h])
|
||||||
|
|
||||||
# Check for C11's optional Atomic operations library
|
AC_ARG_ENABLE([myerror],
|
||||||
# AC_CHECK_HEADER([stdatomic.h], [], [
|
AS_HELP_STRING([--enable-myerror],[enable error]),
|
||||||
# AC_MSG_ERROR([C11 with atomic support needed.])
|
[enable_myerror=yes],[enable_myerror=${enableval}])
|
||||||
# ])
|
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
if test "x${enable_myerror}" == "xyes"; then
|
||||||
|
AC_DEFINE([MYERROR], 1, [myerroris enabled])
|
||||||
# Checks for library functions.
|
|
||||||
|
|
||||||
# The following statement will use pkg-config --cflags --libs
|
|
||||||
# to find out CFLAGS and -l options required to build a target that
|
|
||||||
# it's going to link against glib2.0.
|
|
||||||
# The required CFLAGS and -l options are available as DEPS_CFLAGS
|
|
||||||
# and DEPS_LIBS in Makefile.am
|
|
||||||
# PKG_CHECK_MODULES([DEPS], [glib-2.0 >= 2.24.1])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([myfeature],
|
|
||||||
AS_HELP_STRING([--disable-myfeature],[disable myfeature to get remove support for this and that]),
|
|
||||||
[enable_myfeature=${enableval}],[enable_myfeature=yes])
|
|
||||||
|
|
||||||
if test "x${enable_myfeature}" == "xyes"; then
|
|
||||||
AC_DEFINE([MYFEATURE], 1, [myfeature is enabled])
|
|
||||||
else
|
|
||||||
AC_MSG_WARN([
|
AC_MSG_WARN([
|
||||||
-----------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------
|
||||||
Are you sure that you want to have myfeature disabled? You will lose this and that.
|
Results won't be real!
|
||||||
-----------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------
|
||||||
])
|
])
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile])
|
AC_CONFIG_FILES([Makefile])
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "common.h"
|
#include "test.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "common.h"
|
#include "test.h"
|
||||||
void myfunc()
|
void myfunc()
|
||||||
{
|
{
|
||||||
printf("myfunc() called\n");
|
printf("myfunc() called\n");
|
|
@ -1,9 +1,9 @@
|
||||||
#ifndef COMMON_H
|
#ifndef TEST_H
|
||||||
#define COMMON_H
|
#define TEST_H
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
void myfunc();
|
void myfunc();
|
||||||
|
|
||||||
#endif /* COMMON_H */
|
#endif /* TEST_H */
|
Loading…
Reference in New Issue
Block a user