*** empty log message ***
[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 guile-config 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 AC_REQUIRE([AC_PROG_LN_S])
45
46 AC_MSG_CHECKING(QuickThreads configuration)
47 # How can we refer to the qt source directory from within the qt build
48 # directory? For headers, we can rely on the fact that the qt src
49 # directory appears in the #include path.
50 qtsrcdir="`(cd $srcdir; pwd)`/qt"
51
52 changequote(,)dnl We use [ and ] in a regexp in the case
53
54 THREAD_PACKAGE=QT
55 case "$host" in
56 i[3456]86-*-*)
57 port_name=i386
58 qtmd_h=md/i386.h
59 qtmds_s=md/i386.s
60 qtmdc_c=md/null.c
61 qtdmdb_s=
62 ;;
63 mips-sgi-irix[56]*)
64 port_name=irix
65 qtmd_h=md/mips.h
66 qtmds_s=md/mips-irix5.s
67 qtmdc_c=md/null.c
68 qtdmdb_s=md/mips_b.s
69 ;;
70 mips-*-*)
71 port_name=mips
72 qtmd_h=md/mips.h
73 qtmds_s=md/mips.s
74 qtmdc_c=md/null.c
75 qtdmdb_s=md/mips_b.s
76 ;;
77 sparc-*-sunos*)
78 port_name=sparc-sunos
79 qtmd_h=md/sparc.h
80 qtmds_s=md/_sparc.s
81 qtmdc_c=md/null.c
82 qtdmdb_s=md/_sparc_b.s
83 ;;
84 sparc-*-*)
85 port_name=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 port_name=alpha
93 qtmd_h=md/axp.h
94 qtmds_s=md/axp.s
95 qtmdc_c=md/null.c
96 qtdmdb_s=md/axp_b.s
97 ;;
98 *)
99 echo "Unknown configuration; threads package disabled"
100 THREAD_PACKAGE=""
101 ;;
102 esac
103 changequote([, ])
104
105 # Did configuration succeed?
106 if test -n "$THREAD_PACKAGE"; then
107 AC_MSG_RESULT($port_name)
108 QTHREAD_LTLIBS=libqthreads.la
109 THREAD_CPPFLAGS="-I$qtsrcdir -I../qt"
110 THREAD_LIBS_LOCAL="../qt/libqthreads.la"
111 THREAD_LIBS_INSTALLED="-lqthreads"
112 else
113 AC_MSG_RESULT(none; disabled)
114 fi
115
116 AC_SUBST(QTHREAD_LTLIBS)
117 AC_SUBST(qtmd_h)
118 AC_SUBST(qtmds_s)
119 AC_SUBST(qtmdc_c)
120 AC_SUBST(qtdmdb_s)
121 AC_SUBST(THREAD_PACKAGE)
122 AC_SUBST(THREAD_CPPFLAGS)
123 AC_SUBST(THREAD_LIBS_LOCAL)
124 AC_SUBST(THREAD_LIBS_INSTALLED)
125 ])