]> git.wh0rd.org - fontconfig.git/blame - acinclude.m4
Bump libtool revision in preparation for release
[fontconfig.git] / acinclude.m4
CommitLineData
4dfb4aa1
KP
1dnl dolt, a replacement for libtool
2dnl Copyright © 2007-2008 Josh Triplett <josh@freedesktop.org>
3dnl Copying and distribution of this file, with or without modification,
4dnl are permitted in any medium without royalty provided the copyright
5dnl notice and this notice are preserved.
6dnl
7dnl To use dolt, invoke the DOLT macro immediately after the libtool macros.
8dnl Optionally, copy this file into acinclude.m4, to avoid the need to have it
9dnl installed when running autoconf on your project.
10
11AC_DEFUN([DOLT], [
12AC_REQUIRE([AC_CANONICAL_HOST])
13# dolt, a replacement for libtool
14# Josh Triplett <josh@freedesktop.org>
15AC_PATH_PROG(DOLT_BASH, bash)
16AC_MSG_CHECKING([if dolt supports this host])
17dolt_supported=yes
18if test x$DOLT_BASH = x; then
19 dolt_supported=no
20fi
21if test x$GCC != xyes; then
22 dolt_supported=no
23fi
24case $host in
25i?86-*-linux*|x86_64-*-linux*|powerpc-*-linux*) ;;
26amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*) ;;
27*) dolt_supported=no ;;
28esac
29if test x$dolt_supported = xno ; then
30 AC_MSG_RESULT([no, falling back to libtool])
31 LTCOMPILE='$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(COMPILE)'
32 LTCXXCOMPILE='$(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXXCOMPILE)'
33else
34 AC_MSG_RESULT([yes, replacing libtool])
35
36dnl Start writing out doltcompile.
37 cat <<__DOLTCOMPILE__EOF__ >doltcompile
38#!$DOLT_BASH
39__DOLTCOMPILE__EOF__
40 cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
41args=("$[]@")
42for ((arg=0; arg<${#args@<:@@@:>@}; arg++)) ; do
43 if test x"${args@<:@$arg@:>@}" = x-o ; then
44 objarg=$((arg+1))
45 break
46 fi
47done
48if test x$objarg = x ; then
49 echo 'Error: no -o on compiler command line' 1>&2
50 exit 1
51fi
52lo="${args@<:@$objarg@:>@}"
53obj="${lo%.lo}"
54if test x"$lo" = x"$obj" ; then
55 echo "Error: libtool object file name \"$lo\" does not end in .lo" 1>&2
56 exit 1
57fi
58objbase="${obj##*/}"
59__DOLTCOMPILE__EOF__
60
61dnl Write out shared compilation code.
62 if test x$enable_shared = xyes; then
63 cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
64libobjdir="${obj%$objbase}.libs"
65if test ! -d "$libobjdir" ; then
66 mkdir_out="$(mkdir "$libobjdir" 2>&1)"
67 mkdir_ret=$?
68 if test "$mkdir_ret" -ne 0 && test ! -d "$libobjdir" ; then
69 echo "$mkdir_out" 1>&2
70 exit $mkdir_ret
71 fi
72fi
73pic_object="$libobjdir/$objbase.o"
74args@<:@$objarg@:>@="$pic_object"
75"${args@<:@@@:>@}" -fPIC -DPIC || exit $?
76__DOLTCOMPILE__EOF__
77 fi
78
79dnl Write out static compilation code.
80dnl Avoid duplicate compiler output if also building shared objects.
81 if test x$enable_static = xyes; then
82 cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
83non_pic_object="$obj.o"
84args@<:@$objarg@:>@="$non_pic_object"
85__DOLTCOMPILE__EOF__
86 if test x$enable_shared = xyes; then
87 cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
88"${args@<:@@@:>@}" >/dev/null 2>&1 || exit $?
89__DOLTCOMPILE__EOF__
90 else
91 cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
92"${args@<:@@@:>@}" || exit $?
93__DOLTCOMPILE__EOF__
94 fi
95 fi
96
97dnl Write out the code to write the .lo file.
98dnl The second line of the .lo file must match "^# Generated by .*libtool"
99 cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
100{
101echo "# $lo - a libtool object file"
102echo "# Generated by doltcompile, not libtool"
103__DOLTCOMPILE__EOF__
104
105 if test x$enable_shared = xyes; then
106 cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
107echo "pic_object='$pic_object'"
108__DOLTCOMPILE__EOF__
109 else
110 cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
111echo pic_object=none
112__DOLTCOMPILE__EOF__
113 fi
114
115 if test x$enable_static = xyes; then
116 cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
117echo "non_pic_object='$non_pic_object'"
118__DOLTCOMPILE__EOF__
119 else
120 cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
121echo non_pic_object=none
122__DOLTCOMPILE__EOF__
123 fi
124
125 cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
126} > "$lo"
127__DOLTCOMPILE__EOF__
128
129dnl Done writing out doltcompile; substitute it for libtool compilation.
130 chmod +x doltcompile
131 LTCOMPILE='$(top_builddir)/doltcompile $(COMPILE)'
132 LTCXXCOMPILE='$(top_builddir)/doltcompile $(CXXCOMPILE)'
133fi
134AC_SUBST(LTCOMPILE)
135AC_SUBST(LTCXXCOMPILE)
136# end dolt
137])