1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00
Commit graph

272 commits

Author SHA1 Message Date
Rob Browning
aeb89f6ad6 configure: add -Werror=array-bounds to CFLAGS when available
This would have prevented https://bugs.gnu.org/76907

* configure.ac: add -Werror=array-bounds to CFLAGS when available
2025-03-18 14:34:38 -05:00
Rob Browning
d7475d4073 configure.ac: enable -ffat-lto-objects with -flto when available
Without -ffat-lto-objects libguile.a ends up with no symbols, visible
via "nm t libguile.a".
cf. https://lintian.debian.org/tags/no-code-sections.html

* configure.ac: enable -ffat-lto-objects with -flto when available.
2025-03-02 14:44:51 -06:00
Tomas Volf
0ceb0036c3
filesys.c: Fix readlink for ports on Darwin.
When passed a port, `readlink' relies on the Linux specific behavior of
empty c_path meaning "the fd itself".  That does not work on Darwin.
Since there is no branch that would yield both fd and c_path, fallback
to freadlink when __APPLE__ is defined.

* libguile/filesys.c (do_readlink): Call freadlink for !__APPLE__.
* configure.ac (AC_CHECK_FUNCS): Add freadlink.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 21:22:23 +02:00
Rob Browning
9b1effb585 Compile with -fexcess-precision=standard for i[3456]86 when we can
* configure.ac: when -fexcess-precision=standard is available and we're
building for i[3456]86, use it.  This fixes floating point precision
problems caused by x87 (80-bit) floating point, and detected by
numbers.test.

Closes: 43262
2024-10-05 19:19:57 -05:00
Rob Browning
6bd70136d9 Ensure GUILE-VERSION changes propagate to .version and Makefiles
Have .version depend on the Makefile, and move our
CONFIG_STATUS_DEPENDENCIES setting to an AC_SUBST, as recommended by the
automake info pages "Rebuilding Makefiles" section, so that changes to
GUILE-VERSION will update the VERSION, etc. in the generated Makefiles.

* Makefile.am (CONFIG_STATUS_DEPENDENCIES): drop.
($(top_srcdir/.version)): depend on Makefile.
* configure: add GUILE-VERSION to CONFIG_STATUS_DEPENDENCIES via
AC_SUBST.
2024-07-26 16:37:41 -05:00
Rob Browning
df04f5357a Switch to the preferred parallel automake test harness
Automake "strongly discourages" use of the serial driver, and switching
to the preferred parallel driver allows make -j4 check to run in about
half the time on a four core (not thread) host.

* Makefile.am (TESTS, TESTS_ENVIRONMENT): run ./check-guile from
test-suite/, not here.
* check-guile.in: let test harness handle progress output.
* configure.ac (AM_INIT_AUTOMAKE): allow parallel testing.
* test-suite/Makefile.am (SCM_TESTS): remove non-tests.
(EXTRA_DIST): move non-tests here.
(TESTS): include SCM_TESTS (now driven from here).
(TEST_EXTENSIONS): allow customization for .scm and .test.
(TESTS_ENVIRONMENT): stop defining (user only).
(AM_TESTS_ENVIRONMENT): replaces TESTS_ENVIRONMENT; drop guile.
(SCM_LOG_COMPILER): run .scm tests via meta/guile.
(AM_SCM_LOG_FLAGS): keep --no-auto-compile for .scm tests.
(TEST_LOG_DRIVER): run .test tests via custom automake ./driver.
* test-suite/driver: add automake test driver.
2024-06-20 15:35:48 +02:00
Arsen Arsenović
ddc5e63b00 build: Use PKG_INSTALL_DIR
This allows users to adjust their pkg-config install location.

* configure.ac: Call PKG_INSTALLDIR.
* meta/Makefile.am (pkgconfigdir): Remove.  It will be defined
automatically by the PKG_INSTALLDIR invocation.
2024-06-18 16:12:11 +02:00
Tomas Volf
e1690f3fd2
Add copy-on-write support to scm_copy_file.
On modern file-systems (BTRFS, ZFS) it is possible to copy a file using
copy-on-write method.  For large files it has the advantage of being
much faster and saving disk space (since identical extents are not
duplicated).  This feature is stable and for example coreutils' `cp'
does use it automatically (see --reflink).

