Skip to content

Commit 462ad35

Browse files
authored
Merge pull request #11 from flightaware/swiftc
Add support for swiftc linker
2 parents 40bbf33 + 8d72021 commit 462ad35

3 files changed

Lines changed: 112 additions & 1 deletion

File tree

Makefile.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ INSTALL_LIBRARY = @INSTALL_LIBRARY@
9999
PACKAGE_NAME = @PACKAGE_NAME@
100100
PACKAGE_VERSION = @PACKAGE_VERSION@
101101
CC = @CC@
102+
LINK_CC = @LINK_CC@
102103
CFLAGS_DEFAULT = @CFLAGS_DEFAULT@
103104
CFLAGS_WARNING = @CFLAGS_WARNING@
104105
EXEEXT = @EXEEXT@
@@ -470,5 +471,5 @@ tclAppInit.o: unix/tclAppInit.c
470471
TCLSH_OBJS = tclAppInit.o
471472

472473
tcllauncher: $(TCLSH_OBJS)
473-
$(CC) -o $@ $(TCLSH_OBJS) $(CFLAGS) $(CFLAGS_DEFAULT) $(CFLAGS_WARNING) \
474+
$(LINK_CC) -o $@ $(TCLSH_OBJS) \
474475
$(TCL_LIB_SPEC) $(TCL_STUB_LIB_SPEC) $(THREADS_LIBS) $(CC_SEARCH_FLAGS) $(LIBS)

configure

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,7 @@ ac_includes_default="\
620620

621621
ac_subst_vars='LTLIBOBJS
622622
LIBOBJS
623+
LINK_CC
623624
THREADS_LIBS
624625
CC_SEARCH_FLAGS
625626
LD_SEARCH_FLAGS
@@ -739,6 +740,7 @@ enable_rpath
739740
enable_wince
740741
with_celib
741742
enable_symbols
743+
enable_swiftc_linker
742744
'
743745
ac_precious_vars='build_alias
744746
host_alias
@@ -1365,6 +1367,7 @@ Optional Features:
13651367
--disable-rpath disable rpath support (default: on)
13661368
--enable-wince enable Win/CE support (where applicable)
13671369
--enable-symbols build with debugging symbols (default: off)
1370+
--enable-swiftc-linker use swiftc for linker (default: no)
13681371
13691372
Optional Packages:
13701373
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -8593,6 +8596,98 @@ fi
85938596
85948597
85958598
8599+
# On Linux look for setproctitle support in libbsd
8600+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing setproctitle_init" >&5
8601+
$as_echo_n "checking for library containing setproctitle_init... " >&6; }
8602+
if ${ac_cv_search_setproctitle_init+:} false; then :
8603+
$as_echo_n "(cached) " >&6
8604+
else
8605+
ac_func_search_save_LIBS=$LIBS
8606+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
8607+
/* end confdefs.h. */
8608+
8609+
/* Override any GCC internal prototype to avoid an error.
8610+
Use char because int might match the return type of a GCC
8611+
builtin and then its argument prototype would still apply. */
8612+
#ifdef __cplusplus
8613+
extern "C"
8614+
#endif
8615+
char setproctitle_init ();
8616+
int
8617+
main ()
8618+
{
8619+
return setproctitle_init ();
8620+
;
8621+
return 0;
8622+
}
8623+
_ACEOF
8624+
for ac_lib in '' bsd; do
8625+
if test -z "$ac_lib"; then
8626+
ac_res="none required"
8627+
else
8628+
ac_res=-l$ac_lib
8629+
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
8630+
fi
8631+
if ac_fn_c_try_link "$LINENO"; then :
8632+
ac_cv_search_setproctitle_init=$ac_res
8633+
fi
8634+
rm -f core conftest.err conftest.$ac_objext \
8635+
conftest$ac_exeext
8636+
if ${ac_cv_search_setproctitle_init+:} false; then :
8637+
break
8638+
fi
8639+
done
8640+
if ${ac_cv_search_setproctitle_init+:} false; then :
8641+
8642+
else
8643+
ac_cv_search_setproctitle_init=no
8644+
fi
8645+
rm conftest.$ac_ext
8646+
LIBS=$ac_func_search_save_LIBS
8647+
fi
8648+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_setproctitle_init" >&5
8649+
$as_echo "$ac_cv_search_setproctitle_init" >&6; }
8650+
ac_res=$ac_cv_search_setproctitle_init
8651+
if test "$ac_res" != no; then :
8652+
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
8653+
8654+
fi
8655+
8656+
for ac_func in setproctitle_init
8657+
do :
8658+
ac_fn_c_check_func "$LINENO" "setproctitle_init" "ac_cv_func_setproctitle_init"
8659+
if test "x$ac_cv_func_setproctitle_init" = xyes; then :
8660+
cat >>confdefs.h <<_ACEOF
8661+
#define HAVE_SETPROCTITLE_INIT 1
8662+
_ACEOF
8663+
8664+
fi
8665+
done
8666+
8667+
8668+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if swiftc linker is requested" >&5
8669+
$as_echo_n "checking if swiftc linker is requested... " >&6; }
8670+
# Check whether --enable-swiftc-linker was given.
8671+
if test "${enable_swiftc_linker+set}" = set; then :
8672+
enableval=$enable_swiftc_linker; swiftlinker=$enableval
8673+
else
8674+
swiftlinker=no
8675+
fi
8676+
8677+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $swiftlinker" >&5
8678+
$as_echo "$swiftlinker" >&6; }
8679+
8680+
# Change linker arguments for rpath
8681+
if test "${swiftlinker}" = "yes" ; then
8682+
LINK_CC="swiftc -emit-executable"
8683+
8684+
CC_SEARCH_FLAGS='-Xlinker -rpath=${LIB_RUNTIME_DIR}'
8685+
else
8686+
LINK_CC=$CC
8687+
8688+
fi
8689+
8690+
85968691
#--------------------------------------------------------------------
85978692
# Finally, substitute all of the various values into the Makefile.
85988693
# You may alternatively have a special pkgIndex.tcl.in or other files

configure.in

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,21 @@ AC_SUBST(THREADS_LIBS)
200200
AC_SEARCH_LIBS([setproctitle_init], [bsd], [], [])
201201
AC_CHECK_FUNCS(setproctitle_init)
202202

203+
AC_MSG_CHECKING([if swiftc linker is requested])
204+
AC_ARG_ENABLE(swiftc-linker,
205+
AC_HELP_STRING([--enable-swiftc-linker], [use swiftc for linker (default: no)]),
206+
[swiftlinker=$enableval], [swiftlinker=no])
207+
AC_MSG_RESULT([$swiftlinker])
208+
209+
# Change linker arguments for rpath
210+
if test "${swiftlinker}" = "yes" ; then
211+
AC_SUBST(LINK_CC, ["swiftc -emit-executable"])
212+
CC_SEARCH_FLAGS='-Xlinker -rpath=${LIB_RUNTIME_DIR}'
213+
else
214+
AC_SUBST(LINK_CC, [$CC])
215+
fi
216+
AC_SUBST(CC_SEARCH_FLAGS)
217+
203218
#--------------------------------------------------------------------
204219
# Finally, substitute all of the various values into the Makefile.
205220
# You may alternatively have a special pkgIndex.tcl.in or other files

0 commit comments

Comments
 (0)