~ubuntu-branches/ubuntu/wily/luatex/wily

« back to all changes in this revision

Viewing changes to source/libs/zziplib/zziplib-0.13.58/m4/patch_libtool_to_add_host_cc.m4

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2010-04-29 00:47:19 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20100429004719-o42etkqe90n97b9e
Tags: 0.60.1-1
* new upstream release, adapt build-script patch
* disable patch: upstream-epstopdf_cc_no_xpdf_patching, included upstream
* disable patch: libpoppler-0.12, not needed anymore

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl /usr/share/aclocal/guidod-cvs/patch_libtool_to_add_host_cc.m4
 
2
dnl @synopsis PATCH_LIBTOOL_TO_ADD_HOST_CC
 
3
dnl
 
4
dnl The libtool 1.4.x processing (and patched 1.3.5) uses a little
 
5
dnl "impgen" tool to turn a "*.dll" into an import "*.lib" as it is
 
6
dnl needed for win32 targets. However, this little tool is not shipped
 
7
dnl by binutils, it is not even a command option of dlltool or dllwrap.
 
8
dnl It happens to be a C source snippet implanted into the libtool
 
9
dnl sources - it gets written to ".libs", compiled into a binary
 
10
dnl on-the-fly, and executed right away on the "dll" file to create the
 
11
dnl import-lib (dll.a files in gcc-speak).
 
12
dnl
 
13
dnl This mode works fine for a native build within mingw or cygwin, but
 
14
dnl it does not work in cross-compile mode since CC is a crosscompiler
 
15
dnl - it will create an .exe file on a non-win32 system, and as a
 
16
dnl result an impgen.exe is created on-the-fly that can not be executed
 
17
dnl on-the-fly. Luckily, the actual libtool snippet uses HOST_CC to
 
18
dnl compile the sources which has a fallback to CC when the HOST_CC
 
19
dnl variable was not set.
 
20
dnl
 
21
dnl this ac-macro is trying to detect a valid HOST_CC which is not a
 
22
dnl cross-compiler. This is done by looking into the $PATH for a "cc"
 
23
dnl and the result is patched into libtool a HOST_CC, iow it adds
 
24
dnl another configured variable at the top of the libtool script.
 
25
dnl
 
26
dnl In discussions on the libtool mailinglist it occurred that later
 
27
dnl gcc/binutils generations are able to link with dlls directly, i.e.
 
28
dnl there is no import-lib needed anymore. The import-table is created
 
29
dnl within the linker itself (in-memory) and bound to the .exe/.dll
 
30
dnl currently in the making. The whole stuff of impgen exe and
 
31
dnl compiling it on-the-fly, well, it is superflouos then.
 
32
dnl
 
33
dnl Since mingw crosscompilers tend to be quite a fresh development it
 
34
dnl was agreed to remove the impgen stuff completly from libtool
 
35
dnl sources. Still however, this macro does not hurt since it does not
 
36
dnl patch impgen cmds but it just adds HOST_CC which might be useful in
 
37
dnl other cross-compiling cases as well. Therefore, you can leave it in
 
38
dnl for maximum compatibility and portability.
 
39
dnl
 
40
dnl @category Misc
 
41
dnl @category C
 
42
dnl @author Guido U. Draheim <guidod@gmx.de>
 
43
dnl @version 2005-01-21
 
44
dnl @license GPLWithACException
 
45
 
 
46
AC_DEFUN([PATCH_LIBTOOL_TO_ADD_HOST_CC],
 
47
[# patch libtool to add HOST_CC sometimes needed in crosscompiling a win32 dll
 
48
if grep "HOST_CC" libtool >/dev/null; then
 
49
  if test "$build" != "$host" ; then
 
50
    if test "_$HOST_CC" = "_" ; then
 
51
      HOST_CC="false"
 
52
      for i in `echo $PATH | sed 's,:, ,g'` ; do
 
53
      test -x $i/cc && HOST_CC=$i/cc
 
54
      done
 
55
    fi
 
56
AC_MSG_RESULT(patching libtool to add HOST_CC=$HOST_CC)
 
57
    test -f libtool.old || (mv libtool libtool.old && cp libtool.old libtool)
 
58
    sed -e "/BEGIN.*LIBTOOL.*CONFIG/a\\
 
59
HOST_CC=$HOST_CC" libtool >libtool.new
 
60
    (test -s libtool.new || rm libtool.new) 2>/dev/null
 
61
    test -f libtool.new && mv libtool.new libtool # not 2>/dev/null !!
 
62
    test -f libtool     || mv libtool.old libtool
 
63
  fi
 
64
fi
 
65
])
 
66