Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
0228a60
ci: add a basic github workflow and commit directly to master so that it
embray Apr 1, 2026
7f4466e
build: first pass at getting the build system working outside starlin…
embray Mar 27, 2026
e8098f8
test: move ast_test.c into new ast_tests/ directory for holding C-bas…
embray Mar 27, 2026
c45b074
build: provide a simple bootstrap.local script as an alternative to the
embray Mar 27, 2026
5cbfa88
chore: ignore m4 files generated by libtool etc
embray Mar 27, 2026
317a61e
build: various fixes to ensure that the build still works as expected
embray Mar 31, 2026
501ae24
build: remove accidental inclusion of src/version.h ; this is is already
embray Mar 31, 2026
4d9c5c3
build: should still be using AM_FFLAGS for the standalone tests build
embray Mar 31, 2026
f8d2f63
build: fix src/version.h generation and fix STAR_PREDIST_SOURCES
embray Mar 31, 2026
f77c85e
build: handle messgen header generation
embray Apr 1, 2026
384f786
build: run all tests in ast_tester/
embray Apr 1, 2026
bb265cb
test: add the testhuge test to the suite as well, but enable it only
embray Apr 1, 2026
aed742f
test: testyamlchan was rewritten from Fortran to C in 20d3d7d63 ;
embray Apr 1, 2026
9711d66
ci: attempt building F77 tests with flang on macOS
embray Apr 1, 2026
294542b
build: add -Wno-real-constant-widening to the f77 flags as well
embray Apr 1, 2026
9c556f6
test: also add the wcsconverter and simplify tests to the automake te…
embray Apr 1, 2026
68ce4fb
test: the simplify and wcsconverter tests have very tiny
embray Apr 1, 2026
ad10f1f
build: reintegrations with new cmake build system
embray Apr 23, 2026
0324cea
build: some work towards enabling out-of-source (VPATH) builds with a…
embray Apr 23, 2026
6d3dd05
ast_tester: update tests to read path to input fixtures from srcdir
embray Apr 23, 2026
6bf33fb
ci: rename for consistency with cmake.yaml
embray Apr 23, 2026
d89cc46
ast_tester: fix building the Fortran tests in autotools build
embray Apr 23, 2026
ec4ae50
ast_tester: delete the testplot3d_f Fortran test for now
embray Apr 23, 2026
333a510
ast_tester: rename tests to have _c and _f suffixes
embray Apr 24, 2026
be4cea2
ast_tester: add srcdir support in testplot3d.{c,f}
embray Apr 24, 2026
6416b0d
ast_tester: *actually* build and run the FORTRAN tests
embray Jul 7, 2026
e98c357
ast_tester: update more tests to use the srcdir environment variable
embray Jul 7, 2026
5853ec4
ast_tester: don't write this file to a hard-coded /tmp dir
embray Jul 7, 2026
24f365e
ast_tester: implement backport of PSX_GETENV for Fortran tests
embray Jul 8, 2026
a3e47bf
ci: rename build.yaml to autotools.yaml
embray Jul 8, 2026
e80b31b
build: fix `make distcheck` in the autotools build
embray Jul 9, 2026
cf5b54e
ci: add `make distcheck` run to the autotools build job
embray Jul 9, 2026
35e3e36
ast_tester: omit now unnecessary copying of test fixtures
embray Jul 9, 2026
18de601
ci: add missing libyaml dependency on macOS build
embray Jul 9, 2026
2da8ff9
ast_tester: overhaul of the data-driven tests in the automake test suite
embray Jul 9, 2026
9324c66
build: improve libyaml detection in autoconf
embray Jul 9, 2026
09b05d5
build: BSD sed doesn't recognize \t as an escape sequence
embray Jul 9, 2026
90ef94a
build: pass through salient configure flags to `make distcheck`
embray Jul 9, 2026
354ff9c
build: run the cmake build/test as part of make distcheck
embray Jul 9, 2026
312f159
build: fix duplicate -rpath warnings when building the tests on macOS
embray Jul 9, 2026
b2f1327
fixup! ast_tester: update tests to read path to input fixtures from s…
timj Aug 31, 2026
4bfb142
fixup! ast_tester: overhaul of the data-driven tests in the automake …
timj Aug 31, 2026
0f1ea8c
fixup! build: run the cmake build/test as part of make distcheck
timj Aug 31, 2026
59bc2f6
fixup! ast_tester: overhaul of the data-driven tests in the automake …
timj Aug 31, 2026
9e7517c
fixup! build: run the cmake build/test as part of make distcheck
timj Aug 31, 2026
a811dd0
build: fix STAR_CHECK_PROGS stub to match the real macro's arguments
timj Aug 31, 2026
af8b379
docs: vendor the Starlink LaTeX support files into star_compat
timj Aug 31, 2026
9924eec
build: make the .htx_tar hypertext documentation optional
timj Aug 31, 2026
d706d78
chore: ignore the .aux files the documentation build leaves behind
timj Aug 31, 2026
4ae4e3d
docs: document ast.sty's macros against html.sty's own definitions
timj Aug 31, 2026
7fd2075
build: measure the Fortran REAL function return type instead of guessing
timj Aug 31, 2026
096c5a8
fixup! build: measure the Fortran REAL function return type instead o…
timj Aug 31, 2026
5e961a3
build: stop shadowing configure's MESSGEN variable
timj Aug 31, 2026
a92a623
build: agree on TRAIL_TYPE between the two build systems
timj Aug 31, 2026
cfe593a
build: stop the EXTRA_DIST lists from silently falling behind
timj Aug 31, 2026
3e687ed
build: don't warn about star2html where no documentation is built
timj Aug 31, 2026
dad3ec9
ci: check every branch push, and move the tarball CMake build here
timj Aug 31, 2026
331d609
build: distribute only what configure cannot regenerate
timj Aug 31, 2026
1269f00
build: skip Fortran ABI run probe when cross compiling
timj Sep 1, 2026
532d551
test: skip YamlChan test without YAML support
timj Sep 1, 2026
4c12c08
build: prefer generated headers from VPATH build tree
timj Sep 1, 2026
d698fb8
test: keep C-only checks independent of Fortran
timj Sep 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions .github/workflows/autotools.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: GNU Autotools Build and Test

