build: use AX_IS_RELEASE() and AX_COMPILER_FLAGS()
The autoconf macros AX_COMPILER_FLAGS_{CFLAGS|GIR|LDFLAGS} test for compiler and linker support of various flags, and add the flags to the generated output. If the command-line option '--enable-compile-warnings' is specified to 'configure', a number of additional warning options is also added to the output. This is the default. This update requires the presence of the GNU autoconf-archive in the system.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
bin_PROGRAMS = mmcli
|
bin_PROGRAMS = mmcli
|
||||||
|
|
||||||
mmcli_CPPFLAGS = \
|
mmcli_CPPFLAGS = \
|
||||||
|
$(WARN_CFLAGS) \
|
||||||
$(MMCLI_CFLAGS) \
|
$(MMCLI_CFLAGS) \
|
||||||
-I$(top_srcdir) \
|
-I$(top_srcdir) \
|
||||||
-I$(top_srcdir)/include \
|
-I$(top_srcdir)/include \
|
||||||
@@ -34,13 +35,17 @@ mmcli_SOURCES = \
|
|||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
mmcli_LDADD = \
|
mmcli_LDADD = \
|
||||||
$(MMCLI_LIBS) \
|
|
||||||
$(top_builddir)/libmm-glib/libmm-glib.la \
|
$(top_builddir)/libmm-glib/libmm-glib.la \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
mmcli_LDFLAGS = \
|
||||||
|
$(WARN_LDFLAGS) \
|
||||||
|
$(MMCLI_LIBS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
if WITH_UDEV
|
if WITH_UDEV
|
||||||
mmcli_CPPFLAGS += $(GUDEV_CFLAGS)
|
mmcli_CPPFLAGS += $(GUDEV_CFLAGS)
|
||||||
mmcli_LDADD += $(GUDEV_LIBS)
|
mmcli_LDFLAGS += $(GUDEV_LIBS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
completiondir = $(datadir)/bash-completion/completions
|
completiondir = $(datadir)/bash-completion/completions
|
||||||
|
32
configure.ac
32
configure.ac
@@ -50,6 +50,33 @@ dnl Initialize libtool
|
|||||||
LT_PREREQ([2.2])
|
LT_PREREQ([2.2])
|
||||||
LT_INIT([disable-static])
|
LT_INIT([disable-static])
|
||||||
|
|
||||||
|
dnl-----------------------------------------------------------------------------
|
||||||
|
dnl Compiler warnings
|
||||||
|
dnl
|
||||||
|
|
||||||
|
dnl Make sure autoconf-archive is available
|
||||||
|
m4_pattern_forbid([^AX_(COMPILER_FLAGS|COMPILER_FLAGS_(CFLAGS|GIR|LDFLAGS))\b],
|
||||||
|
[Unexpanded AX_ macro found. Please install GNU autoconf-archive])
|
||||||
|
|
||||||
|
dnl Detect git or release builds
|
||||||
|
AX_IS_RELEASE([git-directory])
|
||||||
|
|
||||||
|
dnl Function type cast disabled: used throughout the code especially to
|
||||||
|
dnl cast GAsyncReadyCallbacks with the real object type instead of GObject
|
||||||
|
DISABLED_WARNINGS="${DISABLED_WARNINGS} -Wno-cast-function-type"
|
||||||
|
|
||||||
|
dnl All message protocol structs are packed, never complain about it
|
||||||
|
DISABLED_WARNINGS="${DISABLED_WARNINGS} -Wno-packed"
|
||||||
|
|
||||||
|
dnl Setup compiler checks
|
||||||
|
AX_COMPILER_FLAGS()
|
||||||
|
AX_COMPILER_FLAGS_CFLAGS(,,,[${DISABLED_WARNINGS}])
|
||||||
|
|
||||||
|
dnl Specify gnu89 mode
|
||||||
|
if test "$GCC" = "yes"; then
|
||||||
|
CFLAGS="$CFLAGS -std=gnu89"
|
||||||
|
fi
|
||||||
|
|
||||||
dnl-----------------------------------------------------------------------------
|
dnl-----------------------------------------------------------------------------
|
||||||
dnl Version definitions
|
dnl Version definitions
|
||||||
dnl
|
dnl
|
||||||
@@ -384,8 +411,6 @@ case $with_qmi in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
NM_COMPILER_WARNINGS
|
|
||||||
|
|
||||||
dnl-----------------------------------------------------------------------------
|
dnl-----------------------------------------------------------------------------
|
||||||
dnl Distribution version string
|
dnl Distribution version string
|
||||||
dnl
|
dnl
|
||||||
@@ -534,7 +559,10 @@ echo "
|
|||||||
compiler: ${CC}
|
compiler: ${CC}
|
||||||
cflags: ${CFLAGS}
|
cflags: ${CFLAGS}
|
||||||
ldflags: ${LDFLAGS}
|
ldflags: ${LDFLAGS}
|
||||||
|
warn cflags: ${WARN_CFLAGS}
|
||||||
|
warn ldflags: ${WARN_LDFLAGS}
|
||||||
maintainer mode: ${USE_MAINTAINER_MODE}
|
maintainer mode: ${USE_MAINTAINER_MODE}
|
||||||
|
release: ${ax_is_release}
|
||||||
|
|
||||||
System paths:
|
System paths:
|
||||||
prefix: ${prefix}
|
prefix: ${prefix}
|
||||||
|
@@ -92,6 +92,7 @@ libmm_glib_la_SOURCES = \
|
|||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libmm_glib_la_CPPFLAGS = \
|
libmm_glib_la_CPPFLAGS = \
|
||||||
|
$(LIBMM_GLIB_CFLAGS) \
|
||||||
-I$(srcdir) \
|
-I$(srcdir) \
|
||||||
-I$(top_srcdir) \
|
-I$(top_srcdir) \
|
||||||
-I$(top_builddir) \
|
-I$(top_builddir) \
|
||||||
@@ -100,22 +101,20 @@ libmm_glib_la_CPPFLAGS = \
|
|||||||
-I${top_srcdir}/libmm-glib/generated \
|
-I${top_srcdir}/libmm-glib/generated \
|
||||||
-I${top_builddir}/libmm-glib/generated \
|
-I${top_builddir}/libmm-glib/generated \
|
||||||
-DLIBMM_GLIB_COMPILATION \
|
-DLIBMM_GLIB_COMPILATION \
|
||||||
$(AM_CPPFLAGS) \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libmm_glib_la_CFLAGS = \
|
libmm_glib_gla_CFLAGS = \
|
||||||
$(LIBMM_GLIB_CFLAGS) \
|
$(WARN_CFLAGS) \
|
||||||
$(AM_CFLAGS) \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libmm_glib_la_LIBADD = \
|
libmm_glib_la_LIBADD = \
|
||||||
${top_builddir}/libmm-glib/generated/libmm-generated.la \
|
${top_builddir}/libmm-glib/generated/libmm-generated.la \
|
||||||
$(LIBMM_GLIB_LIBS) \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libmm_glib_la_LDFLAGS = \
|
libmm_glib_la_LDFLAGS = \
|
||||||
-version-info $(MM_GLIB_LT_CURRENT):$(MM_GLIB_LT_REVISION):$(MM_GLIB_LT_AGE) \
|
-version-info $(MM_GLIB_LT_CURRENT):$(MM_GLIB_LT_REVISION):$(MM_GLIB_LT_AGE) \
|
||||||
$(AM_LDFLAGS) \
|
$(WARN_LDFLAGS) \
|
||||||
|
$(LIBMM_GLIB_LIBS) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
includedir = @includedir@/libmm-glib
|
includedir = @includedir@/libmm-glib
|
||||||
@@ -209,6 +208,7 @@ ModemManager_1_0_gir_CFLAGS = $(libmm_glib_la_CPPFLAGS)
|
|||||||
ModemManager_1_0_gir_LIBS = libmm-glib.la
|
ModemManager_1_0_gir_LIBS = libmm-glib.la
|
||||||
ModemManager_1_0_gir_EXPORT_PACKAGES = libmm-glib
|
ModemManager_1_0_gir_EXPORT_PACKAGES = libmm-glib
|
||||||
ModemManager_1_0_gir_SCANNERFLAGS = \
|
ModemManager_1_0_gir_SCANNERFLAGS = \
|
||||||
|
$(WARN_SCANNERFLAGS) \
|
||||||
--c-include "libmm-glib.h" \
|
--c-include "libmm-glib.h" \
|
||||||
--identifier-prefix=MM \
|
--identifier-prefix=MM \
|
||||||
--identifier-prefix=Mm \
|
--identifier-prefix=Mm \
|
||||||
|
@@ -244,7 +244,14 @@ libmm_generated_la_CPPFLAGS = \
|
|||||||
-Wno-shadow \
|
-Wno-shadow \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libmm_generated_la_LIBADD = $(LIBMM_GLIB_LIBS)
|
libmm_generated_la_CFLAGS = \
|
||||||
|
$(WARN_CFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
libmm_generated_la_LDFLAGS = \
|
||||||
|
$(WARN_LDFLAGS) \
|
||||||
|
$(LIBMM_GLIB_LIBS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
includedir = @includedir@/libmm-glib
|
includedir = @includedir@/libmm-glib
|
||||||
nodist_include_HEADERS = $(GENERATED_H)
|
nodist_include_HEADERS = $(GENERATED_H)
|
||||||
|
@@ -1,5 +1,13 @@
|
|||||||
AM_CFLAGS = $(CODE_COVERAGE_CFLAGS)
|
|
||||||
AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
|
AM_CFLAGS = \
|
||||||
|
$(WARN_CFLAGS) \
|
||||||
|
$(CODE_COVERAGE_CFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
AM_LDFLAGS = \
|
||||||
|
$(WARN_LDFLAGS) \
|
||||||
|
$(CODE_COVERAGE_LDFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
noinst_LTLIBRARIES = libqcdm.la libqcdm-test.la
|
noinst_LTLIBRARIES = libqcdm.la libqcdm-test.la
|
||||||
|
|
||||||
@@ -41,4 +49,3 @@ libqcdm_test_la_SOURCES = \
|
|||||||
|
|
||||||
libqcdm_test_la_LIBADD = \
|
libqcdm_test_la_LIBADD = \
|
||||||
$(MM_LIBS)
|
$(MM_LIBS)
|
||||||
|
|
||||||
|
@@ -1,7 +1,14 @@
|
|||||||
include $(top_srcdir)/gtester.make
|
include $(top_srcdir)/gtester.make
|
||||||
|
|
||||||
AM_CFLAGS = $(CODE_COVERAGE_CFLAGS)
|
AM_CFLAGS = \
|
||||||
AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
|
$(WARN_CFLAGS) \
|
||||||
|
$(CODE_COVERAGE_CFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
AM_LDFLAGS = \
|
||||||
|
$(WARN_LDFLAGS) \
|
||||||
|
$(CODE_COVERAGE_LDFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
noinst_PROGRAMS = test-qcdm modepref ipv6pref reset
|
noinst_PROGRAMS = test-qcdm modepref ipv6pref reset
|
||||||
TEST_PROGS += test-qcdm
|
TEST_PROGS += test-qcdm
|
||||||
|
@@ -1,35 +0,0 @@
|
|||||||
AC_DEFUN([NM_COMPILER_WARNINGS],
|
|
||||||
[AC_ARG_ENABLE(more-warnings,
|
|
||||||
AS_HELP_STRING([--enable-more-warnings], [Possible values: no/yes/error]),
|
|
||||||
set_more_warnings="$enableval",set_more_warnings=error)
|
|
||||||
AC_MSG_CHECKING(for more warnings)
|
|
||||||
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
CFLAGS="-Wall -std=gnu89 $CFLAGS"
|
|
||||||
|
|
||||||
for option in -Wmissing-declarations -Wmissing-prototypes \
|
|
||||||
-Wdeclaration-after-statement -Wstrict-prototypes \
|
|
||||||
-Wno-unused-parameter -Wno-sign-compare \
|
|
||||||
-Wno-deprecated-declarations -Wno-unused-function \
|
|
||||||
-Wunused-variable -Wformat-security; do
|
|
||||||
SAVE_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="$CFLAGS $option -Werror"
|
|
||||||
AC_MSG_CHECKING([whether gcc understands $option])
|
|
||||||
AC_TRY_COMPILE([], [],
|
|
||||||
has_option=yes,
|
|
||||||
has_option=no,)
|
|
||||||
if test $has_option = no; then
|
|
||||||
CFLAGS="$SAVE_CFLAGS"
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT($has_option)
|
|
||||||
unset has_option
|
|
||||||
unset SAVE_CFLAGS
|
|
||||||
done
|
|
||||||
unset option
|
|
||||||
if test "x$set_more_warnings" = xerror; then
|
|
||||||
CFLAGS="$CFLAGS -Werror"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
fi
|
|
||||||
])
|
|
@@ -6,6 +6,7 @@ include $(top_srcdir)/gtester.make
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
|
$(WARN_CFLAGS) \
|
||||||
$(MM_CFLAGS) \
|
$(MM_CFLAGS) \
|
||||||
$(CODE_COVERAGE_CFLAGS) \
|
$(CODE_COVERAGE_CFLAGS) \
|
||||||
$(GUDEV_CFLAGS) \
|
$(GUDEV_CFLAGS) \
|
||||||
@@ -22,6 +23,7 @@ AM_CFLAGS = \
|
|||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
AM_LDFLAGS = \
|
AM_LDFLAGS = \
|
||||||
|
$(WARN_LDFLAGS) \
|
||||||
$(MM_LIBS) \
|
$(MM_LIBS) \
|
||||||
$(CODE_COVERAGE_LDFLAGS) \
|
$(CODE_COVERAGE_LDFLAGS) \
|
||||||
$(GUDEV_LIBS) \
|
$(GUDEV_LIBS) \
|
||||||
|
@@ -12,6 +12,7 @@ BUILT_SOURCES =
|
|||||||
CLEANFILES =
|
CLEANFILES =
|
||||||
|
|
||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
|
$(WARN_CFLAGS) \
|
||||||
$(MM_CFLAGS) \
|
$(MM_CFLAGS) \
|
||||||
$(CODE_COVERAGE_CFLAGS) \
|
$(CODE_COVERAGE_CFLAGS) \
|
||||||
$(GUDEV_CFLAGS) \
|
$(GUDEV_CFLAGS) \
|
||||||
@@ -26,6 +27,7 @@ AM_CFLAGS = \
|
|||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
AM_LDFLAGS = \
|
AM_LDFLAGS = \
|
||||||
|
$(WARN_LDFLAGS) \
|
||||||
$(MM_LIBS) \
|
$(MM_LIBS) \
|
||||||
$(CODE_COVERAGE_LDFLAGS) \
|
$(CODE_COVERAGE_LDFLAGS) \
|
||||||
$(GUDEV_LIBS) \
|
$(GUDEV_LIBS) \
|
||||||
|
@@ -6,6 +6,7 @@ include $(top_srcdir)/gtester.make
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
|
$(WARN_CFLAGS) \
|
||||||
$(MM_CFLAGS) \
|
$(MM_CFLAGS) \
|
||||||
$(CODE_COVERAGE_CFLAGS) \
|
$(CODE_COVERAGE_CFLAGS) \
|
||||||
-I$(top_srcdir) \
|
-I$(top_srcdir) \
|
||||||
@@ -27,6 +28,7 @@ LDADD = \
|
|||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
AM_LDFLAGS = \
|
AM_LDFLAGS = \
|
||||||
|
$(WARN_LDFLAGS) \
|
||||||
$(MM_LIBS) \
|
$(MM_LIBS) \
|
||||||
$(CODE_COVERAGE_LDFLAGS) \
|
$(CODE_COVERAGE_LDFLAGS) \
|
||||||
-lutil \
|
-lutil \
|
||||||
|
@@ -2,6 +2,14 @@
|
|||||||
noinst_PROGRAMS =
|
noinst_PROGRAMS =
|
||||||
EXTRA_DIST =
|
EXTRA_DIST =
|
||||||
|
|
||||||
|
AM_CFLAGS = \
|
||||||
|
$(WARN_CFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
|
AM_LDFLAGS = \
|
||||||
|
$(WARN_LDFLAGS) \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# lsudev
|
# lsudev
|
||||||
################################################################################
|
################################################################################
|
||||||
|
Reference in New Issue
Block a user