summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <swo-dev@marcschink.de>2016-11-02 21:09:31 +0100
committerMarc Schink <swo-dev@marcschink.de>2016-11-02 21:09:31 +0100
commit451c6bf629c199e5c4defb992bba12d52dcbd5ed (patch)
tree860d37323b666572e9903c157190875d8f20bd91
parent15df56c9499005f7ade27fc9608993161309538e (diff)
configure.ac: Do not assign user variables
Do not assign user variables (e.g. CFLAGS) in configure.ac, otherwise users are not able to modify them properly at 'make' and 'configure' invocation time. For more information, see: https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
-rw-r--r--configure.ac11
-rw-r--r--src/Makefile.am3
2 files changed, 9 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 5883f55..9e87c36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,10 +29,11 @@ AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
# Enable additional compiler warnings via -Wall and -Wextra.
-CFLAGS="$CFLAGS -Wall -Wextra -Werror"
+SWODEC_CFLAGS="-Wall -Wextra -Werror"
# Checks for programs.
AC_PROG_CC
+AM_PROG_CC_C_O
# Initialize pkg-config.
PKG_PROG_PKG_CONFIG
@@ -40,12 +41,10 @@ PKG_PROG_PKG_CONFIG
# Checks for libraries.
# Check for glib-2.0 which is always needed.
-PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.28.0],
- [CFLAGS="$CFLAGS $glib_CFLAGS"; LIBS="$LIBS $glib_LIBS"])
+PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.28.0])
# Check for libswo-0.1 which is always needed.
-PKG_CHECK_MODULES([libswo], [libswo >= 0.1.0],
- [CFLAGS="$CFLAGS $libswo_CFLAGS"; LIBS="$LIBS $libswo_LIBS"])
+PKG_CHECK_MODULES([libswo], [libswo >= 0.1.0])
# Checks for header files.
@@ -59,6 +58,8 @@ AS_CASE([$host_os], [mingw*],
[AC_DEFINE([__USE_MINGW_ANSI_STDIO], [1],
[Define to 1 to use C99 compatible stdio functions on MinGW.])])
+AC_SUBST([SWODEC_CFLAGS])
+
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([src/Makefile])
diff --git a/src/Makefile.am b/src/Makefile.am
index ee64246..1ca8681 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,3 +21,6 @@ bin_PROGRAMS = swodec
swodec_SOURCES = \
main.c
+
+swodec_CFLAGS = $(SWODEC_CFLAGS) $(glib_CFLAGS) $(libswo_CFLAGS)
+swodec_LDADD = $(glib_LIBS) $(libswo_LIBS)