* qthreads.m4 (QTHREADS_CONFIGURE): On NetBSD, pass through a flag
[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, qtmds_s, qtmdc_c, qtdmdb_s --- the names of the machine-
10 dnl dependent source files.
11 dnl qthread_asflags --- flags to pass to the compiler when processing
12 dnl assembly-language files.
13 dnl
14 dnl It also sets the following variables, which describe how clients
15 dnl can link against libqthreads.a:
16 dnl THREAD_PACKAGE --- set to "QT" if configuration succeeds, or
17 dnl the empty string if configuration fails.
18 dnl THREAD_CPPFLAGS --- set to `-I' flags for thread header files
19 dnl THREAD_LIBS_LOCAL --- linker options for use in this source tree
20 dnl THREAD_LIBS_INSTALLED --- linker options for use after this package
21 dnl is installed
22 dnl It would be nice if all thread configuration packages for Guile
23 dnl followed the same conventions.
24 dnl
25 dnl All of the above variables will be substituted into Makefiles in
26 dnl the usual autoconf fashion.
27 dnl
28 dnl We distinguish between THREAD_LIBS_LOCAL and
29 dnl THREAD_LIBS_INSTALLED because the thread library might be in
30 dnl this tree, and be built using libtool. This means that:
31 dnl 1) when building other executables in this tree, one must
32 dnl pass the relative path to the ../libfoo.la file, but
33 dnl 2) once the whole package has been installed, users should
34 dnl link using -lfoo.
35 dnl Normally, we only care about the first case, but since the
36 dnl guile-config script needs to give users all the flags they need
37 dnl to link programs against guile, the GUILE_WITH_THREADS macro
38 dnl needs to supply the second piece of information as well.
39 dnl
40 dnl This whole thing is a little confused about what ought to be
41 dnl done in the top-level configure script, and what ought to be
42 dnl taken care of in the subdirectory. For example, qtmds_s and
43 dnl friends really ought not to be even mentioned in the top-level
44 dnl configure script, but here they are.
45
46 AC_DEFUN([QTHREADS_CONFIGURE],[
47 AC_REQUIRE([AC_PROG_LN_S])
48
49 AC_MSG_CHECKING(QuickThreads configuration)
50 # How can we refer to the qt source directory from within the qt build
51 # directory? For headers, we can rely on the fact that the qt src
52 # directory appears in the #include path.
53 qtsrcdir="`(cd $srcdir; pwd)`/qt"
54
55 changequote(,)dnl We use [ and ] in a regexp in the case
56
57 THREAD_PACKAGE=QT
58 qthread_asflags=''
59 case "$host" in
60 i[3456]86-*-*)
61 port_name=i386
62 qtmd_h=md/i386.h
63 qtmds_s=md/i386.s
64 qtmdc_c=md/null.c
65 qtdmdb_s=
66 case "$host" in
67 *-*-netbsd* )
68 ## NetBSD needs to be told to pass the assembly code through
69 ## the C preprocessor. Other GCC installations seem to do
70 ## this by default, but NetBSD's doesn't. We could get the
71 ## same effect by giving the file a name ending with .S
72 ## instead of .s, but I don't see how to tell automake to do
73 ## that.
74 qthread_asflags='-x assembler-with-cpp'
75 ;;
76 esac
77 ;;
78 mips-sgi-irix[56]*)
79 port_name=irix
80 qtmd_h=md/mips.h
81 qtmds_s=md/mips-irix5.s
82 qtmdc_c=md/null.c
83 qtdmdb_s=md/mips_b.s
84 ;;
85 mips-*-*)
86 port_name=mips
87 qtmd_h=md/mips.h
88 qtmds_s=md/mips.s
89 qtmdc_c=md/null.c
90 qtdmdb_s=md/mips_b.s
91 ;;
92 sparc-*-sunos*)
93 port_name=sparc-sunos
94 qtmd_h=md/sparc.h
95 qtmds_s=md/_sparc.s
96 qtmdc_c=md/null.c
97 qtdmdb_s=md/_sparc_b.s
98 ;;
99 sparc-*-*)
100 port_name=sparc
101 qtmd_h=md/sparc.h
102 qtmds_s=md/sparc.s
103 qtmdc_c=md/null.c
104 qtdmdb_s=md/sparc_b.s
105 ;;
106 alpha-*-*)
107 port_name=alpha
108 qtmd_h=md/axp.h
109 qtmds_s=md/axp.s
110 qtmdc_c=md/null.c
111 qtdmdb_s=md/axp_b.s
112 ;;
113 *)
114 echo "Unknown configuration; threads package disabled"
115 THREAD_PACKAGE=""
116 ;;
117 esac
118 changequote([, ])
119
120 # Did configuration succeed?
121 if test -n "$THREAD_PACKAGE"; then
122 AC_MSG_RESULT($port_name)
123 QTHREAD_LTLIBS=libqthreads.la
124 THREAD_CPPFLAGS="-I$qtsrcdir -I../qt"
125 THREAD_LIBS_LOCAL="../qt/libqthreads.la"
126 THREAD_LIBS_INSTALLED="-lqthreads"
127 else
128 AC_MSG_RESULT(none; disabled)
129 fi
130
131 AC_SUBST(QTHREAD_LTLIBS)
132 AC_SUBST(qtmd_h)
133 AC_SUBST(qtmds_s)
134 AC_SUBST(qtmdc_c)
135 AC_SUBST(qtdmdb_s)
136 AC_SUBST(qthread_asflags)
137 AC_SUBST(THREAD_PACKAGE)
138 AC_SUBST(THREAD_CPPFLAGS)
139 AC_SUBST(THREAD_LIBS_LOCAL)
140 AC_SUBST(THREAD_LIBS_INSTALLED)
141 ])