This commit adds support for this feature into our copy-file procedure.
Same as `cp', it defaults to 'auto, meaning the copy-on-write is
attempted, and in case of failure the regular copy is performed.

No tests are provided, because the behavior depends on the system,
underlying file-system and its configuration.  That makes it challenging
to write a test for it.  Manual testing was performed instead:

    $ btrfs filesystem du /tmp/cow*
         Total   Exclusive  Set shared  Filename
      36.00KiB    36.00KiB       0.00B  /tmp/cow

    $ cat cow-test.scm
    (copy-file "/tmp/cow" "/tmp/cow-unspecified")
    (copy-file "/tmp/cow" "/tmp/cow-always" #:copy-on-write 'always)
    (copy-file "/tmp/cow" "/tmp/cow-auto" #:copy-on-write 'auto)
    (copy-file "/tmp/cow" "/tmp/cow-never" #:copy-on-write 'never)
    (copy-file "/tmp/cow" "/dev/shm/cow-unspecified")
    (copy-file "/tmp/cow" "/dev/shm/cow-auto" #:copy-on-write 'auto)
    (copy-file "/tmp/cow" "/dev/shm/cow-never" #:copy-on-write 'never)
    $ ./meta/guile -s cow-test.scm

    $ btrfs filesystem du /tmp/cow*
         Total   Exclusive  Set shared  Filename
      36.00KiB       0.00B    36.00KiB  /tmp/cow
      36.00KiB       0.00B    36.00KiB  /tmp/cow-always
      36.00KiB       0.00B    36.00KiB  /tmp/cow-auto
      36.00KiB    36.00KiB       0.00B  /tmp/cow-never
      36.00KiB       0.00B    36.00KiB  /tmp/cow-unspecified

    $ sha1sum /tmp/cow* /dev/shm/cow*
    4c665f87b5dc2e7d26279c4b48968d085e1ace32  /tmp/cow
    4c665f87b5dc2e7d26279c4b48968d085e1ace32  /tmp/cow-always
    4c665f87b5dc2e7d26279c4b48968d085e1ace32  /tmp/cow-auto
    4c665f87b5dc2e7d26279c4b48968d085e1ace32  /tmp/cow-never
    4c665f87b5dc2e7d26279c4b48968d085e1ace32  /tmp/cow-unspecified
    4c665f87b5dc2e7d26279c4b48968d085e1ace32  /dev/shm/cow-auto
    4c665f87b5dc2e7d26279c4b48968d085e1ace32  /dev/shm/cow-never
    4c665f87b5dc2e7d26279c4b48968d085e1ace32  /dev/shm/cow-unspecified

This commit also adds to new failure modes for (copy-file).

Failure to copy-on-write when 'always was passed in:

    scheme@(guile-user)> (copy-file "/tmp/cow" "/dev/shm/cow" #:copy-on-write 'always)
    ice-9/boot-9.scm:1676:22: In procedure raise-exception:
    In procedure copy-file: copy-on-write failed: Invalid cross-device link

Passing in invalid value for the #:copy-on-write keyword argument:

    scheme@(guile-user)> (copy-file "/tmp/cow" "/dev/shm/cow" #:copy-on-write 'nevr)
    ice-9/boot-9.scm:1676:22: In procedure raise-exception:
    In procedure copy-file: invalid value for #:copy-on-write: nevr

* NEWS: Add note for copy-file supporting copy-on-write.
* configure.ac: Check for linux/fs.h.
* doc/ref/posix.texi (File System)[copy-file]: Document the new
signature.
* libguile/filesys.c (clone_file): New function cloning a file using
FICLONE, if supported.
(k_copy_on_write): New keyword.
(sym_always, sym_auto, sym_never): New symbols.
(scm_copy_file2): Renamed from scm_copy_file.  New #:copy-on-write
keyword argument.  Attempt copy-on-write copy by default.
(scm_copy_file): Call scm_copy_file2.
* libguile/filesys.h: Add scm_copy_file2 as SCM_INTERNAL.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-03-12 14:04:41 +01:00
Michael Gran
df225a87b9 Test for clearenv function
clearenv() may not be provided by non-glibc systems.  As a fallback,
just set environ to NULL.

* libguile/posix.c (scm_environ)[!HAVE_CLEARENV]: add fallback logic
    for clearenv()
2023-07-17 18:30:18 -07:00
Ludovic Courtès
99e727adde
Remove recursive Makefile for 'benchmark-suite'.
* benchmark-suite/Makefile.am: Rename to...
* benchmark-suite/local.mk: ... this.  Prefix file names with %D%.
(EXTRA_DIST): Use '+=' and add 'README'.
* Makefile.am: Include it.
* configure.ac: Don't output 'benchmark-suite/Makefile'.
2023-07-16 22:02:30 +02:00
Ludovic Courtès
fc8c63acae
Remove recursive Makefile for 'am'.
* Makefile.am (SUBDIRS): Remove 'am'.
(EXTRA_DIST): Add files from am/.
* am/Makefile.am: Remove.
* configure.ac: Don't emit 'am/Makefile'.
2023-06-05 10:33:26 +02:00
Ludovic Courtès
b14ce93fa9
Remove recursive Makefile for 'gc-benchmarks'.
* gc-benchmarks/Makefile.am: Rename to...
* gc-benchmarks/local.mk: ... this.  Prefix file names with %D%.
(benchmarks): Rename to...
(gc_benchmarks): ... this.
* Makefile.am: Include it.
* configure.ac: Don't output 'gc-benchmarks/Makefile'.
2023-06-05 10:26:07 +02:00
Ludovic Courtès
a6ec043f7a
Remove 'emacs/Makefile.am'.
This is a followup to 178e9d237b.

* emacs/Makefile.am: Delete.
* configure.ac: Don't output 'emacs/Makefile'.
* Makefile.am (SUBDIRS): Remove 'emacs'.
2023-06-05 10:18:13 +02:00
Mikael Djurfeldt
e9c8ca341b Add missing backslash. 2023-04-04 13:33:57 +02:00
Ludovic Courtès
9cc85a4f52
Use 'posix_spawn_file_actions_addclosefrom_np' where available.
* configure.ac: Check for 'posix_spawn_file_actions_addclosefrom_np'.
* libguile/posix.c (HAVE_ADDCLOSEFROM): New macro.
(close_inherited_fds): Wrap in #ifdef HAVE_ADDCLOSEFROM.
(do_spawn) [HAVE_ADDCLOSEFROM]: Use 'posix_spawn_file_actions_addclosefrom_np'.
2023-04-02 15:36:33 +02:00
Ludovic Courtès
aeb22f4861 Update Gnulib to v0.1-5703-g356a414e8c and add 'posix_spawn' module.
This is a followup to edfca3b7e5, which
added the 'posix_spawnp' module but not 'posix_spawn'.

* m4/gnulib-cache.m4: Add 'posix_spawn' module.
* gnulib-local/m4/clock_time.m4.diff: Adjust.
* configure.ac: Move 'gl_EARLY' use right after 'AC_PROG_CC'.
2023-01-18 22:50:18 +01:00
Ludovic Courtès
f8938f517e build: Avoid implicit 'int' return type in configure tests.
Fixes <https://bugs.gnu.org/60022>.
Reported by Florian Weimer <fweimer@redhat.com>.

* configure.ac: Add missing implicit 'int' return type in tests.
2023-01-16 23:17:41 +01:00
Aleix Conchillo Flaqué
3bdcc3668f fix Apple Silicon JIT compilation
* configure.ac: check for pthread_jit_write_protect_np.

* libguile/jit.c: add support for Apple Silicon JIT compilation.

Fixes https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44505
2022-12-20 20:27:42 +01:00
Maxime Devos
c8b81ffb34 Define Scheme bindings to ‘openat’ when available.
* configure.ac: Detect if ‘openat’ is defined.
* libguile/filesys.c
  (flags_to_mode): Extract from ...
  (scm_mode): ... here.
  (scm_open_fdes_at, scm_openat): Define the Scheme bindings.
* libguile/filesys.h (scm_open_fdes_at, scm_openat): Make them part
  of the API.
* doc/ref/posix.texi (File System): Document them.
* test-suite/tests/filesys.test ("openat"): Test ‘openat’.
* libguile/syscalls.h (openat_or_openat64): Decide between ‘openat’
  and ‘openat64’.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21 17:42:20 +02:00
Maxime Devos
cf255dd3a4 Define a Scheme binding to ‘fstatat’ when available.
* configure.ac: Detect if ‘fstatat’ is defined.
* libguile/filesys.c (scm_statat): Define a Scheme binding to ‘fstatat’.
* libguile/filesys.h (scm_statat): Make it part of the C API.
* doc/ref/posix.texi (File System): Document it.
* libguile/syscalls.h (fstatat_or_fstatat64): Choose between ‘fstatat’
  and ‘fstatat64’.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21 17:41:10 +02:00
Maxime Devos
0af3c2f509 Define a Scheme binding to ‘fchownat’ when it exists.
* configure.ac: Detect whether ‘fchownat’ is available.
* libguile/filesys.c (scm_chownat): Define a Scheme binding to
  ‘fchownat’ when available.
* libguile/filesys.h (scm_chownat): Make it part of the API.
* doc/ref/posix.texi (File System): Document it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21 17:40:37 +02:00
Maxime Devos
3b45185d8f Define a Scheme binding to ‘unlinkat’ when it exists.
‘unlinkat’ is used for both unlinking regular files
and removing empty directories.

* configure.ac: Detect if ‘unlinkat’ exists.
* doc/ref/posix.texi (File System): Document why there is no
  ‘rmdirat’ procedure, and document the ‘delete-file-at’ procedure.
* libguile/filesys.c
  (scm_rmdir): Adjust the docstring here as well.
  (scm_delete_file_at): Define a Scheme binding to ‘unlinkat’.
* libguile/filesys.h (scm_delete_file_at): Make ‘scm_delete_file_at’
  part of the C API.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21 17:40:37 +02:00
Maxime Devos
19b48b1c4a Define a Scheme binding to ‘fchmodat’ when it exists.
* configure.ac: Detect existence of fchmodat.
* libguile/filesys.c (scm_chmodat): New procedure.
* libguile/filesys.h (scm_chmodat): Make it part of the API.
* test-suite/tests/filesys.test ("chmodat"): Test it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21 17:40:37 +02:00
Maxime Devos
3a0554c60f Define a Scheme binding to ‘renameat’ when it exists.
* configure.ac: Detect if ‘renameat’ is defined.
* libguile/filesys.c (scm_renameat): Define a Scheme binding
  to the ‘renameat’ system call.
* doc/ref/posix.texi (File System): Document it.
* libguile/filesys.h (scm_renameat): Make it part of the C API.
* test-suite/tests/filesys.test ("rename-file-at"): New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21 17:40:37 +02:00
Maxime Devos
58ddd5c7bc Define bindings to ‘mkdirat’ when the C function exists.
* configure.ac: Detect if ‘mkdirat’ exists.
* libguile/filesys.c (scm_mkdirat): Define the Scheme binding.
* doc/ref/posix.texi (File System): Document it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21 17:40:37 +02:00
Maxime Devos
6c350b6094 Define ‘symlinkat’ wrapper when supported.
* configure.ac: Detect whether ‘symlinkat’ exists.
* libguile/filesys.c (scm_symlinkat): Define a Scheme binding
  when it exists.
* libguile/filesys.h: Make the binding part of the public C API.
* doc/ref/posix.texi (File System): Document the binding.
* test-suite/tests/filesys.test ("symlinkat"): Test it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21 17:40:37 +02:00
Maxime Devos
9ffd297249 Allow file ports in ‘utime’.
Ports representing symbolic links are currently unsupported.

* configure.ac: Detect 'futimens'.
* doc/ref/posix.texi (utime): Update documentation.
* libguile/posix.c (scm_utime): Support ports.
* libguile/posix.h (scm_utime): Rename argument.
* test-suite/tests/posix.test ("utime"): Add more tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21 17:40:30 +02:00
Maxime Devos
30247dc414 Allow file ports in ‘readlink’.
* configure.ac: Detect whether ‘readlinkat’ is defined.
* libguile/filesys.c (scm_readlink): Support file ports
  when ‘readlinkat’ exists.
  (scm_init_filesys): Provide ‘chdir-ports’ when it exists.
* doc/ref/posix.texi (File System): Document it.
* test-suite/tests/filesys.test ("readlink"): Test it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21 17:39:38 +02:00
Maxime Devos
273bfe7510 Allow file ports in ‘chdir’ when supported.
* configure.ac: Check for ‘fchdir’.
* libguile/filesys.c
(scm_chdir): Support file ports.
(scm_init_filesys): Report support of file ports.
* doc/ref/posix.texi (Processes): Update accordingly.
* doc/ref/guile.texi: Add copyright line for new documentation in this
patch and later patches.
* test-suite/tests/filesys.test ("chdir"): Test it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21 17:39:38 +02:00
Michael Gran
d3261e8497 Presumes signal handler return void
Since Guile requires a C99 compiler, we can rely on signal handlers
returning void, not int.

* configure.ac: remove AC_TYPE_SIGNAL
* libguile/scmsigs.c (SIGRETTYPE): remove SIGRETTYPE
  (take_signal): returns void
  (scm_sigaction_for_thread): presumes handlers return void
2022-10-14 08:40:23 -07:00
Mike Gran
e9db8a29e4 Remove special logic for the obscure CMU C library's libc.h
* acinclude.m4 (GUILE_HEADER_LIBC_WITH_UNISTD): removed
* configure.ac: remove GUILE_HEADER_LIBC_WITH_UNISTD, don't check for libc.h
* libguile/filesys.c [LIBC_H_WITH_UNISTD_H]: remove libc.h inclusion
* libguile/posix.c [LIBC_H_WITH_UNISTD_H]: remove libc.h inclusion
2022-10-14 08:40:23 -07:00
Mike Gran
df8e772f3c Presume time.h and sys/time.h don't conflict when included
Systems on which time.h and sys/time.h conflicted are obsolescent.

* configure.ac: remove AC_HEADER_TIME. remove conditional
  in tm.tm_gmtoff test.
* libguile/filesys.c [TIME_WITH_SYS_TIME]: remove conditional
* libguile/posix.c [TIME_WITH_SYS_TIME]: remove conditional

# Conflicts:
#	libguile/filesys.c
2022-10-14 08:40:23 -07:00
Mike Gran
3827291425 Presume ISO C90 functions are always available
* configure.ac: don't check for rename, setlocale, system, memcpy,
   and strcoll
* libguile/i18n.c [HAVE_SETLOCALE] (setlocale): remove static setlocale
    Don't use HAVE_SETLOCALE
* libguile/posix.c: include <locale.h>, remove HAVE_SETLOCALE
  (scm_setlocale): always include. remove HAVE_SETLOCALE
* libguile/simpos.c (scm_system): always include. remove HAVE_SYSTEM
2022-10-14 08:40:23 -07:00
Mike Gran
9b357bace3 Presume ISO C90 headers are always available
This includes <assert.h>, <ctype.h>, <errno.h>, <float.h>, <iso646.h>,
<limits.h>, <locale.h>, <math.h>, <setjmp.h>, <signal.h>, <stdarg.h>,
<stddef.h>, <stdio.h>, <stdlib.h>, <string.h>, <time.h>, <wchar.h>,
and <wctype.h>.

* configure.ac: don't check for <limits.h>, <string.h>, <time.h>, <assert.h>.
   Remove AC_INCLUDES_DEFAULT macro
* libguile/bytevectors.c: include <limits.h>, remove HAVE_LIMITS_H
* libguile/filesys.c: include <string.h>, remove HAVE_STRING_H
* libguile/fports.c: include <string.h>, remove HAVE_STRING_H
* libguile/gen-scmconfig.c: remove HAVE_LIMITS_H, HAVE_TIME_H, STDC_HEADERS
    Remove SCM_HAVE_STDC_HEADERS
* libguile/hash.c: include <wchar.h>, remove HAVE_WCHAR_H
* libguile/net_db.c: include <string.h>, remove HAVE_STRING_H
* libguile/numbers.h: remove SCM_HAVE_STDC_HEADERS
* libguile/regex-posix.c: include <wchar.h>, remove HAVE_WCHAR_H
  (fixup_multibyte_match): always defined
  (scm_regexp_exec): use fixup_multibyte_match
* libguile/scmsigs.c: remove STDC_HEADERS
* libguile/socket.c: include <string.h>, remove HAVE_STRING_H
* test-suite/standalone/test-unwind.c: include <string.h>, remove HAVE_STRING_H
2022-10-14 08:40:23 -07:00
Mike Gran
128e0a3479 Remove AC_HEADER_STDC from configure.ac
Requiring C99 implies standard headers are available

* configure.ac: remove AC_HEADER_STDC
2022-10-14 08:40:23 -07:00
Mike Gran
a274e1ced4 Remove obsolete macro AM_PROG_CC_C_O in configure script
It has been replaced by new functionality in AC_PROG_CC

* configure.ac: remove AM_PROG_CC_C_O
2022-10-14 08:40:23 -07:00
Mike Gran
78a98062a4 Use autoconf's ability to choose the latest version of C
Modern AC_PROG_CC will add flags to enable C11 when necessary.

* configure.ac: remove AC_PROG_CC_C99, rely on updated AC_PROG_CC
2022-10-14 08:40:23 -07:00
Mike Gran
bec1918b38 Presume const is always available
* configure.ac (AC_C_CONST): removed
2022-10-14 08:40:23 -07:00
Mike Gran
da254d6778 Update libtool initialization in configure script
* configure.ac (AC_LIBTOOL_WIN32_DLL, AC_LIBTOOL_DLOPEN): removed
  (AC_PROG_LIBTOOL): removed
  (LT_INIT): added
2022-10-14 08:40:23 -07:00
Ludovic Courtès
1d313bf5f0 'pipe' now takes an optional 'flags' parameter.
This is the same strategy as used for the 'accept4' bindings introduced
in 6e0965104c.

* libguile/posix.c (scm_pipe): Rename to...
(scm_pipe2): ... this.  Add an optional 'flags' parameter and honor it.
(scm_pipe): Rewrite as a call to 'scm_pipe2'.
* libguile/posix.h (scm_pipe2): New declaration.
* test-suite/tests/posix.test ("pipe"): New tests.
* configure.ac: Look for 'pipe2'.
* NEWS: Update.
2022-09-19 22:30:16 +02:00
Daniel Llorens
50d4b50203 Check for gperf at configure time
Edited Arne Babenhauserheide's patch
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51129;att=0;filename=0001-autoconf-Check-for-gperf-if-running-from-git.patch;msg=5.

Fixes https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51129.
2022-08-02 15:08:57 +02:00
Sergei Trofimovich
f047133e7b build: Test '-flto' on both compiler and linker.
Before the change ./configure incorrectly enabled -flto on toolchains
that support -flto on compiler side but don't support -flto on linker
side. This caused incorrect type size detection on nixpkgs' Darwin:

 configure:54594: checking size of size_t
 configure:54600: clang -std=gnu11 -o conftest -g -O2 -flto   conftest.c  >&5
 ld: warning: ignoring file /private/tmp/nix-build-guile-3.0.8.drv-0/conftest-00e93d.o,
   building for macOS-x86_64 but attempting to link with file built
   for unknown-unsupported file format ( 0xDE 0xC0 0x17 0x0B 0x00 0x00 0x00 0x00 0x14 0x00 0x00 0x00 0x80 0x1A 0x00 0x00 )
 Undefined symbols for architecture x86_64:
   "_main", referenced from:
      implicit entry/start for main executable
 ld: symbol(s) not found for architecture x86_64
 clang-11: error: linker command failed with exit code 1 (use -v to see invocation)

Taken from https://github.com/NixOS/nixpkgs/pull/160051#issuecomment-1046105041

The change makes sure -flto support tests basic support of just for
object file generation but for linker as well.

* configure.ac: use AC_LINK_IFELSE instead of AC_COMPILE_IFELSE.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-03-07 10:54:16 +01:00
Ludovic Courtès
24b30130ca build: When cross-compiling, get type sizes of the target system.
Fixes <https://issues.guix.gnu.org/54198>.

As noted in the comment at the top, 'SIZEOF_TYPE' must be used instead
of 'sizeof (TYPE)' to support cross-compilation.

The regression was introduced in
5e5afde06f but only became apparent with
717e787da6.

* libguile/gen-scmconfig.c (main): Replace uses of 'sizeof' by
references to the SIZEOF_* macros.
* configure.ac: Add 'AC_CHECK_SIZEOF' call for 'intmax_t'.
2022-02-28 23:00:46 +01:00
Andy Wingo
9b9149a5bf Rework bootstrap to be reproducible
* configure.ac:
* Makefile.am (SUBDIRS): Replace bootstrap/ with stage0, stage1, and
stage2.
* am/bootstrap.am: Include all files and all rules.
* meta/build-env.in (GUILE_AUTO_COMPILE): Always turn off
auto-compilation.  Take a GUILE_BOOTSTRAP_STAGE argument, which can be
stage0, stage1, stage2, or unset.  Adapt the load-compiled path
accordingly.
* meta/uninstalled-env.in: Include .go files from stage2.
* module/Makefile.am: Rework to use boostrap.am.
* module/system/base/optimize.scm (available-optimizations): Punt the
inlinable-exports machinery to -O2.
* stage0/Makefile.am:
* stage1/Makefile.am:
* stage2/Makefile.am: New files.
2022-02-01 14:50:40 +01:00
Andy Wingo
6ed66f42cb Add -ftlo support
* configure.ac: Check if the compiler supports link-time optimization.
If it does, turn it on.  Saves around 15% off libguile binary size.
Controllable via --enable-lto configure option.
2022-01-29 15:49:43 +01:00
Michael Gran
3f4d5d128c For MinGW use Windows filepaths in libpath.h
* configure.ac (MINGW_LIBPATH): new automake conditional and test
* libguile/Makefile.am (libpath.h) [MINGW_LIBPATH]: use Windows-style
    paths
2021-03-11 10:46:06 -08:00
Andy Wingo
91547abf54 More informative error message if GMP not found
* configure.ac: Mention --enable-mini-gmp if GMP not found.
2021-03-07 20:43:16 +01:00
Michael Gran
6ca3ab621c don't presume availability of gmp.pc
This suggests moving the conditional that determines if mini-gmp is used
into scmconfig.h.

* configure.ac: replace PKG_CHECK_MODULES for gmp with AC_LIB_HAVE_LINKFLAGS
    Remove ENABLE_MINI_GMP define.  Also don't run mpz_inits test for
    --enable-mini-gmp.
* libguile/gen-scmconfig.c (main) [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP
    with SCM_I_GSC_ENABLE_MINI_GMP
* libguile/bytevectors.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP
    with SCM_ENABLE_MINI_GMP
* libguile/init.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP
    with SCM_ENABLE_MINI_GMP
* libguile/numbers.c: include scm.h
    [SCM_ENABLE_MINI_GMP]: provide mpz_inits and mpz_clears
    [ENABLE_MINI_GMP]: prefer SCM_ENABLE_MINI_GMP to ENABLE_MINI_GMP
* libguile/numbers.h: include scm.h
* libguile/random.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP
    with SCM_ENABLE_MINI_GMP
* libguile/socket.c [ENABLE_MINI_GMP]: replace ENABLE_MINI_GMP
    with SCM_ENABLE_MINI_GMP
2021-03-03 14:06:29 -08:00
Michael Gran
54adbd6f0f improve autoconfigury for minigmp
* configure.ac: add SCM_I_GSC_ENABLE_MINI_GMP var and rename
    GUILE_MINI_GMP to ENABLE_MINI_GMP
* libguile/bytevectors (GUILE_MINI_GMP): rename to ENABLE_MINI_GMP
* libguile/gen-scmconfig.c: renamed GUILE_MINI_GMP to ENABLE_MINI_GMP.
    rename GUILE_MINI_GMP to SCM_ENABLE_MINI_GMP
* libguile/gen-scmconfig.h: add SCM_I_GSC_ENABLE_MINI_GMP
* libguile/init.c [GUILE_MINI_GMP]: prefer ENABLE_MINI_GMP
* libguile/numbers.c [GUILE_MINI_GMP]: prefer ENABLE_MINI_GMP
* libguile/numbers.h: include scmconfig.h
    rename GUILE_MINI_GMP to SCM_ENABLE_MINI_GMP
* libguile/random.c [GUILE_MINI_GMP]: prefer ENABLE_MINI_GMP
* libguile/socket.c [GUILE_MINI_GMP]: prefer ENABLE_MINI_GMP
* libguile.h [GUILE_MINI_GMP]: prefer SCM_ENABLE_MINI_GMP
2021-03-02 06:18:32 -08:00
Michael Gran
eb1bd8050e Enable option to prefer mini-gmp over libgmp
* configure.ac: rework gmp library detection. Add new flag.
* libguile.h: modify gmp header inclusion
* libguile/Makefile.am: add mini-gmp.[ch] files
* libguile/bytevectors.c: add mini-gmp headers
* libguile/gen-scmconfig.c: new #include variable GUILE_MINI_GMP
* libguile/init.c: add mini-gmp header
* libguile/mini-gmp.c: new file
* libguile/mini-gmp.h: new file
* libguile/numbers.c: add fallback for missing mpz_get_d_2exp
* libguile/numbers.h: yse mini-gmp header
* libguile/random.c: use mini-gmp header
* libguile/socket.c: use mini-gmp header
2021-03-02 06:18:32 -08:00