source: git/factory/configure.ac @ 409d930

fieker-DuValspielwiese
Last change on this file since 409d930 was 409d930, checked in by Hans Schoenemann <hannes@…>, 5 years ago
add: test for gmp.h, not only libgmp
  • Property mode set to 100644
File size: 11.8 KB
Line 
1
2dnl # emacs edit mode for this file is -*- sh -*-
3
4dnl #
5dnl # configure.in - process this file with `autoconf' to generate
6dnl #   a `configure' script.
7dnl #
8dnl # See the `INSTALL' file for information on how the `configure'
9dnl # script works.
10dnl #
11
12#
13# - initialisation.
14#
15AC_INIT([factory], [4.1.2])
16AC_CONFIG_SRCDIR(canonicalform.cc)
17AC_CONFIG_MACRO_DIR([../m4])
18AC_CONFIG_AUX_DIR([../build-aux])
19AC_CONFIG_HEADER([_config.h])
20
21AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) # -Wno-extra-portability -Werror silent-rules
22m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
23m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
24
25AM_MAINTAINER_MODE([enable])
26
27# Add pre'prefixed config
28AX_PREFIX_CONFIG_H([config.h],[],[_config.h])
29
30#
31# - check for CC and CXX but be careful about CFLAGS.
32#
33SING_RESET_FLAGS()
34SING_CHECK_SET_ARGS()
35
36#AC_PROG_CC
37#AC_PROG_CXX
38#
39# - check for some other programs.
40#
41AC_PROG_CPP
42AC_PROG_CXXCPP
43AC_PROG_LN_S
44AC_PROG_INSTALL
45## AC_DISABLE_STATIC
46AC_PROG_YACC
47LT_INIT([win32-dll])
48AC_PROG_MAKE_SET
49AC_CHECK_PROG(AR, ar, ar, where-is-your-ar)
50AC_CHECK_PROG(M4, m4, m4, where-is-your-m4)
51AC_CHECK_PROG(BISON, bison, bison, where-is-your-bison)
52AC_CHECK_SIZEOF(long,4)
53AC_C_CONST
54AC_C_INLINE
55
56
57SING_WIN_FLAGS
58
59
60#
61# - check withs and enables.
62#
63AC_ARG_ENABLE(
64  cf-inline,
65  [AS_HELP_STRING([--disable-cf-inline],[build Factory with \"configurable inline methods\" disabled.])],
66  [enable_cf_inline=$enableval],
67  [enable_cf_inline=yes])
68
69AC_ARG_ENABLE(
70  assertions,
71  [AS_HELP_STRING([--disable-assertions],[build Factory with no assertions])],
72  ,
73  enable_assertions=yes)
74
75AC_ARG_ENABLE(
76  timing,
77  [AS_HELP_STRING([--enable-timing],[build Factory so it will print timing information])],
78  ,
79  enable_timing=no)
80
81AC_ARG_ENABLE(
82  debugoutput,
83  [AS_HELP_STRING([--enable-debugoutput],[build Factory so it will print debugging information])],
84  ,
85  enable_debugoutput=no)
86
87AC_ARG_ENABLE(
88  streamio,
89  [AS_HELP_STRING([--enable-streamio],[build Factory with stream IO])],
90  ,
91  [enable_streamio=no])
92
93AH_TEMPLATE([NOSTREAMIO], [define to build factory without stream IO])
94
95AC_ARG_WITH(
96  Singular,
97  [AS_HELP_STRING([--without-Singular],[(obsolete) build NOT for the use with CAS Singular.])],
98  ,
99  [with_Singular=yes])
100
101PKG_REQUIRE="$PKG_REQUIRE"
102AC_SUBST(PKG_REQUIRE)
103
104SING_CHECK_OMALLOC()
105
106AH_TEMPLATE([SINGULAR], [define if linked to Singular])
107AH_TEMPLATE([DISABLE_GMP_CPP],[DISABLE_GMP_CPP])
108
109# Singular
110if test "x$with_Singular" = xyes; then
111  AC_DEFINE([SINGULAR],[1])
112  AC_DEFINE([DISABLE_GMP_CPP],[1])
113#  AC_DEFINE([NOSTREAMIO],[1])
114fi
115
116# || test "x$with_Singular" = xyes
117# Use no streamio (C++) if SINGULAR or explicitely disabled
118if test "x$enable_streamio" = xno;  then
119  AC_DEFINE([NOSTREAMIO],[1])
120fi
121
122AM_CONDITIONAL(
123    [WITH_PARSER_FOR_CANONICAL_FORM],
124    [test "x$enable_streamio" = xyes])
125
126AC_ARG_VAR( [RESOURCES_INCLUDES], [INCLUDES for libsingular_resources] )
127AC_ARG_VAR( [RESOURCES_LIBS], [LIBS for libsingular_resources] )
128
129AC_MSG_CHECKING(whether libsingular_resources should be used)
130if test "x$with_Singular" = xyes;
131then
132  AC_MSG_RESULT(yes)
133
134  AC_MSG_CHECKING([  RESOURCES_INCLUDES?..])
135  AC_MSG_RESULT(${RESOURCES_INCLUDES:-unset})
136
137  AC_MSG_CHECKING([  RESOURCES_LIBS?..])
138  AC_MSG_RESULT(${RESOURCES_LIBS:-unset})
139
140  PKG_REQUIRE="$PKG_REQUIRE singular_resources"
141  AC_SUBST(PKG_REQUIRE)
142else
143  AC_MSG_RESULT(no)
144fi
145
146AM_CONDITIONAL([ENABLE_RESOURCES],[test "x$with_Singular" = xyes])
147
148
149DX_INIT_DOXYGEN($PACKAGE_NAME, doxygen.cfg, $srcdir/docu)
150
151# do not use `MKINSTALLDIRS' and `MAKEHEADER' since there may be
152# name clashes with other peoples configure scripts via
153# `config.cache'.  Furthermore, we do not use cache at all to
154# avoid some nasty problems with our own development environment.
155#unset ac_cv_path_FACTORY_MKINSTALLDIRS
156#unset ac_cv_path_FACTORY_MAKEHEADER
157#save_path="$PATH"
158#PATH="$PATH:$srcdir/bin"
159#AC_PATH_PROG(FACTORY_MKINSTALLDIRS, mkinstalldirs, -mkdir)
160#PATH="$srcdir/bin:$save_path"
161#AC_PATH_PROG(FACTORY_MAKEHEADER, makeheader)
162#PATH="$save_path"
163
164#
165# - expand paths.
166#
167
168#AC_MSG_CHECKING(and generating explicit install paths)
169
170## generate Makefile
171#save_prefix="$prefix"
172#save_exec_prefix="$exec_prefix"
173#test "x$prefix" = xNONE && prefix=$ac_default_prefix
174#test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
175#for dir in prefix exec_prefix bindir sbindir libexecdir \
176#          datadir sysconfdir sharedstatedir localstatedir libdir \
177#          includedir oldincludedir infodir mandir; do
178#  eval "dir_value=\$$dir"
179#  cat >> ./conftest.mk << EXPLPATHEOT
180#$dir=$dir_value
181#explicit_$dir:
182#       @ echo \$($dir)
183#       @ if echo \$($dir) | grep '^/'; \\
184#       then echo \$($dir) > ./conftest.dir; \\
185#       else echo \`pwd\`/\$($dir) > ./conftest.dir; fi
186#EXPLPATHEOT
187#done
188#prefix="$save_prefix"
189#exec_prefix="$save_exec_prefix"
190
191# generate the explicit paths
192#make >&5 2>&1 -f ./conftest.mk explicit_datadir
193#explicit_datadir=`cat ./conftest.dir`
194#make >&5 2>&1 -f ./conftest.mk explicit_libdir
195#explicit_libdir=`cat ./conftest.dir`
196#make >&5 2>&1 -f ./conftest.mk explicit_includedir
197#explicit_includedir=`cat ./conftest.dir`
198
199# clean up
200#rm -f ./conftest.mk ./conftest.dir
201
202#AC_MSG_RESULT(done)
203
204#
205# - check for libraries.
206#
207AC_CHECK_LIB(m, atof, , [ AC_MSG_ERROR(libm.a not found) ])
208
209# Check whether --with-gmp was given.
210if test "${with_gmp+set}" = set; then :
211  if test "$with_gmp" = yes ; then
212        GMP_HOME_PATH="${DEFAULT_CHECKING_PATH}"
213   elif test "$with_gmp" != no ; then
214        GMP_HOME_PATH="$with_gmp ${DEFAULT_CHECKING_PATH}"
215    fi
216else
217  GMP_HOME_PATH="${DEFAULT_CHECKING_PATH}"
218fi
219
220BACKUP_CFLAGS=${CFLAGS}
221BACKUP_LIBS=${LIBS}
222
223for GMP_HOME in ${GMP_HOME_PATH}
224do
225  if test "x$GMP_HOME" != "x/usr"; then
226    GMP_CPPFLAGS="-I${GMP_HOME}/include"
227    GMP_LIBS="-L${GMP_HOME}/lib -Wl,-rpath -Wl,${GMP_HOME}/lib -lgmp"
228  else
229    GMP_CPPFLAGS=""
230    GMP_LIBS="-lgmp"
231  fi
232  CFLAGS="${BACKUP_CFLAGS} ${GMP_CPPFLAGS}"
233  LIBS="${BACKUP_LIBS} ${GMP_LIBS}"
234done
235AC_SUBST(GMP_CPPFLAGS)
236AC_SUBST(GMP_LIBS)
237
238AC_CHECK_HEADERS([gmp.h], ,[AC_MSG_ERROR([GNU MP not found])])
239AC_CHECK_LIB(gmp, __gmpz_init, , [AC_MSG_ERROR([GNU MP not found])])
240
241#NTL 9.6.4 requires -lpthread/-pthread
242# This test for -lpthread etc has to come before AX_PTHREAD,
243# because libtool tends to ignore -pthread in linking shared C++-libs
244# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
245# (happens with ubuntu 14.04)
246AC_SEARCH_LIBS(sem_wait,[rt pthreads pthread],[],[
247  AC_MSG_ERROR([sem_wait not found in rt,pthreads,pthread])
248])
249
250LB_CHECK_NTL(5.0,,AC_MSG_WARN([Unable to find NTL (which is strongly recommended) on your machine: please use --with-ntl=PATH_TO_DIR_CONTAINING_LIB_AND_INCLUDE (see also ./configure --help if you do not understand what we are talking about)]))
251
252LB_CHECK_FLINT(2.4,,AC_MSG_WARN([Unable to find FLINT (which is strongly recommended) on your machine: please use --with-flint=PATH_TO_DIR_CONTAINING_LIB_AND_INCLUDE (see also ./configure --help if you do not understand what we are talking about)]))
253
254# arithmetic shift
255#AC_MSG_CHECKING(whether your compiler does arithmetic shifts)
256#AC_CACHE_VAL(ac_cv_shift,
257#  [ LDFLAGS="-L$explicit_libdir $LDFLAGS"
258#       AC_TRY_RUN(
259#      [ int main() { if (-2 >> 1 == -1) return(0); else return(1); } ],
260#      ac_cv_shift=yes, ac_cv_shift=no, ac_cv_shift=yes) ])
261#if test "x$ac_cv_shift" = xyes; then
262#  AC_MSG_RESULT(yes)
263#else
264#  AC_MSG_RESULT(no)
265#fi
266
267#
268# - check for header files.
269#
270AC_LANG_CPLUSPLUS
271AC_LANG_PUSH([C++])
272
273AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h, ,
274  [ AC_MSG_ERROR(C header files not found) ])
275AC_CHECK_HEADERS(cstdio)
276
277if test "x$enable_streamio" != xno;  then
278  AC_CHECK_HEADERS(iostream.h strstream.h fstream.h iostream string fstream)
279  AC_CHECK_HEADERS(ctype.h, , [ AC_MSG_ERROR(standard C header files not found) ])
280
281  # since the FTE will compile only with stream IO enabled we will not
282  # check for the necessary header files if stream IO is disabled
283  AC_CHECK_HEADERS(stdarg.h signal.h errno.h unistd.h, ,
284    [ AC_MSG_WARN(C/C++ header files not found.
285                    You will not be able to build the Factory Test Environment
286                    (though Factory itself should compile)) ])
287fi
288
289
290if test "x$enable_timing" != xno; then
291  AC_CHECK_HEADERS(sys/param.h sys/times.h, ,
292    [ AC_MSG_ERROR(\`sys/times.h' or \`sys/param.h' not found.  Try
293                  \`configure --disable-timing') ])
294fi
295
296# font-lock-trick: '
297
298#
299# - check for compiler characteristics.
300#
301
302# use C to check compiler characteristics instead of C++.  On
303# nextstep, checking with C++ may fail.
304# AC_LANG_C
305
306# cross-compiling ?!
307#AC_C_CROSS
308#if test "x$cross_compiling" = xyes; then
309#  AC_MSG_WARN([you better specify a cache file to get the values for
310#                    cross-compiling right (e.g., call \`configure
311#                    --cache-file=yourTarget.cache').  In particular, you
312#                    should make sure that your target machine supports
313#                    arithmetic shift.])
314#fi
315
316# font-lock-trick: '
317
318#
319# - paths.
320#
321
322# note that Singular has its own mechanism to search the tables,
323# hence we do not need to mind it here
324#gftabledir='${datadir}/factory/gftables'
325#explicit_gftabledir="$explicit_datadir/gftables"
326
327# for installation of the templates
328#templatedir='${includedir}/templates'
329
330#
331# - set defines and variables according to our tests.
332#
333
334## CFLAGS
335#if test "x$GCC" = xyes && test "x$cflags_expl_set" = xno; then
336#  CFLAGS=""
337#fi
338
339# CXXFLAGS
340#if test "x$GXX" = xyes && test "x$cxxflags_expl_set" = xno; then
341#  CXXFLAGS=""
342#
343#AC_LANG_SAVE
344#AC_LANG_CPLUSPLUS
345# check whether CXX accepts -fno-rtti
346#AC_MSG_CHECKING(whether gcc accepts -fno-rtti)
347#tmp_flags=${CXXFLAGS}
348#CXXFLAGS="${CXXFLAGS}"
349#AC_CACHE_VAL(ac_cv_cxx_have_rtti,
350#AC_TRY_COMPILE(,,ac_cv_cxx_have_rtti=yes,ac_cv_cxx_have_rtti=no)
351#)
352#AC_MSG_RESULT(${ac_cv_cxx_have_rtti})
353#CXXFLAGS=$tmp_flags
354#if test "${ac_cv_cxx_have_rtti}" = yes; then
355#CXXFLAGS="$CXXFLAGS"
356#fi
357#AC_MSG_CHECKING(whether gcc accepts -fno-exceptions)
358#tmp_flags=${CXXFLAGS}
359#CXXFLAGS="${CXXFLAGS} -fno-exceptions"
360#AC_CACHE_VAL(ac_cv_cxx_have_exceptions,
361#AC_TRY_LINK(,,ac_cv_cxx_have_exceptions=yes,ac_cv_cxx_have_exceptions=no)
362#)
363#AC_MSG_RESULT(${ac_cv_cxx_have_exceptions})
364#CXXFLAGS=$tmp_flags
365#if test "${ac_cv_cxx_have_exceptions}" = yes; then
366#CXXFLAGS="$CXXFLAGS -fno-exceptions"
367#fi
368#AC_LANG_RESTORE
369#
370#fi
371
372# ARFLAGS
373#test "${ARFLAGS+set}" = set || ARFLAGS=cr
374
375# M4FLAGS
376#test "${M4FLAGS+set}" = set || M4FLAGS=
377
378# arithmetic shift
379#if test "x$ac_cv_shift" = xyes; then
380#  AC_DEFINE([HAS_ARITHMETIC_SHIFT],[1],[HAS_ARITHMETIC_SHIFT])
381#fi
382
383AH_TEMPLATE([CF_USE_INLINE], [define to use "configurable inline methods" (see cf_inline.cc)])
384# "configurable inline methods"
385if test "x$enable_cf_inline" != xno; then
386  AC_DEFINE([CF_USE_INLINE],[1])
387fi
388
389AH_TEMPLATE([NOASSERT], [define if you do not want to activate assertions])
390# assertions
391if test "x$enable_assertions" = xno; then
392  AC_DEFINE([NOASSERT],[1])
393fi
394
395AH_TEMPLATE([TIMING], [define if you want to activate the timing stuff])
396# timing
397if test "x$enable_timing" != xno; then
398  AC_DEFINE([TIMING],[1])
399fi
400
401# debugoutput
402AH_TEMPLATE([DEBUGOUTPUT], [define if you want to have debugging output])
403if test "x$enable_debugoutput" != xno; then
404  AC_DEFINE([DEBUGOUTPUT],[1])
405fi
406
407#
408# - complete and substitute variables, defines.
409#
410#AC_SUBST(gftabledir)
411#AC_SUBST(templatedir)
412
413
414
415# AC_SUBST(libfactory)
416
417#AC_SUBST(ARFLAGS)
418#AC_SUBST(M4FLAGS)
419
420AC_SUBST(MAKEHEADERFLAGS)
421
422#AC_SUBST(factorysrc)
423#AC_SUBST(factoryincl)
424
425#AC_SUBST(alltargets)
426#AC_SUBST(installtargets)
427#AC_SUBST(uninstalltargets)
428
429factory_version="4.1.1"
430factory_configuration="'$ac_configure_args' in `pwd`"
431AC_SUBST(factory_version)
432
433AH_TEMPLATE([FACTORYVERSION], [factory version])
434AC_DEFINE_UNQUOTED([FACTORYVERSION], "$factory_version")
435
436AH_TEMPLATE([FACTORYCONFIGURATION], [factory configuration])
437AC_DEFINE_UNQUOTED([FACTORYCONFIGURATION], "$factory_configuration")
438
439#AH_TEMPLATE([GFTABLEDIR], [where the gftables live])
440#AC_DEFINE_UNQUOTED([GFTABLEDIR], "$explicit_gftabledir")
441
442
443
444AC_CONFIG_FILES([Makefile include/factory/Makefile factory.pc]) #  ftest/GNUmakefile
445AC_OUTPUT
446
Note: See TracBrowser for help on using the repository browser.