"Fossies" - the Fresh Open Source Software Archive

Member "regexxer-0.10/m4/dk-warn.m4" (6 Oct 2011, 3689 Bytes) of package /linux/privat/old/regexxer-0.10.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 ## Copyright (c) 2004-2007  Daniel Elstner  <daniel.kitta@gmail.com>
    2 ##
    3 ## This file is part of danielk's Autostuff.
    4 ##
    5 ## danielk's Autostuff is free software; you can redistribute it and/or
    6 ## modify it under the terms of the GNU General Public License as published
    7 ## by the Free Software Foundation; either version 2 of the License, or (at
    8 ## your option) any later version.
    9 ##
   10 ## danielk's Autostuff is distributed in the hope that it will be useful, but
   11 ## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   12 ## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   13 ## for more details.
   14 ##
   15 ## You should have received a copy of the GNU General Public License along
   16 ## with danielk's Autostuff; if not, write to the Free Software Foundation,
   17 ## Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   18 
   19 #serial 20070116
   20 
   21 ## DK_ARG_ENABLE_WARNINGS(variable, min-flags, max-flags, [deprecation-prefixes])
   22 ##
   23 ## Provide the --enable-warnings configure argument, set to "min" by default.
   24 ## <min-flags> and <max-flags> should be space-separated lists of compiler
   25 ## warning flags to use with --enable-warnings=min or --enable-warnings=max,
   26 ## respectively.  Warning level "fatal" is the same as "max" but in addition
   27 ## enables -Werror mode.
   28 ##
   29 ## If not empty, <deprecation-prefixes> should be a list of module prefixes
   30 ## which is expanded to -D<module>_DISABLE_DEPRECATED flags if fatal warnings
   31 ## are enabled, too.
   32 ##
   33 AC_DEFUN([DK_ARG_ENABLE_WARNINGS],
   34 [dnl
   35 m4_if([$3],, [AC_FATAL([3 arguments expected])])[]dnl
   36 dnl
   37 AC_ARG_ENABLE([warnings], [AS_HELP_STRING(
   38   [--enable-warnings=@<:@min|max|fatal|no@:>@],
   39   [control compiler pickyness @<:@min@:>@])],
   40   [dk_enable_warnings=$enableval],
   41   [dk_enable_warnings=min])[]dnl
   42 
   43 dk_lang=
   44 case $ac_compile in
   45   *'$CXXFLAGS '*)
   46     dk_lang='C++'
   47     dk_cc=$CXX
   48     dk_conftest=conftest.${ac_ext-cc}
   49     ;;
   50   *'$CFLAGS '*)
   51     dk_lang=C
   52     dk_cc=$CC
   53     dk_conftest=conftest.${ac_ext-c}
   54     ;;
   55 esac
   56 
   57 AS_IF([test "x$dk_lang" != x],
   58 [
   59   AC_MSG_CHECKING([which $dk_lang compiler warning flags to use])
   60 
   61   case $dk_enable_warnings in
   62     no)     dk_warning_flags=;;
   63     max)    dk_warning_flags="$3";;
   64     fatal)  dk_warning_flags="$3 -Werror";;
   65     *)      dk_warning_flags="$2";;
   66   esac
   67 
   68   dk_deprecation_flags=
   69 m4_if([$4],,, [
   70   AS_IF([test "x$dk_enable_warnings" = xfatal],
   71   [
   72     dk_deprecation_prefixes="$4"
   73     for dk_prefix in $dk_deprecation_prefixes
   74     do
   75       dk_deprecation_flags="${dk_deprecation_flags}-D${dk_prefix}_DISABLE_DEPRECATED "
   76     done
   77   ])
   78 ])[]dnl
   79   dk_tested_flags=
   80 
   81   AS_IF([test "x$dk_warning_flags" != x],
   82   [
   83     # Keep in mind that the dummy source must be devoid of any
   84     # problems that might cause diagnostics.
   85     AC_LANG_CONFTEST([AC_LANG_SOURCE(
   86       [[int main(int argc, char** argv) { return (argv != 0) ? argc : 0; }]])])
   87 
   88     for dk_flag in $dk_warning_flags
   89     do
   90       # Test whether the compiler accepts the flag.  GCC doesn't bail
   91       # out when given an unsupported flag but prints a warning, so
   92       # check the compiler output instead.
   93       dk_cc_out=`$dk_cc $dk_tested_flags $dk_flag -c "$dk_conftest" 2>&1 || echo failed`
   94       rm -f "conftest.${OBJEXT-o}"
   95 
   96       AS_IF([test "x$dk_cc_out" = x],
   97       [
   98         AS_IF([test "x$dk_tested_flags" = x],
   99               [dk_tested_flags=$dk_flag],
  100               [dk_tested_flags="$dk_tested_flags $dk_flag"])
  101       ], [
  102         echo "$dk_cc_out" >&AS_MESSAGE_LOG_FD
  103       ])
  104     done
  105 
  106     rm -f "$dk_conftest"
  107   ])
  108   dk_all_flags=$dk_deprecation_flags$dk_tested_flags
  109   AC_SUBST([$1], [$dk_all_flags])
  110 
  111   test "x$dk_all_flags" != x || dk_all_flags=none
  112   AC_MSG_RESULT([$dk_all_flags])
  113 ])
  114 ])