1dnl Process this file with autoconf to produce a configure script.
2dnl
3dnl   Copyright (C) 2009-2013 Peter Breitenlohner <tex-live@tug.org>
4dnl
5dnl   This file is free software; the copyright holder
6dnl   gives unlimited permission to copy and/or distribute it,
7dnl   with or without modifications, as long as this notice is preserved.
8dnl
9m4_include([tardate.ac])[] dnl define tex_live_tardate
10m4_include([version.ac])[] dnl define tex_live_version
11AC_INIT([TeX Live], tex_live_tardate, [tex-k@tug.org])
12AC_PREREQ([2.65])
13AC_CONFIG_SRCDIR([m4/kpse-pkgs.m4])
14AC_CONFIG_AUX_DIR([build-aux])
15AC_CONFIG_MACRO_DIRS([m4])
16
17dnl Prevent to configure the source tree by mistake.
18if test "x$srcdir" = x. && test "x$enable_build_in_source_tree" != xyes; then
19  rm -rf config.log
20  AC_MSG_ERROR([Configuring and building TeX Live in the source tree
21is strongly discouraged.  If you really want to do that, you must
22specify the configure option `--enable-build-in-source-tree', but
23then do not ask for help -- you have been warned.])
24fi
25
26dnl ## ------------------------------------------- ##
27dnl ## Setup of the TeX Live (TL) infrastructure   ##
28dnl ##    done in ./, libs/, utils/, and texk/     ##
29dnl ## ------------------------------------------- ##
30dnl
31dnl 1. Define four lists of TeXk programs, utility programs,
32dnl    and (generic or TeX specific) libraries in the TL tree.
33dnl    These list are defined in m4/kpse-pkgs.m4.
34dnl
35dnl 2. For each program Prog in the list of
36dnl      utility programs:
37dnl        sinclude utils/Prog/ac/withenable.ac
38dnl      TeXk programs:
39dnl        sinclude texk/Prog/ac/withenable.ac
40dnl    These fragments usually provide the configure options
41dnl      --disable-Prog or --enable-Prog
42dnl    If Prog is to be built, then set need_SubLib=yes
43dnl      for each TL library SubLib required by Prog (if any)
44dnl
45dnl 3. For each library Lib in the list of
46dnl      generic TL libraries:
47dnl        sinclude libs/Lib/ac/withenable.ac
48dnl      TeX specific TL libraries:
49dnl        sinclude texk/Lib/ac/withenable.ac
50dnl    These fragments usually provide the configure options
51dnl      --with-system-Lib, --with-Lib-includes=DIR, and --with-Lib-libdir=DIR
52dnl    For each TL library SubLib required by Lib (if any):
53dnl      disallow with_system_Lib=yes and with_system_SubLib=no
54dnl      if $need_Lib=yes then set need_SubLib=yes
55dnl
56KPSE_SETUP([])
57
58dnl Common code for all programs using libkpathsea.
59KPSE_COMMON([TeX Live top-level], [tar-pax dist-xz no-dist-gzip])
60KPSE_CANONICAL_HOST
61
62AC_PROG_MKDIR_P
63
64AC_PATH_XTRA
65
66AC_PROG_CXX
67
68AC_PROG_LN_S
69AC_ARG_WITH([ln-s],
70            AS_HELP_STRING([--without-ln-s],
71                           [do build even if `ln -s' does not work]))[]dnl
72if test "x$LN_S" != "xln -s" && test "x$kpse_cv_have_win32" = xno && test "x$with_ln_s" != xno; then
73  AC_MSG_ERROR([You could use `--without-ln-s' to build without working `ln -s'])
74fi
75
76if test "x$enable_native_texlive_build" = xyes; then
77  if test "x$datarootdir" = 'x${prefix}/share'; then
78    datarootdir='${prefix}'
79    ac_configure_args="$ac_configure_args '--datarootdir=$datarootdir'"
80  fi
81  if test "x$mandir" = 'x${datarootdir}/man'; then
82    mandir='${prefix}/texmf-dist/doc/man'
83    ac_configure_args="$ac_configure_args '--mandir=$mandir'"
84  fi
85  if test "x$infodir" = 'x${datarootdir}/info'; then
86    infodir='${prefix}/texmf-dist/doc/info'
87    ac_configure_args="$ac_configure_args '--infodir=$infodir'"
88  fi
89fi
90
91dnl Although quite unusual, it is possible to build Web2C (TeX & Co)
92dnl using installed (system) kpathsea headers and library.
93dnl In that case we need the location of <kpathsea/paths.h>.
94if test "x$enable_web2c" = xyes && test "x$with_system_kpathsea" = xyes; then
95  if test "x$with_kpathsea_includes" = x; then
96    list="/usr/include /usr/local/include"
97  else
98    list=$with_kpathsea_includes
99  fi
100  found=no
101  for ac_dir in $list; do
102    if test -r "$ac_dir/kpathsea/paths.h"; then
103      found=yes
104      break
105    fi
106  done
107  if test "x$found" = xno; then
108    AC_MSG_NOTICE([You requested to build `web2c' using an installed `kpathsea' version,])
109    AC_MSG_NOTICE([    which requires to locate the <kpathsea/paths.h> header file.])
110    AC_MSG_ERROR([Sorry, not found under any of: $list *****])
111  fi
112fi
113
114KPSE_RECURSE_LIBS([texlibs], [TeX specific], [texk/])
115
116dnl We check that all required system libraries are usable, and may
117dnl reduce frustration if anything is wrong by doing this first.
118dnl A native TeX Live build must not use any system libraries.
119KPSE_SAVE_FLAGS
120syslib_status=yes
121syslib_used=no
122KPSE_ALL_SYSTEM_FLAGS
123KPSE_LT_HACK
124KPSE_FOR_PKGS([sys_texk], [m4_sinclude([texk/]Kpse_Pkg[/ac/]Kpse_Pkg[.ac])])[]dnl
125KPSE_FOR_PKGS([sys_libs], [m4_sinclude([libs/]Kpse_Pkg[/ac/]Kpse_Pkg[.ac])])[]dnl
126if test "x$syslib_status" = xno; then
127  AC_MSG_ERROR([some requested system libraries failed])
128fi
129if test "x$syslib_used:$enable_native_texlive_build" = xyes:yes; then
130  AC_MSG_ERROR([you can not use system libraries for a native TeX Live build])
131fi
132KPSE_RESTORE_FLAGS
133
134AM_CONDITIONAL([cross], [test "x$cross_compiling" = xyes])
135
136AC_CONFIG_SUBDIRS([auxdir/auxsub libs utils texk])
137
138AC_CONFIG_FILES([Makefile doc/Makefile])
139
140dnl Try to detect GNU make early, '-v' is verbose for BSD make.
141rm -f Makefile
142kpse_GNU_make=`${MAKE-make} -v 2>/dev/null | grep GNU`
143
144AC_OUTPUT
145
146dnl Most probably we need GNU make.
147if test -z "$kpse_GNU_make"; then
148  if test "x$enable_native_texlive_build" = xno; then
149    AC_MSG_WARN([Building TeX Live may require GNU make])
150  else
151    AC_MSG_ERROR([Building TeX Live requires GNU make])
152  fi
153fi
154
155AS_IF([test "x$cross_compiling" = xyes],
156      [msg_compiling="cross-compiling on $build_alias for $host_alias"],
157      [msg_compiling="compiling for $kpse_build_alias"])
158kpse_bld=`pwd`
159kpse_src=`cd "$srcdir" && pwd`
160msg_compiling="$msg_compiling
161      in $kpse_bld"
162test "x$srcdir" = x. || msg_compiling="$msg_compiling
163      from sources in $kpse_src"
164AC_MSG_RESULT([
165** Configuration summary for $PACKAGE_STRING (tex_live_version$with_banner_add):
166
167   $msg_compiling])
168case $kpse_src$kpse_bld in
169  *' '*) AC_MSG_ERROR([Absolute source and/or build path with embedded spaces]);;
170esac
171
172cc_version=`$CC   --version 2>/dev/null | sed 1q`
173test -n "$cc_version" && cc_version=" ($cc_version)"
174#
175cxx_version=`$CXX --version 2>/dev/null | sed 1q`
176test -n "$cxx_version" && cxx_version=" ($cxx_version)"
177
178AC_MSG_RESULT([
179   C compiler (CC):              $CC$cc_version
180   C++ compiler (CXX):           $CXX$cxx_version
181   PATH:                         $PATH
182
183   enable_native_texlive_build:  $enable_native_texlive_build
184   enable_largefile:             $enable_largefile
185   enable_shared:                $enable_shared
186   enable_multiplatform:         $enable_multiplatform
187   enable_cxx_runtime_hack:      $enable_cxx_runtime_hack
188   enable_libtool_hack:          $enable_libtool_hack
189   enable_compiler_warnings:     $enable_compiler_warnings
190
191   prefix:                       $prefix
192   includedir:                   $includedir
193   datarootdir:                  $datarootdir
194   mandir:                       $mandir
195   infodir:                      $infodir
196   exec_prefix:                  $exec_prefix
197   bindir:                       $bindir
198   libdir:                       $libdir
199
200** Next run `make' to configure and build each library and program.
201])
202