RISC-V: Add testcases for vector unsigned SAT_SUB form 2
[official-gcc.git] / c++tools / configure.ac
blobbc0ae382f0a2630c0a4fc5314cf6fd0e36148930
1 # Configure script for c++tools
2 #   Copyright (C) 2020-2024 Free Software Foundation, Inc.
3 #   Written by Nathan Sidwell <nathan@acm.org> while at FaceBook
5 # This file is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; see the file COPYING3.  If not see
17 # <http://www.gnu.org/licenses/>.
19 # C++ has grown a C++20 mapper server.  This may be used to provide
20 # and/or learn and/or build required modules.  This sample server
21 # shows how the protocol introduced by wg21.link/p1184 may be used.
22 # By default g++ uses an in-process mapper.
24 sinclude(../config/acx.m4)
26 AC_INIT(c++tools)
28 AC_CONFIG_SRCDIR([server.cc])
30 # Determine the noncanonical names used for directories.
31 ACX_NONCANONICAL_TARGET
33 AC_CANONICAL_SYSTEM
34 AC_PROG_INSTALL
35 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
36 AC_SUBST(INSTALL_PROGRAM)
38 AC_PROG_CXX
39 MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
40 AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf])
41 AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader])
43 AC_LANG(C++)
45 dnl Enabled by default
46 AC_MSG_CHECKING([whether to build C++ tools])
47   AC_ARG_ENABLE(c++-tools, 
48     [AS_HELP_STRING([--enable-c++-tools],
49                     [build auxiliary c++ tools])],
50       cxx_aux_tools=$enableval,
51       cxx_aux_tools=yes)
53 AC_MSG_RESULT($cxx_aux_tools)
54 CXX_AUX_TOOLS="$cxx_aux_tools"
55 AC_SUBST(CXX_AUX_TOOLS)
57 AC_ARG_ENABLE([maintainer-mode],
58 AS_HELP_STRING([--enable-maintainer-mode],
59 [enable maintainer mode.  Add rules to rebuild configurey bits]),,
60 [enable_maintainer_mode=no])
61 case "$enable_maintainer_mode" in
62   yes) maintainer_mode=yes ;;
63   no) maintainer_mode=no ;;
64   *) AC_MSG_ERROR([unknown maintainer mode $enable_maintainer_mode]) ;;
65 esac
66 AC_MSG_CHECKING([maintainer-mode])
67 AC_MSG_RESULT([$maintainer_mode])
68 test "$maintainer_mode" = yes && MAINTAINER=yes
69 AC_SUBST(MAINTAINER)
71 # Handle configuration of checking; for the tools in this directory we
72 # default to release checking and stricter checks do not change this.
74 AC_ARG_ENABLE(checking,
75 [AS_HELP_STRING([[--enable-checking[=LIST]]],
76                 [enable expensive run-time checks.  With LIST,
77                  enable only specific categories of checks.
78                  Categories are: yes,no,all,none,release.])],
79 [ac_checking_flags="${enableval}"],[
80 # Default to checking.
81 ac_checking_flags=yes
83 IFS="${IFS=     }"; ac_save_IFS="$IFS"; IFS="$IFS,"
84 for check in release $ac_checking_flags
86         case $check in
87         # these set all the flags to specific states
88         yes|all|release|assert) ac_assert_checking=1 ; ;;
89         no|none) ac_assert_checking= ; ;;
90         *) ;;
91         esac
92 done
93 IFS="$ac_save_IFS"
95 if test x$ac_assert_checking != x ; then
96   AC_DEFINE(ENABLE_ASSERT_CHECKING, 1,
97 [Define if you want assertions enabled.  This is a cheap check.])
100 # Check whether --enable-default-pie was given.
101 AC_ARG_ENABLE(default-pie,
102 [AS_HELP_STRING([--enable-default-pie],
103                   [enable Position Independent Executable as default])],
104 [PICFLAG=-fPIE], [PICFLAG=])
106 # Enable --enable-host-pie
107 AC_ARG_ENABLE(host-pie,
108 [AS_HELP_STRING([--enable-host-pie],
109                 [build host code as PIE])],
110 [PICFLAG=-fPIE; LD_PICFLAG=-pie], [])
111 AC_SUBST(PICFLAG)
113 # Enable --enable-host-bind-now
114 AC_ARG_ENABLE(host-bind-now,
115 [AS_HELP_STRING([--enable-host-bind-now],
116        [link host code as BIND_NOW])],
117 [LD_PICFLAG="$LD_PICFLAG -Wl,-z,now"], [])
118 AC_SUBST(enable_host_bind_now)
119 AC_SUBST(LD_PICFLAG)
121 # Check if O_CLOEXEC is defined by fcntl
122 AC_CACHE_CHECK(for O_CLOEXEC, ac_cv_o_cloexec, [
123 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
124 #include <fcntl.h>]], [[
125 return open ("/dev/null", O_RDONLY | O_CLOEXEC);]])],
126 [ac_cv_o_cloexec=yes],[ac_cv_o_cloexec=no])])
127 if test $ac_cv_o_cloexec = yes; then
128   AC_DEFINE(HOST_HAS_O_CLOEXEC, 1,
129   [Define if O_CLOEXEC supported by fcntl.])
132 AC_CHECK_HEADERS(sys/mman.h)
134 # C++ Modules would like some networking features to provide the mapping
135 # server.  You can still use modules without them though.
136 # The following network-related checks could probably do with some
137 # Windows and other non-linux defenses and checking.
139 # Local socket connectivity wants AF_UNIX networking
140 # Check for AF_UNIX networking
141 AC_CACHE_CHECK(for AF_UNIX, ac_cv_af_unix, [
142 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
143 #include <sys/types.h>
144 #include <sys/socket.h>
145 #include <sys/un.h>
146 #include <netinet/in.h>]],[[
147 sockaddr_un un;
148 un.sun_family = AF_UNSPEC;
149 int fd = socket (AF_UNIX, SOCK_STREAM, 0);
150 connect (fd, (sockaddr *)&un, sizeof (un));]])],
151 [ac_cv_af_unix=yes],
152 [ac_cv_af_unix=no])])
153 if test $ac_cv_af_unix = yes; then
154   AC_DEFINE(HAVE_AF_UNIX, 1,
155   [Define if AF_UNIX supported.])
158 # Remote socket connectivity wants AF_INET6 networking
159 # Check for AF_INET6 networking
160 AC_CACHE_CHECK(for AF_INET6, ac_cv_af_inet6, [
161 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
162 #include <sys/types.h>
163 #include <sys/socket.h>
164 #include <netinet/in.h>
165 #include <netdb.h>]],[[
166 sockaddr_in6 in6;
167 in6.sin6_family = AF_UNSPEC;
168 struct addrinfo *addrs = 0;
169 struct addrinfo hints;
170 hints.ai_flags = 0;
171 hints.ai_family = AF_INET6;
172 hints.ai_socktype = SOCK_STREAM;
173 hints.ai_protocol = 0;
174 hints.ai_canonname = 0;
175 hints.ai_addr = 0;
176 hints.ai_next = 0;
177 int e = getaddrinfo ("localhost", 0, &hints, &addrs);
178 const char *str = gai_strerror (e);
179 freeaddrinfo (addrs);
180 int fd = socket (AF_INET6, SOCK_STREAM, 0);
181 connect (fd, (sockaddr *)&in6, sizeof (in6));]])],
182 [ac_cv_af_inet6=yes],
183 [ac_cv_af_inet6=no])])
184 if test $ac_cv_af_inet6 = yes; then
185   AC_DEFINE(HAVE_AF_INET6, 1,
186   [Define if AF_INET6 supported.])
189 # Efficient server response wants epoll
190 # Check for epoll_create, epoll_ctl, epoll_pwait
191 AC_CACHE_CHECK(for epoll, ac_cv_epoll, [
192 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
193 #include <sys/epoll.h>]],[[
194 int fd = epoll_create (1);
195 epoll_event ev;
196 ev.events = EPOLLIN;
197 ev.data.fd = 0;
198 epoll_ctl (fd, EPOLL_CTL_ADD, 0, &ev);
199 epoll_pwait (fd, 0, 0, -1, 0);]])],
200 [ac_cv_epoll=yes],
201 [ac_cv_epoll=no])])
202 if test $ac_cv_epoll = yes; then
203   AC_DEFINE(HAVE_EPOLL, 1,
204   [Define if epoll_create, epoll_ctl, epoll_pwait provided.])
207 # If we can't use epoll, try pselect.
208 # Check for pselect
209 AC_CACHE_CHECK(for pselect, ac_cv_pselect, [
210 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
211 #include <sys/select.h>]],[[
212 pselect (0, 0, 0, 0, 0, 0);]])],
213 [ac_cv_pselect=yes],
214 [ac_cv_pselect=no])])
215 if test $ac_cv_pselect = yes; then
216   AC_DEFINE(HAVE_PSELECT, 1,
217   [Define if pselect provided.])
220 # And failing that, use good old select.
221 # If we can't even use this, the server is serialized.
222 # Check for select
223 AC_CACHE_CHECK(for select, ac_cv_select, [
224 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
225 #include <sys/select.h>]],[[
226 select (0, 0, 0, 0, 0);]])],
227 [ac_cv_select=yes],
228 [ac_cv_select=no])])
229 if test $ac_cv_select = yes; then
230   AC_DEFINE(HAVE_SELECT, 1,
231   [Define if select provided.])
234 # Avoid some fnctl calls by using accept4, when available.
235 # Check for accept4
236 AC_CACHE_CHECK(for accept4, ac_cv_accept4, [
237 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
238 #include <sys/socket.h>]],[[
239 int err = accept4 (1, 0, 0, SOCK_NONBLOCK);]])],
240 [ac_cv_accept4=yes],
241 [ac_cv_accept4=no])])
242 if test $ac_cv_accept4 = yes; then
243   AC_DEFINE(HAVE_ACCEPT4, 1,
244   [Define if accept4 provided.])
247 # For better server messages, look for a way to stringize network addresses
248 # Check for inet_ntop
249 AC_CACHE_CHECK(for inet_ntop, ac_cv_inet_ntop, [
250 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
251 #include <arpa/inet.h>
252 #include <netinet/in.h>]],[[
253 sockaddr_in6 in6;
254 char buf[INET6_ADDRSTRLEN];
255 const char *str = inet_ntop (AF_INET6, &in6, buf, sizeof (buf));]])],
256 [ac_cv_inet_ntop=yes],
257 [ac_cv_inet_ntop=no])])
258 if test $ac_cv_inet_ntop = yes; then
259   AC_DEFINE(HAVE_INET_NTOP, 1,
260   [Define if inet_ntop provided.])
263 # Determine what GCC version number to use in filesystem paths.
264 GCC_BASE_VER
266 AC_CONFIG_HEADERS([config.h])
267 AC_CONFIG_FILES([Makefile])
269 AC_OUTPUT