diff options
-rw-r--r-- | Makefile.common | 3 | ||||
-rw-r--r-- | config/lf_warnings.m4 | 35 | ||||
-rw-r--r-- | configure.ac | 31 | ||||
-rw-r--r-- | gnuradio-core/src/lib/viterbi/Makefile.am | 4 | ||||
-rw-r--r-- | usrp/host/misc/Makefile.am | 2 |
5 files changed, 43 insertions, 32 deletions
diff --git a/Makefile.common b/Makefile.common index b81433a32..e9bc13e41 100644 --- a/Makefile.common +++ b/Makefile.common @@ -20,7 +20,8 @@ # Boston, MA 02110-1301, USA. # -AM_CXXFLAGS = @autoconf_default_CXXFLAGS@ +AM_CFLAGS = @autoconf_default_CFLAGS@ @lf_CFLAGS@ +AM_CXXFLAGS = @autoconf_default_CXXFLAGS@ @lf_CXXFLAGS@ # includes grincludedir = $(includedir)/gnuradio diff --git a/config/lf_warnings.m4 b/config/lf_warnings.m4 index 7bb8b60fc..d40c77f14 100644 --- a/config/lf_warnings.m4 +++ b/config/lf_warnings.m4 @@ -1,4 +1,5 @@ dnl Copyright (C) 1988 Eleftherios Gkioulekas <lf@amath.washington.edu> +dnl Copyright (C) 2009 Free Software Foundation, Inc. dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by @@ -21,7 +22,7 @@ dnl distribution terms that you use for the rest of that program. # -------------------------------------------------------------------------- # Check whether the C++ compiler accepts a certain flag -# If it does it adds the flag to CXXFLAGS +# If it does it adds the flag to lf_CXXFLAGS # If it does not then it returns an error to lf_ok # Usage: # LF_CHECK_CXX_FLAG(-flag1 -flag2 -flag3 ...) @@ -34,18 +35,19 @@ AC_DEFUN([LF_CHECK_CXX_FLAG],[ AC_MSG_CHECKING([whether $CXX accepts $i]) if test -z "`${CXX} $i -c conftest.cc 2>&1`" then - CXXFLAGS="${CXXFLAGS} $i" + lf_CXXFLAGS="${lf_CXXFLAGS} $i" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi done rm -f conftest.cc conftest.o + AC_SUBST(lf_CXXFLAGS) ]) # -------------------------------------------------------------------------- # Check whether the C compiler accepts a certain flag -# If it does it adds the flag to CFLAGS +# If it does it adds the flag to lf_CFLAGS # If it does not then it returns an error to lf_ok # Usage: # LF_CHECK_CC_FLAG(-flag1 -flag2 -flag3 ...) @@ -58,18 +60,19 @@ AC_DEFUN([LF_CHECK_CC_FLAG],[ AC_MSG_CHECKING([whether $CC accepts $i]) if test -z "`${CC} $i -c conftest.c 2>&1`" then - CFLAGS="${CFLAGS} $i" + lf_CFLAGS="${lf_CFLAGS} $i" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi done rm -f conftest.c conftest.o + AC_SUBST(lf_CFLAGS) ]) # -------------------------------------------------------------------------- # Check whether the Fortran compiler accepts a certain flag -# If it does it adds the flag to FFLAGS +# If it does it adds the flag to lf_FFLAGS # If it does not then it returns an error to lf_ok # Usage: # LF_CHECK_F77_FLAG(-flag1 -flag2 -flag3 ...) @@ -87,36 +90,26 @@ EOF AC_MSG_CHECKING([whether $F77 accepts $i]) if test -z "`${F77} $i -c conftest.f 2>&1`" then - FFLAGS="${FFLAGS} $i" + lf_FFLAGS="${lf_FFLAGS} $i" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi done rm -f conftest.f conftest.o + AC_SUBST(lf_FFLAGS) ]) # ---------------------------------------------------------------------- -# Enable compiler warnings. Conditionally enable -Werror. -# Call this command AFTER you have configured ALL your -# compilers. +# Enable compiler warnings. +# Call this command AFTER you have configured ALL your compilers. # ---------------------------------------------------------------------- AC_DEFUN([LF_SET_WARNINGS],[ - lf_warnings_as_errors="" - AC_ARG_ENABLE([warnings-as-errors], - AC_HELP_STRING([--enable-warnings-as-errors], [Treat compiler warnings as errors (no)]), - [case "$enableval" in - (no) ;; - (yes) lf_warnings_as_errors="-Werror" ;; - (*) AC_MSG_ERROR([Invalid argument ($enableval) to --enable-warnings-as-errors]) ;; - esac], - []) - dnl Warnings for the two main compilers dnl add -Wextra when you're got time to fix a bunch of them ;-) - cc_warning_flags="-Wall -Werror-implicit-function-declaration $lf_warnings_as_errors" - cxx_warning_flags="-Wall -Woverloaded-virtual $lf_warnings_as_errors" + cc_warning_flags="-Wall -Werror-implicit-function-declaration" + cxx_warning_flags="-Wall -Woverloaded-virtual" if test -n "${CC}" then LF_CHECK_CC_FLAG($cc_warning_flags) diff --git a/configure.ac b/configure.ac index f0bc516fc..c5257300f 100644 --- a/configure.ac +++ b/configure.ac @@ -31,15 +31,35 @@ AM_INIT_AUTOMAKE(gnuradio,3.2svn) DEFINES="" AC_SUBST(DEFINES) +dnl Remember if the user explicity set CFLAGS +if test -n "${CFLAGS}"; then + user_set_cflags=yes +fi dnl Remember if the user explicity set CXXFLAGS if test -n "${CXXFLAGS}"; then user_set_cxxflags=yes fi + LF_CONFIGURE_CC LF_CONFIGURE_CXX GR_LIB64 dnl check for lib64 suffix after choosing compilers + +dnl The three macros above are known to override CFLAGS if the user +dnl didn't specify them. Though I'm sure somebody thought this was +dnl a good idea, it makes it hard to use other than -g -O2 when compiling +dnl selected files. Thus we "undo" the damage here... +dnl +dnl If the user specified CFLAGS, we use them. +dnl See Makefile.common for the rest of the magic. +if test "$user_set_cflags" != yes; then + autoconf_default_CFLAGS="$CFLAGS" + CFLAGS="" +fi +AC_SUBST(autoconf_default_CFLAGS) + + dnl The three macros above are known to override CXXFLAGS if the user dnl didn't specify them. Though I'm sure somebody thought this was dnl a good idea, it makes it hard to use other than -g -O2 when compiling @@ -50,6 +70,7 @@ dnl the output of swig use use -O1 if we're using g++. dnl See Makefile.common for the rest of the magic. if test "$user_set_cxxflags" != yes; then autoconf_default_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="" if test "$GXX" = yes; then case "$host_cpu" in powerpc*) @@ -66,7 +87,6 @@ fi AC_SUBST(autoconf_default_CXXFLAGS) AC_SUBST(swig_CXXFLAGS) - dnl add ${prefix}/lib${gr_libdir_suffix}/pkgconfig to the head of the PKG_CONFIG_PATH if test x${PKG_CONFIG_PATH} = x; then PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig @@ -75,7 +95,7 @@ else fi export PKG_CONFIG_PATH - +LF_SET_WARNINGS GR_SET_GPROF GR_SET_PROF AM_PROG_AS @@ -114,8 +134,6 @@ AC_CHECK_LIB(socket,socket) dnl check for omnithreads (will soon be removed) GR_OMNITHREAD -CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" dnl Set the c++ compiler that we use for the build system when cross compiling if test x$CXX_FOR_BUILD = x @@ -344,11 +362,6 @@ AC_CONFIG_FILES([\ dnl run_tests.sh is created from run_tests.sh.in . Make it executable. AC_CONFIG_COMMANDS([run_tests_build], [chmod +x run_tests.sh]) -dnl Enable warnings as the last thing before generating output, since -dnl this may add -Werror to CFLAGS which can cause various configure -dnl checks to fail. -LF_SET_WARNINGS - AC_OUTPUT echo diff --git a/gnuradio-core/src/lib/viterbi/Makefile.am b/gnuradio-core/src/lib/viterbi/Makefile.am index 4b434cb4b..8384c52f0 100644 --- a/gnuradio-core/src/lib/viterbi/Makefile.am +++ b/gnuradio-core/src/lib/viterbi/Makefile.am @@ -17,6 +17,8 @@ # Boston, MA 02110-1301, USA. # +include $(top_srcdir)/Makefile.common + LIBS = -lm noinst_LTLIBRARIES = libviterbi.la @@ -25,7 +27,7 @@ libviterbi_la_SOURCES = \ metrics.c \ tab.c \ viterbi.c - + noinst_HEADERS = \ viterbi.h diff --git a/usrp/host/misc/Makefile.am b/usrp/host/misc/Makefile.am index c201735ca..45c940f67 100644 --- a/usrp/host/misc/Makefile.am +++ b/usrp/host/misc/Makefile.am @@ -19,6 +19,8 @@ # Boston, MA 02110-1301, USA. # +include $(top_srcdir)/Makefile.common + EXTRA_DIST = \ getopt.c getopt.h \ gettimeofday.c \ |