Debian Codegraph @

texk/kpathsea/configure.ac

raw ◀ ▶
1 Debian patch touch this file
1 dnl $Id: configure.ac 64941 2022-11-05 15:43:53Z karl $
2 dnl Process this file with autoconf to produce a configure script.
3 dnl
•4 dnl Copyright 2015-2026 Karl Berry <[email protected]>
5 dnl Copyright 2009-2015 Peter Breitenlohner <[email protected]>
6 dnl
7 dnl This file is free software; the copyright holder
8 dnl gives unlimited permission to copy and/or distribute it,
9 dnl with or without modifications, as long as this notice is preserved.
10 dnl
11 m4_include([version.ac])[] dnl define kpse_version
12 AC_INIT([Kpathsea], kpse_version, [[email protected]])
13 AC_PREREQ([2.65])
14 AC_CONFIG_SRCDIR([pathsearch.c])
15 AC_CONFIG_AUX_DIR([../../build-aux])
16 AC_CONFIG_MACRO_DIR([../../m4])
17
18 AC_SUBST([KPSEVERSION], [kpse_version])
19 KPSE_LT_VERSION([kpse])
20
21 m4_include([../../version.ac])[] dnl define tex_live_version
22 AC_SUBST([WEB2CVERSION], [" (TeX Live tex_live_version)"])
23
24 dnl Common code for all programs using libkpathsea.
25 KPSE_COMMON([kpathsea])
26 dnl Include additional code for kpathsea.
27 KPSE_MKTEX_PREPARE
28 m4_sinclude([ac/mktex.ac])
29
30 dnl Generate MAKE_TEX_*_BY_DEFAULT and MAKE_OMEGA_*_BY_DEFAULT defines.
31 m4_foreach([Kpse_Mktex], [kpse_mktex_opts],
32 [m4_ifset([Kpse_Mktex],
33 [KPSE_MKTEX_DEFINE(Kpse_Mktex)])])[]dnl
34
35 # So we can use reasonable awk in the Makefile.
36 AC_PROG_AWK
37
38 AC_CHECK_SIZEOF([long])
39
40 dnl Replacement functions that may be required on ancient broken system.
41 AC_CHECK_DECLS([putenv])
42 AC_REPLACE_FUNCS([putenv])
43
44 if test "x$ac_cv_func_getcwd" = xyes; then
•45 # We only need to run this if we have getcwd.
46 # Don't declare getcwd(), since C23 doesn't allow empty parens.
47 # Instead, we just have to hope that it's declared where it should be.
48 AC_CACHE_CHECK([whether getcwd uses fork or vfork],
49 [kb_cv_func_getcwd_forks],
•50 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
51 #include <stdlib.h>
52 int fork() { exit(1); }
53 int vfork() { exit(1); }
54 char path[100];]],
55 [[getcwd(path,100);]])],
56 [kb_cv_func_getcwd_forks=no],
57 [kb_cv_func_getcwd_forks=yes],
58 [kb_cv_func_getcwd_forks=no])])
•59 if test "x$kb_cv_func_getcwd_forks" = xyes; then
60 AC_DEFINE([GETCWD_FORKS], 1,
61 [Define to 1 if getcwd is implemented using fork or vfork.
•62 Email [email protected] with your system info and config.log if
63 you have to add this by hand because configure failed to
64 detect it.])
65 fi # forks=yes
66 fi # have_getcwd
67
68 KPSE_COND_MINGW32
69
70 AC_SUBST([LT_OBJDIR], ["$lt_cv_objdir"])
71
72 # Checking snprintf and vsnprintf
73 AC_ARG_WITH([snprintf-wrapper],
74 AS_HELP_STRING([--with-snprintf-wrapper],
75 [use (v)snprintf wrapper functions @<:@automatic
76 for native compilation or Windows@:>@]),
77 [kpse_cv_wrap_snprintf=$withval],
78 [test "x$kpse_cv_have_win32" != xno && kpse_cv_wrap_snprintf=yes])[]dnl
79 if test "x$kpse_cv_have_win32" = xno; then
80 snfunc=snprintf vsnfunc=vsnprintf
81 else
82 snfunc=_snprintf vsnfunc=_vsnprintf
83 fi
84 AC_CACHE_CHECK([for $snfunc and $vsnfunc],
85 [kpse_cv_have_snfuncs],
86 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
87 #include <stdio.h>
88 char buf[16];
89 va_list ap;]],
90 [[$snfunc (buf, 16, "%s", "abc");
91 $vsnfunc (buf, 16, "%s", ap);]])],
92 [kpse_cv_have_snfuncs=yes],
93 [kpse_cv_have_snfuncs=no])])
94 if test "x$kpse_cv_have_snfuncs" != xyes; then
95 AC_MSG_ERROR([Sorry, you need $snfunc and $vsnfunc.])
96 fi
97 AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
98 #include <stdio.h>
99 char buf[4] = "abc";]],
100 [[if ($snfunc (buf, 1, "%s", "x") == 0 || buf[1] != 'b')
101 return 1;]])],
102 [],
103 [AC_MSG_ERROR([Sorry, your $snfunc is badly broken.])],
104 [:])
105 AC_CACHE_CHECK([if we need (v)snprintf wrapper functions],
106 [kpse_cv_wrap_snprintf],
107 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
108 #include <stdio.h>
109 char buf[4] = "abc";]],
110 [[$snfunc (buf, 3, "xyz");
111 if (buf[2] != 0) return 1;
112 $snfunc (buf, 2, "xyz");
113 if (buf[1] != 0) return 1;]])],
114 [kpse_cv_wrap_snprintf=no],
115 [kpse_cv_wrap_snprintf=yes],
116 [kpse_cv_wrap_snprintf=no])])
117 if test "x$kpse_cv_wrap_snprintf" = xyes; then
118 AC_DEFINE([WRAP_SNPRINTF], 1,
119 [Define to 1 if we need (v)snprintf wrapper functions.])
120 fi
121
122 AM_CONDITIONAL([have_EXEEXT], [test -n "$EXEEXT"])
123
124 dnl Write output here, instead of putting a zillion -D's on the command line.
125 AC_CONFIG_HEADERS([c-auto.h:c-auto.in],
126 [sed -e 's/^#define PACKAGE/#define KPSE_PACKAGE/' \
127 -e 's/^#define VERSION/#define KPSE_VERSION/' c-auto.h >c-auto.tmp && mv -f c-auto.tmp c-auto.h])
128
129 AH_TOP([/* c-auto.h: defines for kpathsea, as determined by configure.
130
131 Copyright 1994-97, 2008-2015 Karl Berry.
132 Copyright 1997-99, 2002, 2005 Olaf Weber.
133
134 This library is free software; you can redistribute it and/or
135 modify it under the terms of the GNU Lesser General Public
136 License as published by the Free Software Foundation; either
137 version 2.1 of the License, or (at your option) any later version.
138
139 This library is distributed in the hope that it will be useful,
140 but WITHOUT ANY WARRANTY; without even the implied warranty of
141 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
142 Lesser General Public License for more details.
143
144 You should have received a copy of the GNU Lesser General Public License
145 along with this library; if not, see <http://www.gnu.org/licenses/>. */
146
147 /* Guard against double inclusion. */
148 #ifndef KPATHSEA_C_AUTO_H
149 #define KPATHSEA_C_AUTO_H
150
151 /* kpathsea: the version string. */
152 #define KPSEVERSION "kpathsea version] kpse_version["])
153 AH_BOTTOM([#endif /* !KPATHSEA_C_AUTO_H */])
154
155 AC_CONFIG_FILES([Makefile doc/Makefile man/Makefile win32/Makefile kpathsea.pc])
156
157 AC_OUTPUT