on:
push:
branches: ['**']
tags: '*'
pull_request:
workflow_dispatch:
inputs:
make_flags:
description: Extra flags to pass to make
required: false

# Every push to a branch is checked, and so is every pull request -- the
# latter so that forks are covered too, since a fork's push never reaches
# this repository. For a branch in this repository with an open pull request
# that does mean two runs of the same commit; the concurrency group below at
# least cancels runs a newer push has superseded, except on master where the
# completed record is worth keeping.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
build-and-test:
name: Build and run `make check`
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
cc: clang
f77: flang
- os: ubuntu-latest
cc: gcc
f77: gfortran

steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: true

- name: Install dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
autoconf \
automake \
libtool \
build-essential \
gfortran \
libyaml-dev

if [ "${{ matrix.cc }}" = "clang" ]; then
sudo apt-get install -y clang
fi

- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew update
brew install \
autoconf \
automake \
libtool \
libyaml \
flang

- name: Setup ccache action
uses: Chocobo1/setup-ccache-action@v1.5.1

- name: Bootstrap autotools
run: ./bootstrap.local

# Homebrew installs outside the compiler's default search paths, so
# libyaml has to be pointed at explicitly
- name: Configure (macOS)
if: runner.os == 'macOS'
run: |
./configure CC=${{ matrix.cc }} \
FC=${{ matrix.f77 }} F77=${{ matrix.f77 }} \
--with-yaml="$(brew --prefix libyaml)"

- name: Configure (Ubuntu)
if: runner.os == 'Linux'
run: |
./configure CC=${{ matrix.cc }} \
FC=${{ matrix.f77 }} F77=${{ matrix.f77 }}

# If make fails re-run with V=1 so we can inspect
- name: Build
run: |
make ${{ github.event.inputs.make_flags }} || \
make ${{ github.event.inputs.make_flags }} V=1

- name: Check
run: make check ${{ github.event.inputs.make_flags }}

