Replace most inappropriate uses of LDFLAGS with LIBS

Originally committed to SVN as r6097.
This commit is contained in:
Thomas Goyne 2011-12-22 21:24:40 +00:00
parent 48526bf341
commit 71109a87e1
8 changed files with 175 additions and 227 deletions

View File

@ -82,7 +82,7 @@ P_DOC =$(P_DATAROOT)/doc/aegisub/$(AEGISUB_VERSION_DATA)
CFLAGS_WX = @WX_CFLAGS@
CXXFLAGS_WX = @WX_CXXFLAGS@
CPPFLAGS_WX = @WX_CPPFLAGS@
LDFLAGS_WX = @WX_LIBS@
LIBS_WX = @WX_LIBS@
CFLAGS_FONTCONFIG = @FONTCONFIG_CFLAGS@
CFLAGS_FREETYPE = @FREETYPE_CFLAGS@
@ -100,22 +100,22 @@ CFLAGS_PORTAUDIO = @PORTAUDIO_CFLAGS@
CFLAGS_PTHREAD = @PTHREAD_CFLAGS@
CFLAGS_UCHARDET = -I../universalchardet
LDFLAGS_ALSA = @ALSA_LDFLAGS@
LDFLAGS_FONTCONFIG = @FONTCONFIG_LIBS@
LDFLAGS_FREETYPE = @FREETYPE_LIBS@
LDFLAGS_GL = @GL_LIBS@
LDFLAGS_FFMS = @FFMS_LIBS@
LDFLAGS_FFTW3 = @FFTW3_LIBS@
LDFLAGS_HUNSPELL = @HUNSPELL_LIBS@
LDFLAGS_ICONV = @ICONV_LDFLAGS@
LDFLAGS_LIBASS = @LIBASS_LIBS@
LDFLAGS_LIBCURL = @LIBCURL_LIBS@
LDFLAGS_LIBPULSE = @LIBPULSE_LIBS@
LIBS_ALSA = @ALSA_LIBS@
LIBS_FONTCONFIG = @FONTCONFIG_LIBS@
LIBS_FREETYPE = @FREETYPE_LIBS@
LIBS_GL = @GL_LIBS@
LIBS_FFMS = @FFMS_LIBS@
LIBS_FFTW3 = @FFTW3_LIBS@
LIBS_HUNSPELL = @HUNSPELL_LIBS@
LIBS_ICONV = @ICONV_LIBS@
LIBS_LIBASS = @LIBASS_LIBS@
LIBS_LIBCURL = @LIBCURL_LIBS@
LIBS_LIBPULSE = @LIBPULSE_LIBS@
LDFLAGS_LUA = @LUA_LDFLAGS@
LDFLAGS_OPENAL = @OPENAL_LIBS@
LDFLAGS_PTHREAD = @PTHREAD_LIBS@
LDFLAGS_PORTAUDIO = @PORTAUDIO_LIBS@
LDFLAGS_UCHARDET ?= ../universalchardet/libuniversalchardet.a
LIBS_OPENAL = @OPENAL_LIBS@
LIBS_PTHREAD = @PTHREAD_LIBS@
LIBS_PORTAUDIO = @PORTAUDIO_LIBS@
LIBS_UCHARDET ?= ../universalchardet/libuniversalchardet.a
#####################
# DEBUG / DEVELOPMENT
@ -123,10 +123,10 @@ LDFLAGS_UCHARDET ?= ../universalchardet/libuniversalchardet.a
PRECOMPILED_HEADER = @enable_gcc_prec@
CCACHE_ENABLE = @enable_ccache@
LDFLAGS_CCMALLOC = @CCMALLOC_LDFLAGS@
LDFLAGS_EFENCE = @EFENCE_LDFLAGS@
LDFLAGS_GCOV = @GCOV_LDFLAGS@
LIBS_EFENCE = @EFENCE_LIBS@
LIBS_GCOV = @GCOV_LIBS@
CFLAGS_EFENCE = @EFENCE_LDFLAGS@
CFLAGS_EFENCE = @EFENCE_CFLAGS@
CFLAGS_GCOV = @GCOV_CFLAGS@

