~ubuntu-branches/ubuntu/trusty/gnutls26/trusty-security

« back to all changes in this revision

Viewing changes to lib/gl/m4/include_next.m4

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Metzler
  • Date: 2010-04-22 19:29:52 UTC
  • mto: (12.4.3 experimental) (1.5.1)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: james.westby@ubuntu.com-20100422192952-gbj6cvaan8e4ejck
Tags: upstream-2.9.10
ImportĀ upstreamĀ versionĀ 2.9.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# include_next.m4 serial 14
2
 
dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
 
2
dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
109
109
# be
110
110
# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
111
111
# That way, a header file with the following line:
112
 
#       #@INCLUDE_NEXT@ @NEXT_FOO_H@
 
112
#       #@INCLUDE_NEXT@ @NEXT_FOO_H@
113
113
# or
114
 
#       #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
 
114
#       #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@
115
115
# behaves (after sed substitution) as if it contained
116
 
#       #include_next <foo.h>
 
116
#       #include_next <foo.h>
117
117
# even if the compiler does not support include_next.
118
118
# The three "///" are to pacify Sun C 5.8, which otherwise would say
119
119
# "warning: #include of /usr/include/... may be non-portable".
129
129
 
130
130
  m4_foreach_w([gl_HEADER_NAME], [$1],
131
131
    [AS_VAR_PUSHDEF([gl_next_header],
132
 
                    [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
 
132
                    [gl_cv_next_]m4_defn([gl_HEADER_NAME]))
133
133
     if test $gl_cv_have_include_next = yes; then
134
134
       AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
135
135
     else
136
136
       AC_CACHE_CHECK(
137
 
         [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
138
 
         m4_defn([gl_next_header]),
139
 
         [AS_VAR_PUSHDEF([gl_header_exists],
140
 
                         [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
141
 
          if test AS_VAR_GET(gl_header_exists) = yes; then
142
 
            AC_LANG_CONFTEST(
143
 
              [AC_LANG_SOURCE(
144
 
                 [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
145
 
               )])
146
 
            dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
147
 
            dnl that contain only a #include of other header files and no
148
 
            dnl non-comment tokens of their own. This leads to a failure to
149
 
            dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
150
 
            dnl and others. The workaround is to force preservation of comments
151
 
            dnl through option -C. This ensures all necessary #line directives
152
 
            dnl are present. GCC supports option -C as well.
153
 
            case "$host_os" in
154
 
              aix*) gl_absname_cpp="$ac_cpp -C" ;;
155
 
              *)    gl_absname_cpp="$ac_cpp" ;;
156
 
            esac
157
 
            dnl eval is necessary to expand gl_absname_cpp.
158
 
            dnl Ultrix and Pyramid sh refuse to redirect output of eval,
159
 
            dnl so use subshell.
160
 
            AS_VAR_SET([gl_next_header],
161
 
              ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
162
 
               sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
163
 
                 s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
164
 
                 s#^/[^/]#//&#
165
 
                 p
166
 
                 q
167
 
               }'`'"'])
168
 
          else
169
 
            AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
170
 
          fi
171
 
          AS_VAR_POPDEF([gl_header_exists])])
 
137
         [absolute name of <]m4_defn([gl_HEADER_NAME])[>],
 
138
         m4_defn([gl_next_header]),
 
139
         [AS_VAR_PUSHDEF([gl_header_exists],
 
140
                         [ac_cv_header_]m4_defn([gl_HEADER_NAME]))
 
141
          if test AS_VAR_GET(gl_header_exists) = yes; then
 
142
            AC_LANG_CONFTEST(
 
143
              [AC_LANG_SOURCE(
 
144
                 [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
 
145
               )])
 
146
            dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
 
147
            dnl that contain only a #include of other header files and no
 
148
            dnl non-comment tokens of their own. This leads to a failure to
 
149
            dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
 
150
            dnl and others. The workaround is to force preservation of comments
 
151
            dnl through option -C. This ensures all necessary #line directives
 
152
            dnl are present. GCC supports option -C as well.
 
153
            case "$host_os" in
 
154
              aix*) gl_absname_cpp="$ac_cpp -C" ;;
 
155
              *)    gl_absname_cpp="$ac_cpp" ;;
 
156
            esac
 
157
            dnl eval is necessary to expand gl_absname_cpp.
 
158
            dnl Ultrix and Pyramid sh refuse to redirect output of eval,
 
159
            dnl so use subshell.
 
160
            AS_VAR_SET([gl_next_header],
 
161
              ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
 
162
               sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{
 
163
                 s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
 
164
                 s#^/[^/]#//&#
 
165
                 p
 
166
                 q
 
167
               }'`'"'])
 
168
          else
 
169
            AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
 
170
          fi
 
171
          AS_VAR_POPDEF([gl_header_exists])])
172
172
     fi
173
173
     AC_SUBST(
174
174
       AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),