- name: Output test logs on failure
if: failure()
run: |
tail -n +1 ast_tester/*.log

- name: Distcheck
run: make distcheck ${{ github.event.inputs.make_flags }}

# The tarball must also build with CMake -- that is what catches a file
# the CMake build needs but the distribution forgot. It runs here rather
# than inside `make distcheck' so that cutting a release needs only the
# autotools; CI has both toolchains anyway. Fortran stays off: the point
# is whether every file arrived, and the flang job would otherwise fail
# here for unrelated reasons.
- name: Build the distribution tarball with CMake
run: |
rm -rf tarball-cmake
mkdir tarball-cmake
tar xzf ast-*.tar.gz -C tarball-cmake --strip-components=1
cmake -S tarball-cmake -B tarball-cmake/_build \
-DCMAKE_BUILD_TYPE=Release -DAST_C_STANDARD=11
cmake --build tarball-cmake/_build --parallel
ctest --test-dir tarball-cmake/_build --output-on-failure
14 changes: 12 additions & 2 deletions .github/workflows/cmake.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@ name: CMake Build and Test

on:
push:
branches: [master]
branches: ['**']
pull_request:
branches: [master]
workflow_dispatch:

# Every push to a branch is checked, and so is every pull request -- the
# latter so that forks are covered too, since a fork's push never reaches
# this repository. For a branch in this repository with an open pull request
# that does mean two runs of the same commit; the concurrency group below at
# least cancels runs a newer push has superseded, except on master where the
# completed record is worth keeping.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
build:
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@ name: Coverage

on:
push:
branches: [master]
branches: ['**']
pull_request:
branches: [master]
workflow_dispatch:

# Every push to a branch is checked, and so is every pull request -- the
# latter so that forks are covered too, since a fork's push never reaches
# this repository. For a branch in this repository with an open pull request
# that does mean two runs of the same commit; the concurrency group below at
# least cancels runs a newer push has superseded, except on master where the
# completed record is worth keeping.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
coverage:
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ aclocal.m4
ast_err.h
ast_test.log
autom4te.cache/
build-aux/
build-aux/*
# tap-driver.sh is vendored (automake's --add-missing does not provide it), so
# keep it tracked even though the rest of build-aux is autoreconf-generated.
!build-aux/tap-driver.sh
cminpack/.deps/
cminpack/.dirstamp
componentinfo.dtd
Expand All @@ -40,12 +43,14 @@ fac_1521_err
libtool
stamp-h1
starconf.status
sun210.aux
sun210.htx/
sun210.htx_tar
sun210.lof
sun210.log
sun210.out
sun210.toc
sun211.aux
sun211.htx/
sun211.htx_tar
sun211.lof
Expand Down
144 changes: 126 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -231,19 +231,84 @@ if(AST_BUILD_FORTRAN)
enable_language(Fortran)

# Determine the type for trailing Fortran string lengths (TRAIL_TYPE).
# gfortran 8+ on 64-bit platforms passes hidden string lengths as
# size_t rather than int. Other compilers use int.
# gfortran 8 and later pass hidden string lengths as size_t rather than
# int, whatever the word size -- on a 32-bit target size_t is int-sized
# anyway, so gating this on a 64-bit build (as this used to) only made the
# answer disagree with the autotools builds for no benefit.
#
# Known gap, in both build systems: the Starlink macro additionally uses
# long for 64-bit Intel and Sun Fortran, and probes anything else non-GNU.
# Here, as in star_compat/starlink_compat.m4, non-GNU compilers get int.
if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU"
AND CMAKE_SIZEOF_VOID_P EQUAL 8
AND CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 8)
set(TRAIL_TYPE "size_t")
else()
set(TRAIL_TYPE "int")
endif()

# Check if Fortran compiler is f2c-compatible (affects REAL function return).
# Non-f2c compilers (i.e. nearly all modern compilers) return float.
# Does a Fortran REAL function return its result as a double, the way f2c
# does, or as a float? This cannot be read off the compiler's identity: it
# is a property of the calling convention, and gfortran uses the f2c one
# only when given -ff2c. So measure it, the same way the autotools build
# does (STAR_CNF_F2C_COMPATIBLE in star_compat/starlink_compat.m4): define
# a C function returning a float, call it from Fortran as a REAL function,
# and see what arrives. A float-returning convention hands back the 1.0
# that was sent; a double-returning one reads the float's bits as a double
# and gets something else, which the probe detects by the result comparing
# equal to zero.
#
# Passing two sources of different languages to try_run() needs CMake 3.25;
# below that, keep the old assumption, which is right for every compiler
# not explicitly asked for the f2c convention.
set(REAL_FUNCTION_TYPE "float")
if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU"
AND CMAKE_VERSION VERSION_LESS 3.25)
message(STATUS
"CMake < 3.25: assuming Fortran REAL functions return float "
"(configure with -ff2c and CMake 3.25+ to have this measured)")
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU"
AND CMAKE_CROSSCOMPILING
AND NOT CMAKE_CROSSCOMPILING_EMULATOR)
message(STATUS
"Cross compiling without an emulator: assuming Fortran REAL "
"functions return float")
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
set(_f2c_dir "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/f2c_probe")
file(WRITE "${_f2c_dir}/fred.c" "\
float fred_() {
return 1.0f;
}
")
file(WRITE "${_f2c_dir}/f2ctest.f" "\
PROGRAM F2CTEST
REAL FRED
REAL R
R = FRED()
IF ( R .NE. 0.0 ) THEN
WRITE(*,*) 'no'
ELSE
WRITE(*,*) 'yes'
ENDIF
END
")
try_run(AST_F2C_RUN_RESULT AST_F2C_COMPILE_RESULT
"${_f2c_dir}/build"
SOURCES "${_f2c_dir}/f2ctest.f" "${_f2c_dir}/fred.c"
RUN_OUTPUT_VARIABLE _f2c_output)
if(NOT AST_F2C_COMPILE_RESULT)
message(WARNING
"f2c compatibility probe would not build; assuming Fortran "
"REAL functions return float")
elseif(AST_F2C_RUN_RESULT STREQUAL "FAILED_TO_RUN")
message(WARNING
"f2c compatibility probe would not run; assuming Fortran "
"REAL functions return float")
elseif(_f2c_output MATCHES "yes")
set(REAL_FUNCTION_TYPE "double")
endif()
message(STATUS
"Fortran REAL functions return ${REAL_FUNCTION_TYPE}")
endif()

# Determine the blank common symbol. gfortran 4+ uses __BLNK__,
# other compilers typically use _BLNK__.
Expand All @@ -259,6 +324,17 @@ if(AST_BUILD_FORTRAN)
"${CMAKE_CURRENT_BINARY_DIR}/src/f77.h"
@ONLY
)

# Check for optional Fortran compiler flags needed by the test programs.
include(CheckFortranCompilerFlag)
set(AST_FORTRAN_TEST_FLAGS "")
foreach(flag -fallow-argument-mismatch -fno-range-check -Wno-real-constant-widening)
string(MAKE_C_IDENTIFIER "HAVE_FC${flag}" varname)
check_fortran_compiler_flag("${flag}" ${varname})
if(${varname})
list(APPEND AST_FORTRAN_TEST_FLAGS "${flag}")
endif()
endforeach()
endif()

# ============================================================
Expand Down Expand Up @@ -331,16 +407,39 @@ configure_file(
)

# ============================================================
# Generate ast_err.h from ast_err.msg
# Build messgen (host tool) and generate ast_err.h / AST_ERR
# ============================================================
# messgen is built as a native host tool from the vendored source
# (star_compat/messgen.c) and used at build time to generate the C
# error-code header and, when Fortran support is enabled, the Fortran
# include file.
add_executable(messgen star_compat/messgen.c)
# messgen.c is vendored upstream code; suppress the -Wformat-overflow warning
# it triggers.
include(CheckCCompilerFlag)
check_c_compiler_flag(-Wno-format-overflow HAVE_WNO_FORMAT_OVERFLOW)
if(HAVE_WNO_FORMAT_OVERFLOW)
target_compile_options(messgen PRIVATE -Wno-format-overflow)
endif()

if(AST_BUILD_FORTRAN)
set(MESSGEN_FLAGS -c -F)
set(MESSGEN_OUTPUTS
"${CMAKE_CURRENT_BINARY_DIR}/ast_err.h"
"${CMAKE_CURRENT_BINARY_DIR}/AST_ERR"
)
else()
set(MESSGEN_FLAGS -c)
set(MESSGEN_OUTPUTS
"${CMAKE_CURRENT_BINARY_DIR}/ast_err.h"
)
endif()

add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ast_err.h"
COMMAND ${CMAKE_COMMAND}
-DINPUT="${CMAKE_CURRENT_SOURCE_DIR}/ast_err.msg"
-DOUTPUT="${CMAKE_CURRENT_BINARY_DIR}/ast_err.h"
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/gen_ast_err_h.cmake"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/ast_err.msg"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/gen_ast_err_h.cmake"
OUTPUT ${MESSGEN_OUTPUTS}
COMMAND messgen ${MESSGEN_FLAGS} "${CMAKE_CURRENT_SOURCE_DIR}/ast_err.msg"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
DEPENDS messgen "${CMAKE_CURRENT_SOURCE_DIR}/ast_err.msg"
COMMENT "Generating ast_err.h from ast_err.msg"
)

Expand Down Expand Up @@ -474,11 +573,20 @@ add_custom_command(
DEPENDS ${MAKEH_DEPS}
COMMENT "Generating ast.h"
)
add_custom_target(ast_codegen
DEPENDS
"${CMAKE_CURRENT_BINARY_DIR}/ast.h"
"${CMAKE_CURRENT_BINARY_DIR}/ast_err.h"
)
if(AST_BUILD_FORTRAN)
add_custom_target(ast_codegen
DEPENDS
"${CMAKE_CURRENT_BINARY_DIR}/ast.h"
"${CMAKE_CURRENT_BINARY_DIR}/ast_err.h"
"${CMAKE_CURRENT_BINARY_DIR}/AST_ERR"
)
else()
add_custom_target(ast_codegen
DEPENDS
"${CMAKE_CURRENT_BINARY_DIR}/ast.h"
"${CMAKE_CURRENT_BINARY_DIR}/ast_err.h"
)
endif()

# ============================================================
# Fortran support: astbad utility and AST_PAR generation
Expand Down
Loading
Loading