Fix detection of tcl and python with -Wl,--as-needed

The problem here was that libs where put into $LDFLAGS where they don't belong.
When you also use -Wl,--as-needed, sth like this is called:

  gcc -Wl,--as-needed -ltcl8.4 your.o objects.o here.o

Due to --as-needed, the linker will drop libtcl8.4 because by the time it sees
that option, nothing depends on it. And if nothing depends on some lib, it can
be dropped.

The fix here is obviously to put -ltcl8.4 into $LIBS (which is appended, not
prepended, to the command line).

The same reasoning goes for python.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2198 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2010-12-23 10:03:21 +00:00
parent aee8763c5d
commit e17348ca3f
2 changed files with 12 additions and 14 deletions

13
configure vendored
View File

@@ -3914,9 +3914,8 @@ fi
if test -n "$PYTHONCFG_BINARY"; then
my_saved_LDFLAGS="$LDFLAGS"
appendLD `$PYTHONCFG_BINARY --includes`
appendLD `$PYTHONCFG_BINARY --ldflags`
my_saved_LIBS="$LIBS"
appendLib `$PYTHONCFG_BINARY --ldflags`
ac_fn_cxx_check_func "$LINENO" "Py_Initialize" "ac_cv_func_Py_Initialize"
if test "x$ac_cv_func_Py_Initialize" = x""yes; then :
@@ -3970,7 +3969,7 @@ fi
as_fn_error $? "To compile modpython you need to be able to execute perl scripts. Try --disable-python or install perl." "$LINENO" 5
fi
fi
LDFLAGS="$my_saved_LDFLAGS"
LIBS="$my_saved_LIBS"
else
PYTHON="no"
fi
@@ -4106,8 +4105,8 @@ $as_echo_n "checking modtcl flags... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCL_FLAGS" >&5
$as_echo "$TCL_FLAGS" >&6; }
fi
my_saved_LDFLAGS="$LDFLAGS"
appendLD "$TCL_FLAGS"
my_saved_LIBS="$LIBS"
appendLib "$TCL_FLAGS"
ac_fn_cxx_check_func "$LINENO" "Tcl_CreateInterp" "ac_cv_func_Tcl_CreateInterp"
if test "x$ac_cv_func_Tcl_CreateInterp" = x""yes; then :
TCL_TEST=yes
@@ -4118,7 +4117,7 @@ fi
if test x"$TCL_TEST" = "xno"; then
as_fn_error $? "tcl not found, try --disable-tcl, or install tcl properly. If tcl is installed to a non-standard path, use --enable-tcl --with-tcl=/path" "$LINENO" 5
fi
LDFLAGS="$my_saved_LDFLAGS"
LIBS="$my_saved_LIBS"
fi
if test x"$EXTRA" = "xyes"

View File

@@ -333,9 +333,8 @@ if test "x$PYTHON" != "xno"; then
old_PYTHON="$PYTHON"
AC_PATH_PROG([PYTHONCFG_BINARY], ["$PYTHON"])
if test -n "$PYTHONCFG_BINARY"; then
my_saved_LDFLAGS="$LDFLAGS"
appendLD `$PYTHONCFG_BINARY --includes`
appendLD `$PYTHONCFG_BINARY --ldflags`
my_saved_LIBS="$LIBS"
appendLib `$PYTHONCFG_BINARY --ldflags`
AC_CHECK_FUNC([Py_Initialize], [], [PYTHON="no"])
if test "x$PYTHON" != "xno"; then
# Yes, modpython depends on perl.
@@ -344,7 +343,7 @@ if test "x$PYTHON" != "xno"; then
AC_MSG_ERROR([To compile modpython you need to be able to execute perl scripts. Try --disable-python or install perl.])
fi
fi
LDFLAGS="$my_saved_LDFLAGS"
LIBS="$my_saved_LIBS"
else
PYTHON="no"
fi
@@ -404,13 +403,13 @@ then
TCL_FLAGS="$TCL_INCLUDE_SPEC $TCL_LIB_SPEC"
AC_MSG_RESULT([$TCL_FLAGS])
fi
my_saved_LDFLAGS="$LDFLAGS"
appendLD "$TCL_FLAGS"
my_saved_LIBS="$LIBS"
appendLib "$TCL_FLAGS"
AC_CHECK_FUNC([Tcl_CreateInterp], [TCL_TEST=yes], [TCL_TEST=no])
if test x"$TCL_TEST" = "xno"; then
AC_MSG_ERROR([tcl not found, try --disable-tcl, or install tcl properly. If tcl is installed to a non-standard path, use --enable-tcl --with-tcl=/path])
fi
LDFLAGS="$my_saved_LDFLAGS"
LIBS="$my_saved_LIBS"
fi
if test x"$EXTRA" = "xyes"