1# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
2#
3# SPDX-License-Identifier: curl
4
5name: configure-vs-cmake
6'on':
7  push:
8    branches:
9      - master
10    paths:
11      - '*.ac'
12      - '**/*.m4'
13      - '**/CMakeLists.txt'
14      - 'lib/curl_config.h.cmake'
15      - '.github/scripts/cmp-config.pl'
16      - '.github/workflows/configure-vs-cmake.yml'
17
18  pull_request:
19    branches:
20      - master
21    paths:
22      - '*.ac'
23      - '**/*.m4'
24      - '**/CMakeLists.txt'
25      - 'lib/curl_config.h.cmake'
26      - '.github/scripts/cmp-config.pl'
27      - '.github/workflows/configure-vs-cmake.yml'
28
29permissions: {}
30
31jobs:
32  check-linux:
33    runs-on: ubuntu-latest
34    steps:
35      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
36
37      - name: run configure --with-openssl
38        run: |
39          autoreconf -fi
40          export PKG_CONFIG_DEBUG_SPEW=1
41          mkdir bld-am && cd bld-am && ../configure --enable-static=no --with-openssl --without-libpsl --without-brotli --without-zstd
42
43      - name: run cmake
44        run: |
45          cmake -B bld-cm -DCURL_USE_LIBPSL=OFF
46
47      - name: 'configure log'
48        run: cat bld-am/config.log 2>/dev/null || true
49
50      - name: 'cmake log'
51        run: cat bld-cm/CMakeFiles/CMakeConfigureLog.yaml 2>/dev/null || true
52
53      - name: compare generated curl_config.h files
54        run: ./.github/scripts/cmp-config.pl bld-am/lib/curl_config.h bld-cm/lib/curl_config.h
55
56      - name: compare generated libcurl.pc files
57        run: ./.github/scripts/cmp-pkg-config.sh bld-am/libcurl.pc bld-cm/libcurl.pc
58
59      - name: compare generated curl-config files
60        run: ./.github/scripts/cmp-pkg-config.sh bld-am/curl-config bld-cm/curl-config
61
62  check-macos:
63    runs-on: macos-latest
64    steps:
65      - name: install packages
66        run: |
67          while [[ $? == 0 ]]; do for i in 1 2 3; do brew update && brew install libtool autoconf automake && break 2 || { echo Error: wait to try again; sleep 10; } done; false Too many retries; done
68
69      - name: 'toolchain versions'
70        run: |
71         echo '::group::brew packages installed'; ls -l "$(brew --prefix)/opt"; echo '::endgroup::'
72
73      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
74
75      - name: run configure --with-openssl
76        run: |
77          autoreconf -fi
78          export PKG_CONFIG_DEBUG_SPEW=1
79          mkdir bld-am && cd bld-am && ../configure --enable-static=no --with-openssl --without-libpsl --disable-ldap
80
81      - name: run cmake
82        run: |
83          cmake -B bld-cm -DCURL_USE_LIBPSL=OFF -DCURL_DISABLE_LDAP=ON \
84            "-DCMAKE_C_COMPILER_TARGET=$(uname -m | sed 's/arm64/aarch64/')-apple-darwin$(uname -r)" \
85            -DCURL_USE_LIBSSH2=OFF
86
87      - name: 'configure log'
88        run: cat bld-am/config.log 2>/dev/null || true
89
90      - name: 'cmake log'
91        run: cat bld-cm/CMakeFiles/CMakeConfigureLog.yaml 2>/dev/null || true
92
93      - name: compare generated curl_config.h files
94        run: ./.github/scripts/cmp-config.pl bld-am/lib/curl_config.h bld-cm/lib/curl_config.h
95
96      - name: compare generated libcurl.pc files
97        run: ./.github/scripts/cmp-pkg-config.sh bld-am/libcurl.pc bld-cm/libcurl.pc
98
99      - name: compare generated curl-config files
100        run: ./.github/scripts/cmp-pkg-config.sh bld-am/curl-config bld-cm/curl-config
101
102  check-windows:
103    runs-on: ubuntu-latest
104    env:
105      TRIPLET: 'x86_64-w64-mingw32'
106    steps:
107      - name: install packages
108        run: sudo apt-get --quiet 2 --option Dpkg::Use-Pty=0 install mingw-w64
109
110      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
111
112      - name: run configure --with-schannel
113        run: |
114          autoreconf -fi
115          export PKG_CONFIG_DEBUG_SPEW=1
116          mkdir bld-am && cd bld-am && ../configure --enable-static=no --with-schannel --without-libpsl --host=${TRIPLET}
117
118      - name: run cmake
119        run: |
120          cmake -B bld-cm -DCURL_USE_SCHANNEL=ON -DCURL_USE_LIBPSL=OFF \
121            -DCMAKE_SYSTEM_NAME=Windows \
122            -DCMAKE_C_COMPILER_TARGET=${TRIPLET} \
123            -DCMAKE_C_COMPILER=${TRIPLET}-gcc
124
125      - name: 'configure log'
126        run: cat bld-am/config.log 2>/dev/null || true
127
128      - name: 'cmake log'
129        run: cat bld-cm/CMakeFiles/CMakeConfigureLog.yaml 2>/dev/null || true
130
131      - name: compare generated curl_config.h files
132        run: ./.github/scripts/cmp-config.pl bld-am/lib/curl_config.h bld-cm/lib/curl_config.h
133
134      - name: compare generated libcurl.pc files
135        run: ./.github/scripts/cmp-pkg-config.sh bld-am/libcurl.pc bld-cm/libcurl.pc
136
137      - name: compare generated curl-config files
138        run: ./.github/scripts/cmp-pkg-config.sh bld-am/curl-config bld-cm/curl-config
139