~seb128/unity-settings-daemon/battery-info-key

« back to all changes in this revision

Viewing changes to acinclude.m4

  • Committer: William Jon McCann
  • Author(s): William Jon McCann
  • Date: 2007-12-14 05:06:55 UTC
  • Revision ID: git-v1:b7f5d9895c19338f10b0bdd494b221b13b540d9d
Initial checkin. Previously lived in gdm module.

2007-12-14  William Jon McCann  <mccann@jhu.edu>

        * configure.ac, etc: Initial checkin.  Previously
        lived in gdm module.


svn path=/trunk/; revision=2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl as-ac-expand.m4 0.2.0
 
2
dnl autostars m4 macro for expanding directories using configure's prefix
 
3
dnl thomas@apestaart.org
 
4
 
 
5
dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
 
6
dnl example
 
7
dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
 
8
dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
 
9
 
 
10
AC_DEFUN([AS_AC_EXPAND],
 
11
[
 
12
  EXP_VAR=[$1]
 
13
  FROM_VAR=[$2]
 
14
 
 
15
  dnl first expand prefix and exec_prefix if necessary
 
16
  prefix_save=$prefix
 
17
  exec_prefix_save=$exec_prefix
 
18
 
 
19
  dnl if no prefix given, then use /usr/local, the default prefix
 
20
  if test "x$prefix" = "xNONE"; then
 
21
    prefix="$ac_default_prefix"
 
22
  fi
 
23
  dnl if no exec_prefix given, then use prefix
 
24
  if test "x$exec_prefix" = "xNONE"; then
 
25
    exec_prefix=$prefix
 
26
  fi
 
27
 
 
28
  full_var="$FROM_VAR"
 
29
  dnl loop until it doesn't change anymore
 
30
  while true; do
 
31
    new_full_var="`eval echo $full_var`"
 
32
    if test "x$new_full_var" = "x$full_var"; then break; fi
 
33
    full_var=$new_full_var
 
34
  done
 
35
 
 
36
  dnl clean up
 
37
  full_var=$new_full_var
 
38
  AC_SUBST([$1], "$full_var")
 
39
 
 
40
  dnl restore prefix and exec_prefix
 
41
  prefix=$prefix_save
 
42
  exec_prefix=$exec_prefix_save
 
43
])
 
44
 
 
45
dnl EXTRA_COMPILE_WARNINGS
 
46
dnl Turn on many useful compiler warnings
 
47
dnl For now, only works on GCC
 
48
AC_DEFUN([EXTRA_COMPILE_WARNINGS],[
 
49
    dnl ******************************
 
50
    dnl More compiler warnings
 
51
    dnl ******************************
 
52
 
 
53
    AC_ARG_ENABLE(compile-warnings,
 
54
                  AC_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],
 
55
                                 [Turn on compiler warnings]),,
 
56
                  [enable_compile_warnings="m4_default([$1],[yes])"])
 
57
 
 
58
    warnCFLAGS=
 
59
    if test "x$GCC" != xyes; then
 
60
        enable_compile_warnings=no
 
61
    fi
 
62
 
 
63
    warning_flags=
 
64
    realsave_CFLAGS="$CFLAGS"
 
65
 
 
66
    case "$enable_compile_warnings" in
 
67
    no)
 
68
        warning_flags=
 
69
        ;;
 
70
    minimum)
 
71
        warning_flags="-Wall"
 
72
        ;;
 
73
    yes)
 
74
        warning_flags="-Wall -Wmissing-prototypes"
 
75
        ;;
 
76
    maximum|error)
 
77
        warning_flags="-Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
 
78
        CFLAGS="$warning_flags $CFLAGS"
 
79
        for option in -Wno-sign-compare; do
 
80
                SAVE_CFLAGS="$CFLAGS"
 
81
                CFLAGS="$CFLAGS $option"
 
82
                AC_MSG_CHECKING([whether gcc understands $option])
 
83
                AC_TRY_COMPILE([], [],
 
84
                        has_option=yes,
 
85
                        has_option=no,)
 
86
                CFLAGS="$SAVE_CFLAGS"
 
87
                AC_MSG_RESULT($has_option)
 
88
                if test $has_option = yes; then
 
89
                  warning_flags="$warning_flags $option"
 
90
                fi
 
91
                unset has_option
 
92
                unset SAVE_CFLAGS
 
93
        done
 
94
        unset option
 
95
        if test "$enable_compile_warnings" = "error" ; then
 
96
            warning_flags="$warning_flags -Werror"
 
97
        fi
 
98
        ;;
 
99
    *)
 
100
        AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
 
101
        ;;
 
102
    esac
 
103
    CFLAGS="$realsave_CFLAGS"
 
104
    AC_MSG_CHECKING(what warning flags to pass to the C compiler)
 
105
    AC_MSG_RESULT($warning_flags)
 
106
 
 
107
    AC_ARG_ENABLE(iso-c,
 
108
                  AC_HELP_STRING([--enable-iso-c],
 
109
                                 [Try to warn if code is not ISO C ]),,
 
110
                  [enable_iso_c=no])
 
111
 
 
112
    AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
 
113
    complCFLAGS=
 
114
    if test "x$enable_iso_c" != "xno"; then
 
115
        if test "x$GCC" = "xyes"; then
 
116
        case " $CFLAGS " in
 
117
            *[\ \       ]-ansi[\ \      ]*) ;;
 
118
            *) complCFLAGS="$complCFLAGS -ansi" ;;
 
119
        esac
 
120
        case " $CFLAGS " in
 
121
            *[\ \       ]-pedantic[\ \  ]*) ;;
 
122
            *) complCFLAGS="$complCFLAGS -pedantic" ;;
 
123
        esac
 
124
        fi
 
125
    fi
 
126
    AC_MSG_RESULT($complCFLAGS)
 
127
 
 
128
    WARN_CFLAGS="$warning_flags $complCFLAGS"
 
129
    AC_SUBST(WARN_CFLAGS)
 
130
])