c++: accepts-invalid with =delete("") [PR111840]
[official-gcc.git] / libgm2 / configure.ac
blob92e76c9346c94c12c48d46a0f91c0251f053c449
1 # Configure script for libgm2.
2 # Copyright (C) 2013-2023 Free Software Foundation, Inc.
4 # This file is part of GCC.
6 # GCC is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3, or (at your option)
9 # any later version.
11 # GCC is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GCC; see the file COPYING3.  If not see
18 # <http://www.gnu.org/licenses/>.
20 # Configure looks for the existence of this file to auto-config each language.
21 # We define several parameters used by configure:
23 # Process this file with autoreconf to produce a configure script.
25 AC_INIT(package-unused, version-unused,,libgm2)
26 AC_CONFIG_SRCDIR(Makefile.am)
27 # AC_CONFIG_MACRO_DIR([config])
28 AC_CONFIG_HEADER(config.h)
30 libtool_VERSION=18:0:0
31 AC_SUBST(libtool_VERSION)
33 AM_ENABLE_MULTILIB(, ..)
35 GCC_NO_EXECUTABLES
37 AC_USE_SYSTEM_EXTENSIONS
39 # Do not delete or change the following two lines.  For why, see
40 # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
41 AC_CANONICAL_SYSTEM
42 target_alias=${target_alias-$host_alias}
43 AC_SUBST(target_alias)
45 if test "$build" != "$host"; then
46   # We are being configured with some form of cross compiler.
47   GLIBCXX_IS_NATIVE=false
48   case "$host","$target" in
49     # Darwin crosses can use the host system's libraries and headers,
50     # because of the fat library support.  Of course, it must be the
51     # same version of Darwin on both sides.  Allow the user to
52     # just say --target=foo-darwin without a version number to mean
53     # "the version on this system".
54       *-*-darwin*,*-*-darwin*)
55         hostos=`echo $host | sed 's/.*-darwin/darwin/'`
56         targetos=`echo $target | sed 's/.*-darwin/darwin/'`
57         if test $hostos = $targetos || test $targetos = darwin ; then
58           GLIBCXX_IS_NATIVE=true
59         fi
60         ;;
62       *)
63         GCC_NO_EXECUTABLES
64         ;;
65   esac
66 else
67   GLIBCXX_IS_NATIVE=true
70 # Runs configure.host, and assorted other critical bits.  Sets
71 # up critical shell variables.
72 GLIBCXX_CONFIGURE
74 # For gettimeofday support.
75 GLIBCXX_CHECK_GETTIMEOFDAY
77 # For clock_gettime, nanosleep and sched_yield support.
78 GLIBCXX_ENABLE_LIBSTDCXX_TIME
81 AM_INIT_AUTOMAKE([1.15.1 no-define foreign no-dist -Wall -Wno-portability])
83 AH_TEMPLATE(PACKAGE, [Name of package])
84 AH_TEMPLATE(VERSION, [Version number of package])
86 AC_ARG_WITH(cross-host,
87 [  --with-cross-host=HOST           Configuring with a cross compiler])
89 # Checks for header files.
90 AC_HEADER_STDC
91 AC_HEADER_SYS_WAIT
92 AC_CHECK_HEADER([math.h],
93                [AC_DEFINE([HAVE_MATH_H], [1], [have math.h])])
95 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h \
96                  time.h \
97                  fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \
98                  sys/resource.h sys/param.h sys/times.h sys/stat.h \
99                  sys/socket.h \
100                  sys/wait.h sys/ioctl.h errno.h sys/errno.h \
101                  pwd.h direct.h dirent.h signal.h malloc.h langinfo.h \
102                  pthread.h stdarg.h stdio.h sys/types.h termios.h \
103                  netinet/in.h netdb.h sys/uio.h sys/stat.h wchar.h)
106 AC_CANONICAL_HOST
107 ACX_NONCANONICAL_HOST
108 ACX_NONCANONICAL_TARGET
109 GCC_TOPLEV_SUBDIRS
111 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
112 AC_ARG_ENABLE(version-specific-runtime-libs,
113 [  --enable-version-specific-runtime-libs    Specify that runtime libraries should be installed in a compiler-specific directory ],
114 [case "$enableval" in
115  yes) version_specific_libs=yes ;;
116  no)  version_specific_libs=no ;;
117  *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
118  esac],
119 [version_specific_libs=no])
120 AC_MSG_RESULT($version_specific_libs)
122 AC_ARG_WITH(slibdir,
123 [  --with-slibdir=DIR      shared libraries in DIR [LIBDIR]],
124 slibdir="$with_slibdir",
125 if test "${version_specific_libs}" = yes; then
126   slibdir='$(libsubdir)'
127 elif test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
128   slibdir='$(exec_prefix)/$(host_noncanonical)/lib'
129 else
130   slibdir='$(libdir)'
132 AC_SUBST(slibdir)
134 # Command-line options.
135 # Very limited version of AC_MAINTAINER_MODE.
136 AC_ARG_ENABLE([maintainer-mode],
137   [AC_HELP_STRING([--enable-maintainer-mode],
138                  [enable make rules and dependencies not useful (and
139                   sometimes confusing) to the casual installer])],
140   [case ${enable_maintainer_mode} in
141      yes) MAINT='' ;;
142      no) MAINT='#' ;;
143      *) AC_MSG_ERROR([--enable-maintainer-mode must be yes or no]) ;;
144    esac
145    maintainer_mode=${enableval}],
146   [MAINT='#'])
147 AC_SUBST([MAINT])dnl
149 toolexecdir=no
150 toolexeclibdir=no
152 # Calculate toolexeclibdir
153 # Also toolexecdir, though it's only used in toolexeclibdir
154 case ${version_specific_libs} in
155   yes)
156     # Need the gcc compiler version to know where to install libraries
157     # and header files if --enable-version-specific-runtime-libs option
158     # is selected.
159     toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
160     toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
161     ;;
162   no)
163     if test -n "$with_cross_host" &&
164        test x"$with_cross_host" != x"no"; then
165       # Install a library built with a cross compiler in tooldir, not libdir.
166       toolexecdir='$(exec_prefix)/$(target_noncanonical)'
167       toolexeclibdir='$(toolexecdir)/lib'
168     else
169       toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
170       toolexeclibdir='$(libdir)'
171     fi
172     multi_os_directory=`$CC -print-multi-os-directory`
173     case $multi_os_directory in
174       .) ;; # Avoid trailing /.
175       *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
176     esac
177     ;;
178 esac
180 AC_SUBST(toolexecdir)
181 AC_SUBST(toolexeclibdir)
183 AH_TEMPLATE(PACKAGE, [Name of package])
184 AH_TEMPLATE(VERSION, [Version number of package])
186 AM_MAINTAINER_MODE
188 # Check the compiler.
189 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
190 # We must force CC to /not/ be precious variables; otherwise
191 # the wrong, non-multilib-adjusted value will be used in multilibs.
192 # As a side effect, we have to subst CFLAGS ourselves.
194 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
195 m4_define([_AC_ARG_VAR_PRECIOUS],[])
196 AC_PROG_CC
197 AC_PROG_CXX
198 AM_PROG_AS
199 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
201 AC_SUBST(CFLAGS)
203 # In order to override CFLAGS_FOR_TARGET, all of our special flags go
204 # in XCFLAGS.  But we need them in CFLAGS during configury.  So put them
205 # in both places for now and restore CFLAGS at the end of config.
206 save_CFLAGS="$CFLAGS"
208 # Find other programs we need.
209 AC_CHECK_TOOL(AR, ar)
210 AC_CHECK_TOOL(NM, nm)
211 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
212 AC_PROG_MAKE_SET
213 AC_PROG_INSTALL
215 AC_LIBTOOL_DLOPEN
216 AM_PROG_LIBTOOL
217 AC_SUBST(enable_shared)
218 AC_SUBST(enable_static)
220 if test "${multilib}" = "yes"; then
221   multilib_arg="--enable-multilib"
222 else
223   multilib_arg=
226 AC_CHECK_TYPES([struct timezone, struct stat, struct timespec, struct timeval, struct tm])
228 # Check if struct tm contains the tm_gmtoff field.
229 AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
230   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
231       #include <time.h>
232     ], [
233       struct tm tm;
234       tm.tm_gmtoff = 1;
235     ])],
236     [ac_cv_struct_tm_gmtoff=yes],
237     [ac_cv_struct_tm_gmtoff=no]
238   )
241 if (test "$ac_cv_struct_tm_gmtoff" = "yes"); then
242   AC_MSG_CHECKING([m2 front end detects struct tm with the tm_gmtoff field.])
243   AC_DEFINE(HAVE_TM_TM_GMTOFF, 1, [Define if struct tm has a tm_gmtoff field.])
246 AC_LANG_C
247 # Check the compiler.
248 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
249 # We must force CC to /not/ be precious variables; otherwise
250 # the wrong, non-multilib-adjusted value will be used in multilibs.
251 # As a side effect, we have to subst CFLAGS ourselves.
253 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
254 m4_define([_AC_ARG_VAR_PRECIOUS],[])
255 AC_PROG_CC
256 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
258 AC_SUBST(CFLAGS)
260 AC_DEFUN([GM2_UNDEF],[
261   $as_echo "#undef HAVE_$1" >>confdefs.h
264 AC_DEFUN([GM2_CHECK_LIB],[
265   AC_MSG_CHECKING([m2 front end checking $1 library for $2])
266   if test x$gcc_no_link != xyes; then
267     AC_CHECK_LIB([$1],[$2],[AC_DEFINE([HAVE_$3],[1],[found $2])],[GM2_UNDEF([$3],[$2])])
268   else
269     if test "x$[ac_cv_lib_$1_$2]" = xyes; then
270       AC_DEFINE([HAVE_$3],[1],[lib$1 includes $2])
271     elif test "x$[ac_cv_func_$2]" = xyes; then
272       AC_DEFINE([HAVE_$3],[1],[function $2 exists])
273     else
274       GM2_UNDEF([$3],[$2])
275     fi
276   fi
279 GM2_CHECK_LIB([c],[access],[ACCESS])
280 GM2_CHECK_LIB([c],[brk],[BRK])
281 GM2_CHECK_LIB([c],[cfmakeraw],[CFMAKERAW])
282 GM2_CHECK_LIB([c],[clock_gettime],[CLOCK_GETTIME])
283 GM2_CHECK_LIB([c],[clock_settime],[CLOCK_SETTIME])
284 GM2_CHECK_LIB([c],[close],[CLOSE])
285 GM2_CHECK_LIB([c],[ctime],[CTIME])
286 GM2_CHECK_LIB([c],[creat],[CREAT])
287 GM2_CHECK_LIB([c],[daylight],[DAYLIGHT])
288 GM2_CHECK_LIB([c],[dup],[DUP])
289 GM2_CHECK_LIB([c],[execve],[EXECVE])
290 GM2_CHECK_LIB([c],[exit],[EXIT])
291 GM2_CHECK_LIB([c],[fcntl],[FCNTL])
292 GM2_CHECK_LIB([c],[fstat],[FSTAT])
293 GM2_CHECK_LIB([c],[getdents],[GETDENTS])
294 GM2_CHECK_LIB([c],[getgid],[GETGID])
295 GM2_CHECK_LIB([c],[getpid],[GETPID])
296 GM2_CHECK_LIB([c],[gettimeofday],[GETTIMEOFD])
297 GM2_CHECK_LIB([c],[getuid],[GETUID])
298 GM2_CHECK_LIB([c],[ioctl],[IOCTL])
299 GM2_CHECK_LIB([c],[kill],[KILL])
300 GM2_CHECK_LIB([c],[link],[LINK])
301 GM2_CHECK_LIB([c],[lseek],[LSEEK])
302 GM2_CHECK_LIB([c],[open],[OPEN])
303 GM2_CHECK_LIB([c],[pause],[PAUSE])
304 GM2_CHECK_LIB([c],[pipe],[PIPE])
305 GM2_CHECK_LIB([c],[rand],[RAND])
306 GM2_CHECK_LIB([c],[read],[READ])
307 GM2_CHECK_LIB([c],[select],[SELECT])
308 GM2_CHECK_LIB([c],[setitimer],[SETITIMER])
309 GM2_CHECK_LIB([c],[setgid],[SETGID])
310 GM2_CHECK_LIB([c],[setuid],[SETUID])
311 GM2_CHECK_LIB([c],[stat],[STAT])
312 GM2_CHECK_LIB([c],[strsignal],[STRSIGNAL])
313 GM2_CHECK_LIB([c],[strtod],[STRTOD])
314 GM2_CHECK_LIB([c],[strtold],[STRTOLD])
315 GM2_CHECK_LIB([c],[times],[TIMES])
316 GM2_CHECK_LIB([c],[timezone],[TIMEZONE])
317 GM2_CHECK_LIB([c],[tzname],[TZNAME])
318 GM2_CHECK_LIB([c],[unlink],[UNLINK])
319 GM2_CHECK_LIB([c],[wait],[WAIT])
320 GM2_CHECK_LIB([c],[write],[WRITE])
322 GM2_CHECK_LIB([m],[signbit],[SIGNBIT])
323 GM2_CHECK_LIB([m],[signbitf],[SIGNBITF])
324 GM2_CHECK_LIB([m],[signbitl],[SIGNBITL])
326 AC_MSG_NOTICE([libgm2 has finished checking target libc and libm contents.])
328 # We test the host here and later on check the target.
330 # All known M2_HOST_OS values.  This is the union of all host operating systems
331 # supported by gm2.
333 M2_SUPPORTED_HOST_OS="aix freebsd hurd linux netbsd openbsd solaris windows darwin"
335 M2_HOST_OS=unknown
337 case ${host} in
338   *-*-darwin*)   M2_HOST_OS=darwin ;;
339   *-*-freebsd*)  M2_HOST_OS=freebsd ;;
340   *-*-linux*)    M2_HOST_OS=linux ;;
341   *-*-netbsd*)   M2_HOST_OS=netbsd ;;
342   *-*-openbsd*)  M2_HOST_OS=openbsd ;;
343   *-*-solaris2*) M2_HOST_OS=solaris ;;
344   *-*-aix*)      M2_HOST_OS=aix ;;
345   *-*-gnu*)      M2_HOST_OS=hurd ;;
346 esac
348 M2_TARGET_OS=unknown
350 case ${target} in
351   *-*-darwin*)   M2_TARGET_OS=darwin ;;
352   *-*-freebsd*)  M2_TARGET_OS=freebsd ;;
353   *-*-linux*)    M2_TARGET_OS=linux ;;
354   *-*-netbsd*)   M2_TARGET_OS=netbsd ;;
355   *-*-openbsd*)  M2_TARGET_OS=openbsd ;;
356   *-*-solaris2*) M2_TARGET_OS=solaris ;;
357   *-*-aix*)      M2_TARGET_OS=aix ;;
358   *-*-gnu*)      M2_TARGET_OS=hurd ;;
359 esac
361 # M2_HOST_OS=unknown
362 if test x${M2_HOST_OS} = xunknown; then
363    AC_MSG_NOTICE([unsupported host, will build a minimal m2 library])
364    BUILD_PIMLIB=false
365    BUILD_ISOLIB=false
366    BUILD_CORLIB=false
367    BUILD_LOGLIB=false
368 else
369    AC_MSG_NOTICE([m2 library will be built on ${M2_HOST_OS}])
370    BUILD_PIMLIB=true
371    BUILD_ISOLIB=true
372    BUILD_CORLIB=true
373    BUILD_LOGLIB=true
376 CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
377 AC_SUBST(CC_FOR_BUILD)
379 # Propagate GM2_FOR_TARGET into Makefiles
380 GM2_FOR_TARGET=${GM2_FOR_TARGET:-gcc}
381 AC_SUBST(GM2_FOR_TARGET)
383 # Now we check the target as long as it is a supported host.
384 # For some embedded targets we choose minimal runtime system which is
385 # just enough to satisfy the linker targetting raw metal.
386 if test x${M2_HOST_OS} != xunknown; then
387 AC_MSG_NOTICE([m2 library building for target ${target}])
388 case "$target" in
390   avr25*-*-* | avr31*-*-* | avr35*-*-* | avr4*-*-* | avr5*-*-* | avr51*-*-* | avr6*-*-*)
391   BUILD_PIMLIB=false
392   BUILD_ISOLIB=false
393   BUILD_CORLIB=false
394   BUILD_LOGLIB=false
395   ;;
397   avrxmega2*-*-* | avrxmega4*-*-* | avrxmega5*-*-* | avrxmega6*-*-* | avrxmega7*-*-*)
398   BUILD_PIMLIB=false
399   BUILD_ISOLIB=false
400   BUILD_CORLIB=false
401   BUILD_LOGLIB=false
402   ;;
404   avr3-*-*)
405   BUILD_PIMLIB=true
406   BUILD_ISOLIB=true
407   BUILD_CORLIB=true
408   BUILD_LOGLIB=true
409   ;;
410   esp32-*-*)
411   BUILD_PIMLIB=false
412   BUILD_ISOLIB=false
413   BUILD_CORLIB=false
414   BUILD_LOGLIB=false
415   ;;
417 esac
420 # GM2_MSG_RESULT issue a query message from the first parameter and a boolean result
421 # in the second parameter is printed as a "yes" or "no".
423 AC_DEFUN([GM2_MSG_RESULT],[
424    AC_MSG_CHECKING([$1])
425    if test x${$2} = xtrue; then
426       AC_MSG_RESULT([yes])
427    else
428       AC_MSG_RESULT([no])
429    fi
432 if test x${M2_HOST_OS} = xunknown; then
433    AC_MSG_NOTICE([m2 front end will only build minimal Modula-2 runtime library on this host])
434 else
435    GM2_MSG_RESULT([m2 front end will build PIM libraries:],[BUILD_PIMLIB])
436    GM2_MSG_RESULT([m2 front end will build ISO libraries:],[BUILD_ISOLIB])
437    GM2_MSG_RESULT([m2 front end will build coroutine libraries:],[BUILD_CORLIB])
438    GM2_MSG_RESULT([m2 front end will build Logitech compatability libraries:],[BUILD_LOGLIB])
441 AM_CONDITIONAL([BUILD_PIMLIB], [test x$BUILD_PIMLIB = xtrue])
442 AM_CONDITIONAL([BUILD_ISOLIB], [test x$BUILD_ISOLIB = xtrue])
443 AM_CONDITIONAL([BUILD_CORLIB], [test x$BUILD_CORLIB = xtrue])
444 AM_CONDITIONAL([BUILD_LOGLIB], [test x$BUILD_LOGLIB = xtrue])
445 AM_CONDITIONAL([TARGET_DARWIN], [test x$M2_TARGET_OS = xdarwin])
447 # Determine what GCC version number to use in filesystem paths.
448 GCC_BASE_VER
450 AC_CONFIG_SRCDIR([Makefile.am])
451 AC_CONFIG_FILES([Makefile])
453 AC_CONFIG_FILES(AC_FOREACH([DIR], [libm2min libm2pim libm2iso libm2cor libm2log], [DIR/Makefile ]),
454  [ cat > vpsed$$ << \_EOF
455 s!`test -f '$<' || echo '$(srcdir)/'`!!
456 _EOF
457    sed -f vpsed$$ $ac_file > tmp$$
458    mv tmp$$ $ac_file
459    rm vpsed$$
460    echo 'MULTISUBDIR =' >> $ac_file
461    ml_norecursion=yes
462    . ${multi_basedir}/config-ml.in
463    AS_UNSET([ml_norecursion])
466 AC_MSG_NOTICE([libgm2 has been configured.])
468 AC_OUTPUT