Skip to content

Commit

Permalink
autoconf: Add --disable-embed-stdcxx to suppress linking libstdc++.a …
Browse files Browse the repository at this point in the history
…into llvm.dll with --enable-shared on Cygming.

Cygwin has stdc++.dll in it's distribution, and we can assume distro's stdc++.dll might be available.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122622 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
chapuni committed Dec 29, 2010
1 parent 0dc8439 commit 8eac886
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Makefile.config.in
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ ENABLE_PIC := @ENABLE_PIC@
# Do we want to build a shared library and link the tools with it?
ENABLE_SHARED := @ENABLE_SHARED@

# Do we want to link the stdc++ into a shared library? (Cygming)
ENABLE_EMBED_STDCXX := @ENABLE_EMBED_STDCXX@

# Use -fvisibility-inlines-hidden?
ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@

Expand Down
12 changes: 12 additions & 0 deletions autoconf/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,18 @@ case "$enableval" in
*) AC_MSG_ERROR([Invalid setting for --enable-shared. Use "yes" or "no"]) ;;
esac

dnl Allow libstdc++ is embedded in LLVM.dll.
AC_ARG_ENABLE(embed-stdcxx,
AS_HELP_STRING([--enable-embed-stdcxx],
[Build a shared library with embedded libstdc++ for Win32 DLL (default is YES)]),,
enableval=default)
case "$enableval" in
yes) AC_SUBST(ENABLE_EMBED_STDCXX,[1]) ;;
no) AC_SUBST(ENABLE_EMBED_STDCXX,[0]) ;;
default) AC_SUBST(ENABLE_EMBED_STDCXX,[1]) ;;
*) AC_MSG_ERROR([Invalid setting for --enable-embed-stdcxx. Use "yes" or "no"]) ;;
esac

dnl Enable embedding timestamp information into build.
AC_ARG_ENABLE(timestamps,
AS_HELP_STRING([--enable-timestamps],
Expand Down
31 changes: 27 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@ ENABLE_THREADS
ENABLE_PTHREADS
ENABLE_PIC
ENABLE_SHARED
ENABLE_EMBED_STDCXX
ENABLE_TIMESTAMPS
TARGETS_TO_BUILD
LLVM_ENUM_TARGETS
Expand Down Expand Up @@ -1421,6 +1422,8 @@ Optional Features:
is YES)
--enable-shared Build a shared library and link tools against it
(default is NO)
--enable-embed-stdcxx Build a shared library with embedded libstdc++ for
Win32 DLL (default is YES)
--enable-timestamps Enable embedding timestamp information in build
(default is YES)
--enable-targets Build specific host targets: all or
Expand Down Expand Up @@ -4999,6 +5002,25 @@ echo "$as_me: error: Invalid setting for --enable-shared. Use \"yes\" or \"no\""
{ (exit 1); exit 1; }; } ;;
esac

# Check whether --enable-embed-stdcxx was given.
if test "${enable_embed_stdcxx+set}" = set; then
enableval=$enable_embed_stdcxx;
else
enableval=default
fi

case "$enableval" in
yes) ENABLE_EMBED_STDCXX=1
;;
no) ENABLE_EMBED_STDCXX=0
;;
default) ENABLE_EMBED_STDCXX=1
;;
*) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-embed-stdcxx. Use \"yes\" or \"no\"" >&5
echo "$as_me: error: Invalid setting for --enable-embed-stdcxx. Use \"yes\" or \"no\"" >&2;}
{ (exit 1); exit 1; }; } ;;
esac

# Check whether --enable-timestamps was given.
if test "${enable_timestamps+set}" = set; then
enableval=$enable_timestamps;
Expand Down Expand Up @@ -11539,7 +11561,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 11542 "configure"
#line 11564 "configure"
#include "confdefs.h"

#if HAVE_DLFCN_H
Expand Down Expand Up @@ -21812,11 +21834,11 @@ ENABLE_THREADS!$ENABLE_THREADS$ac_delim
ENABLE_PTHREADS!$ENABLE_PTHREADS$ac_delim
ENABLE_PIC!$ENABLE_PIC$ac_delim
ENABLE_SHARED!$ENABLE_SHARED$ac_delim
ENABLE_EMBED_STDCXX!$ENABLE_EMBED_STDCXX$ac_delim
ENABLE_TIMESTAMPS!$ENABLE_TIMESTAMPS$ac_delim
TARGETS_TO_BUILD!$TARGETS_TO_BUILD$ac_delim
LLVM_ENUM_TARGETS!$LLVM_ENUM_TARGETS$ac_delim
LLVM_ENUM_ASM_PRINTERS!$LLVM_ENUM_ASM_PRINTERS$ac_delim
LLVM_ENUM_ASM_PARSERS!$LLVM_ENUM_ASM_PARSERS$ac_delim
_ACEOF

if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
Expand Down Expand Up @@ -21858,6 +21880,7 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
LLVM_ENUM_ASM_PARSERS!$LLVM_ENUM_ASM_PARSERS$ac_delim
LLVM_ENUM_DISASSEMBLERS!$LLVM_ENUM_DISASSEMBLERS$ac_delim
ENABLE_CBE_PRINTF_A!$ENABLE_CBE_PRINTF_A$ac_delim
CLANGPATH!$CLANGPATH$ac_delim
Expand Down Expand Up @@ -21954,7 +21977,6 @@ LLVM_CONFIGTIME!$LLVM_CONFIGTIME$ac_delim
BINDINGS_TO_BUILD!$BINDINGS_TO_BUILD$ac_delim
ALL_BINDINGS!$ALL_BINDINGS$ac_delim
OCAML_LIBDIR!$OCAML_LIBDIR$ac_delim
ENABLE_VISIBILITY_INLINES_HIDDEN!$ENABLE_VISIBILITY_INLINES_HIDDEN$ac_delim
_ACEOF

if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
Expand Down Expand Up @@ -21996,13 +22018,14 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
ENABLE_VISIBILITY_INLINES_HIDDEN!$ENABLE_VISIBILITY_INLINES_HIDDEN$ac_delim
RPATH!$RPATH$ac_delim
RDYNAMIC!$RDYNAMIC$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF

if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 4; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 5; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
Expand Down
5 changes: 3 additions & 2 deletions tools/llvm-shlib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ SHARED_LIBRARY = 1
include $(LEVEL)/Makefile.config

ifeq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
EXPORTED_SYMBOL_FILE = $(ObjDir)/$(LIBRARYNAME).exports
EXPORTED_SYMBOL_FILE = $(ObjDir)/$(LIBRARYNAME).exports

ifeq (1,$(ENABLE_EMBED_STDCXX))
# It is needed to force static-stdc++.a linked.
# FIXME: It should be omitted when configure detects system's stdc++.dll.
SHLIB_FRAG_NAMES += stdc++.a.o
endif

endif

Expand Down

0 comments on commit 8eac886

Please sign in to comment.