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

Commit4d399a6

Browse files
committed
Bring configure support for LZ4 up to snuff.
It's not okay to just shove the pkg_config results right into ourbuild flags, for a couple different reasons:* This fails to maintain the separation between CPPFLAGS and CFLAGS,as well as that between LDFLAGS and LIBS. (The CPPFLAGS angle is,I believe, the reason for warning messages reported when buildingwith MacPorts' liblz4.)* If pkg_config emits anything other than -I/-D/-L/-l switches,it's highly unlikely that we want to absorb those. That'd be morelikely to break the build than do anything helpful. (Even the -Dcase is questionable; but we're doing that for libxml2, so I kept it.)Also, it's not okay to skip doing an AC_CHECK_LIB probe, asevidenced by recent build failure on topminnow; that shouldhave been caught at configure time.Model fixes for this on configure's libxml2 support.It appears that somebody overlooked an autoheader run, too.Discussion:https://postgr.es/m/20210119190720.GL8560@telsasoft.com
1 parentfd1ac9a commit4d399a6

File tree

4 files changed

+91
-5
lines changed

4 files changed

+91
-5
lines changed

‎configure

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8699,8 +8699,18 @@ else
86998699
$as_echo "yes" >&6; }
87008700

87018701
fi
8702-
LIBS="$LZ4_LIBS $LIBS"
8703-
CFLAGS="$LZ4_CFLAGS $CFLAGS"
8702+
# We only care about -I, -D, and -L switches;
8703+
# note that -llz4 will be added by AC_CHECK_LIB below.
8704+
for pgac_option in $LZ4_CFLAGS; do
8705+
case $pgac_option in
8706+
-I*|-D*) CPPFLAGS="$CPPFLAGS $pgac_option";;
8707+
esac
8708+
done
8709+
for pgac_option in $LZ4_LIBS; do
8710+
case $pgac_option in
8711+
-L*) LDFLAGS="$LDFLAGS $pgac_option";;
8712+
esac
8713+
done
87048714
fi
87058715

87068716
#
@@ -12816,6 +12826,56 @@ fi
1281612826

1281712827
fi
1281812828

12829+
if test "$with_lz4" = yes ; then
12830+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LZ4_compress_default in -llz4" >&5
12831+
$as_echo_n "checking for LZ4_compress_default in -llz4... " >&6; }
12832+
if ${ac_cv_lib_lz4_LZ4_compress_default+:} false; then :
12833+
$as_echo_n "(cached) " >&6
12834+
else
12835+
ac_check_lib_save_LIBS=$LIBS
12836+
LIBS="-llz4 $LIBS"
12837+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12838+
/* end confdefs.h. */
12839+
12840+
/* Override any GCC internal prototype to avoid an error.
12841+
Use char because int might match the return type of a GCC
12842+
builtin and then its argument prototype would still apply. */
12843+
#ifdef __cplusplus
12844+
extern "C"
12845+
#endif
12846+
char LZ4_compress_default ();
12847+
int
12848+
main ()
12849+
{
12850+
return LZ4_compress_default ();
12851+
;
12852+
return 0;
12853+
}
12854+
_ACEOF
12855+
if ac_fn_c_try_link "$LINENO"; then :
12856+
ac_cv_lib_lz4_LZ4_compress_default=yes
12857+
else
12858+
ac_cv_lib_lz4_LZ4_compress_default=no
12859+
fi
12860+
rm -f core conftest.err conftest.$ac_objext \
12861+
conftest$ac_exeext conftest.$ac_ext
12862+
LIBS=$ac_check_lib_save_LIBS
12863+
fi
12864+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lz4_LZ4_compress_default" >&5
12865+
$as_echo "$ac_cv_lib_lz4_LZ4_compress_default" >&6; }
12866+
if test "x$ac_cv_lib_lz4_LZ4_compress_default" = xyes; then :
12867+
cat >>confdefs.h <<_ACEOF
12868+
#define HAVE_LIBLZ4 1
12869+
_ACEOF
12870+
12871+
LIBS="-llz4 $LIBS"
12872+
12873+
else
12874+
as_fn_error $? "library 'lz4' is required for LZ4 support" "$LINENO" 5
12875+
fi
12876+
12877+
fi
12878+
1281912879
# Note: We can test for libldap_r only after we know PTHREAD_LIBS
1282012880
if test "$with_ldap" = yes ; then
1282112881
_LIBS="$LIBS"