View File

@ -30,19 +30,17 @@ $(LIB) : $(OBJ)
ifdef LIB_SHARED
LIB_SHARED_FULL = $(LIB_SHARED).$(LIB_VERSION)
$(LIB_SHARED) : $(OBJ)
$(BIN_CXX) $(LIB_SHARED_LINK) $(LDFLAGS) $(OBJ) $(LDFLAGS_POST) -o $(LIB_SHARED_FULL)
$(BIN_CXX) $(LIB_SHARED_LINK) $(LDFLAGS) $(OBJ) $(LIBS) -o $(LIB_SHARED_FULL)
$(BIN_LN) -sf $(LIB_SHARED_FULL) $(LIB_SHARED)
CLEANFILES+= $(LIB_SHARED_FULL)
endif
##########
# PROGRAMS
##########
$(PROGRAM): $(OBJ)
$(BIN_CXX) -o $@ $(LDFLAGS) $(OBJ) $(LDFLAGS_POST)
$(BIN_CXX) -o $@ $(LDFLAGS) $(OBJ) $(LIBS)
##########
# CLEANING

View File

@ -62,7 +62,7 @@ AS_CASE([$host],
AS_IF([test "$build_bsd" = "yes"], [
ICONV_CFLAGS="-I/usr/local/include"
ICONV_LDFLAGS="-L/usr/local/lib -liconv"
ICONV_LIBS="-L/usr/local/lib -liconv"
])
# Used for universalchardet.
@ -260,39 +260,26 @@ AC_CHECK_SIZEOF([time_t])
##############################
# Program Support and Features
##############################
##########################
# X
##########################
#########################
### Required Dependencies
#########################
AC_PATH_XTRA
AS_IF([test x$no_x = xyes && test x$build_darwin != xyes],
[AC_MSG_FAILURE([You must have a working copy of X installed.])])
#########
## OpenGL
#########
AX_CHECK_GL
AS_IF([test x$no_gl = xyes], [AC_MSG_FAILURE([Aegisub requires GL support.])])
AC_SUBST(GL_CFLAGS)
AC_SUBST(GL_LIBS)
#######
## cURL
#######
PKG_CHECK_MODULES(LIBCURL, libcurl >= curl_required_version,,
[AC_MSG_FAILURE([aegisub requires >= cURL curl_required_version])])
###########
## Freetype
###########
PKG_CHECK_MODULES(FREETYPE, freetype2 >= freetype_required_version,
AC_DEFINE(WITH_FREETYPE2, 1, [Enable FreeType 2 support.]),
[AC_MSG_FAILURE([Aegisub requires >= FreeType2 freetype_required_version])])
#############
## Fontconfig
#############
PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= fontconfig_required_version,
[AC_DEFINE(WITH_FONTCONFIG, 1, [Enable FontConfig support.])],
[AC_MSG_FAILURE([Aegisub requires fontconfig >= fontconfig_required_version])])
@ -301,17 +288,11 @@ PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= fontconfig_required_version,
## iconv
########
AC_ARG_VAR([ICONV_CFLAGS], [CFLAGS to use for iconv []])
AC_ARG_VAR([ICONV_LDFLAGS], [LDFLAGS to use for iconv [-liconv]])
AC_ARG_VAR([ICONV_LIBS], [LIBS to use for iconv [-liconv]])
AS_IF([test -z "$ICONV_LDFLAGS"], [
OLD_LIBS="$LIBS"
LIBS=""
AC_SEARCH_LIBS([iconv_open], [iconv])
ICONV_LDFLAGS="$LIBS"
LIBS="$OLD_LIBS"
])
AS_IF([test -z "$ICONV_LIBS"], AC_SEARCH_LIBS([iconv_open], [iconv]))
AC_AGI_COMPILE([iconv], [iconv], [$ICONV_CFLAGS], [$ICONV_LDFLAGS],[
AC_AGI_COMPILE([iconv], [iconv], [$ICONV_CFLAGS], [$ICONV_LIBS],[
#include <iconv.h>
int main(void) {
iconv_t ic;
@ -320,12 +301,12 @@ int main(void) {
return 0;
} ])
AC_SUBST(ICONV_LDFLAGS)
AC_SUBST(ICONV_LIBS)
AC_SUBST(ICONV_CFLAGS)
AS_IF([test x$agi_cv_with_iconv = xno], [AC_MSG_FAILURE([Please install a working iconv library.])])
AC_AGI_COMPILE([iconv (const)], [iconv_const], [$ICONV_CFLAGS], [$ICONV_LDFLAGS],[
AC_AGI_COMPILE([iconv (const)], [iconv_const], [$ICONV_CFLAGS], [$ICONV_LIBS],[
#include <iconv.h>
int main(void) {
iconv_t cd = iconv_open("UTF-16", "UTF-8");
@ -350,18 +331,18 @@ AC_ARG_WITH(alsa,
[build without ALSA audio provider [auto]]))
AC_ARG_VAR([ALSA_CFLAGS], [CFLAGS to use for ALSA []])
AC_ARG_VAR([ALSA_LDFLAGS], [LDFLAGS to use for ALSA [-lasound -lrt]])
AC_ARG_VAR([ALSA_LIBS], [LIBS to use for ALSA [-lasound -lrt]])
ALSA_LDFLAGS=${ALSA_LDFLAGS:--lasound -lrt}
ALSA_LIBS=${ALSA_LIBS:--lasound -lrt}
AS_IF([test x$with_alsa = xno],
[alsa_disabled="(disabled)"],
[AC_CHECK_LIB([asound], [snd_pcm_open], [with_alsa="yes"], [with_alsa="no"], $ALSA_LDFLAGS)])
[AC_CHECK_LIB([asound], [snd_pcm_open], [with_alsa="yes"], [with_alsa="no"], $ALSA_LIBS)])
AS_IF([test x$with_alsa = xyes], AC_DEFINE(WITH_ALSA, 1, [Enable ALSA Support]))
AC_SUBST(ALSA_CFLAGS)
AC_SUBST(ALSA_LDFLAGS)
AC_SUBST(ALSA_LIBS)
AC_SUBST(with_alsa)
############
@ -564,7 +545,7 @@ WX_UNICODE=$UNICODE
WX_CONFIG_CHECK([wx_required_version],,,[std,gl,stc],[$WXCONFIG_FLAGS])
AS_IF([test x$have_wxconfig = xno],
AC_MSG_FAILURE([wxWidgets detection failed, please set --with-wx* or add the libraries to your LDFLAGS, CXX/CFLAGS.]))
AC_MSG_FAILURE([wxWidgets detection failed, please set --with-wx* or add the libraries to your LIBS, CXX/CFLAGS.]))
AC_ARG_ENABLE(slow-wx-checks,
AS_HELP_STRING([--disable-slow-wx-checks],[Disable slow-running checks for wx components.]))
@ -657,18 +638,18 @@ AS_IF([test x$enable_profile = xyes], [
# gcov
######
AC_ARG_VAR([GCOV_CFLAGS], [gcov cflag(s) to use with --enable-gcov [-ftest-coverage -fprofile-arcs]])
AC_ARG_VAR([GCOV_LDFLAGS], [gcov ldflag(s) to use with --enable-gcov [-lgcov]])
AC_ARG_VAR([GCOV_LIBS], [gcov ldflag(s) to use with --enable-gcov [-lgcov]])
AC_MSG_CHECKING([whether to turn on gcov])
AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov],[enable gcov [no]]))
AS_IF([test x$enable_gcov = xyes], [
GCOV_CFLAGS=${GCOV_CLFAGS:--fprofile-arcs -ftest-coverage}
GCOV_LDFLAGS=${GCOV_LDFLAGS:--lgcov}
GCOV_LIBS=${GCOV_LIBS:--lgcov}
AC_MSG_RESULT([yes ($GCOV_CFLAGS) ($GCOV_LDFLAGS)])
AC_MSG_RESULT([yes ($GCOV_CFLAGS) ($GCOV_LIBS)])
CFLAGS="$CFLAGS $GCOV_CFLAGS"
LDFLAGS="$LDFLAGS $GCOV_LDFLAGS"
LIBS="$LIBS $GCOV_LIBS"
], [
enable_gcov="no"
AC_MSG_RESULT([no])
@ -677,18 +658,18 @@ AS_IF([test x$enable_gcov = xyes], [
################
# Electric Fence
################
AC_ARG_VAR([EFENCE_LDFLAGS], [Electric Fence ldflag(s) to use with --enable-profile [-lefence]])
AC_ARG_VAR([EFENCE_LIBS], [Electric Fence ldflag(s) to use with --enable-profile [-lefence]])
AC_MSG_CHECKING([whether to turn on Electric Fence])
AC_ARG_ENABLE(efence, AS_HELP_STRING([--enable-efence],[enable Electric Fence [no]]))
AS_IF([test x$enable_efence = xyes], [
EFENCE_LDFLAGS=${EFENCE_LDFLAGS:--lefence}
AC_MSG_RESULT([yes ($EFENCE_LDFLAGS)])
EFENCE_LIBS=${EFENCE_LIBS:--lefence}
AC_MSG_RESULT([yes ($EFENCE_LIBS)])
], [
enable_efence="no"
AC_MSG_RESULT([no])
])
AC_SUBST(EFENCE_LDFLAGS)
AC_SUBST(EFENCE_LIBS)
##########
# ccmalloc
@ -808,6 +789,7 @@ Configure settings
CXXFLAGS $CXXFLAGS
CPPFLAGS $CPPFLAGS
LDFLAGS $LDFLAGS
LIBS $LIBS
Default Settings
Audio Player: $default_player_audio

View File

@ -13,7 +13,7 @@ lagi_pre.h.gch: CXXFLAGS := $(CXXFLAGS)
ifeq (yes, $(BUILD_DARWIN))
CXXFLAGS += -I/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Headers/
LDFLAGS += -L../universalchardet -luniversalchardet
LIBS += -L../universalchardet -luniversalchardet
endif
common/charset_conv.o: CXXFLAGS += $(CFLAGS_ICONV)

View File

@ -1,43 +1,29 @@
AC_DEFUN([AC_AGI_COMPILE],[
aegisub_save_LDFLAGS="$LDFLAGS"
aegisub_save_LIBS="$LIBS"
aegisub_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$3"
LDFLAGS="$4"
CPPFLAGS="$CPPFLAGS $3"
LIBS="$LIBS $4"
AC_CACHE_CHECK(
[whether $1 works], [agi_cv_with_$2],
[AC_RUN_IFELSE([AC_LANG_SOURCE([$5])],
[eval agi_cv_with_$2="yes"],
[eval agi_cv_with_$2="no"],
[if test $? -ne 0; then
eval agi_cv_with_$2="no";
else
eval agi_cv_with_$2="yes";
fi])
])
[AS_IF([test $? -ne 0], [eval agi_cv_with_$2="no"], [eval agi_cv_with_$2="yes"])])])
CPPFLAGS="$aegisub_save_CPPFLAGS"
LDFLAGS="$aegisub_save_LDFLAGS"
LIBS="$aegisub_save_LIBS"
])
AC_DEFUN([AC_AGI_LINK],[
aegisub_save_LIBS="$LIBS"
aegisub_save_CPPFLAGS="$CPPFLAGS"
aegisub_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$4"
CXXFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $4"
LIBS="$LIBS $5"
AC_CHECK_HEADER([$3], [agi_cv_header="yes"], [agi_cv_header="no"])
if test "$agi_cv_header" = "yes"; then
aegisub_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$5"
AC_CACHE_CHECK(
AS_IF([test "x$agi_cv_header" = xyes],
[AC_CACHE_CHECK(
[whether $1 works], [agi_cv_with_$2],
[AC_LINK_IFELSE([AC_LANG_SOURCE([$6])],
[eval agi_cv_with_$2="yes"],
[AC_LINK_IFELSE([AC_LANG_SOURCE([$6])], [eval agi_cv_with_$2="yes"], [eval agi_cv_with_$2="no"])])]
[eval agi_cv_with_$2="no"])
])
LDFLAGS="$aegisub_save_LDFLAGS"
else
eval agi_cv_with_$2="no"
fi
CPPFLAGS="$aegisub_save_CPPFLAGS"
CXXFLAGS="$aegisub_save_CXXFLAGS"
LIBS="$aegisub_save_LIBS"
])

View File

@ -4,27 +4,9 @@ PROGRAM = reporter-3.0
PROGRAM_INSTALL = yes
PRECOMPILED_HEADER_NAME=r_pre.h
#if PRECOMPILED_HEADER
#BUILT_SOURCES = r_pre.h.gch
#AM_CXXFLAGS += -include r_pre.h -Winvalid-pch -fpch-deps -fpch-preprocess
#nodist_reporter_3_0_SOURCES = r_prec.h.gch
#endif
CXXFLAGS += -Iinclude $(CFLAGS_WX) -I../libaegisub/include
LDFLAGS += $(LDFLAGS_WX) $(LDFLAGS_LIBCURL) -L../libaegisub -laegisub-3.0 $(LDFLAGS_UCHARDET) -Wl,-rpath ../libaegisub $(LDFLAGS_GL)
ifeq (yes, $(HAVE_PROVIDER_FFMPEGSOURCE))
LDFLAGS += $(LDFLAGS_LIBAVFORMAT) $(LDFLAGS_LIBAVCODEC) $(LDFLAGS_LIBSWSCALE) $(LDFLAGS_LIBAVUTIL) $(LDFLAGS_LIBPOSTPROC)
endif
#if PRECOMPILED_HEADER
## This doesn't depend on Makefile on purpose, you should already know what you're doing when using this.
#r_pre.h.gch: r_pre.h
# @CXX@ @WX_CPPFLAGS@ @CXXFLAGS@ @DEBUG_FLAGS@ r_pre.h
#DISTCLEANFILES += r_pre.h.gch
#endif
LIBS += $(LIBS_WX) $(LIBS_LIBCURL) -L../libaegisub -laegisub-3.0 $(LIBS_UCHARDET) $(LIBS_GL)
LDFLAGS += -Wl,-rpath ../libaegisub
# File-specific flags
upload.o: CXXFLAGS += $(CFLAGS_CURL)

View File

@ -10,14 +10,16 @@ AEGISUB_CFLAGS = -I. -I.. -Iinclude -I../libaegisub/include -DAEGISUB $(CFLAGS_
CFLAGS += $(AEGISUB_CFLAGS)
CXXFLAGS += $(AEGISUB_CFLAGS) -D__STDC_FORMAT_MACROS $(CXXFLAGS_WX)
LDFLAGS += -L../libaegisub -laegisub-3.0
LDFLAGS += $(LDFLAGS_CCMALLOC) $(LDFLAGS_EFENCE) $(LDFLAGS_GL)
LDFLAGS += $(LDFLAGS_PTHREAD) $(LDFLAGS_WX) $(LDFLAGS_FREETYPE)
LDFLAGS += $(LDFLAGS_FONTCONFIG) $(LDFLAGS_FFTW3)
LDFLAGS_POST += $(LDFLAGS_UCHARDET)
LIBS += -L../libaegisub -laegisub-3.0
LIBS += $(LIBS_CCMALLOC) $(LIBS_EFENCE) $(LIBS_GL)
LIBS += $(LIBS_PTHREAD) $(LIBS_WX) $(LIBS_FREETYPE)
LIBS += $(LIBS_FONTCONFIG) $(LIBS_FFTW3)
LIBS += $(LIBS_UCHARDET)
LDFLAGS += $(LDFLAGS_CCMALLOC)
ifdef BUILD_DARWIN
LDFLAGS += -lz
LIBS += -lz
endif
###############
@ -26,25 +28,25 @@ endif
ifeq (yes, $(HAVE_ALSA))
SRC_OPT += audio_player_alsa.cpp
audio_player_alsa.o: CXXFLAGS += $(CFLAGS_ALSA)
LDFLAGS += $(LDFLAGS_ALSA)
LIBS += $(LIBS_ALSA)
endif
ifeq (yes, $(HAVE_PORTAUDIO))
SRC_OPT += audio_player_portaudio.cpp
audio_player_portaudio.o: CXXFLAGS += $(CFLAGS_PORTAUDIO)
LDFLAGS += $(LDFLAGS_PORTAUDIO)
LIBS += $(LIBS_PORTAUDIO)
endif
ifeq (yes, $(HAVE_PULSEAUDIO))
SRC_OPT += audio_player_pulse.cpp
audio_player_pulse.o: CXXFLAGS += $(CFLAGS_LIBPULSE)
LDFLAGS += $(LDFLAGS_LIBPULSE)
LIBS += $(LIBS_LIBPULSE)
endif
ifeq (yes, $(HAVE_OPENAL))
SRC_OPT += audio_player_openal.cpp
audio_player_openal.o: CXXFLAGS += $(CFLAGS_OPENAL)
LDFLAGS += $(LDFLAGS_OPENAL)
LIBS += $(LIBS_OPENAL)
endif
ifeq (yes, $(HAVE_OSS))
@ -58,8 +60,7 @@ ifeq (yes, $(HAVE_FFMS))
SRC_OPT += audio_provider_ffmpegsource.cpp video_provider_ffmpegsource.cpp ffmpegsource_common.cpp
audio_provider_ffmpegsource.o video_provider_ffmpegsource.o ffmpegsource_common.o: \
CXXFLAGS += $(CFLAGS_FFMS)
LDFLAGS += $(LDFLAGS_FFMS)
LDFLAGS_POST += $(LDFLAGS_FFMS)
LIBS += $(LIBS_FFMS)
endif
###########
@ -68,8 +69,7 @@ endif
ifeq (yes, $(HAVE_LIBASS))
SRC_OPT += subtitles_provider_libass.cpp
subtitles_provider_libass.o: CXXFLAGS += $(CFLAGS_LIBASS)
LDFLAGS += $(LDFLAGS_LIBASS)
LDFLAGS_POST += $(LDFLAGS_LIBASS)
LIBS += $(LIBS_LIBASS)
endif
############
@ -87,7 +87,7 @@ endif
ifeq (yes, $(HAVE_HUNSPELL))
SRC_OPT += spellchecker_hunspell.cpp
spellchecker_hunspell.o: CXXFLAGS += $(CFLAGS_HUNSPELL)
LDFLAGS += $(LDFLAGS_HUNSPELL)
LIBS += $(LIBS_HUNSPELL)
endif
#####################

View File

@ -3,8 +3,8 @@ include ../Makefile.inc
PROGRAM = run
LDFLAGS += -L../libaegisub -laegisub-3.0 -Wl,-rpath $(CURDIR)/../libaegisub -lgtest -L../universalchardet -luniversalchardet
LDFLAGS += $(LDFLAGS_ICONV)
LIBS += -L../libaegisub -laegisub-3.0 -lgtest -L../universalchardet -luniversalchardet
LDFLAGS += -Wl,-rpath $(CURDIR)/../libaegisub $(LDFLAGS_ICONV)
CPPFLAGS += -I../src/include -I../libaegisub/include $(CFLAGS_ICONV)
CXXFLAGS += -Wno-unused-value