Skip to content

Commit 2f9380c

Browse files
authored
undo erroneous removal of check for STDBOOL (#165)
* undo erroneous removal of check for STDBOOL * add build and test on linux add debian postgres headers and debug logging for fedora
1 parent fda89ab commit 2f9380c

2 files changed

Lines changed: 103 additions & 1 deletion

File tree

.github/workflows/linux.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Linux Build
2+
run-name: psql ODBC Linux CI - ${{ github.event.head_commit.message }}
3+
4+
on:
5+
push:
6+
branches: [ "main" ]
7+
pull_request:
8+
branches: [ "main" ]
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
build-and-test:
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- os: ubuntu-latest
21+
name: Debian (Ubuntu)
22+
- os: ubuntu-latest
23+
name: Red Hat (Fedora)
24+
container: fedora:latest
25+
26+
name: ${{ matrix.name }}
27+
runs-on: ${{ matrix.os }}
28+
container: ${{ matrix.container || '' }}
29+
30+
steps:
31+
- name: Install dependencies (Debian)
32+
if: matrix.container == ''
33+
run: |
34+
sudo apt-get update
35+
sudo apt-get install -y \
36+
build-essential autoconf automake libtool \
37+
libpq-dev unixodbc-dev unixodbc \
38+
postgresql postgresql-client
39+
if ! command -v odbc_config >/dev/null 2>&1; then
40+
sudo tee /usr/local/bin/odbc_config > /dev/null <<'EOF'
41+
#!/bin/sh
42+
case $1 in
43+
--include-prefix) echo "/usr/include" ;;
44+
--lib-prefix) echo "/usr/lib" ;;
45+
--libs) echo "-lodbc" ;;
46+
*) echo "$0: unknown argument '$1'"; exit 1 ;;
47+
esac
48+
EOF
49+
sudo chmod +x /usr/local/bin/odbc_config
50+
fi
51+
52+
- name: Install dependencies (Fedora)
53+
if: matrix.container == 'fedora:latest'
54+
run: |
55+
dnf install -y \
56+
gcc make autoconf automake libtool \
57+
libpq-devel unixODBC-devel postgresql-server postgresql \
58+
diffutils git
59+
60+
- name: Checkout
61+
uses: actions/checkout@v4
62+
63+
- name: Bootstrap
64+
run: autoreconf -fi
65+
66+
- name: Configure
67+
run: |
68+
PG_CONFIG=$(find /usr -name pg_config -type f 2>/dev/null | head -1)
69+
if [ -n "$PG_CONFIG" ]; then
70+
export PATH="$(dirname $PG_CONFIG):$PATH"
71+
fi
72+
./configure
73+
74+
- name: Build
75+
run: make -j$(nproc)
76+
77+
- name: Start PostgreSQL (Debian)
78+
if: matrix.container == ''
79+
run: |
80+
sudo mkdir -p /var/run/postgresql
81+
sudo chown postgres:postgres /var/run/postgresql
82+
sudo pg_ctlcluster $(pg_lsclusters -h | head -1 | awk '{print $1, $2}') start
83+
sudo -u postgres createuser -s runner
84+
sudo -u postgres createdb contrib_regression
85+
86+
- name: Start PostgreSQL (Fedora)
87+
if: matrix.container == 'fedora:latest'
88+
run: |
89+
mkdir -p /var/lib/pgsql/data /var/run/postgresql
90+
chown postgres:postgres /var/lib/pgsql/data /var/run/postgresql
91+
su postgres -c 'initdb -D /var/lib/pgsql/data' || { echo "initdb failed"; exit 1; }
92+
su postgres -c "sed -i 's/^logging_collector = on/logging_collector = off/' /var/lib/pgsql/data/postgresql.conf"
93+
su postgres -c 'pg_ctl -D /var/lib/pgsql/data -l /tmp/pg.log -t 30 start' || { cat /tmp/pg.log; exit 1; }
94+
su postgres -c 'createuser -s root'
95+
createdb contrib_regression
96+
97+
- name: Test
98+
run: |
99+
cd test
100+
make installcheck

configure.ac

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ AC_CHECK_SIZEOF([bool], [],
2828
#include <stdbool.h>
2929
#endif])
3030

31+
AC_CHECK_HEADER_STDBOOL()
32+
3133
dnl We use <stdbool.h> if we have it and it declares type bool as having
3234
dnl size 1. Otherwise, c.h will fall back to declaring bool as unsigned char.
33-
if test "$ac_cv_header_stdbool_h" = yes -a "$ac_cv_sizeof_bool" = 1; then
35+
if test "$ac_cv_header_stdbool_h" = yes && test "$ac_cv_sizeof_bool" = 1; then
3436
AC_DEFINE([PG_USE_STDBOOL], 1,
3537
[Define to 1 to use <stdbool.h> to define type bool.])
3638
fi

0 commit comments

Comments
 (0)