Respect GNU Standards user variables

Several variables are considered "user variables" by the GNU Standards.
This means that the user can pass these to their ./configure and make
invocations as they see fit.  These variables include CPPFLAGS, CFLAGS
and LDFLAGS.

This changeset pushes our use of these variables to the automake shadow
variables, AM_CPPFLAGS, AM_CFLAGS and AM_LDFLAGS, so that user variables
will no longer clobber flags required in order to build.
merge-requests/1/head
Olaf Meeuwissen 2015-10-22 20:15:45 +09:00
rodzic 7a2b112d20
commit 2d6fad58b4
9 zmienionych plików z 40 dodań i 36 usunięć

Wyświetl plik

@ -1,15 +1,15 @@
dnl
dnl Contains the following macros
dnl SANE_SET_CFLAGS(is_release)
dnl SANE_SET_AM_CFLAGS(is_release)
dnl SANE_CHECK_MISSING_HEADERS
dnl SANE_SET_LDFLAGS
dnl SANE_SET_AM_LDFLAGS
dnl SANE_CHECK_DLL_LIB
dnl SANE_EXTRACT_LDFLAGS(LIBS, LDFLAGS)
dnl SANE_CHECK_JPEG
dnl SANE_CHECK_IEEE1284
dnl SANE_CHECK_PTHREAD
dnl SANE_CHECK_LOCKING
dnl JAPHAR_GREP_CFLAGS(flag, cmd_if_missing, cmd_if_present)
dnl JAPHAR_GREP_AM_CFLAGS(flag, cmd_if_missing, cmd_if_present)
dnl SANE_LINKER_RPATH
dnl SANE_CHECK_U_TYPES
dnl SANE_CHECK_GPHOTO2
@ -19,12 +19,12 @@ dnl SANE_PROTOTYPES
dnl AC_PROG_LIBTOOL
dnl
# SANE_SET_CFLAGS(is_release)
# Set default CFLAGS if gcc is used. Enable or disable additional
# SANE_SET_AM_CFLAGS(is_release)
# Set default AM_CFLAGS if gcc is used. Enable/disable additional
# compilation warnings. The extra warnings are enabled by default
# during the development cycle but disabled for official releases.
# The argument is_release is either yes or no.
AC_DEFUN([SANE_SET_CFLAGS],
AC_DEFUN([SANE_SET_AM_CFLAGS],
[
if test "${ac_cv_c_compiler_gnu}" = "yes"; then
DEFAULT_CFLAGS="\
@ -35,7 +35,7 @@ if test "${ac_cv_c_compiler_gnu}" = "yes"; then
-pedantic"
for flag in $DEFAULT_CFLAGS; do
JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
JAPHAR_GREP_AM_CFLAGS($flag, [ AM_CFLAGS="$AM_CFLAGS $flag" ])
done
AC_ARG_ENABLE(warnings,
@ -44,14 +44,14 @@ if test "${ac_cv_c_compiler_gnu}" = "yes"; then
[
if eval "test x$enable_warnings = xyes"; then
for flag in $EXTRA_WARNINGS; do
JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
JAPHAR_GREP_AM_CFLAGS($flag, [ AM_CFLAGS="$AM_CFLAGS $flag" ])
done
fi
],
[if test x$1 = xno; then
# Warnings enabled by default (development)
for flag in $EXTRA_WARNINGS; do
JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
JAPHAR_GREP_AM_CFLAGS($flag, [ AM_CFLAGS="$AM_CFLAGS $flag" ])
done
fi])
fi # ac_cv_c_compiler_gnu
@ -84,9 +84,9 @@ AC_DEFUN([SANE_CHECK_MISSING_HEADERS],
fi
])
# SANE_SET_LDFLAGS
# Add special LDFLAGS
AC_DEFUN([SANE_SET_LDFLAGS],
# SANE_SET_AM_LDFLAGS
# Add special AM_LDFLAGS
AC_DEFUN([SANE_SET_AM_LDFLAGS],
[
# Define stricter linking policy on GNU systems. This is not
# added to global LDFLAGS because we may want to create convenience
@ -101,7 +101,7 @@ AC_DEFUN([SANE_SET_LDFLAGS],
AC_SUBST(STRICT_LDFLAGS)
case "${host_os}" in
aix*) #enable .so libraries, disable archives
LDFLAGS="$LDFLAGS -Wl,-brtl"
AM_LDFLAGS="$AM_LDFLAGS -Wl,-brtl"
;;
darwin*) #include frameworks
LIBS="$LIBS -framework CoreFoundation -framework IOKit"
@ -245,7 +245,7 @@ AC_DEFUN([SANE_CHECK_PTHREAD],
PTHREAD_LIBS=""
fi
if test "$have_pthread" = "yes" ; then
CPPFLAGS="${CPPFLAGS} -D_REENTRANT"
AM_CPPFLAGS="${AM_CPPFLAGS} -D_REENTRANT"
fi
AC_SUBST(PTHREAD_LIBS)
AC_MSG_CHECKING([whether to enable pthread support])
@ -362,12 +362,12 @@ AC_DEFUN([SANE_CHECK_LOCKING],
])
dnl
dnl JAPHAR_GREP_CFLAGS(flag, cmd_if_missing, cmd_if_present)
dnl JAPHAR_GREP_AM_CFLAGS(flag, cmd_if_missing, cmd_if_present)
dnl
dnl From Japhar. Report changes to japhar@hungry.com
dnl
AC_DEFUN([JAPHAR_GREP_CFLAGS],
[case "$CFLAGS" in
AC_DEFUN([JAPHAR_GREP_AM_CFLAGS],
[case "$AM_CFLAGS" in
"$1" | "$1 "* | *" $1" | *" $1 "* )
ifelse($#, 3, [$3], [:])
;;

Wyświetl plik

@ -4,9 +4,9 @@
## This file is part of the "Sane" build infra-structure. See
## included LICENSE file for license information.
AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -DLIBDIR="\"$(libdir)/sane\""
AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -DLIBDIR="\"$(libdir)/sane\""
AM_LDFLAGS = $(STRICT_LDFLAGS)
AM_LDFLAGS += $(STRICT_LDFLAGS)
# The -rpath option is added because we are creating _LTLIBRARIES based
# on configure substitution. This causes automake to not know the
# correct $libdir and must be added here.

Wyświetl plik

@ -82,8 +82,8 @@ AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
dnl ***********************************************************************
dnl set compiler/linker flags
dnl ***********************************************************************
SANE_SET_CFLAGS([$is_release])
SANE_SET_LDFLAGS
SANE_SET_AM_CFLAGS([$is_release])
SANE_SET_AM_LDFLAGS
SANE_LINKER_RPATH
dnl ***********************************************************************
@ -414,7 +414,7 @@ if test "$enable_libusb" != "no"; then
if test "$enable_libusb_1_0" = "yes"; then
PKG_CHECK_MODULES(LIBUSB_1_0, [ libusb-1.0 >= 1.0.0 ], have_libusb_1_0=yes, have_libusb_1_0=no)
if test "$have_libusb_1_0" = "yes"; then
CFLAGS="$CFLAGS $LIBUSB_1_0_CFLAGS"
AM_CFLAGS="$AM_CFLAGS $LIBUSB_1_0_CFLAGS"
USB_LIBS="$USB_LIBS $LIBUSB_1_0_LIBS"
HAVE_USB=yes
fi
@ -561,7 +561,7 @@ AC_ARG_ENABLE(scsi-directio,
README.linux)]),
[
if eval "test x$enable_scsi_directio = xyes"; then
CFLAGS="$CFLAGS -DENABLE_SCSI_DIRECTIO"
AM_CFLAGS="$AM_CFLAGS -DENABLE_SCSI_DIRECTIO"
fi
])
@ -592,7 +592,7 @@ AC_PROG_LIBTOOL
dnl Windows (cygwin/mingw), BeOS, and OS/2 need this.
case $host_os in
cygwin* | mingw* | beos* | os2*)
LDFLAGS="$LDFLAGS -no-undefined"
AM_LDFLAGS="$AM_LDFLAGS -no-undefined"
esac
dnl Check for lock dir
@ -610,7 +610,7 @@ dnl enable/disable backends and features based on previous tests and user's
dnl choice
dnl ***********************************************************************
CPPFLAGS="${CPPFLAGS} -DPATH_SANE_CONFIG_DIR=\$(configdir) \
AM_CPPFLAGS="${AM_CPPFLAGS} -DPATH_SANE_CONFIG_DIR=\$(configdir) \
-DPATH_SANE_DATA_DIR=\$(datadir) \
-DPATH_SANE_LOCK_DIR=\$(locksanedir) \
-DV_MAJOR=${V_MAJOR} -DV_MINOR=${V_MINOR}"
@ -762,7 +762,7 @@ AC_ARG_ENABLE(parport-directio,
frontends will require special permission level]),
[
if eval "test x$enable_parport_directio = xyes"; then
CFLAGS="$CFLAGS -DENABLE_PARPORT_DIRECTIO"
AM_CFLAGS="$AM_CFLAGS -DENABLE_PARPORT_DIRECTIO"
fi
])
@ -802,6 +802,10 @@ dnl ***********************************************************************
dnl Write output files
dnl ***********************************************************************
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_LDFLAGS)
DISTCLEAN_FILES="*~ .*~ *.log *.bak *.old *.orig *.out *.rej \"\#\"* \".\\#\"*"
AC_SUBST(DISTCLEAN_FILES)
@ -818,9 +822,9 @@ dnl print configuration information
dnl ***********************************************************************
echo "-> Variables used for compilation/linking:"
echo CPPFLAGS=\"${CPPFLAGS}\"
echo CFLAGS=\"${CFLAGS}\"
echo LDFLAGS=\"${LDFLAGS}\"
echo AM_CPPFLAGS=\"${AM_CPPFLAGS}\"
echo AM_CFLAGS=\"${AM_CFLAGS}\"
echo AM_LDFLAGS=\"${AM_LDFLAGS}\"
echo LIBS=\"${LIBS}\"
echo "-> Installation directories:"
echo "Configuration: `eval eval echo ${sysconfdir}`"

Wyświetl plik

@ -14,7 +14,7 @@ else
EXTRA_PROGRAMS += saned
endif
AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include
AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include
scanimage_SOURCES = scanimage.c stiff.c stiff.h
scanimage_LDADD = ../backend/libsane.la ../sanei/libsanei.la ../lib/liblib.la \

Wyświetl plik

@ -13,10 +13,10 @@ CLASSPATH_ENV=.
JAVAH=javah -jni -cp $(CLASSPATH_ENV)
# We'll need something in 'configure' for the Java includes.
AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/include \
AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include \
-I$(top_srcdir)/include -I${JDK_HOME}/include \
-I${JDK_HOME}/include/genunix
AM_LDFLAGS = $(STRICT_LDFLAGS) -version-number $(V_MAJOR):$(V_MINOR):$(VREV)
AM_LDFLAGS += $(STRICT_LDFLAGS) -version-number $(V_MAJOR):$(V_MINOR):$(VREV)
JAVA_SRC = SaneDevice.java SaneOption.java SaneRange.java\
Sane.java SaneParameters.java ScanIt.java \

Wyświetl plik

@ -3,7 +3,7 @@
##
## This file is part of the "Sane" build infra-structure. See
## included LICENSE file for license information.
AM_CPPFLAGS = -I. -I$(top_builddir)/include -I$(top_srcdir)/include
AM_CPPFLAGS += -I. -I$(top_builddir)/include -I$(top_srcdir)/include
noinst_LTLIBRARIES = liblib.la libfelib.la

Wyświetl plik

@ -4,7 +4,7 @@
## This file is part of the "Sane" build infra-structure. See
## included LICENSE file for license information.
AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/include \
AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include \
-I$(top_srcdir)/include
noinst_LTLIBRARIES = libsanei.la

Wyświetl plik

@ -15,7 +15,7 @@ TEST_LDADD = ../../sanei/libsanei.la ../../lib/liblib.la ../../lib/libfelib.la $
check_PROGRAMS = sanei_usb_test test_wire sanei_check_test sanei_config_test sanei_constrain_test
TESTS = $(check_PROGRAMS)
AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include
AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include
sanei_constrain_test_SOURCES = sanei_constrain_test.c
sanei_constrain_test_LDADD = $(TEST_LDADD)

Wyświetl plik

@ -4,7 +4,7 @@
## This file is part of the "Sane" build infra-structure. See
## included LICENSE file for license information.
AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/include \
AM_CPPFLAGS += -I. -I$(srcdir) -I$(top_builddir)/include \
-I$(top_srcdir)/include
bin_PROGRAMS = sane-find-scanner gamma4scanimage