Clean up thread configuration.
[bpt/guile.git] / qthreads.m4
CommitLineData
539c89a1
JB
1dnl Autoconf macros for configuring the QuickThreads package
2
3dnl QTHREADS_CONFIGURE configures the QuickThreads package. The QT
4dnl sources should be in $srcdir/qt. If configuration succeeds, this
5dnl macro creates the appropriate symlinks in the qt object directory,
6dnl and sets the following variables, used in building libqthreads.a:
7dnl QTHREAD_LTLIBS --- set to libqthreads.la if configuration
8dnl succeeds, or the empty string if configuration fails.
9dnl qtmd_h --- the name of the machine-dependent header file.
10dnl
11dnl It also sets the following variables, which describe how clients
12dnl can link against libqthreads.a:
13dnl THREAD_PACKAGE --- set to "QT" if configuration succeeds, or
14dnl the empty string if configuration fails.
15dnl THREAD_CPPFLAGS --- set to `-I' flags for thread header files
16dnl THREAD_LIBS_LOCAL --- linker options for use in this source tree
17dnl THREAD_LIBS_INSTALLED --- linker options for use after this package
18dnl is installed
19dnl It would be nice if all thread configuration packages for Guile
20dnl followed the same conventions.
21dnl
22dnl All of the above variables will be substituted into Makefiles in
23dnl the usual autoconf fashion.
24dnl
25dnl We distinguish between THREAD_LIBS_LOCAL and
26dnl THREAD_LIBS_INSTALLED because the thread library might be in
27dnl this tree, and be built using libtool. This means that:
28dnl 1) when building other executables in this tree, one must
29dnl pass the relative path to the ../libfoo.la file, but
30dnl 2) once the whole package has been installed, users should
31dnl link using -lfoo.
32dnl Normally, we only care about the first case, but since the
33dnl build-guile script needs to give users all the flags they need
34dnl to link programs against guile, the GUILE_WITH_THREADS macro
35dnl needs to supply the second piece of information as well.
36dnl
37dnl This whole thing is a little confused about what ought to be
38dnl done in the top-level configure script, and what ought to be
39dnl taken care of in the subdirectory. For example, qtmdc_lo and
40dnl friends really ought not to be even mentioned in the top-level
41dnl configure script, but here they are.
42
43AC_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])