1
2#################################################################
3# This is the source for the `configure` script, to be compiled #
4# by autoconf (use `make-configure` in "../../ac").             #
5#################################################################
6
7AC_INIT([embed-boot.rkt])
8AC_CONFIG_HEADERS([cs_config.h])
9
10AC_CONFIG_AUX_DIR(../../lt)
11AC_CANONICAL_SYSTEM
12
13AC_DISABLE_OPTION_CHECKING
14
15AC_ARG_ENABLE(shared,     [  --enable-shared         create shared libraries (not currently supported)])
16AC_ARG_ENABLE(standalone, [  --enable-standalone     create a standalone shared library])
17AC_ARG_ENABLE(pthread,    [  --enable-pthread        link with pthreads (usually auto-enabled if needed)])
18AC_ARG_ENABLE(iconv,      [  --enable-iconv          use iconv (usually auto-enabled)])
19AC_ARG_ENABLE(wpo,        [  --enable-wpo            agressively optimize Racket core (enabled by default)])
20AC_ARG_ENABLE(compress,   [  --enable-compress       compress compiled code (enabled by default)])
21AC_ARG_ENABLE(compressmore, [  --enable-compressmore   compress compiled code even more])
22AC_ARG_ENABLE(compressboot, [  --enable-compressboot   compress boot files])
23m4_include(../ac/path_arg.m4)
24AC_ARG_ENABLE(racket,     [  --enable-racket=<path>  use <path> as Racket for build; or "auto" to create])
25AC_ARG_ENABLE(scheme,     [  --enable-scheme=<path>  use <path> as host's build directory for cross])
26AC_ARG_ENABLE(mach,       [  --enable-mach=<mach>    use Chez Scheme machine type <mach>])
27AC_ARG_ENABLE(target,     [  --enable-target=<mach>  cross-build for Chez Scheme machine type <mach>])
28m4_include(../ac/natipkg_arg.m4)
29m4_include(../ac/sdk_arg.m4)
30m4_include(../ac/instlib_arg.m4)
31m4_include(../ac/strip_arg.m4)
32m4_include(../ac/ubsan_arg.m4)
33m4_include(../ac/asan_arg.m4)
34m4_include(../ac/vm_arg.m4)
35m4_include(../ac/crossany_arg.m4)
36AC_ARG_ENABLE(libz,       [  --enable-libz           use installed libz if available])
37AC_ARG_ENABLE(liblz4,     [  --enable-liblz4         use installed liblz4 if available])
38
39m4_include(../ac/sdk.m4)
40
41show_explicitly_disabled()
42{
43  if test "$1" = "no" ; then
44    echo "=== $2 disabled"
45  fi
46}
47
48show_explicitly_enabled()
49{
50  if test "$1" = "yes" ; then
51    echo "=== $2 enabled"
52    if test "$3" != "" ; then
53      echo "  $3"
54    fi
55  fi
56}
57
58show_explicitly_set()
59{
60  if test "$1" != "" ; then
61    echo "=== $2 set to $1"
62  fi
63}
64
65if test "${enable_shared}" = "yes" ; then
66  echo "=== Canceling --enable-shared"
67  echo "    Building Racket CS as a shared library is not currently"
68  echo "    supported --- but Racket executables get the benefits of"
69  echo "    sharing, anyway, by going through a shared executable"
70  enable_shared=no
71fi
72
73show_explicitly_enabled "${enable_pthread}" "pthreads"
74show_explicitly_disabled "${enable_pthread}" "pthreads"
75show_explicitly_disabled "${enable_compress}" "Compressed code"
76show_explicitly_disabled "${enable_compressmore}" "Compressed code even more"
77show_explicitly_enabled "${enable_compressboot}" "Compressed boot files"
78show_explicitly_disabled "${enable_compressboot}" "Compressed boot files"
79show_explicitly_enabled "${enable_xonx}" "Unix style"
80m4_include(../ac/path_show.m4)
81show_explicitly_set "${enable_racket}" "Racket"
82show_explicitly_set "${enable_scheme}" "Chez Scheme build directory"
83show_explicitly_set "${enable_mach}" "machine type"
84show_explicitly_set "${enable_target}" "cross-build machine type"
85m4_include(../ac/natipkg_show.m4)
86show_explicitly_enabled "${enable_libz}" "Installed libz"
87show_explicitly_enabled "${enable_liblz4}" "Installed liblz4"
88
89m4_include(../ac/vm.m4)
90
91m4_include(../ac/instlib.m4)
92m4_include(../ac/sdk_show.m4)
93m4_include(../ac/strip_show.m4)
94
95if test "${enable_iconv}" = "" ; then
96  enable_iconv=yes
97fi
98
99if test "${enable_xonx}" == "" ; then
100  enable_xonx=no
101fi
102
103m4_include(../ac/path_pkgscope.m4)
104
105m4_include(../ac/crossany.m4)
106
107SUB_CONFIGURE_EXTRAS=
108
109if test "${enable_csdefault}" = "yes" ; then
110  CS_INSTALLED=""
111else
112  CS_INSTALLED=cs
113  AC_DEFINE(CS_COMPILED_SUBDIR,1,[Use a subdirectory of "compiled"])
114fi
115
116show_explicitly_disabled "${enable_wpo}" "Agressive core optimization"
117if test "${enable_wpo}" = "no" ; then
118  ENABLE_OR_DISABLE_WPO="WHEN_WPO=no_ UNLESS_WPO="
119else
120  ENABLE_OR_DISABLE_WPO=""
121fi
122
123############## Install targets ################
124
125PREFIX_PATH_RELATIVE=/../..
126
127m4_include(../ac/path.m4)
128
129############## init variables ################
130
131skip_iconv_check=no
132use_flag_pthread=yes
133use_flag_posix_pthread=no
134
135INCLUDEDEP="#"
136OSX="not_osx"
137NOT_OSX=""
138MINGW="not_mingw"
139NOT_MINGW=""
140CONFIGURE_RACKET_SO_COMPILE=""
141COMPRESS_COMP=""
142BOOT_COMPRESS_COMP=""
143POST_LINKER="echo"
144
145FRAMEWORK_INSTALL_DIR='$(libpltdir)'
146FRAMEWORK_PREFIX='@executable_path/../lib/'
147
148RACKET='$(DEFAULT_RACKET)'
149BOOTFILE_RACKET='$(RACKET)'
150RUN_RACKET='$(RUN_THIS_RACKET)'
151SETUP_BOOT_MODE=--boot
152
153INSTALL_SETUP_FLAGS="--no-user"
154INSTALL_SETUP_RACKET_FLAGS=
155
156Z_LIB_DEP='$(OWN_Z_LIB)'
157Z_LIB='$(OWN_Z_LIB)'
158Z_LIB_UNPACK='$(AR) x $(OWN_Z_LIB)'
159LZ4_LIB_DEP='$(OWN_LZ4_LIB)'
160LZ4_LIB='$(OWN_LZ4_LIB)'
161LZ4_LIB_UNPACK='$(AR) x $(OWN_LZ4_LIB)'
162
163CS_HOST_WORKAREA_PREFIX=
164
165PLT_CS_SLSP_SUFFIX=
166
167enable_pthread_by_default=yes
168
169compress_boot_files_by_default=no
170
171cs_auto_flags=--disable-auto-flags
172
173COPY_NEW_CFLAGS_TO_CPPFLAGS=no
174
175###### Autoconfigure #######
176
177m4_include(../ac/sdk_ios.m4)
178
179AC_PROG_CC
180
181m4_include(../ac/is_gcc.m4)
182
183# If using gcc, we want all warnings:
184if test "$is_gcc" != "" ; then
185  if test "${enable_warning}" != "no" ; then
186    CFLAGS="$CFLAGS -Wall"
187    cs_auto_flags="${cs_auto_flags} --enable-warning-flags"
188  fi
189fi
190
191AC_CHECK_LIB(m, fmod)
192AC_CHECK_LIB(dl, dlopen)
193
194AC_PROG_RANLIB
195if test "$AR" = '' ; then
196  AR="${ac_tool_prefix}ar"
197  AC_CHECK_PROG(platform_ar_found, $AR, yes, no)
198  if test "$platform_ar_found" = 'no' ; then
199    AR="ar"
200  fi
201fi
202if test "$ARFLAGS" = '' ; then
203  ARFLAGS=rc
204fi
205
206WINDRES=windres
207
208############## platform tests ################
209
210# At first, `MACH` means the target that we're building for. In
211# cross-build mode, `MACH` will be moved to `TARGET_MACH`.
212
213MACH_HOST_CPU="${host_cpu}"
214extra_scheme_config_args=
215disable_curses_arg=--disable-curses
216
217case "$host_os" in
218  solaris2*)
219    MACH_OS=s2
220    LIBS="$LIBS -lsocket -lnsl -lintl"
221    use_flag_pthread="no"
222    use_flag_posix_pthread="yes"
223    ;;
224  aix*)
225    ;;
226  *freebsd*)
227    MACH_OS=fb
228    CFLAGS="${CFLAGS} -I/usr/local/include"
229    LDFLAGS="${LDFLAGS} -L/usr/local/lib"
230    LIBS="${LIBS} -lm -lpthread"
231    LINK_DYNAMIC="-rdynamic"
232    add_iconv_lib="-liconv"
233    ;;
234  openbsd*)
235    MACH_OS=ob
236    CFLAGS="${CFLAGS} -I/usr/local/include"
237    LDFLAGS="${LDFLAGS} -L/usr/local/lib"
238    LIBS="${LIBS} -lm -lpthread"
239    LINK_DYNAMIC="-Wl,--export-dynamic"
240    add_iconv_lib="-liconv"
241    LDFLAGS="${LDFLAGS} -Wl,-zwxneeded"
242    ;;
243  bitrig*)
244    LINK_DYNAMIC="-Wl,--export-dynamic"
245    ;;
246  dragonfly*)
247    LINK_DYNAMIC="-Wl,--export-dynamic"
248    ;;
249  netbsd*)
250    MACH_OS=nb
251    LIBS="${LIBS} -lm -lpthread"
252    LINK_DYNAMIC="-rdynamic"
253    add_iconv_lib="/usr/lib/i18n/libiconv_std.a"
254    POST_LINKER="paxctl +m"
255    ;;
256  irix*)
257    ;;
258  linux*)
259    MACH_OS=le
260    case "$host_os" in
261      *linux-android*)
262        ;;
263      *)
264        LIBS="${LIBS} -lrt"
265        ;;
266    esac
267    LINK_DYNAMIC="-rdynamic"
268    ;;
269  osf1*)
270    ;;
271  hpux*)
272    ;;
273  *mingw*)
274    skip_iconv_check=yes
275    use_flag_pthread=no
276    MACH_OS=nt
277    LIBS="${LIBS} -lshell32 -luser32 -lole32 -lrpcrt4 -luuid -lws2_32 -ladvapi32 -lwinmm"
278    MINGW=""
279    NOT_MINGW="mingw"
280    compress_boot_files_by_default=yes
281    if `which ${host}-windres > /dev/null` ; then
282      WINDRES="${host}-windres"
283    fi
284    # ".a" is typically not useful, since we always build a DLL:
285    if test "${enable_libs}" = "" ; then
286      INSTALL_LIBS_ENABLE=no-install
287    fi
288    ;;
289  cygwin*)
290    ;;
291  darwin*)
292    PREFLAGS="$PREFLAGS -DOS_X"
293    MACH_OS=osx
294    LIBS="${LIBS} -lncurses -framework CoreFoundation"
295    LDFLAGS="${LDFLAGS} -Wl,-headerpad_max_install_names"
296    if test "${enable_xonx}" == "no" ; then
297      INCLUDEDEP="-include"
298      OSX=""
299      NOT_OSX="osx"
300    else
301      CONFIGURE_RACKET_SO_COMPILE="env PLT_CS_MAKE_UNIX_STYLE_MACOS=y"
302      CPPFLAGS="${CPPFLAGS} -DRACKET_XONX"
303      strip_needs_dash_s=yes
304    fi
305    if test "${enable_embedfw}" = "yes" ; then
306      strip_needs_dash_s=yes
307    fi
308
309    PROPAGATE_SUB_CONFIGURE=no
310    m4_include(../ac/sdk_mac.m4)
311
312    if test "${enable_libfw}" = "yes" ; then
313      FRAMEWORK_INSTALL_DIR=/Library/Frameworks
314      FRAMEWORK_REL_INSTALL=no
315      FRAMEWORK_PREFIX=''
316    elif test "${enable_userfw}" = "yes" ; then
317      FRAMEWORK_INSTALL_DIR=~/Library/Frameworks
318      FRAMEWORK_REL_INSTALL=no
319      FRAMEWORK_PREFIX=''
320    else
321      FRAMEWORK_INSTALL_DIR='${libpltdir}'
322      FRAMEWORK_REL_INSTALL=yes
323      if test "${libpltdir_rel}" = "" ; then
324        FRAMEWORK_PREFIX='$(FRAMEWORK_ABS_PREFIX)'
325      else
326        FRAMEWORK_PREFIX='$(FRAMEWORK_REL_PREFIX)'
327      fi
328    fi
329
330    if test "${enable_mac64}" == "no"; then
331      MACH_HOST_CPU="x86"
332      extra_scheme_config_args="--32"
333    fi
334
335    # -pthread is not needed and triggers a warning
336    use_flag_pthread=no
337
338    # ncurses.h is always available, except on iOS
339    if test "${enable_ios}" == "" ; then
340      disable_curses_arg=""
341    fi
342    ;;
343  nto-qnx*)
344    MACH_OS=qnx
345    use_flag_pthread=no
346    ;;
347  *)
348    ;;
349esac
350
351if test "${enable_pthread}" = "" ; then
352  if test "${enable_pthread_by_default}" = "yes" ; then
353    enable_pthread=yes
354  fi
355fi
356
357############## machine type ################
358
359thread_prefix=""
360if test "${enable_pthread}" = "yes" ; then
361  thread_prefix="t"
362fi
363
364case "$MACH_HOST_CPU" in
365  x86_64)
366    MACH="${thread_prefix}a6${MACH_OS}"
367    ;;
368  x86|i*86)
369    MACH="${thread_prefix}i3${MACH_OS}"
370    ;;
371  aarch64*|arm64*)
372    MACH="${thread_prefix}arm64${MACH_OS}"
373    ;;
374  arm*)
375    MACH="${thread_prefix}arm32${MACH_OS}"
376    ;;
377  powerpc64*)
378    MACH=""
379    # MACH="${thread_prefix}ppc64${MACH_OS}"
380    ;;
381  power*)
382    MACH="${thread_prefix}ppc32${MACH_OS}"
383    ;;
384esac
385
386if test "$MACH" = "" -o "$MACH_OS" = "" ; then
387   echo "Platform is not supported by Racket CS."
388   echo 'Try `--enable-bcdefault`, instead.'
389   exit 1
390fi
391
392if test "${enable_mach}" != "" ; then
393  MACH="${enable_mach}"
394fi
395
396if test "${enable_target}" != "" ; then
397  TARGET_MACH=${enable_target}
398  CROSS_MODE="cross"
399elif test "${build_os}_${build_cpu}" != "${host_os}_${host_cpu}" ; then
400  BUILD_THREAD_PREFIX="${thread_prefix}"
401  case "$build_os" in
402    solaris2*)
403      BUILD_OS=s2
404      ;;
405    *freebsd*)
406      BUILD_OS=fb
407      ;;
408    openbsd*)
409      BUILD_OS=ob
410      ;;
411    netbsd*)
412      BUILD_OS=nb
413      ;;
414    linux*)
415      BUILD_OS=le
416      ;;
417    *mingw*)
418      BUILD_OS=nt
419      ;;
420    darwin*)
421      BUILD_OS=osx
422      ;;
423    nto-qnx*)
424      BUILD_OS=qnx
425      ;;
426    *)
427      echo "unknown build OS"
428      exit 1
429      ;;
430  esac
431  case "$build_cpu" in
432    x86_64)
433      BUILD_MACH="${BUILD_THREAD_PREFIX}a6${BUILD_OS}"
434      ;;
435    x86|i*86)
436      BUILD_MACH="${BUILD_THREAD_PREFIX}i3${BUILD_OS}"
437      ;;
438    aarch64*|arm64*)
439      BUILD_MACH="${BUILD_THREAD_PREFIX}arm64${BUILD_OS}"
440      ;;
441    arm*)
442      BUILD_MACH="${BUILD_THREAD_PREFIX}arm32${BUILD_OS}"
443      ;;
444    powerpc64*)
445      BUILD_MACH="${BUILD_THREAD_PREFIX}ppc64${BUILD_OS}"
446      ;;
447    power*)
448      BUILD_MACH="${BUILD_THREAD_PREFIX}ppc32${BUILD_OS}"
449      ;;
450    *)
451      echo "unknown build CPU"
452      exit 1
453      ;;
454  esac
455  TARGET_MACH=${MACH}
456  MACH=${BUILD_MACH}
457  CROSS_MODE="cross"
458else
459  BUILD_MACH=${MACH}
460  TARGET_MACH=${MACH}
461  CROSS_MODE=""
462fi
463
464if test "${CROSS_MODE}" = "cross" ; then
465  T_CROSS_MODE="-cross"
466  TT_CROSS_MODE="--cross"
467  RUN_RACKET='$(RACKET)'
468else
469  T_CROSS_MODE=""
470  TT_CROSS_MODE=""
471fi
472
473# From this point on, `MACH` means the build machine, and
474# `TARGET_MACH` is the target that we're building for (which
475# is different in cross-build mode).
476
477############## Racket and Chez Scheme ################
478
479case "$srcdir" in
480    /*)
481        upsrcdir=$srcdir
482        ;;
483    *)
484        upsrcdir=../$srcdir
485        ;;
486esac
487
488SCHEME_DIR=${srcdir}/../../ChezScheme
489MAKE_BUILD_SCHEME=checkout
490
491if test "${enable_scheme}" != "" ; then
492  CS_HOST_WORKAREA_PREFIX="${enable_scheme}/"
493fi
494
495if test "${enable_racket}" != "" ; then
496  if test "${enable_racket}" = "auto" ; then
497    # See also "configure-parent.ac"
498    enable_racket="`pwd`/../../local/cs/c/racketcs"
499    CS_HOST_WORKAREA_PREFIX=../../local/cs/c/
500  fi
501  # In non-cross mode, we interpret `--enable-racket` to supply a
502  # Racket used only for generating Chez Scheme boot files
503  if test "${CROSS_MODE}" = "cross" ; then
504    RACKET="${enable_racket}"
505  else
506    BOOTFILE_RACKET="${enable_racket}"
507  fi
508  SETUP_BOOT_MODE=--chain
509fi
510
511if test "${enable_compress}" != "no" ; then
512  COMPRESS_COMP="--compress"
513fi
514if test "${enable_compressmore}" = "yes" ; then
515  COMPRESS_COMP="--compress-more"
516fi
517
518if test "${enable_compressboot}" = "yes" ; then
519  BOOT_COMPRESS_COMP="--compress"
520elif test "${compress_boot_files_by_default}" = "yes" ; then
521  if test "${enable_compressboot}" != "no" ; then
522    BOOT_COMPRESS_COMP="--compress"
523  fi
524fi
525
526DIFF_MACH=skip
527if test "${MACH}" != "${TARGET_MACH}" ; then
528  DIFF_MACH=
529fi
530
531############## Strip tool ################
532
533m4_include(../ac/strip.m4)
534
535############## natipkg ################
536
537if test "${enable_natipkg}" = "yes" ; then
538  CONFIGURE_RACKET_SO_COMPILE="${CONFIGURE_RACKET_SO_COMPILE} env PLT_CS_SLSP_SUFFIX=-natipkg"
539  PLT_CS_SLSP_SUFFIX="-natipkg"
540fi
541
542############## ubsan ################
543
544m4_include(../ac/ubsan.m4)
545
546############## ubsan ################
547
548m4_include(../ac/asan.m4)
549
550############## Makefile includes ################
551
552if test "$INCLUDEDEP" = "#" ; then
553  is_gmake=`make -v no-such-target-we-hope 2>&1 | grep "GNU Make"`
554  if test "$is_gmake" != "" ; then
555     INCLUDEDEP="-include"
556  fi
557fi
558
559if test "$INCLUDEDEP" != "#" ; then
560  RKTL_PRE="compiled/"
561  RKTL_POST=".rktl"
562fi
563
564############## C flags ################
565
566AC_LANG_C
567
568m4_include(../ac/iconv.m4)
569if test "${enable_iconv}" = "no" ; then
570  AC_DEFINE(RKTIO_NO_ICONV,1,[Do not use iconv])
571  extra_scheme_config_args="${extra_scheme_config_args} --disable-iconv"
572  add_iconv_lib=
573fi
574
575if test "${enable_iconv}" = "yes" ; then
576  AC_MSG_CHECKING([for nl_langinfo (CODESET)])
577  AC_TRY_LINK([#include <langinfo.h>],
578              [char *codeset = nl_langinfo (CODESET);],
579              AC_DEFINE(RKTIO_HAVE_CODESET,1,[Have nl_langinfo (CODESET)])
580               have_codeset=yes,
581              have_codeset=no)
582  AC_MSG_RESULT($have_codeset)
583fi
584
585if test "${add_iconv_lib}" != "" ; then
586    LIBS="${LIBS} ${add_iconv_lib}"
587fi
588
589############### pthread ###################
590
591if test "${enable_pthread}" = "yes" ; then
592  if test "${use_flag_pthread}" = "yes" ; then
593    PREFLAGS="$PREFLAGS -pthread"
594    LDFLAGS="$LDFLAGS -pthread"
595  fi
596  if test "${use_flag_posix_pthread}" = "yes" ; then
597    PREFLAGS="$PREFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT"
598  fi
599  AC_DEFINE(RKTIO_USE_PTHREADS, 1, [Pthread enabled])
600fi
601
602############## zlib and LZ4 ################
603
604if test "${enable_libz}" != "no" ; then
605  if test ! -d "$SCHEME_DIR/zlib" ; then
606    echo "No libz in Scheme directory, so trying installed"
607    enable_libz=yes
608  fi
609fi
610
611if test "${enable_liblz4}" != "no" ; then
612  if test ! -d "$SCHEME_DIR/lz4" ; then
613    echo "No lz4 in Scheme directory, so trying installed"
614    enable_liblz4=yes
615  fi
616fi
617
618if test "${enable_libz}" = "yes" ; then
619  AC_MSG_CHECKING([for libz])
620
621  OLD_LIBS="${LIBS}"
622  LIBS="${LIBS} -lz"
623  AC_TRY_LINK([#include <zlib.h>],
624              [zlibVersion();],
625             have_zlib=yes,
626             have_zlib=no)
627  AC_MSG_RESULT($have_zlib)
628
629  if test "${have_zlib}" = "no" ; then
630    LIBS="${OLD_LIBS}"
631    echo "Building own libz"
632  else
633    Z_LIB_DEP=""
634    Z_LIB="-lz"
635    Z_LIB_UNPACK='$(NOOP)'
636    extra_scheme_config_args="${extra_scheme_config_args} ZLIB=-lz"
637  fi
638fi
639
640if test "${enable_liblz4}" = "yes" ; then
641  AC_MSG_CHECKING([for liblz4])
642
643  OLD_LIBS="${LIBS}"
644  LIBS="${LIBS} -llz4"
645  AC_TRY_LINK([#include <lz4.h>],
646              [LZ4_versionString();],
647             have_lz4=yes,
648             have_lz4=no)
649  AC_MSG_RESULT($have_lz4)
650
651  if test "${have_lz4}" = "no" ; then
652    LIBS="${OLD_LIBS}"
653    echo "Building own liblz4"
654  else
655    LZ4_LIB_DEP=""
656    LZ4_LIB="-llz4"
657    LZ4_LIB_UNPACK='$(NOOP)'
658    extra_scheme_config_args="${extra_scheme_config_args} LZ4=-llz4"
659  fi
660fi
661
662############## other inferred machine properties ################
663
664AC_CHECK_SIZEOF([void *])
665
666m4_include(../ac/valid_sizeof.m4)
667
668############## subconfigure ################
669
670# Before libtool setup
671
672CPPFLAGS="$CPPFLAGS $PREFLAGS"
673
674SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} CC="'"'"${CC}"'"'
675SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} CFLAGS="'"'"${CFLAGS}"'"'
676SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} LDFLAGS="'"'"${LDFLAGS}"'"'
677SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} LIBS="'"'"${LIBS}"'"'
678SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} AR="'"'"${AR}"'"'
679SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} ARFLAGS="'"'"${ARFLAGS}"'"'
680SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} RANLIB="'"'"${RANLIB}"'"'
681SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} WINDRES="'"'"${WINDRES}"'"'
682SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} CPPFLAGS="'"'"${CPPFLAGS}"'"'
683
684# Make sure the --enable-pthread result is propagated:
685if test "${enable_pthread}" = "yes" ; then
686  SUB_CONFIGURE_EXTRAS="$SUB_CONFIGURE_EXTRAS --enable-pthread"
687else
688  SUB_CONFIGURE_EXTRAS="$SUB_CONFIGURE_EXTRAS --disable-pthread"
689fi
690
691# Make sure the --enable-iconv result is propagated:
692if test "${enable_iconv}" = "yes" ; then
693  SUB_CONFIGURE_EXTRAS="$SUB_CONFIGURE_EXTRAS --enable-iconv"
694else
695  SUB_CONFIGURE_EXTRAS="$SUB_CONFIGURE_EXTRAS --disable-iconv"
696fi
697
698############## libtool ################
699
700if test "${enable_shared}" = "yes" ; then
701  echo "Configuring libtool"
702
703  # Assuming an absolute "${libdir}":
704  abslibdir="${libdir}"
705
706  if test ! -d "../../lt" ; then
707    mkdir "../../lt"
708  fi
709  abssrcdir=`(cd ${srcdir}; pwd)`
710
711  if test "${LIBTOOLPROG}" = "" ; then
712    (cd ../../lt; sh ${abssrcdir}/../../lt/configure --enable-shared --disable-static)
713    LIBTOOLPROG=`pwd`/../../lt/libtool
714  fi
715
716  if test "${need_gcc_static_libgcc}" = "yes" ; then
717    need_gcc_static_libgcc=""
718    if test "$CC" = "gcc" ; then
719      gcc_vers_three=`${CC} -v 2>&1 | grep "version 3[.]"`
720      if test "$gcc_vers_three" = "" ; then
721        need_gcc_static_libgcc=""
722      else
723        need_gcc_static_libgcc=" -XCClinker -static-libgcc"
724      fi
725    fi
726  fi
727
728  # Use only for standalone builds:
729  AR="${LIBTOOLPROG} --mode=link --tag=CC $CC${need_gcc_static_libgcc}${ar_libtool_no_undefined} -release ${rktio_version} -rpath ${abslibdir} \$(ARLIBFLAGS) -o"
730  # Used for a librktio convenience library:
731  STATIC_AR="${LIBTOOLPROG} --mode=link --tag=CC $CC -o"
732  ARFLAGS=""
733  RANLIB=":"
734
735  RKTLINKER="${LIBTOOLPROG} --mode=link --tag=CC $CC${need_gcc_static_libgcc}"
736  CC="${LIBTOOLPROG} --mode=compile --tag=CC $CC"
737  LTO="lo"
738  LTA="la"
739  STRIP_LIB_DEBUG=":"
740  LIBSFX=la
741  ICP_LIB="${LIBTOOLPROG} --mode=install install${ICP_STRIP_FLAG}"
742
743  CONFIGURE_RACKET_SO_COMPILE="env PLT_CS_MAKE_LINK_SHARED=y"
744else
745  ICP=cp
746  LTO="o"
747  LTA="a"
748  RKTLINKER='$(CC)'
749  STATIC_AR="$AR"
750  LIBSFX=so
751  ICP_LIB=cp
752  if test "${make_darwin_dylib}" = "yes" ; then
753     LIBSFX="dylib"
754     AR='$(RKTLINKER) --shared -o'
755     ARFLAGS=""
756     LIBS="${LIBS} -framework CoreFoundation"
757     ICP_LIB=cp
758  fi
759fi
760
761############## final output ################
762
763m4_include(../ac/rktio_keep.m4)
764
765SCHEME_CONFIG_ARGS="--machine=${MACH} --disable-x11 ${disable_curses_arg} ${cs_auto_flags} ${extra_scheme_config_args}"
766SCHEME_CROSS_CONFIG_ARGS="--machine=${TARGET_MACH} --disable-x11 ${cs_auto_flags} ${disable_curses_arg} ${extra_scheme_config_args}"
767
768AC_SUBST(upsrcdir)
769AC_SUBST(CC)
770AC_SUBST(CFLAGS)
771AC_SUBST(CPPFLAGS)
772AC_SUBST(LD)
773AC_SUBST(LDFLAGS)
774AC_SUBST(LIBS)
775AC_SUBST(LINK_DYNAMIC)
776AC_SUBST(AR)
777AC_SUBST(ARFLAGS)
778AC_SUBST(RANLIB)
779AC_SUBST(STATIC_AR)
780AC_SUBST(WINDRES)
781AC_SUBST(ICP)
782AC_SUBST(ICP_LIB)
783AC_SUBST(STRIP_DEBUG)
784AC_SUBST(STRIP_LIB_DEBUG)
785AC_SUBST(STRIP_SIGNATURE)
786AC_SUBST(RESTORE_SIGNATURE)
787AC_SUBST(RKTLINKER)
788AC_SUBST(POST_LINKER)
789AC_SUBST(INCLUDEDEP)
790AC_SUBST(RKTL_PRE)
791AC_SUBST(RKTL_POST)
792AC_SUBST(RACKET)
793AC_SUBST(BOOTFILE_RACKET)
794AC_SUBST(SCHEME_DIR)
795AC_SUBST(MACH)
796AC_SUBST(TARGET_MACH)
797AC_SUBST(DIFF_MACH)
798AC_SUBST(CROSS_MODE)
799AC_SUBST(T_CROSS_MODE)
800AC_SUBST(TT_CROSS_MODE)
801AC_SUBST(SETUP_BOOT_MODE)
802AC_SUBST(OSX)
803AC_SUBST(NOT_OSX)
804AC_SUBST(MINGW)
805AC_SUBST(NOT_MINGW)
806AC_SUBST(Z_LIB_DEP)
807AC_SUBST(Z_LIB)
808AC_SUBST(Z_LIB_UNPACK)
809AC_SUBST(LZ4_LIB_DEP)
810AC_SUBST(LZ4_LIB)
811AC_SUBST(LZ4_LIB_UNPACK)
812AC_SUBST(CONFIGURE_RACKET_SO_COMPILE)
813AC_SUBST(COMPRESS_COMP)
814AC_SUBST(BOOT_COMPRESS_COMP)
815AC_SUBST(MAKE_BUILD_SCHEME)
816AC_SUBST(SCHEME_CONFIG_ARGS)
817AC_SUBST(SCHEME_CROSS_CONFIG_ARGS)
818AC_SUBST(FRAMEWORK_INSTALL_DIR)
819AC_SUBST(FRAMEWORK_PREFIX)
820AC_SUBST(FRAMEWORK_REL_INSTALL)
821AC_SUBST(CS_INSTALLED)
822AC_SUBST(CS_COMPILED_SUBDIR)
823AC_SUBST(ENABLE_OR_DISABLE_WPO)
824AC_SUBST(COMP_SUBDIR_CONFIGURE_ARGS)
825AC_SUBST(CROSS_COMPILE_TARGET_KIND)
826AC_SUBST(CS_HOST_WORKAREA_PREFIX)
827AC_SUBST(RUN_RACKET)
828AC_SUBST(INSTALL_SETUP_FLAGS)
829AC_SUBST(INSTALL_SETUP_RACKET_FLAGS)
830AC_SUBST(INSTALL_LIBS_ENABLE)
831AC_SUBST(PLT_CS_SLSP_SUFFIX)
832
833makefiles="Makefile"
834
835AC_OUTPUT($makefiles)
836
837mkdir -p rktio
838abssrcdir=`(cd ${srcdir}; pwd)`
839echo "=== configuring in rktio (${abssrcdir}/../../rktio)"
840cd rktio; eval "${abssrcdir}/../../rktio/configure ${keep_configure_args} ${SUB_CONFIGURE_EXTRAS}"
841