summaryrefslogtreecommitdiff
path: root/Build/source/texk/xdvik/kpathsea.ac.orig
blob: 3163f9d411196a9d9a9018f298c1a60fae888e4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
dnl Check if we want to compile against an installed kpathsea library

EXTRA_LIBKPATHSEA_INCLUDE=
EXTRA_LIBKPATHSEA_LIBDIR=

if test "$with_system_kpathsea" = yes; then
  if test "x$with_kpathsea_libdir" != x; then
    EXTRA_LIBKPATHSEA_LIBDIR="-L$with_kpathsea_libdir"
  fi
  if test "x$with_kpathsea_include" != x; then
    EXTRA_LIBKPATHSEA_INCLUDE="-I$with_kpathsea_include"
  fi
fi

if test "$with_system_kpathsea" = yes; then
  OLD_LDFLAGS=$LDFLAGS
  OLD_CPP=$CPP
  OLD_CPPFLAGS=$CPPFLAGS
  OLD_LIBS=$LIBS
  
  LDFLAGS="$LDFLAGS $EXTRA_LIBKPATHSEA_LIBDIR"
  CPP="$CPP $EXTRA_LIBKPATHSEA_INCLUDE"
  CPPFLAGS="$EXTRA_LIBKPATHSEA_INCLUDE"

  AC_MSG_CHECKING(whether kpathsea defines kpse_enc_format)
  AC_TRY_COMPILE([#include "kpathsea/kpathsea.h"
  ], [kpse_file_format_type mytype = kpse_enc_format;
  ], have_good_kpathsea=yes, have_good_kpathsea=no)
  if test $have_good_kpathsea = no; then
    AC_MSG_RESULT(no)
    AC_MSG_WARN(kpathsea library is not recent enough; will compile my own)
    with_system_kpathsea=no
  else
    AC_MSG_RESULT(yes)
  fi

  LDFLAGS=$OLD_LDFLAGS
  CPP=$OLD_CPP
  CPPFLAGS=$OLD_CPPFLAGS
  LIBS=$OLD_LIBS
fi

if test "$with_system_kpathsea" = yes; then
  LIBKPATHSEACPPFLAGS="$EXTRA_LIBKPATHSEA_INCLUDE"
  LDLIBKPATHSEA="$EXTRA_LIBKPATHSEA_LIBDIR -lkpathsea"
  LIBKPATHSEADEP=
  using_system_kpathsea=yes
else
  LIBKPATHSEACPPFLAGS='-I$(kpathsea_dir)'
  LDLIBKPATHSEA='$(kpathsea_dir)/libkpathsea.la'
  LIBKPATHSEADEP='$(kpathsea_dir)/libkpathsea.la'
  using_system_kpathsea=no
fi


AC_SUBST(LIBKPATHSEACPPFLAGS)
AC_SUBST(LDLIBKPATHSEA)
AC_SUBST(LIBKPATHSEADEP)