Fix 22_locale/locale/cons/12658_thread-2.cc on hppa.
[official-gcc.git] / libgm2 / configure.ac
blob3a79d2612b67db206f1d626899d19ae644c07669
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 AM_INIT_AUTOMAKE([1.15.1 no-define foreign no-dist -Wall -Wno-portability])
47 AH_TEMPLATE(PACKAGE, [Name of package])
48 AH_TEMPLATE(VERSION, [Version number of package])
50 AC_ARG_WITH(cross-host,
51 [  --with-cross-host=HOST           Configuring with a cross compiler])
53 # Checks for header files.
54 AC_HEADER_STDC
55 AC_HEADER_SYS_WAIT
56 AC_CHECK_HEADER([math.h],
57                [AC_DEFINE([HAVE_MATH_H], [1], [have math.h])])
59 AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h \
60                  time.h \
61                  fcntl.h unistd.h sys/file.h sys/time.h sys/mman.h \
62                  sys/resource.h sys/param.h sys/times.h sys/stat.h \
63                  sys/socket.h \
64                  sys/wait.h sys/ioctl.h errno.h sys/errno.h \
65                  pwd.h direct.h dirent.h signal.h malloc.h langinfo.h \
66                  pthread.h stdarg.h stdio.h sys/types.h termios.h \
67                  netinet/in.h netdb.h sys/uio.h sys/stat.h wchar.h)
70 AC_CANONICAL_HOST
71 ACX_NONCANONICAL_HOST
72 ACX_NONCANONICAL_TARGET
73 GCC_TOPLEV_SUBDIRS
75 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
76 AC_ARG_ENABLE(version-specific-runtime-libs,
77 [  --enable-version-specific-runtime-libs    Specify that runtime libraries should be installed in a compiler-specific directory ],
78 [case "$enableval" in
79  yes) version_specific_libs=yes ;;
80  no)  version_specific_libs=no ;;
81  *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
82  esac],
83 [version_specific_libs=no])
84 AC_MSG_RESULT($version_specific_libs)
86 AC_ARG_WITH(slibdir,
87 [  --with-slibdir=DIR      shared libraries in DIR [LIBDIR]],
88 slibdir="$with_slibdir",
89 if test "${version_specific_libs}" = yes; then
90   slibdir='$(libsubdir)'
91 elif test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
92   slibdir='$(exec_prefix)/$(host_noncanonical)/lib'
93 else
94   slibdir='$(libdir)'
95 fi)
96 AC_SUBST(slibdir)
98 # Command-line options.
99 # Very limited version of AC_MAINTAINER_MODE.
100 AC_ARG_ENABLE([maintainer-mode],
101   [AC_HELP_STRING([--enable-maintainer-mode],
102                  [enable make rules and dependencies not useful (and
103                   sometimes confusing) to the casual installer])],
104   [case ${enable_maintainer_mode} in
105      yes) MAINT='' ;;
106      no) MAINT='#' ;;
107      *) AC_MSG_ERROR([--enable-maintainer-mode must be yes or no]) ;;
108    esac
109    maintainer_mode=${enableval}],
110   [MAINT='#'])
111 AC_SUBST([MAINT])dnl
113 toolexecdir=no
114 toolexeclibdir=no
116 # Calculate toolexeclibdir
117 # Also toolexecdir, though it's only used in toolexeclibdir
118 case ${version_specific_libs} in
119   yes)
120     # Need the gcc compiler version to know where to install libraries
121     # and header files if --enable-version-specific-runtime-libs option
122     # is selected.
123     toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
124     toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
125     ;;
126   no)
127     if test -n "$with_cross_host" &&
128        test x"$with_cross_host" != x"no"; then
129       # Install a library built with a cross compiler in tooldir, not libdir.
130       toolexecdir='$(exec_prefix)/$(target_noncanonical)'
131       toolexeclibdir='$(toolexecdir)/lib'
132     else
133       toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
134       toolexeclibdir='$(libdir)'
135     fi
136     multi_os_directory=`$CC -print-multi-os-directory`
137     case $multi_os_directory in
138       .) ;; # Avoid trailing /.
139       *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
140     esac
141     ;;
142 esac
144 AC_SUBST(toolexecdir)
145 AC_SUBST(toolexeclibdir)
147 AH_TEMPLATE(PACKAGE, [Name of package])
148 AH_TEMPLATE(VERSION, [Version number of package])
150 AM_MAINTAINER_MODE
152 # Check the compiler.
153 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
154 # We must force CC to /not/ be precious variables; otherwise
155 # the wrong, non-multilib-adjusted value will be used in multilibs.
156 # As a side effect, we have to subst CFLAGS ourselves.
158 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
159 m4_define([_AC_ARG_VAR_PRECIOUS],[])
160 AC_PROG_CC
161 AC_PROG_CXX
162 AM_PROG_AS
163 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
165 AC_SUBST(CFLAGS)
167 # In order to override CFLAGS_FOR_TARGET, all of our special flags go
168 # in XCFLAGS.  But we need them in CFLAGS during configury.  So put them
169 # in both places for now and restore CFLAGS at the end of config.
170 save_CFLAGS="$CFLAGS"
172 # Find other programs we need.
173 AC_CHECK_TOOL(AR, ar)
174 AC_CHECK_TOOL(NM, nm)
175 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
176 AC_PATH_PROG(PERL, perl, perl-not-found-in-path-error)
177 AC_PROG_MAKE_SET
178 AC_PROG_INSTALL
180 AC_LIBTOOL_DLOPEN
181 AM_PROG_LIBTOOL
182 AC_SUBST(enable_shared)
183 AC_SUBST(enable_static)
185 if test "${multilib}" = "yes"; then
186   multilib_arg="--enable-multilib"
187 else
188   multilib_arg=
191 AC_CHECK_TYPES([struct timezone, struct stat, struct timeval])
193 AC_LANG_C
194 # Check the compiler.
195 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
196 # We must force CC to /not/ be precious variables; otherwise
197 # the wrong, non-multilib-adjusted value will be used in multilibs.
198 # As a side effect, we have to subst CFLAGS ourselves.
200 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
201 m4_define([_AC_ARG_VAR_PRECIOUS],[])
202 AC_PROG_CC
203 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
205 AC_SUBST(CFLAGS)
207 AC_DEFUN([GM2_UNDEF],[
208   $as_echo "#undef HAVE_$1" >>confdefs.h
211 AC_DEFUN([GM2_CHECK_LIB],[
212   AC_MSG_CHECKING([m2 front end checking $1 library for $2])
213   if test x$gcc_no_link != xyes; then
214     AC_CHECK_LIB([$1],[$2],[AC_DEFINE([HAVE_$3],[1],[found $2])],[GM2_UNDEF([$3],[$2])])
215   else
216     if test "x$[ac_cv_lib_$1_$2]" = xyes; then
217       AC_DEFINE([HAVE_$3],[1],[lib$1 includes $2])
218     elif test "x$[ac_cv_func_$2]" = xyes; then
219       AC_DEFINE([HAVE_$3],[1],[function $2 exists])
220     else
221       GM2_UNDEF([$3],[$2])
222     fi
223   fi
226 GM2_CHECK_LIB([c],[access],[ACCESS])
227 GM2_CHECK_LIB([c],[brk],[BRK])
228 GM2_CHECK_LIB([c],[cfmakeraw],[CFMAKERAW])
229 GM2_CHECK_LIB([c],[close],[CLOSE])
230 GM2_CHECK_LIB([c],[ctime],[CTIME])
231 GM2_CHECK_LIB([c],[creat],[CREAT])
232 GM2_CHECK_LIB([c],[dup],[DUP])
233 GM2_CHECK_LIB([c],[execve],[EXECVE])
234 GM2_CHECK_LIB([c],[exit],[EXIT])
235 GM2_CHECK_LIB([c],[fcntl],[FCNTL])
236 GM2_CHECK_LIB([c],[fstat],[FSTAT])
237 GM2_CHECK_LIB([c],[getdents],[GETDENTS])
238 GM2_CHECK_LIB([c],[getgid],[GETGID])
239 GM2_CHECK_LIB([c],[getpid],[GETPID])
240 GM2_CHECK_LIB([c],[gettimeofday],[GETTIMEOFD])
241 GM2_CHECK_LIB([c],[getuid],[GETUID])
242 GM2_CHECK_LIB([c],[ioctl],[IOCTL])
243 GM2_CHECK_LIB([c],[kill],[KILL])
244 GM2_CHECK_LIB([c],[link],[LINK])
245 GM2_CHECK_LIB([c],[lseek],[LSEEK])
246 GM2_CHECK_LIB([c],[open],[OPEN])
247 GM2_CHECK_LIB([c],[pause],[PAUSE])
248 GM2_CHECK_LIB([c],[pipe],[PIPE])
249 GM2_CHECK_LIB([c],[rand],[RAND])
250 GM2_CHECK_LIB([c],[read],[READ])
251 GM2_CHECK_LIB([c],[select],[SELECT])
252 GM2_CHECK_LIB([c],[setitimer],[SETITIMER])
253 GM2_CHECK_LIB([c],[setgid],[SETGID])
254 GM2_CHECK_LIB([c],[setuid],[SETUID])
255 GM2_CHECK_LIB([c],[stat],[STAT])
256 GM2_CHECK_LIB([c],[strsignal],[STRSIGNAL])
257 GM2_CHECK_LIB([c],[strtod],[STRTOD])
258 GM2_CHECK_LIB([c],[strtold],[STRTOLD])
259 GM2_CHECK_LIB([c],[times],[TIMES])
260 GM2_CHECK_LIB([c],[unlink],[UNLINK])
261 GM2_CHECK_LIB([c],[wait],[WAIT])
262 GM2_CHECK_LIB([c],[write],[WRITE])
264 GM2_CHECK_LIB([m],[signbit],[SIGNBIT])
265 GM2_CHECK_LIB([m],[signbitf],[SIGNBITF])
266 GM2_CHECK_LIB([m],[signbitl],[SIGNBITL])
268 AC_MSG_NOTICE([libgm2 has finished checking target libc and libm contents.])
270 # We test the host here and later on check the target.
272 # All known M2_HOST_OS values.  This is the union of all host operating systems
273 # supported by gm2.
275 M2_SUPPORTED_HOST_OS="aix freebsd hurd linux netbsd openbsd solaris windows darwin"
277 M2_HOST_OS=unknown
279 case ${host} in
280   *-*-darwin*)   M2_HOST_OS=darwin ;;
281   *-*-freebsd*)  M2_HOST_OS=freebsd ;;
282   *-*-linux*)    M2_HOST_OS=linux ;;
283   *-*-netbsd*)   M2_HOST_OS=netbsd ;;
284   *-*-openbsd*)  M2_HOST_OS=openbsd ;;
285   *-*-solaris2*) M2_HOST_OS=solaris ;;
286   *-*-aix*)      M2_HOST_OS=aix ;;
287   *-*-gnu*)      M2_HOST_OS=hurd ;;
288 esac
290 M2_TARGET_OS=unknown
292 case ${target} in
293   *-*-darwin*)   M2_TARGET_OS=darwin ;;
294   *-*-freebsd*)  M2_TARGET_OS=freebsd ;;
295   *-*-linux*)    M2_TARGET_OS=linux ;;
296   *-*-netbsd*)   M2_TARGET_OS=netbsd ;;
297   *-*-openbsd*)  M2_TARGET_OS=openbsd ;;
298   *-*-solaris2*) M2_TARGET_OS=solaris ;;
299   *-*-aix*)      M2_TARGET_OS=aix ;;
300   *-*-gnu*)      M2_TARGET_OS=hurd ;;
301 esac
303 # M2_HOST_OS=unknown
304 if test x${M2_HOST_OS} = xunknown; then
305    AC_MSG_NOTICE([unsupported host, will build a minimal m2 library])
306    BUILD_PIMLIB=false
307    BUILD_ISOLIB=false
308    BUILD_CORLIB=false
309    BUILD_LOGLIB=false
310 else
311    AC_MSG_NOTICE([m2 library will be built on ${M2_HOST_OS}])
312    BUILD_PIMLIB=true
313    BUILD_ISOLIB=true
314    BUILD_CORLIB=true
315    BUILD_LOGLIB=true
318 CC_FOR_BUILD=${CC_FOR_BUILD:-gcc}
319 AC_SUBST(CC_FOR_BUILD)
321 # Propagate GM2_FOR_TARGET into Makefiles
322 GM2_FOR_TARGET=${GM2_FOR_TARGET:-gcc}
323 AC_SUBST(GM2_FOR_TARGET)
325 # Now we check the target as long as it is a supported host.
326 # For some embedded targets we choose minimal runtime system which is
327 # just enough to satisfy the linker targetting raw metal.
328 if test x${M2_HOST_OS} != xunknown; then
329 AC_MSG_NOTICE([m2 library building for target ${target}])
330 case "$target" in
332   avr25*-*-* | avr31*-*-* | avr35*-*-* | avr4*-*-* | avr5*-*-* | avr51*-*-* | avr6*-*-*)
333   BUILD_PIMLIB=false
334   BUILD_ISOLIB=false
335   BUILD_CORLIB=false
336   BUILD_LOGLIB=false
337   ;;
339   avrxmega2*-*-* | avrxmega4*-*-* | avrxmega5*-*-* | avrxmega6*-*-* | avrxmega7*-*-*)
340   BUILD_PIMLIB=false
341   BUILD_ISOLIB=false
342   BUILD_CORLIB=false
343   BUILD_LOGLIB=false
344   ;;
346   avr3-*-*)
347   BUILD_PIMLIB=true
348   BUILD_ISOLIB=true
349   BUILD_CORLIB=true
350   BUILD_LOGLIB=true
351   ;;
352   esp32-*-*)
353   BUILD_PIMLIB=false
354   BUILD_ISOLIB=false
355   BUILD_CORLIB=false
356   BUILD_LOGLIB=false
357   ;;
359 esac
362 # GM2_MSG_RESULT issue a query message from the first parameter and a boolean result
363 # in the second parameter is printed as a "yes" or "no".
365 AC_DEFUN([GM2_MSG_RESULT],[
366    AC_MSG_CHECKING([$1])
367    if test x${$2} = xtrue; then
368       AC_MSG_RESULT([yes])
369    else
370       AC_MSG_RESULT([no])
371    fi
374 if test x${M2_HOST_OS} = xunknown; then
375    AC_MSG_NOTICE([m2 front end will only build minimal Modula-2 runtime library on this host])
376 else
377    GM2_MSG_RESULT([m2 front end will build PIM libraries:],[BUILD_PIMLIB])
378    GM2_MSG_RESULT([m2 front end will build ISO libraries:],[BUILD_ISOLIB])
379    GM2_MSG_RESULT([m2 front end will build coroutine libraries:],[BUILD_CORLIB])
380    GM2_MSG_RESULT([m2 front end will build Logitech compatability libraries:],[BUILD_LOGLIB])
383 AM_CONDITIONAL([BUILD_PIMLIB], [test x$BUILD_PIMLIB = xtrue])
384 AM_CONDITIONAL([BUILD_ISOLIB], [test x$BUILD_ISOLIB = xtrue])
385 AM_CONDITIONAL([BUILD_CORLIB], [test x$BUILD_CORLIB = xtrue])
386 AM_CONDITIONAL([BUILD_LOGLIB], [test x$BUILD_LOGLIB = xtrue])
387 AM_CONDITIONAL([TARGET_DARWIN], [test x$M2_TARGET_OS = xdarwin])
389 # Determine what GCC version number to use in filesystem paths.
390 GCC_BASE_VER
392 AC_CONFIG_SRCDIR([Makefile.am])
393 AC_CONFIG_FILES([Makefile])
395 AC_CONFIG_FILES(AC_FOREACH([DIR], [libm2min libm2pim libm2iso libm2cor libm2log], [DIR/Makefile ]),
396  [ cat > vpsed$$ << \_EOF
397 s!`test -f '$<' || echo '$(srcdir)/'`!!
398 _EOF
399    sed -f vpsed$$ $ac_file > tmp$$
400    mv tmp$$ $ac_file
401    rm vpsed$$
402    echo 'MULTISUBDIR =' >> $ac_file
403    ml_norecursion=yes
404    . ${multi_basedir}/config-ml.in
405    AS_UNSET([ml_norecursion])
408 AC_MSG_NOTICE([libgm2 has been configured.])
410 AC_OUTPUT