comparison m4/include_next.m4 @ 15589:164add203442

absolute-header, include-next: Add support for MSVC compiler. * m4/absolute-header.m4 (gl_ABSOLUTE_HEADER_ONE): Require AC_CANONICAL_HOST. On native Windows, recognize also backslash as directory separator in #line directives. * m4/include_next.m4 (gl_NEXT_HEADERS_INTERNAL): On native Windows, recognize also backslash as directory separator in #line directives.
author Bruno Haible <bruno@clisp.org>
date Sat, 10 Sep 2011 11:35:17 +0200
parents f10877c6816b
children 947cb4acb113
comparison
equal deleted inserted replaced
15588:e2334639eeea 15589:164add203442
1 # include_next.m4 serial 20 1 # include_next.m4 serial 21
2 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. 2 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation 3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it, 4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved. 5 dnl with or without modifications, as long as this notice is preserved.
6 6
205 dnl #line directives are present. GCC supports option -C as well. 205 dnl #line directives are present. GCC supports option -C as well.
206 case "$host_os" in 206 case "$host_os" in
207 aix*) gl_absname_cpp="$ac_cpp -C" ;; 207 aix*) gl_absname_cpp="$ac_cpp -C" ;;
208 *) gl_absname_cpp="$ac_cpp" ;; 208 *) gl_absname_cpp="$ac_cpp" ;;
209 esac 209 esac
210 changequote(,)
211 case "$host_os" in
212 mingw*)
213 dnl For the sake of native Windows compilers (excluding gcc),
214 dnl treat backslash as a directory separator, like /.
215 dnl Actually, these compilers use a double-backslash as
216 dnl directory separator, inside the
217 dnl # line "filename"
218 dnl directives.
219 gl_dirsep_regex='[/\\]'
220 ;;
221 *)
222 gl_dirsep_regex='/'
223 ;;
224 esac
225 changequote([,])
226 gl_absolute_header_sed='\#'"${gl_dirsep_regex}"']m4_defn([gl_HEADER_NAME])[#{
227 s#.*"\(.*'"${gl_dirsep_regex}"']m4_defn([gl_HEADER_NAME])[\)".*#\1#
228 s#^/[^/]#//&#
229 p
230 q
231 }'
210 dnl eval is necessary to expand gl_absname_cpp. 232 dnl eval is necessary to expand gl_absname_cpp.
211 dnl Ultrix and Pyramid sh refuse to redirect output of eval, 233 dnl Ultrix and Pyramid sh refuse to redirect output of eval,
212 dnl so use subshell. 234 dnl so use subshell.
213 AS_VAR_SET(gl_next_header, 235 AS_VAR_SET(gl_next_header,
214 ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | 236 ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
215 sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{ 237 sed -n "$gl_absolute_header_sed"`'"'])
216 s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1#
217 s#^/[^/]#//&#
218 p
219 q
220 }'`'"'])
221 m4_if([$2], [check], 238 m4_if([$2], [check],
222 [else 239 [else
223 AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) 240 AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>'])
224 fi 241 fi
225 ]) 242 ])