|
161 | 161 | # OK, create .c file to include this .h file.
|
162 | 162 | {
|
163 | 163 | echo 'extern "C" {'
|
164 |
| - test "$f" != src/include/postgres_fe.h && echo '#include "postgres.h"' |
| 164 | + # Ideally we'd pre-include only the appropriate one of |
| 165 | + # postgres.h, postgres_fe.h, or c.h. We don't always have enough |
| 166 | + # info to guess which, but in some subdirectories there's a |
| 167 | + # reasonable choice to make, and otherwise we use postgres.h. |
| 168 | + # Also, those three files should compile with no pre-include, as |
| 169 | + # should src/interfaces headers meant to be exposed to clients. |
| 170 | + case "$f" in |
| 171 | + src/include/postgres.h) ;; |
| 172 | + src/include/postgres_fe.h) ;; |
| 173 | + src/include/c.h) ;; |
| 174 | + src/interfaces/libpq/libpq-fe.h) ;; |
| 175 | + src/interfaces/libpq/libpq-events.h) ;; |
| 176 | + src/interfaces/ecpg/ecpglib/ecpglib_extern.h) |
| 177 | + echo '#include "postgres_fe.h"' ;; |
| 178 | + src/interfaces/ecpg/ecpglib/*) ;; |
| 179 | + src/interfaces/*) |
| 180 | + echo '#include "postgres_fe.h"' ;; |
| 181 | + src/bin/*) |
| 182 | + echo '#include "postgres_fe.h"' ;; |
| 183 | + src/fe_utils/*) |
| 184 | + echo '#include "postgres_fe.h"' ;; |
| 185 | + src/port/*) ;; |
| 186 | + src/common/*) |
| 187 | + echo '#include "c.h"' ;; |
| 188 | + *) |
| 189 | + echo '#include "postgres.h"' ;; |
| 190 | + esac |
165 | 191 | echo "#include \"$f\""
|
166 | 192 | echo '};'
|
167 | 193 | } >$tmp/test.cpp
|
|
174 | 200 | EXTRAINCLUDES="$python_includespec" ;;
|
175 | 201 | src/interfaces/ecpg/*)
|
176 | 202 | EXTRAINCLUDES="-I $builddir/src/interfaces/ecpg/include -I $srcdir/src/interfaces/ecpg/include" ;;
|
177 |
| - src/backend/parser/*) |
| 203 | + src/backend/parser/*) |
178 | 204 | EXTRAINCLUDES="-I $builddir/src/backend/parser/" ;;
|
179 |
| - src/backend/utils/adt/*) |
| 205 | + src/backend/utils/adt/*) |
180 | 206 | EXTRAINCLUDES="-I $builddir/src/backend/utils/adt/" ;;
|
181 | 207 | *)
|
182 | 208 | EXTRAINCLUDES="" ;;
|
|
0 commit comments