diff --git a/racket/src/configure b/racket/src/configure index 164fe5ca1c..e095f37686 100755 --- a/racket/src/configure +++ b/racket/src/configure @@ -7102,7 +7102,7 @@ makefiles="Makefile # Make sure the --enable-shared default is propagated: if test "${enable_shared}" = "yes" ; then - ac_configure_args="$ac_configure_args --enable-shared" + SUB_CONFIGURE_EXTRAS="$SUB_CONFIGURE_EXTRAS --enable-shared" fi FOREIGNTARGET= diff --git a/racket/src/racket/configure.ac b/racket/src/racket/configure.ac index 0fe411d03e..4d931fa553 100644 --- a/racket/src/racket/configure.ac +++ b/racket/src/racket/configure.ac @@ -1920,7 +1920,7 @@ makefiles="Makefile # Make sure the --enable-shared default is propagated: if test "${enable_shared}" = "yes" ; then - ac_configure_args="$ac_configure_args --enable-shared" + SUB_CONFIGURE_EXTRAS="$SUB_CONFIGURE_EXTRAS --enable-shared" fi FOREIGNTARGET= diff --git a/racket/src/rktio/Makefile.in b/racket/src/rktio/Makefile.in index 9c54644226..8cca47c646 100644 --- a/racket/src/rktio/Makefile.in +++ b/racket/src/rktio/Makefile.in @@ -5,67 +5,75 @@ CC = @CC@ CFLAGS = @CFLAGS@ @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ +RKTLINKER = @RKTLINKER@ + +NICEAR = $(srcdir)/../utils/nicear +AR = @AR@ +ARFLAGS = @ARFLAGS@ +RANLIB = @RANLIB@ RKTIO_HEADERS = $(srcdir)/rktio.h $(srcdir)/rktio_private.h rktio_config.h -OBJS = rktio_fs.o \ - rktio_fd.o \ - rktio_file.o \ - rktio_poll_set.o \ - rktio_ltps.o \ - rktio_network.o \ - rktio_process.o \ - rktio_envvars.o \ - rktio_fs_change.o \ - rktio_error.o \ - rktio_main.o +OBJS = rktio_fs.@LTO@ \ + rktio_fd.@LTO@ \ + rktio_file.@LTO@ \ + rktio_poll_set.@LTO@ \ + rktio_ltps.@LTO@ \ + rktio_network.@LTO@ \ + rktio_process.@LTO@ \ + rktio_envvars.@LTO@ \ + rktio_fs_change.@LTO@ \ + rktio_error.@LTO@ \ + rktio_main.@LTO@ -all: $(OBJS) +librktio.@LIBSFX@: $(OBJS) + $(NICEAR) $(AR) $(ARFLAGS) librktio.@LIBSFX@ $(OBJS) + $(RANLIB) librktio.@LIBSFX@ demo: rktio_demo ./rktio_demo -rktio_demo: $(OBJS) demo.o demo_fifo - $(CC) -o rktio_demo $(CFLAGS) $(LDFLAGS) demo.o $(OBJS) $(LIBS) +rktio_demo: librktio.@LIBSFX@ demo.@LTO@ demo_fifo + $(RKTLINKER) -o rktio_demo $(CFLAGS) $(LDFLAGS) demo.@LTO@ librktio.@LIBSFX@ $(LIBS) demo_fifo: mkfifo demo_fifo -rktio_fs.o: $(srcdir)/rktio_fs.c $(RKTIO_HEADERS) - $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_fs.o -c $(srcdir)/rktio_fs.c +rktio_fs.@LTO@: $(srcdir)/rktio_fs.c $(RKTIO_HEADERS) + $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_fs.@LTO@ -c $(srcdir)/rktio_fs.c -rktio_fd.o: $(srcdir)/rktio_fd.c $(RKTIO_HEADERS) - $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_fd.o -c $(srcdir)/rktio_fd.c +rktio_fd.@LTO@: $(srcdir)/rktio_fd.c $(RKTIO_HEADERS) + $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_fd.@LTO@ -c $(srcdir)/rktio_fd.c -rktio_file.o: $(srcdir)/rktio_file.c $(RKTIO_HEADERS) - $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_file.o -c $(srcdir)/rktio_file.c +rktio_file.@LTO@: $(srcdir)/rktio_file.c $(RKTIO_HEADERS) + $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_file.@LTO@ -c $(srcdir)/rktio_file.c -rktio_poll_set.o: $(srcdir)/rktio_poll_set.c $(RKTIO_HEADERS) - $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_poll_set.o -c $(srcdir)/rktio_poll_set.c +rktio_poll_set.@LTO@: $(srcdir)/rktio_poll_set.c $(RKTIO_HEADERS) + $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_poll_set.@LTO@ -c $(srcdir)/rktio_poll_set.c -rktio_ltps.o: $(srcdir)/rktio_ltps.c $(RKTIO_HEADERS) - $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_ltps.o -c $(srcdir)/rktio_ltps.c +rktio_ltps.@LTO@: $(srcdir)/rktio_ltps.c $(RKTIO_HEADERS) + $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_ltps.@LTO@ -c $(srcdir)/rktio_ltps.c -rktio_network.o: $(srcdir)/rktio_network.c $(RKTIO_HEADERS) - $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_network.o -c $(srcdir)/rktio_network.c +rktio_network.@LTO@: $(srcdir)/rktio_network.c $(RKTIO_HEADERS) + $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_network.@LTO@ -c $(srcdir)/rktio_network.c -rktio_process.o: $(srcdir)/rktio_process.c $(RKTIO_HEADERS) - $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_process.o -c $(srcdir)/rktio_process.c +rktio_process.@LTO@: $(srcdir)/rktio_process.c $(RKTIO_HEADERS) + $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_process.@LTO@ -c $(srcdir)/rktio_process.c -rktio_envvars.o: $(srcdir)/rktio_envvars.c $(RKTIO_HEADERS) - $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_envvars.o -c $(srcdir)/rktio_envvars.c +rktio_envvars.@LTO@: $(srcdir)/rktio_envvars.c $(RKTIO_HEADERS) + $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_envvars.@LTO@ -c $(srcdir)/rktio_envvars.c -rktio_fs_change.o: $(srcdir)/rktio_fs_change.c $(RKTIO_HEADERS) - $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_fs_change.o -c $(srcdir)/rktio_fs_change.c +rktio_fs_change.@LTO@: $(srcdir)/rktio_fs_change.c $(RKTIO_HEADERS) + $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_fs_change.@LTO@ -c $(srcdir)/rktio_fs_change.c -rktio_error.o: $(srcdir)/rktio_error.c $(RKTIO_HEADERS) - $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_error.o -c $(srcdir)/rktio_error.c +rktio_error.@LTO@: $(srcdir)/rktio_error.c $(RKTIO_HEADERS) + $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_error.@LTO@ -c $(srcdir)/rktio_error.c -rktio_main.o: $(srcdir)/rktio_main.c $(RKTIO_HEADERS) - $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_main.o -c $(srcdir)/rktio_main.c +rktio_main.@LTO@: $(srcdir)/rktio_main.c $(RKTIO_HEADERS) + $(CC) $(CFLAGS) -I$(srcdir) -I. -o rktio_main.@LTO@ -c $(srcdir)/rktio_main.c -demo.o: $(srcdir)/demo.c $(RKTIO_HEADERS) - $(CC) $(CFLAGS) -I$(srcdir) -I. -o demo.o -c $(srcdir)/demo.c +demo.@LTO@: $(srcdir)/demo.c $(RKTIO_HEADERS) + $(CC) $(CFLAGS) -I$(srcdir) -I. -o demo.@LTO@ -c $(srcdir)/demo.c clean: - rm -f $(OBJS) rktio_demo + rm -f $(OBJS) librktio.@LIBSFX@ rktio_demo demo_fifo diff --git a/racket/src/rktio/configure b/racket/src/rktio/configure index 228b826ad4..d926a2bdfd 100755 --- a/racket/src/rktio/configure +++ b/racket/src/rktio/configure @@ -621,9 +621,18 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS LIBOBJS +LTA +LTO +LIBSFX +STATIC_AR +ARFLAGS +AR +RKTLINKER EGREP GREP CPP +platform_ar_found +RANLIB OBJEXT EXEEXT ac_ct_CC @@ -684,6 +693,7 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking +enable_shared ' ac_precious_vars='build_alias host_alias @@ -1302,6 +1312,12 @@ if test -n "$ac_init_help"; then cat <<\_ACEOF +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-shared create shared libraries (ok, but not recommended) + Some influential environment variables: CC C compiler command CFLAGS C compiler flags @@ -2222,6 +2238,12 @@ test -n "$target_alias" && program_prefix=${target_alias}- +# Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; +fi + + ###### Autoconfigure ####### ac_ext=c @@ -3014,6 +3036,146 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test "$AR" = '' ; then + AR="${ac_tool_prefix}ar" + # Extract the first word of "$AR", so it can be a program name with args. +set dummy $AR; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_platform_ar_found+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$platform_ar_found"; then + ac_cv_prog_platform_ar_found="$platform_ar_found" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_platform_ar_found="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_platform_ar_found" && ac_cv_prog_platform_ar_found="no" +fi +fi +platform_ar_found=$ac_cv_prog_platform_ar_found +if test -n "$platform_ar_found"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $platform_ar_found" >&5 +$as_echo "$platform_ar_found" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "$platform_ar_found" = 'no' ; then + AR="ar" + fi +fi +if test "$ARFLAGS" = '' ; then + ARFLAGS=ruv +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fmod in -lm" >&5 $as_echo_n "checking for fmod in -lm... " >&6; } @@ -3999,12 +4161,68 @@ $as_echo "#define RKTIO_USE_PTHREADS 1" >>confdefs.h fi +############## libtool ################ + +if test "${enable_shared}" = "yes" ; then + echo "Configuring libtool" + + if test ! -d "../lt" ; then + mkdir "../lt" + fi + abssrcdir=`(cd ${srcdir}; pwd)` + + if test "${LIBTOOLPROG}" = "" ; then + (cd ../lt; sh ${abssrcdir}/../lt/configure --enable-shared --disable-static) + LIBTOOLPROG=`pwd`/../lt/libtool + fi + + if test "${need_gcc_static_libgcc}" = "yes" ; then + need_gcc_static_libgcc="" + if test "$CC" = "gcc" ; then + gcc_vers_three=`${CC} -v 2>&1 | grep "version 3."` + if test "$gcc_vers_three" = "" ; then + need_gcc_static_libgcc="" + else + need_gcc_static_libgcc=" -XCClinker -static-libgcc" + fi + fi + fi + + AR="${LIBTOOLPROG} --mode=link --tag=CC $CC${need_gcc_static_libgcc}${ar_libtool_no_undefined} -release ${plt_lib_version} -rpath ${abslibdir} \$(ARLIBFLAGS) -o" + STATIC_AR="${LIBTOOLPROG} --mode=link --tag=CC $CC -o" + ARFLAGS="" + RANLIB=":" + RKTLINKER="${LIBTOOLPROG} --mode=link --tag=CC $CC${need_gcc_static_libgcc} -rpath ${abslibdir}" + CC="${LIBTOOLPROG} --mode=compile --tag=CC $CC" + LIBSFX=la + LTO="lo" + LTA="la" + STRIP_LIB_DEBUG=":" +else + LIBSFX=a + ICP=cp + ICP_LIB=cp + LTO="o" + LTA="a" + RKTLINKER='$(CC)' + STATIC_AR="$AR" +fi + ############## final output ################ + + + + + + + + + makefiles="Makefile" ac_config_files="$ac_config_files $makefiles" diff --git a/racket/src/rktio/configure.ac b/racket/src/rktio/configure.ac index a2e47b1bb8..b246bbe41a 100644 --- a/racket/src/rktio/configure.ac +++ b/racket/src/rktio/configure.ac @@ -10,10 +10,24 @@ AC_CONFIG_HEADERS([rktio_config.h]) AC_CONFIG_AUX_DIR(../lt) AC_CANONICAL_SYSTEM +AC_ARG_ENABLE(shared, [ --enable-shared create shared libraries (ok, but not recommended)]) + ###### Autoconfigure ####### AC_PROG_CC +AC_PROG_RANLIB +if test "$AR" = '' ; then + AR="${ac_tool_prefix}ar" + AC_CHECK_PROG(platform_ar_found, $AR, yes, no) + if test "$platform_ar_found" = 'no' ; then + AR="ar" + fi +fi +if test "$ARFLAGS" = '' ; then + ARFLAGS=ruv +fi + AC_CHECK_LIB(m, fmod) AC_CHECK_LIB(dl, dlopen) @@ -271,11 +285,67 @@ if test "${enable_pthread}" = "yes" ; then AC_DEFINE(RKTIO_USE_PTHREADS, 1, [Pthread enabled]) fi +############## libtool ################ + +if test "${enable_shared}" = "yes" ; then + echo "Configuring libtool" + + if test ! -d "../lt" ; then + mkdir "../lt" + fi + abssrcdir=`(cd ${srcdir}; pwd)` + + if test "${LIBTOOLPROG}" = "" ; then + (cd ../lt; sh ${abssrcdir}/../lt/configure --enable-shared --disable-static) + LIBTOOLPROG=`pwd`/../lt/libtool + fi + + if test "${need_gcc_static_libgcc}" = "yes" ; then + need_gcc_static_libgcc="" + if test "$CC" = "gcc" ; then + gcc_vers_three=`${CC} -v 2>&1 | grep "version 3[.]"` + if test "$gcc_vers_three" = "" ; then + need_gcc_static_libgcc="" + else + need_gcc_static_libgcc=" -XCClinker -static-libgcc" + fi + fi + fi + + AR="${LIBTOOLPROG} --mode=link --tag=CC $CC${need_gcc_static_libgcc}${ar_libtool_no_undefined} -release ${plt_lib_version} \$(ARLIBFLAGS) -o" + STATIC_AR="${LIBTOOLPROG} --mode=link --tag=CC $CC -o" + ARFLAGS="" + RANLIB=":" + RKTLINKER="${LIBTOOLPROG} --mode=link --tag=CC $CC${need_gcc_static_libgcc}" + CC="${LIBTOOLPROG} --mode=compile --tag=CC $CC" + LIBSFX=la + LTO="lo" + LTA="la" + STRIP_LIB_DEBUG=":" +else + LIBSFX=a + ICP=cp + ICP_LIB=cp + LTO="o" + LTA="a" + RKTLINKER='$(CC)' + STATIC_AR="$AR" +fi + ############## final output ################ AC_SUBST(CC) AC_SUBST(CFLAGS) AC_SUBST(LDFLAGS) +AC_SUBST(RKTLINKER) +AC_SUBST(AR) +AC_SUBST(ARFLAGS) +AC_SUBST(RANLIB) +AC_SUBST(STATIC_AR) + +AC_SUBST(LIBSFX) +AC_SUBST(LTO) +AC_SUBST(LTA) makefiles="Makefile"