2 dnl Originally written by Karl Berry
4 dnl Common Autoconf sinclude file for kpathsea-using programs. (Have to
5 dnl use the m4 `sinclude' builtin instead of `include', since Autoconf
6 dnl disables `include'.)
13 sinclude(../libtool.m4)
23 AC_CHECK_HEADERS([assert.h float.h limits.h memory.h pwd.h stdlib.h \
24 string.h strings.h sys/param.h unistd.h])
25 AC_CHECK_DECLS([strstr])
27 dnl Libtool supporting objects that may be required on ancient broken system.
28 AC_CHECK_FUNCS(putenv,, LTLIBOBJS="$LTLIBOBJS putenv.lo")
29 AC_CHECK_FUNCS(strcasecmp,, LTLIBOBJS="$LTLIBOBJS strcasecmp.lo")
30 AC_CHECK_FUNCS(strtol,, LTLIBOBJS="$LTLIBOBJS strtol.lo")
31 AC_CHECK_FUNCS(strstr,, LTLIBOBJS="$LTLIBOBJS strstr.lo")
34 AC_CHECK_FUNCS(bcmp bcopy bzero getcwd getwd index memcmp memcpy rindex strchr strrchr)
38 # Check whether struct stat provides high-res time.
39 AC_CHECK_MEMBERS([struct stat.st_mtim])
41 # Check whether prototypes work.
42 AC_MSG_CHECKING(whether the compiler accepts prototypes)
43 AC_CACHE_VAL(kb_cv_c_prototypes,
44 [AC_TRY_COMPILE([#include <stdarg.h>], [extern void foo(int i,...);],
45 kb_cv_c_prototypes=yes, kb_cv_c_prototypes=no)])dnl
46 AC_MSG_RESULT($kb_cv_c_prototypes)
47 if test "$kb_cv_c_prototypes" = yes; then
48 AC_DEFINE([HAVE_PROTOTYPES], 1,
49 [Define to 1 if your compiler understands prototypes.])
52 # This is a GNU libc invention.
53 AC_MSG_CHECKING([whether program_invocation_name is predefined])
54 AC_CACHE_VAL([kb_cv_var_program_inv_name],
56 [extern char *program_invocation_name; program_invocation_name = "love";],
57 [kb_cv_var_program_inv_name=yes], [kb_cv_var_program_inv_name=no])])dnl
58 AC_MSG_RESULT([$kb_cv_var_program_inv_name])
59 if test "$kb_cv_var_program_inv_name" = yes; then
60 AC_DEFINE([HAVE_PROGRAM_INVOCATION_NAME], 1,
61 [Define to 1 if you are using GNU libc or otherwise have global
62 variables `program_invocation_name' and `program_invocation_short_name'.])
65 if test $ac_cv_func_getcwd = yes; then
66 # We only need to run this if we have getcwd.
67 AC_MSG_CHECKING([whether getcwd uses fork or vfork])
68 AC_CACHE_VAL([kb_cv_func_getcwd_forks],
70 int fork() { exit(1); }
71 int vfork() { exit(1); }
72 extern char *getcwd();
77 }], [kb_cv_func_getcwd_forks=no], [kb_cv_func_getcwd_forks=yes],
78 [kb_cv_func_getcwd_forks=no])])dnl
79 AC_MSG_RESULT([$kb_cv_func_getcwd_forks])
80 if test $kb_cv_func_getcwd_forks = yes; then
81 AC_DEFINE([GETCWD_FORKS], 1,
82 [Define to 1 if getcwd is implemented using fork or vfork. Let me know
83 if you have to add this by hand because configure failed to detect it.])
87 # Common --with and --enable options.
88 sinclude(../../texk/kpathsea/withenable.ac)
90 # Implementation of those options.
91 AC_DEFUN([_KPSE_DEFINE_MAKE_BY_DEFAULT],
92 [if test "x$with_$1_default" = xyes; then
93 AC_DEFINE([MAKE_$2_BY_DEFAULT], 1,
94 [Define to 1 if you want to run $1 if $3 missing, and to 0 if you don't.])
96 AC_DEFINE([MAKE_$2_BY_DEFAULT], 0)
98 ])# _KPSE_DEFINE_MAKE_BY_DEFAULT
100 _KPSE_DEFINE_MAKE_BY_DEFAULT([mktexmf], [TEX_MF], [MF source])
101 _KPSE_DEFINE_MAKE_BY_DEFAULT([mktexpk], [TEX_PK], [PK font])
102 _KPSE_DEFINE_MAKE_BY_DEFAULT([mktextex], [TEX_TEX], [TeX source])
103 _KPSE_DEFINE_MAKE_BY_DEFAULT([mktexfmt], [TEX_FMT], [format file])
104 _KPSE_DEFINE_MAKE_BY_DEFAULT([mktextfm], [TEX_TFM], [TFM file])
105 _KPSE_DEFINE_MAKE_BY_DEFAULT([mkocp], [OMEGA_OCP], [OCP file])
106 _KPSE_DEFINE_MAKE_BY_DEFAULT([mkofm], [OMEGA_OFM], [OFM file])
108 # Is libm present. FIXME: do we need it at all?
109 AC_CHECK_LIB(m, main)
111 # If you're cross-compiling, these macros set up the variables in
112 # ../make/cross.mk: BUILDCC, BUILDCFLAGS, BUILDCCLD etc.
113 KPSE_CROSS_BUILD_VAR(CC, cc)
114 KPSE_CROSS_BUILD_VAR(CFLAGS, $(BUILDXCFLAGS))
115 KPSE_CROSS_BUILD_VAR(CPPFLAGS, $(BUILDXCPPFLAGS))
116 KPSE_CROSS_BUILD_VAR(LDFLAGS, $(BUILDXLDFLAGS))
117 KPSE_CROSS_BUILD_VAR(CCLD, $(BUILDCC))