‎configure.ac

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -997,8 +997,18 @@ AC_SUBST(with_lz4)
997997

998998
if test "$with_lz4" = yes; then
999999
PKG_CHECK_MODULES(LZ4, liblz4)
1000-
LIBS="$LZ4_LIBS $LIBS"
1001-
CFLAGS="$LZ4_CFLAGS $CFLAGS"
1000+
# We only care about -I, -D, and -L switches;
1001+
# note that -llz4 will be added by AC_CHECK_LIB below.
1002+
for pgac_option in $LZ4_CFLAGS; do
1003+
case $pgac_option in
1004+
-I*|-D*) CPPFLAGS="$CPPFLAGS $pgac_option";;
1005+
esac
1006+
done
1007+
for pgac_option in $LZ4_LIBS; do
1008+
case $pgac_option in
1009+
-L*) LDFLAGS="$LDFLAGS $pgac_option";;
1010+
esac
1011+
done
10021012
fi
10031013

10041014
#
@@ -1271,6 +1281,10 @@ if test "$with_libxslt" = yes ; then
12711281
AC_CHECK_LIB(xslt,xsltCleanupGlobals,[],[AC_MSG_ERROR([library 'xslt' is required for XSLT support])])
12721282
fi
12731283

1284+
if test "$with_lz4" = yes ; then
1285+
AC_CHECK_LIB(lz4,LZ4_compress_default,[],[AC_MSG_ERROR([library 'lz4' is required for LZ4 support])])
1286+
fi
1287+
12741288
# Note: We can test for libldap_r only after we know PTHREAD_LIBS
12751289
if test "$with_ldap" = yes ; then
12761290
_LIBS="$LIBS"

‎src/include/pg_config.h.in

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@
319319
/* Define to 1 if you have the `ldap_r' library (-lldap_r). */
320320
#undef HAVE_LIBLDAP_R
321321

322+
/* Define to 1 if you have the `lz4' library (-llz4). */
323+
#undef HAVE_LIBLZ4
324+
322325
/* Define to 1 if you have the `m' library (-lm). */
323326
#undef HAVE_LIBM
324327

@@ -358,6 +361,12 @@
358361
/* Define to 1 if `long long int' works and is 64 bits. */
359362
#undef HAVE_LONG_LONG_INT_64
360363

364+
/* Define to 1 if you have the <lz4.h> header file. */
365+
#undef HAVE_LZ4_H
366+
367+
/* Define to 1 if you have the <lz4/lz4.h> header file. */
368+
#undef HAVE_LZ4_LZ4_H
369+
361370
/* Define to 1 if you have the <mbarrier.h> header file. */
362371
#undef HAVE_MBARRIER_H
363372

@@ -902,7 +911,7 @@
902911
/* Define to 1 to build with LLVM based JIT support. (--with-llvm) */
903912
#undef USE_LLVM
904913

905-
/* Define to 1 to build with LZ4 support (--with-lz4) */
914+
/* Define to 1 to build with LZ4 support. (--with-lz4) */
906915
#undef USE_LZ4
907916

908917
/* Define to select named POSIX semaphores. */

‎src/tools/msvc/Solution.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ sub GenerateFiles
298298
HAVE_LIBCRYPTO=>undef,
299299
HAVE_LIBLDAP=>undef,
300300
HAVE_LIBLDAP_R=>undef,
301+
HAVE_LIBLZ4=>undef,
301302
HAVE_LIBM=>undef,
302303
HAVE_LIBPAM=>undef,
303304
HAVE_LIBREADLINE=>undef,
@@ -311,6 +312,8 @@ sub GenerateFiles
311312
HAVE_LOCALE_T=> 1,
312313
HAVE_LONG_INT_64=>undef,
313314
HAVE_LONG_LONG_INT_64=> 1,
315+
HAVE_LZ4_H=>undef,
316+
HAVE_LZ4_LZ4_H=>undef,
314317
HAVE_MBARRIER_H=>undef,
315318
HAVE_MBSTOWCS_L=> 1,
316319
HAVE_MEMORY_H=> 1,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp