Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdb2277a

Browse files
author
Erlend Egeberg Aasland
authored
bpo-45723: Add helpers for save/restore env (GH-29637)
1 parentd2b55b0 commitdb2277a

File tree

3 files changed

+73
-41
lines changed

3 files changed

+73
-41
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Add ``autoconf`` helpers for saving and restoring environment variables:
2+
3+
* ``SAVE_ENV``: Save ``$CFLAGS``, ``$LDFLAGS``, ``$LIBS``, and
4+
``$CPPFLAGS``.
5+
* ``RESTORE_ENV``: Restore ``$CFLAGS``, ``$LDFLAGS``, ``$LIBS``, and
6+
``$CPPFLAGS``.
7+
* ``WITH_SAVE_ENV([SCRIPT])``: Run ``SCRIPT`` wrapped with ``SAVE_ENV`` and
8+
``RESTORE_ENV``.
9+
10+
Patch by Erlend E. Aasland.

‎configure

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2866,6 +2866,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
28662866

28672867

28682868

2869+
28692870
if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then
28702871
# If we're building out-of-tree, we need to make sure the following
28712872
# resources get picked up before their $srcdir counterparts.
@@ -11085,13 +11086,14 @@ save_CFLAGS=$CFLAGS
1108511086
save_CPPFLAGS=$CPPFLAGS
1108611087
save_LDFLAGS=$LDFLAGS
1108711088
save_LIBS=$LIBS
11088-
CPPFLAGS="$LIBSQLITE3_CFLAGS $CFLAGS"
11089-
LDFLAGS="$LIBSQLITE3_LIBS $LDFLAGS"
1109011089

11091-
ac_fn_c_check_header_mongrel "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default"
11090+
CPPFLAGS="$LIBSQLITE3_CFLAGS $CFLAGS"
11091+
LDFLAGS="$LIBSQLITE3_LIBS $LDFLAGS"
11092+
11093+
ac_fn_c_check_header_mongrel "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default"
1109211094
if test "x$ac_cv_header_sqlite3_h" = xyes; then :
1109311095

11094-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_open_v2 in -lsqlite3" >&5
11096+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_open_v2 in -lsqlite3" >&5
1109511097
$as_echo_n "checking for sqlite3_open_v2 in -lsqlite3... " >&6; }
1109611098
if ${ac_cv_lib_sqlite3_sqlite3_open_v2+:} false; then :
1109711099
$as_echo_n "(cached) " >&6
@@ -11129,15 +11131,15 @@ fi
1112911131
$as_echo "$ac_cv_lib_sqlite3_sqlite3_open_v2" >&6; }
1113011132
if test "x$ac_cv_lib_sqlite3_sqlite3_open_v2" = xyes; then :
1113111133

11132-
have_sqlite3=yes
11133-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
11134+
have_sqlite3=yes
11135+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1113411136
/* end confdefs.h. */
1113511137

1113611138

11137-
#include <sqlite3.h>
11138-
#if SQLITE_VERSION_NUMBER < 3007015
11139-
# error "SQLite 3.7.15 or higher required"
11140-
#endif
11139+
#include <sqlite3.h>
11140+
#if SQLITE_VERSION_NUMBER < 3007015
11141+
# error "SQLite 3.7.15 or higher required"
11142+
#endif
1114111143

1114211144
int
1114311145
main ()
@@ -11159,7 +11161,7 @@ else
1115911161
have_sqlite3=no
1116011162
fi
1116111163

11162-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_load_extension in -lsqlite3" >&5
11164+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqlite3_load_extension in -lsqlite3" >&5
1116311165
$as_echo_n "checking for sqlite3_load_extension in -lsqlite3... " >&6; }
1116411166
if ${ac_cv_lib_sqlite3_sqlite3_load_extension+:} false; then :
1116511167
$as_echo_n "(cached) " >&6
@@ -11211,6 +11213,8 @@ CPPFLAGS=$save_CPPFLAGS
1121111213
LDFLAGS=$save_LDFLAGS
1121211214
LIBS=$save_LIBS
1121311215

11216+
11217+
1121411218
# Check for support for loadable sqlite extensions
1121511219
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-loadable-sqlite-extensions" >&5
1121611220
$as_echo_n "checking for --enable-loadable-sqlite-extensions... " >&6; }

‎configure.ac

