~ubuntu-branches/ubuntu/vivid/kmod/vivid

« back to all changes in this revision

Viewing changes to m4/attributes.m4

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2012-09-21 16:05:32 UTC
  • mfrom: (4.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20120921160532-bdsxhmpj5og2ru5h
Tags: 9-2ubuntu1
* Sync with Debian unstable; remaining Ubuntu changes:
  - Ubuntu-specific depmod.d and modprobe.d contents.
  - Mark module-init-tools Multi-Arch: foreign.
  - Don't install Debian's extra/aliases.conf file.
  - Install upstart job instead of the sysvinit script.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
dnl Macros to check the presence of generic (non-typed) symbols.
2
2
dnl Copyright (c) 2006-2008 Diego Pettenò <flameeyes@gmail.com>
3
3
dnl Copyright (c) 2006-2008 xine project
 
4
dnl Copyright (c) 2012 Lucas De Marchi <lucas.de.marchi@gmail.com>
4
5
dnl
5
6
dnl This program is free software; you can redistribute it and/or modify
6
7
dnl it under the terms of the GNU General Public License as published by
32
33
dnl this special exception to the GPL to apply to your modified version as
33
34
dnl well.
34
35
 
35
 
dnl Check if the flag is supported by compiler
36
 
dnl CC_CHECK_CFLAGS_SILENT([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
37
 
 
38
 
AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [
39
 
  AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]),
40
 
    [ac_save_CFLAGS="$CFLAGS"
41
 
     CFLAGS="$CFLAGS $1"
42
 
     AC_COMPILE_IFELSE([AC_LANG_SOURCE([int a;])],
43
 
       [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"],
44
 
       [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"])
45
 
     CFLAGS="$ac_save_CFLAGS"
46
 
    ])
47
 
 
48
 
  AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
49
 
    [$2], [$3])
50
 
])
51
 
 
52
 
dnl Check if the flag is supported by compiler (cacheable)
53
 
dnl CC_CHECK_CFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
54
 
 
55
 
AC_DEFUN([CC_CHECK_CFLAGS], [
56
 
  AC_CACHE_CHECK([if $CC supports $1 flag],
57
 
    AS_TR_SH([cc_cv_cflags_$1]),
58
 
    CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
59
 
  )
60
 
 
61
 
  AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
62
 
    [$2], [$3])
63
 
])
64
 
 
65
 
dnl CC_CHECK_CFLAG_APPEND(FLAG, [action-if-found], [action-if-not-found])
66
 
dnl Check for CFLAG and appends them to CFLAGS if supported
67
 
AC_DEFUN([CC_CHECK_CFLAG_APPEND], [
68
 
  AC_CACHE_CHECK([if $CC supports $1 flag],
69
 
    AS_TR_SH([cc_cv_cflags_$1]),
70
 
    CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
71
 
  )
72
 
 
73
 
  AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
74
 
    [CFLAGS="$CFLAGS $1"; DEBUG_CFLAGS="$DEBUG_CFLAGS $1"; $2], [$3])
75
 
])
76
 
 
77
 
dnl CC_CHECK_CFLAGS_APPEND([FLAG1 FLAG2], [action-if-found], [action-if-not])
78
 
AC_DEFUN([CC_CHECK_CFLAGS_APPEND], [
79
 
  for flag in $1; do
80
 
    CC_CHECK_CFLAG_APPEND($flag, [$2], [$3])
 
36
dnl Check if flag in a envvar is supported by compiler and append
 
37
dnl "backup" variable
 
38
dnl CC_CHECK_FLAG_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG])
 
39
AC_DEFUN([CC_CHECK_FLAG_APPEND], [
 
40
  AC_CACHE_CHECK([if $CC supports flag $3 in envvar $2],
 
41
                 AS_TR_SH([cc_cv_$2_$3]),
 
42
                 [eval "AS_TR_SH([cc_save_$2])='${$2}'"
 
43
                  eval "AS_TR_SH([$2])='$3'"
 
44
                  AC_COMPILE_IFELSE([AC_LANG_SOURCE([int a = 0; int main(void) { return a; } ])],
 
45
                                    [eval "AS_TR_SH([cc_cv_$2_$3])='yes'"],
 
46
                                    [eval "AS_TR_SH([cc_cv_$2_$3])='no'"])
 
47
                  eval "AS_TR_SH([$2])='$cc_save_$2'"])
 
48
 
 
49
  AS_IF([eval test x$]AS_TR_SH([cc_cv_$2_$3])[ = xyes],
 
50
        [eval "$1='${$1} $3'"])
 
51
])
 
52
 
 
53
dnl CC_CHECK_FLAGS_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG1 FLAG2])
 
54
AC_DEFUN([CC_CHECK_FLAGS_APPEND], [
 
55
  for flag in $3; do
 
56
    CC_CHECK_FLAG_APPEND($1, $2, $flag)
81
57
  done
82
58
])
83
59
 
84
 
dnl Check if the flag is supported by linker (cacheable)
85
 
dnl CC_CHECK_LDFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
86
 
 
87
 
AC_DEFUN([CC_CHECK_LDFLAGS], [
88
 
  AC_CACHE_CHECK([if $CC supports $1 flag],
89
 
    AS_TR_SH([cc_cv_ldflags_$1]),
 
60
 
 
61
 
 
62
dnl Check if the flag is supported by linker
 
63
dnl CC_CHECK_LDFLAGS_SILENT([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
 
64
AC_DEFUN([CC_CHECK_LDFLAGS_SILENT], [
 
65
  AC_CACHE_VAL(AS_TR_SH([cc_cv_ldflags_$1]),
90
66
    [ac_save_LDFLAGS="$LDFLAGS"
91
67
     LDFLAGS="$LDFLAGS $1"
92
 
     AC_LINK_IFELSE([int main() { return 1; }],
 
68
     AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 1; }])],
93
69
       [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
94
70
       [eval "AS_TR_SH([cc_cv_ldflags_$1])="])
95
71
     LDFLAGS="$ac_save_LDFLAGS"
99
75
    [$2], [$3])
100
76
])
101
77
 
 
78
dnl Check if the flag is supported by linker (cacheable)
 
79
dnl CC_CHECK_LDFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
 
80
 
 
81
AC_DEFUN([CC_CHECK_LDFLAGS], [
 
82
  AC_CACHE_CHECK([if $CC supports $1 flag],
 
83
    AS_TR_SH([cc_cv_ldflags_$1]),
 
84
    CC_CHECK_LDFLAGS_SILENT([$1]) dnl Don't execute actions here!
 
85
  )
 
86
 
 
87
  AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes],
 
88
    [$2], [$3])
 
89
])
 
90
 
102
91
dnl define the LDFLAGS_NOUNDEFINED variable with the correct value for
103
92
dnl the current linker to avoid undefined references in a shared object.
104
93
AC_DEFUN([CC_NOUNDEFINED], [