Welcome to mirror list, hosted at ThFree Co, Russian Federation.

aclocal.m4 « w32api « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4bff47f9199248f8c4e16c0cd7078ae0c85f1338 (plain)
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# aclocal.m4 for MinGW/Cygwin w32api package.  -*- Autoconf -*-
#
# Definitions of autoconf macros used to implement the configure
# script for the w32api package.
#
# $Id$
#
# Written by Keith Marshall <keithmarshall@users.sourceforge.net>
# Copyright (C) 2011, 2012, MinGW Project
#
# -----------------------------------------------------------------------------
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# -----------------------------------------------------------------------------
#

# MINGW_AC_CONFIG_SRCDIR( VERSION_TAG, UNIQUE_FILE )
# --------------------------------------------------
# Wrapper for AC_CONFIG_SRCDIR; in addition to checking for a
# unique file reference within the source tree, it resolves the
# definition for PACKAGE_VERSION, based on a tagged definition
# within that file.
#
AC_DEFUN([MINGW_AC_CONFIG_SRCDIR],
[AC_CONFIG_SRCDIR([$2])
 AC_MSG_CHECKING([package version])
 PACKAGE_VERSION=`awk '$[2] == "'"$1"'" { print $[3] }' ${srcdir}/$2`
 AC_MSG_RESULT([$PACKAGE_VERSION])dnl
])# MINGW_AC_CONFIG_SRCDIR

# MINGW_AC_RUNTIME_SRCDIR
# -----------------------
# Attempt to identify the locations of the C runtime sources.
# Accept explicit locations specified by the user, as arguments
# to --with-host-srcdir and --with-libc-srcdir; if unspecified,
# fall back to standard locations relative to ${srcdir}.  For a
# MinGW build, identification of an appropriate location will be
# determined by presence of include/_mingw.h in host-srcdir, and
# lib-srcdir is not required; for a Cygwin build, host-srcdir is
# identified by the presence of include/cygwin/cygwin_dll.h, and
# presence of include/newlib.h is also required to identify the
# libc-srcdir location.  This is naive; however, AC_CHECK_HEADER
# cannot be used because the system's runtime headers may result
# in false identification of unsuitable locations.
#
AC_DEFUN([MINGW_AC_RUNTIME_SRCDIR],
[AC_REQUIRE([MINGW_AC_HOST_SRCDIR])dnl
 AC_REQUIRE([MINGW_AC_LIBC_SRCDIR])dnl
 AS_IF([(test "x${with_host_srcdir}" = xMISSING || test "x${with_libc_srcdir}" = xMISSING)],
 [AC_MSG_WARN([the location of required runtime headers cannot be established])
  AC_MSG_WARN([please correct this omission before running configure again])
  AC_MSG_RESULT
  AC_MSG_ERROR([unable to continue until this issue is resolved])
 ])dnl
])# MINGW_AC_RUNTIME_SRCDIR

# MINGW_AC_HOST_SRCDIR
# --------------------
# Helper macro, AC_REQUIREd by MINGW_AC_RUNTIME_SRCDIR.
# This establishes the --with-host-srcdir reference for identification
# of runtime header path; it is never called directly by configure.ac
#
AC_DEFUN([MINGW_AC_HOST_SRCDIR],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_ARG_WITH([host-srcdir],
 [AS_HELP_STRING([--with-host-srcdir=DIR],
  [locate host-specific runtime library sources in DIR [SRCDIR/../mingw*]
   ([SRCDIR/../cygwin] when HOST == Cygwin)
  ])dnl
 ],[],[with_host_srcdir=NONE])
 AS_CASE([${host_os}],
  [*cygwin*],[ac_dir="cygwin" ac_file="cygwin/cygwin_dll"],
  [ac_dir="mingw" ac_file="_mingw"])
 MINGW_AC_CHECK_RUNTIME_SRCDIR([host],[host runtime])
 EXTRA_INCLUDES="-I ${with_host_srcdir}/include"
])# MINGW_AC_HOST_SRCDIR

# MINGW_AC_LIBC_SRCDIR
# --------------------
# Helper macro, AC_REQUIREd by MINGW_AC_RUNTIME_SRCDIR.
# This establishes the --with-libc-srcdir reference for identification
# of runtime header path; it is never called directly by configure.ac
#
AC_DEFUN([MINGW_AC_LIBC_SRCDIR],
[AC_ARG_WITH([libc-srcdir],
 [AS_HELP_STRING([--with-libc-srcdir=DIR],
  [locate additional libc sources in DIR [SRCDIR/../../newlib/libc]
   (required only when HOST == Cygwin)
  ])dnl
 ],[],[with_libc_srcdir=NONE])
 AC_MSG_CHECKING([whether additional runtime headers are required])
 AS_CASE([${host_os}],
 [*cygwin*],
  [AC_MSG_RESULT([libc (newlib)])
   ac_dir="../newlib/libc" ac_file="newlib"
   MINGW_AC_CHECK_RUNTIME_SRCDIR([libc],[libc runtime])
   AS_IF([test "x${with_libc_srcdir}" != xNONE],
   [EXTRA_INCLUDES="-I ${with_libc_srcdir}/include ${EXTRA_INCLUDES}"
   ])dnl
  ],dnl
 [AC_MSG_RESULT([no])
 ])dnl
])# MINGW_AC_LIBC_SRCDIR

# MINGW_AC_CHECK_RUNTIME_SRCDIR( KEY, CATEGORY )
# ----------------------------------------------
# Helper macro, invoked by each of MINGW_AC_HOST_SRCDIR and
# MINGW_AC_LIBC_SRCDIR, with KEY passed as 'host' or as 'libc'
# respectively; it establishes and verifies the reference path
# for headers of the class described by CATEGORY, assigning
# the result to the shell variable 'with_KEY_srcdir'.
#
# As is the case for each of the preceding macros, which may
# call it, MINGW_AC_CHECK_RUNTIME_SRCDIR is never invoked
# directly by configure.ac
#
AC_DEFUN([MINGW_AC_CHECK_RUNTIME_SRCDIR],
[AS_IF([test "x${with_$1_srcdir}" = xNONE],
 [AC_MSG_CHECKING([include path for $2 headers])
  for with_$1_srcdir in ${srcdir}/../${ac_dir}*; do
    test -f "${with_$1_srcdir}/include/${ac_file}.h" && break
    with_$1_srcdir=MISSING
  done
  AS_IF([test "x${with_$1_srcdir}" = xMISSING],
  [AC_MSG_RESULT([none found])
   AC_MSG_RESULT
   AC_MSG_WARN([source directory containing include/${ac_file}.h not found])
   AC_MSG_WARN([ensure $2 sources are installed at \${top_srcdir}/../${ac_dir}*])
   AC_MSG_WARN([or use --with-$1-srcdir=DIR to specify an alternative])
   AC_MSG_RESULT
  ],dnl
  [case "${with_$1_srcdir}" in
     "${srcdir}/"*) with_$1_srcdir="`echo "${with_$1_srcdir}" \
       | sed s,"^${srcdir}/",'${top_srcdir}/',`" ;;
   esac
   AC_MSG_RESULT([${with_$1_srcdir}/include])dnl
  ])dnl
 ],dnl
 [AC_MSG_CHECKING([for ${ac_file}.h in ${with_$1_srcdir}/include])
  AS_IF([test -f "${with_$1_srcdir}/include/${ac_file}.h"],
  [AC_MSG_RESULT([yes])
   case "${with_$1_srcdir}" in /*) ;;
     *) with_$1_srcdir='${top_builddir}/'"${with_$1_srcdir}" ;;
   esac
  ],dnl
  [AC_MSG_RESULT([no])
   AC_MSG_RESULT
   AC_MSG_WARN([the nominated directory, ${with_$1_srcdir}])
   AC_MSG_WARN([does not appear to contain valid $2 source code])
   AC_MSG_WARN([(file '${with_$1_srcdir}/include/${ac_file}.h' is not present)])
   AC_MSG_RESULT
   with_$1_srcdir=MISSING
  ])dnl
 ])dnl
])# MINGW_AC_CHECK_RUNTIME_SRCDIR

# $RCSfile$: end of file: vim: ft=config