Lines changed: 48 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,32 @@ m4_ifdef(
2323
[AC_MSG_ERROR([Please install pkgconf's m4 macro package and re-run autoreconf])]
2424
)dnl
2525

26+
dnl Helpers for saving and restoring environment variables:
27+
dnl - _SAVE_VAR([VAR]) Helper for SAVE_ENV; stores VAR as save_VAR
28+
dnl - _RESTORE_VAR([VAR]) Helper for RESTORE_ENV; restores VAR from save_VAR
29+
dnl - SAVE_ENV Saves CFLAGS, LDFLAGS, LIBS, and CPPFLAGS
30+
dnl - RESTORE_ENV Restores CFLAGS, LDFLAGS, LIBS, and CPPFLAGS
31+
dnl - WITH_SAVE_ENV([SCRIPT]) Runs SCRIPT wrapped with SAVE_ENV/RESTORE_ENV
32+
AC_DEFUN([_SAVE_VAR],[AS_VAR_COPY([save_][$1],[$1])])dnl
33+
AC_DEFUN([_RESTORE_VAR],[AS_VAR_COPY([$1],[save_][$1])])dnl
34+
AC_DEFUN([SAVE_ENV],
35+
[_SAVE_VAR([CFLAGS])]
36+
[_SAVE_VAR([CPPFLAGS])]
37+
[_SAVE_VAR([LDFLAGS])]
38+
[_SAVE_VAR([LIBS])]
39+
)dnl
40+
AC_DEFUN([RESTORE_ENV],
41+
[_RESTORE_VAR([CFLAGS])]
42+
[_RESTORE_VAR([CPPFLAGS])]
43+
[_RESTORE_VAR([LDFLAGS])]
44+
[_RESTORE_VAR([LIBS])]
45+
)dnl
46+
AC_DEFUN([WITH_SAVE_ENV],
47+
[SAVE_ENV]
48+
[$1]
49+
[RESTORE_ENV]
50+
)dnl
51+
2652
AC_SUBST(BASECPPFLAGS)
2753
if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then
2854
# If we're building out-of-tree, we need to make sure the following
@@ -3174,37 +3200,29 @@ PKG_CHECK_MODULES(
31743200
)
31753201
AS_VAR_APPEND([LIBSQLITE3_CFLAGS],[' -I$(srcdir)/Modules/_sqlite'])
31763202

3203+
WITH_SAVE_ENV(
31773204
dnl bpo-45774/GH-29507: The CPP check in AC_CHECK_HEADER can fail on FreeBSD,
3178-
dnl hence CPPFLAGS instead of CFLAGS. We still need to save CFLAGS, because it
3179-
dnl is touched by AC_CHECK_HEADER.
3180-
AS_VAR_COPY([save_CFLAGS],[CFLAGS])
3181-
AS_VAR_COPY([save_CPPFLAGS],[CPPFLAGS])
3182-
AS_VAR_COPY([save_LDFLAGS],[LDFLAGS])
3183-
AS_VAR_COPY([save_LIBS],[LIBS])
3184-
CPPFLAGS="$LIBSQLITE3_CFLAGS $CFLAGS"
3185-
LDFLAGS="$LIBSQLITE3_LIBS $LDFLAGS"
3186-
3187-
AC_CHECK_HEADER([sqlite3.h],[
3188-
AC_CHECK_LIB([sqlite3],[sqlite3_open_v2],[
3189-
have_sqlite3=yes
3190-
AC_COMPILE_IFELSE([
3191-
AC_LANG_PROGRAM([
3192-
#include <sqlite3.h>
3193-
#if SQLITE_VERSION_NUMBER < 3007015
3194-
# error "SQLite 3.7.15 or higher required"
3195-
#endif
3196-
],[])
3197-
],[have_supported_sqlite3=yes],[have_supported_sqlite3=no])
3198-
],[have_sqlite3=no])
3199-
AC_CHECK_LIB([sqlite3],[sqlite3_load_extension],
3200-
[have_sqlite3_load_extension=yes],
3201-
[have_sqlite3_load_extension=no])
3202-
])
3203-
3204-
AS_VAR_COPY([CFLAGS],[save_CFLAGS])
3205-
AS_VAR_COPY([CPPFLAGS],[save_CPPFLAGS])
3206-
AS_VAR_COPY([LDFLAGS],[save_LDFLAGS])
3207-
AS_VAR_COPY([LIBS],[save_LIBS])
3205+
dnl hence CPPFLAGS instead of CFLAGS.
3206+
CPPFLAGS="$LIBSQLITE3_CFLAGS $CFLAGS"
3207+
LDFLAGS="$LIBSQLITE3_LIBS $LDFLAGS"
3208+
3209+
AC_CHECK_HEADER([sqlite3.h],[
3210+
AC_CHECK_LIB([sqlite3],[sqlite3_open_v2],[
3211+
have_sqlite3=yes
3212+
AC_COMPILE_IFELSE([
3213+
AC_LANG_PROGRAM([
3214+
#include <sqlite3.h>
3215+
#if SQLITE_VERSION_NUMBER < 3007015
3216+
# error "SQLite 3.7.15 or higher required"
3217+
#endif
3218+
],[])
3219+
],[have_supported_sqlite3=yes],[have_supported_sqlite3=no])
3220+
],[have_sqlite3=no])
3221+
AC_CHECK_LIB([sqlite3],[sqlite3_load_extension],
3222+
[have_sqlite3_load_extension=yes],
3223+
[have_sqlite3_load_extension=no])
3224+
])
3225+
)
32083226

32093227
# Check for support for loadable sqlite extensions
32103228
AC_MSG_CHECKING(for--enable-loadable-sqlite-extensions)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp