File: acinclude.m4

package info (click to toggle)
netcf 1%3A0.2.8-1.1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 7,172 kB
  • sloc: ansic: 44,029; sh: 13,424; xml: 1,039; makefile: 248
file content (85 lines) | stat: -rw-r--r-- 2,728 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
dnl
dnl Determine readline linker flags in a way that works on RHEL 5
dnl
AC_DEFUN([NETCF_CHECK_READLINE], [
  AC_CHECK_HEADERS([readline/readline.h])

  # Check for readline.
  AC_CHECK_LIB(readline, readline,
          [use_readline=yes; READLINE_LIBS=-lreadline],
          [use_readline=no])

  # If the above test failed, it may simply be that -lreadline requires
  # some termcap-related code, e.g., from one of the following libraries.
  # See if adding one of them to LIBS helps.
  if test $use_readline = no; then
      saved_libs=$LIBS
      LIBS=
      AC_SEARCH_LIBS(tgetent, ncurses curses termcap termlib)
      case $LIBS in
        no*) ;;  # handle "no" and "none required"
        *) # anything else is a -lLIBRARY
          # Now, check for -lreadline again, also using $LIBS.
          # Note: this time we use a different function, so that
          # we don't get a cached "no" result.
          AC_CHECK_LIB(readline, rl_initialize,
                  [use_readline=yes
                   READLINE_LIBS="-lreadline $LIBS"],,
                  [$LIBS])
          ;;
      esac
      test $use_readline = no &&
          AC_MSG_WARN([readline library not found])
      LIBS=$saved_libs
  fi

  if test $use_readline = no; then
    AC_MSG_ERROR(Could not find a working readline library (see config.log for details).)
  fi

  AC_SUBST(READLINE_LIBS)
])

dnl
dnl Set compiler warning flags using gnulib's warnings module
dnl
AC_DEFUN([NETCF_COMPILE_WARNINGS],[
    dnl ******************************
    dnl More compiler warnings
    dnl ******************************

    AC_ARG_ENABLE(compile-warnings,
        AC_HELP_STRING([--enable-compile-warnings=@<:@no/yes/error@:>@],
                  [Turn on compiler warnings]),,
                  [enable_compile_warnings="m4_default([$1],[yes])"])

    case "x$enable_compile_warnings" in
    xyes | xno | xerror)
    ;;
    *)
    AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
    ;;
    esac

    if test "x$enable_compile_warnings" != "xno"; then
        gl_WARN_ADD([-Wall])
        gl_WARN_ADD([-Wformat])
        gl_WARN_ADD([-Wformat-security])
        gl_WARN_ADD([-Wmissing-prototypes])
        gl_WARN_ADD([-Wnested-externs])
        gl_WARN_ADD([-Wpointer-arith])
        gl_WARN_ADD([-Wextra])
        gl_WARN_ADD([-Wshadow])
        gl_WARN_ADD([-Wcast-align])
        gl_WARN_ADD([-Wwrite-strings])
        gl_WARN_ADD([-Waggregate-return])
        gl_WARN_ADD([-Wstrict-prototypes])
        gl_WARN_ADD([-Winline])
        gl_WARN_ADD([-Wredundant-decls])
        gl_WARN_ADD([-Wno-sign-compare])
    fi

    if test "x$enable_compile_warnings" = "xerror"; then
        gl_WARN_ADD([-Werror])
    fi
])