Clean up thread configuration.
[bpt/guile.git] / qthreads.m4
1 dnl Autoconf macros for configuring the QuickThreads package
2
3 dnl QTHREADS_CONFIGURE configures the QuickThreads package. The QT
4 dnl sources should be in $srcdir/qt. If configuration succeeds, this
5 dnl macro creates the appropriate symlinks in the qt object directory,
6 dnl and sets the following variables, used in building libqthreads.a:
7 dnl QTHREAD_LTLIBS --- set to libqthreads.la if configuration
8 dnl succeeds, or the empty string if configuration fails.
9 dnl qtmd_h --- the name of the machine-dependent header file.
10 dnl
11 dnl It also sets the following variables, which describe how clients
12 dnl can link against libqthreads.a:
13 dnl THREAD_PACKAGE --- set to "QT" if configuration succeeds, or
14 dnl the empty string if configuration fails.
15 dnl THREAD_CPPFLAGS --- set to `-I' flags for thread header files
16 dnl THREAD_LIBS_LOCAL --- linker options for use in this source tree
17 dnl THREAD_LIBS_INSTALLED --- linker options for use after this package
18 dnl is installed
19 dnl It would be nice if all thread configuration packages for Guile
20 dnl followed the same conventions.
21 dnl
22 dnl All of the above variables will be substituted into Makefiles in
23 dnl the usual autoconf fashion.
24 dnl
25 dnl We distinguish between THREAD_LIBS_LOCAL and
26 dnl THREAD_LIBS_INSTALLED because the thread library might be in
27 dnl this tree, and be built using libtool. This means that:
28 dnl 1) when building other executables in this tree, one must
29 dnl pass the relative path to the ../libfoo.la file, but
30 dnl 2) once the whole package has been installed, users should
31 dnl link using -lfoo.
32 dnl Normally, we only care about the first case, but since the
33 dnl build-guile script needs to give users all the flags they need
34 dnl to link programs against guile, the GUILE_WITH_THREADS macro
35 dnl needs to supply the second piece of information as well.
36 dnl
37 dnl This whole thing is a little confused about what ought to be
38 dnl done in the top-level configure script, and what ought to be
39 dnl taken care of in the subdirectory. For example, qtmdc_lo and
40 dnl friends really ought not to be even mentioned in the top-level
41 dnl configure script, but here they are.
42
43 AC_DEFUN([QTHREADS_CONFIGURE],[
44
45 # For some reason, AC_REQUIRE doesn't seem to work with the aclocal
46 # program. So we'll just do this runtime check.
47 if test "${LN_S}" = ""; then
48 f=''
49 AC_MSG_ERROR(The QTHREADS${f}_CONFIGURE macro requires A${f}C_PROG_LN_S)
50 fi
51
52 # How can we refer to the qt source directory from within the qt build
53 # directory? For headers, we can rely on the fact that the qt src
54 # directory appears in the #include path.
55 qtsrcdir="`(cd $srcdir; pwd)`/qt"
56
57 changequote(,)dnl We use [ and ] in a regexp in the case
58
59 THREAD_PACKAGE=QT
60 case "$host" in
61 i[3456]86-*-*)
62 qtmd_h=md/i386.h
63 qtmds_s=md/i386.s
64 qtmdc_c=md/null.c
65 qtdmdb_s=
66 ;;
67 mips-sgi-irix[56]*)
68 qtmd_h=md/mips.h
69 qtmds_s=md/mips-irix5.s
70 qtmdc_c=md/null.c
71 qtdmdb_s=md/mips_b.s
72 ;;
73 mips-*-*)
74 qtmd_h=md/mips.h
75 qtmds_s=md/mips.s
76 qtmdc_c=md/null.c
77 qtdmdb_s=md/mips_b.s
78 ;;
79 sparc-*-sunos*)
80 qtmd_h=md/sparc.h
81 qtmds_s=md/_sparc.s
82 qtmdc_c=md/null.c
83 qtdmdb_s=md/_sparc_b.s
84 ;;
85 sparc-*-*)
86 qtmd_h=md/sparc.h
87 qtmds_s=md/sparc.s
88 qtmdc_c=md/null.c
89 qtdmdb_s=md/sparc_b.s
90 ;;
91 alpha-*-*)
92 qtmd_h=md/axp.h
93 qtmds_s=md/axp.s
94 qtmdc_c=md/null.c
95 qtdmdb_s=md/axp_b.s
96 ;;
97 *)
98 echo "Unknown configuration; threads package disabled"
99 THREAD_PACKAGE=""
100 ;;
101 esac
102 changequote([, ])
103
104 # Did configuration succeed?
105 if test -n "$THREAD_PACKAGE"; then
106 QTHREAD_LTLIBS=libqthreads.la
107 THREAD_CPPFLAGS="-I$qtsrcdir -I../qt"
108 THREAD_LIBS_LOCAL="../qt/libqthreads.la"
109 THREAD_LIBS_INSTALLED="-lqthreads"
110 fi
111
112 AC_SUBST(QTHREAD_LTLIBS)
113 AC_SUBST(qtmd_h)
114 AC_SUBST(qtmds_s)
115 AC_SUBST(qtmdc_c)
116 AC_SUBST(qtdmdb_s)
117 AC_SUBST(THREAD_PACKAGE)
118 AC_SUBST(THREAD_CPPFLAGS)
119 AC_SUBST(THREAD_LIBS_LOCAL)
120 AC_SUBST(THREAD_LIBS_INSTALLED)
121 ])