Fixes ticket:364, ticket:365. Merged eb/t364 -r11015:11017 to trunk.
authoreb <eb@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 13 May 2009 05:29:11 +0000 (05:29 +0000)
committereb <eb@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 13 May 2009 05:29:11 +0000 (05:29 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11018 221aa14e-8319-0410-a670-987f0aec2ac5

Makefile.common
config/lf_warnings.m4
configure.ac
gnuradio-core/src/lib/viterbi/Makefile.am
usrp/host/misc/Makefile.am

index b81433a32972d74e7164c1785869f38fbd12f84e..e9bc13e4109d11fb01c2699b561f4426a1cc0b80 100644 (file)
@@ -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
index 7bb8b60fc2ef03b29ff09a940c68afbda5927026..d40c77f14d56206e56334727bc35d438a03cbece 100644 (file)
@@ -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)
index f0bc516fc0c9fc0f0511a0409a970e4cc203e1ce..c5257300f73bdf858236e43eb8916a0c1125f40c 100644 (file)
@@ -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
index 4b434cb4b7149d43bea681fc36a87617606301c9..8384c52f01423159ef8b5fcfa05ce324910d445f 100644 (file)
@@ -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
 
index c201735ca2973dcaa5d056d72bf630b66244670e..45c940f67ed7b3de302f83e577dca2534d0cabdd 100644 (file)
@@ -19,6 +19,8 @@
 # Boston, MA 02110-1301, USA.
 # 
 
+include $(top_srcdir)/Makefile.common
+
 EXTRA_DIST = \
        getopt.c getopt.h \
        gettimeofday.c \