[Ada] Add mention of underscore and fix grammar error in doc for -gnatd
[official-gcc.git] / c++tools / configure.ac
blob5771f2ace687fe22655b9a1d9bd0803cf351f2a3
1 # Configure script for c++tools
2 #   Copyright (C) 2020 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)
25 sinclude(../config/ax_lib_socket_nsl.m4)
27 AC_INIT(c++tools)
29 AC_CONFIG_SRCDIR([server.cc])
31 # Determine the noncanonical names used for directories.
32 ACX_NONCANONICAL_TARGET
34 AC_CANONICAL_SYSTEM
35 AC_PROG_INSTALL
36 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
37 AC_SUBST(INSTALL_PROGRAM)
39 AC_PROG_CXX
40 MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
41 AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf])
42 AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader])
44 dnl Enabled by default
45 AC_MSG_CHECKING([whether to build C++ tools])
46   AC_ARG_ENABLE(c++-tools, 
47     [AS_HELP_STRING([--enable-c++-tools],
48                     [build auxiliary c++ tools])],
49       cxx_aux_tools=$enableval,
50       cxx_aux_tools=yes)
52 AC_MSG_RESULT($cxx_aux_tools)
53 CXX_AUX_TOOLS="$cxx_aux_tools"
54 AC_SUBST(CXX_AUX_TOOLS)
56 AC_ARG_ENABLE([maintainer-mode],
57 AS_HELP_STRING([--enable-maintainer-mode],
58 [enable maintainer mode.  Add rules to rebuild configurey bits]),,
59 [enable_maintainer_mode=no])
60 case "$enable_maintainer_mode" in
61   ("yes") maintainer_mode=yes ;;
62   ("no") maintainer=no ;;
63   (*) AC_MSG_ERROR([unknown maintainer mode $enable_maintainer_mode]) ;;
64 esac
65 AC_MSG_CHECKING([maintainer-mode])
66 AC_MSG_RESULT([$maintainer_mode])
67 test "$maintainer_mode" = yes && MAINTAINER=yes
68 AC_SUBST(MAINTAINER)
70 # Check whether --enable-default-pie was given.
71 AC_ARG_ENABLE(default-pie,
72 [AS_HELP_STRING([--enable-default-pie],
73                   [enable Position Independent Executable as default])],
74 [PIEFLAG=-fPIE], [PIEFLAG=])
75 AC_SUBST([PIEFLAG])
77 # Check if O_CLOEXEC is defined by fcntl
78 AC_CACHE_CHECK(for O_CLOEXEC, ac_cv_o_cloexec, [
79 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
80 #include <fcntl.h>]], [[
81 return open ("/dev/null", O_RDONLY | O_CLOEXEC);]])],
82 [ac_cv_o_cloexec=yes],[ac_cv_o_cloexec=no])])
83 if test $ac_cv_o_cloexec = yes; then
84   AC_DEFINE(HOST_HAS_O_CLOEXEC, 1,
85   [Define if O_CLOEXEC supported by fcntl.])
88 AC_CHECK_HEADERS(sys/mman.h)
90 # C++ Modules would like some networking features to provide the mapping
91 # server.  You can still use modules without them though.
92 # The following network-related checks could probably do with some
93 # Windows and other non-linux defenses and checking.
95 # Local socket connectivity wants AF_UNIX networking
96 # Check for AF_UNIX networking
97 AC_CACHE_CHECK(for AF_UNIX, ac_cv_af_unix, [
98 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
99 #include <sys/types.h>
100 #include <sys/socket.h>
101 #include <sys/un.h>
102 #include <netinet/in.h>]],[[
103 sockaddr_un un;
104 un.sun_family = AF_UNSPEC;
105 int fd = socket (AF_UNIX, SOCK_STREAM, 0);
106 connect (fd, (sockaddr *)&un, sizeof (un));]])],
107 [ac_cv_af_unix=yes],
108 [ac_cv_af_unix=no])])
109 if test $ac_cv_af_unix = yes; then
110   AC_DEFINE(HAVE_AF_UNIX, 1,
111   [Define if AF_UNIX supported.])
114 # Remote socket connectivity wants AF_INET6 networking
115 # Check for AF_INET6 networking
116 AC_CACHE_CHECK(for AF_INET6, ac_cv_af_inet6, [
117 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
118 #include <sys/types.h>
119 #include <sys/socket.h>
120 #include <netinet/in.h>
121 #include <netdb.h>]],[[
122 sockaddr_in6 in6;
123 in6.sin6_family = AF_UNSPEC;
124 struct addrinfo *addrs = 0;
125 struct addrinfo hints;
126 hints.ai_flags = 0;
127 hints.ai_family = AF_INET6;
128 hints.ai_socktype = SOCK_STREAM;
129 hints.ai_protocol = 0;
130 hints.ai_canonname = 0;
131 hints.ai_addr = 0;
132 hints.ai_next = 0;
133 int e = getaddrinfo ("localhost", 0, &hints, &addrs);
134 const char *str = gai_strerror (e);
135 freeaddrinfo (addrs);
136 int fd = socket (AF_INET6, SOCK_STREAM, 0);
137 connect (fd, (sockaddr *)&in6, sizeof (in6));]])],
138 [ac_cv_af_inet6=yes],
139 [ac_cv_af_inet6=no])])
140 if test $ac_cv_af_inet6 = yes; then
141   AC_DEFINE(HAVE_AF_INET6, 1,
142   [Define if AF_INET6 supported.])
145 # Efficient server response wants epoll
146 # Check for epoll_create, epoll_ctl, epoll_pwait
147 AC_CACHE_CHECK(for epoll, ac_cv_epoll, [
148 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
149 #include <sys/epoll.h>]],[[
150 int fd = epoll_create (1);
151 epoll_event ev;
152 ev.events = EPOLLIN;
153 ev.data.fd = 0;
154 epoll_ctl (fd, EPOLL_CTL_ADD, 0, &ev);
155 epoll_pwait (fd, 0, 0, -1, 0);]])],
156 [ac_cv_epoll=yes],
157 [ac_cv_epoll=no])])
158 if test $ac_cv_epoll = yes; then
159   AC_DEFINE(HAVE_EPOLL, 1,
160   [Define if epoll_create, epoll_ctl, epoll_pwait provided.])
163 # If we can't use epoll, try pselect.
164 # Check for pselect
165 AC_CACHE_CHECK(for pselect, ac_cv_pselect, [
166 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
167 #include <sys/select.h>]],[[
168 pselect (0, 0, 0, 0, 0, 0);]])],
169 [ac_cv_pselect=yes],
170 [ac_cv_pselect=no])])
171 if test $ac_cv_pselect = yes; then
172   AC_DEFINE(HAVE_PSELECT, 1,
173   [Define if pselect provided.])
176 # And failing that, use good old select.
177 # If we can't even use this, the server is serialized.
178 # Check for select
179 AC_CACHE_CHECK(for select, ac_cv_select, [
180 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
181 #include <sys/select.h>]],[[
182 select (0, 0, 0, 0, 0);]])],
183 [ac_cv_select=yes],
184 [ac_cv_select=no])])
185 if test $ac_cv_select = yes; then
186   AC_DEFINE(HAVE_SELECT, 1,
187   [Define if select provided.])
190 # Avoid some fnctl calls by using accept4, when available.
191 # Check for accept4
192 AC_CACHE_CHECK(for accept4, ac_cv_accept4, [
193 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
194 #include <sys/socket.h>]],[[
195 int err = accept4 (1, 0, 0, SOCK_NONBLOCK);]])],
196 [ac_cv_accept4=yes],
197 [ac_cv_accept4=no])])
198 if test $ac_cv_accept4 = yes; then
199   AC_DEFINE(HAVE_ACCEPT4, 1,
200   [Define if accept4 provided.])
203 # For better server messages, look for a way to stringize network addresses
204 # Check for inet_ntop
205 AC_CACHE_CHECK(for inet_ntop, ac_cv_inet_ntop, [
206 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
207 #include <arpa/inet.h>
208 #include <netinet/in.h>]],[[
209 sockaddr_in6 in6;
210 char buf[INET6_ADDRSTRLEN];
211 const char *str = inet_ntop (AF_INET6, &in6, buf, sizeof (buf));]])],
212 [ac_cv_inet_ntop=yes],
213 [ac_cv_inet_ntop=no])])
214 if test $ac_cv_inet_ntop = yes; then
215   AC_DEFINE(HAVE_INET_NTOP, 1,
216   [Define if inet_ntop provided.])
219 # Determine what GCC version number to use in filesystem paths.
220 GCC_BASE_VER
222 # Solaris needs libsocket and libnsl for socket functions before 11.4.
223 # libcody uses those.
224 save_LIBS="$LIBS"
225 LIBS=
226 AX_LIB_SOCKET_NSL
227 NETLIBS="$LIBS"
228 LIBS="$save_LIBS"
229 AC_SUBST(NETLIBS)
231 AC_CONFIG_HEADERS([config.h])
232 AC_CONFIG_FILES([Makefile])
234 AC_OUTPUT