source: git/MP/configure.in @ e5dafa

spielwiese
Last change on this file since e5dafa was e5dafa, checked in by Olaf Bachmann <obachman@…>, 25 years ago
* increased to version 1.3.1 git-svn-id: file:///usr/local/Singular/svn/trunk@2696 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 15.1 KB
Line 
1dnl
2dnl Written by Olaf Bachmann (obachman@mathematik.uni-kl.de)
3dnl
4dnl configure.in for MP
5dnl Process this file with autoconf to produce a configure script.
6AC_INIT(MP/MP_Put.c)
7AC_CONFIG_HEADER(MP/MP_Config.h:MP/h/MP_Config.h.in)
8
9PRODUCT=MP
10VERSION=1.1.2.1
11AC_SUBST(PRODUCT)
12AC_SUBST(VERSION)
13AC_DEFINE_UNQUOTED(MP_VERSION, "$VERSION")
14AC_CANONICAL_SYSTEM
15
16AC_PREFIX_DEFAULT(`pwd`)
17
18dnl The "philosophy" is this: 
19dnl 1) by default the libraries are stored in ${prefix}/lib/${ARCH}
20dnl 2) the user can override this by setting either --exec-prefix
21dnl    or --libdir
22dnl 3) If --libdir is given, then libraries are put exactly there
23dnl 4) If --libdir is not given, and --exec-dir is given, then
24dnl    libraries are put into $exec_prefix/lib (as is standard)
25dnl 5) The same thing applies to bindir
26
27AC_MSG_CHECKING(for architecture identifier) 
28AC_CACHE_VAL(ac_cv_arch,ac_cv_arch=`./pvmgetarch`)
29AC_MSG_RESULT($ac_cv_arch)
30
31if test "$libdir" = '${exec_prefix}/lib' && test "$exec_prefix" = "NONE"; then
32  libdir='${prefix}/lib/'$ac_cv_arch
33fi
34
35if test "$bindir" = '${exec_prefix}/bin' && test "$exec_prefix" = "NONE"; then
36  bindir='${prefix}/bin/'$ac_cv_arch
37fi
38
39dnl Check for programs
40AC_PROG_RANLIB
41AC_CHECK_PROG(AR, ar, ar, :)
42if test "$ac_cv_prog_AR" != ar; then
43  AC_MSG_ERROR(*** ar program not found)
44fi
45
46dnl compiler stuff
47dnl we do not want to have "-g -O" for CFLAGS
48
49if test "$with_debug" = yes; then
50  if test "${CFLAGS+set}" != set; then 
51    CFLAGS="-g"
52    ac_cv_cflags_not_set=yes
53  fi
54  AC_DEFINE(MPT_DEBUG)
55else
56  if test "${CFLAGS+set}" != set; then
57    CFLAGS="-O"
58    ac_cv_cflags_not_set=yes
59  fi
60  AC_DEFINE(NO_LOGGING)
61fi
62
63AC_PROG_CC
64AC_PROG_CPP
65AC_AIX
66
67dnl compiler/system specific options
68if test "${GCC}" != yes; then
69  echo not using gcc, so checking for special flags and defines
70  case "$target" in
71    hppa1*)
72      if test "$ac_cv_prog_CC" = cc; then
73         echo Using HPUX native compiler with -Aa and -D_HPUX_SOURCE
74         CFLAGS="$CFLAGS -Aa "
75         AC_DEFUN(_HPUX_SOURCE)
76      fi
77  esac
78fi
79
80dnl add to CPPFLAGS and LDFLAGS so that ${includedir} and ${libdir}
81dnl are in there
82if test "$libdir" = '${exec_prefix}/lib'; then
83  if test "x$exec_prefix" = xNONE; then
84    if test "x$prefix" = xNONE; then
85      LDFLAGS="-L${ac_default_prefix}/lib ${LDFLAGS}"
86    else
87      LDFLAGS="-L${prefix}/lib ${LDFLAGS}"
88    fi
89  else
90    LDFLAGS="-L${exec_prefix}/lib ${LDFLAGS}"
91  fi
92elif test "$libdir" = '${prefix}/lib/'$ac_cv_arch ; then
93  if test "x$prefix" = xNONE; then
94    LDFLAGS="-L${ac_default_prefix}/lib/$ac_cv_arch  ${LDFLAGS}"
95  else
96    LDFLAGS="-L${prefix}/lib/$ac_cv_arch ${LDFLAGS}"
97  fi
98else
99  LDFLAGS="-L${libdir} ${LDFLAGS}"
100fi
101
102if test "$includedir" = '${prefix}/include'; then
103  if test "x$prefix" = xNONE; then
104    CPPFLAGS="-I${ac_default_prefix}/include ${CPPFLAGS}"
105  else
106    CPPFLAGS="-I${prefix}/include ${CPPFLAGS}"
107  fi
108else
109  CPPFLAGS="-I${includedir} ${CPPFLAGS}"
110fi
111
112dnl add to  CPPFLAGS and LDFLAGS if PVM_ROOT and PVM_ARCH are set
113if test "${PVM_ROOT+set}" = set; then
114  if test "$enable_mppvm" = yes || test "$with_pvm" = yes; then
115    CPPFLAGS="${CPPFLAGS} -I${PVM_ROOT}/include"
116    if test "${PVM_ARCH+set}" = set; then
117      LDFLAGS="${LDFLAGS} -L{PVM_ROOT}/lib/${PVM_ARCH}"
118    fi
119  fi
120fi
121
122AC_SET_MAKE
123AC_FUNC_VFORK
124
125dnl
126dnl Lib checks --depend on enable/disable options
127dnl
128AC_ARG_ENABLE(MPT, \
129 [  --disable-MPT           disable building of MPT library])
130
131AC_ARG_ENABLE(gmp, \
132 [  --disable-gmp           configure and build without gmp library])
133
134AC_ARG_ENABLE(tests, \
135 [  --enable-example        enable building of example programs])
136
137AC_ARG_ENABLE(mpviewer, \
138 [  --enable-mpviewer       enable building of mpviewer program])
139
140AC_ARG_ENABLE(mppvm, \
141 [  --enable-mppvm          enable building of mppvm routines])
142
143
144if test "$enable_gmp" != no && test -d gmp; then
145  CONFIG_SUBDIRS="gmp"
146  enable_gmp=yes
147fi
148BUILD_SUBDIRS="$CONFIG_SUBDIRS MP"
149
150if test "$enable_MPT" != no && test -d MPT; then
151    BUILD_SUBDIRS="${BUILD_SUBDIRS} MPT"
152fi
153
154if test "$enable_examples" = yes && test -d examples; then
155  BUILD_SUBDIRS="${BUILD_SUBDIRS} examples"
156  ac_check_prog=yes
157fi
158
159if test "$enable_mpviewer" = yes && test -d mpviewer; then
160  BUILD_SUBDIRS="${BUILD_SUBDIRS} mpviewer"
161  ac_check_prog=yes
162fi
163
164if test "$enable_mppvm" = yes && test -d mp-pvm3; then
165  BUILD_SUBDIRS="${BUILD_SUBDIRS} mp-pvm3"
166  ac_check_prog=yes
167  with_pvm=yes
168fi
169
170AC_SUBST(BUILD_SUBDIRS)
171AC_SUBST(CONFIG_SUBDIRS)
172
173if test "$ac_check_prog" = yes; then
174  AC_CHECK_LIB(m, atof)
175  AC_CHECK_LIB(bsd, socket)
176  AC_CHECK_LIB(gmp, mpz_init)
177
178  if test "$ac_cv_lib_gmp_mpz_init" != yes || "$enable_gmp" != no; then
179    AC_MSG_WARN(Did not find gmp library: Linking programs with MP will fail)
180    NEED_LIBS=$LIBS
181  else
182    NEED_LIBS="-lgmp $LIBS"
183  fi
184 
185  AC_CHECK_FUNCS(select socket gethostname gethostbyname strtol strstr)
186  if test "$ac_cv_func_select" != yes; then
187    AC_MSG_WARN(Did not find library containing function select)
188    AC_MSG_WARN(Linking programs with MP might fail)
189  fi
190  if test "$ac_cv_func_gethostname" != yes; then
191    AC_MSG_WARN(Did not find library containing gethostname)
192    AC_MSG_WARN(Linking programs with MP might fail)
193  fi
194
195  if test "$ac_cv_func_gethostbyname" != yes; then
196    AC_CHECK_LIB(nsl, gethostbyname)
197    if test "$ac_cv_lib_nsl_gethostbyname" != yes; then
198      AC_MSG_WARN(Did not find library containing gethostname)
199      AC_MSG_WARN(Linking programs with MP might fail)
200    fi
201  fi
202
203  if test "$ac_cv_func_socket" != yes; then
204    AC_CHECK_LIB(socket, socket)
205    if test "$ac_cv_lib_socket_socket" != yes; then
206      AC_MSG_WARN(Did not find library containing socket)
207      AC_MSG_WARN(Linking programs with MP might fail)
208    fi
209  fi
210fi
211AC_SUBST(NEED_LIBS)
212
213dnl Do the header checks now
214AC_HEADER_STDC
215AC_HEADER_CHECK(arpa/inet.h,:, echo "*** no arpa/inet.h";exit)
216AC_HEADER_CHECK(assert.h,:, echo "*** no assert.h";exit)
217AC_HEADER_CHECK(ctype.h,:, echo "*** no ctype.h";exit)
218AC_HEADER_CHECK(errno.h,:, echo "*** no errno.h";exit)
219AC_HEADER_CHECK(netdb.h,:, echo "*** no netdb.h";exit)
220AC_HEADER_CHECK(netinet/in.h,:, echo "*** no netinet/in.h";exit)
221AC_HEADER_CHECK(netinet/tcp.h,:, echo "*** no netinet/tcp.h";exit)
222AC_HEADER_CHECK(signal.h,:, echo "*** no sihnal.h";exit)
223AC_HEADER_CHECK(stdarg.h,:, echo "*** no stdarg.h";exit)
224AC_HEADER_CHECK(stdio.h,:, echo "*** no stdio.h";exit)
225AC_HEADER_CHECK(stdlib.h,:, echo "*** no stdlib.h";exit)
226AC_HEADER_CHECK(string.h,:, echo "*** no string.h";exit)
227AC_HEADER_CHECK(stddef.h,:, echo "*** no stddef.h";exit)
228AC_HEADER_CHECK(values.h,:, echo "*** no values.h";exit)
229
230AC_HEADER_CHECK(fcntl.h,:, echo "*** no fcntl.h";exit)
231AC_HEADER_CHECK(sys/ioctl.h,:, echo "*** no sys/ioctl.h";exit)
232AC_HEADER_CHECK(sys/param.h,:, echo "*** no sys/param.h";exit)
233AC_HEADER_CHECK(sys/socket.h,:, echo "*** no sys/socket.h";exit)
234AC_HEADER_CHECK(sys/stat.h,:, echo "*** no sys/stat.h";exit)
235AC_HEADER_CHECK(sys/time.h,:, echo "*** no sys/time.h";exit)
236AC_HEADER_CHECK(sys/types.h,:, echo "*** no sys/types.h";exit)
237AC_HEADER_CHECK(sys/uio.h,:, echo "*** no sys/uio.h";exit)
238AC_HEADER_CHECK(sys/un.h,:, echo "*** no sys/un.h";exit)
239AC_HEADER_CHECK(unistd.h,:, echo "*** no unistd.h";exit)
240AC_HEADER_CHECK(math.h,:, echo "*** no math.h";exit)
241
242
243AC_CHECK_HEADERS(sys/select.h gmp.h genpari.h saclib.h)
244
245dnl Check whether mpz_ptr is defined (is not defined in earlier gmp versions)
246if test "$ac_cv_header_gmp_h" = yes; then
247  AC_EGREP_HEADER(mpz_ptr, gmp.h, MPZ_PTR=mpz_ptr)
248  if test ! "$MPZ_PTR" = mpz_ptr; then
249    AC_EGREP_HEADER(MP_INT, gmp.h, MPZ_PTR="MP_INT*")
250    AC_DEFINE_UNQUOTED(mpz_ptr, MP_INT*)
251    AC_DEFINE_UNQUOTED(_mp_alloc,alloc)
252    AC_DEFINE_UNQUOTED(_mp_size,size)
253    AC_DEFINE_UNQUOTED(_mp_d,d)
254  fi
255  AC_EGREP_HEADER(mpf_ptr, gmp.h, MPF_PTR=mpf_ptr)
256fi
257
258dnl
259dnl deal with Ap Number configuration
260dnl
261AC_ARG_WITH(apint, \
262 [  --with-default_apint=PACKAGE    use PACKAGE as MP's default ApInt format
263                           where PACKAGE can be: gmp (default), pari,
264                           saclib, none])
265AC_ARG_WITH(apreal, \
266 [  --with-default_apreal=PACKAGE   use PACKAGE as MP's default ApReal format
267                           where PACKAGE can be: gmp (default), none])
268AC_ARG_WITH(gmp, \
269 [  --without-gmp           build without gmp ApNumber routines])
270
271AC_ARG_WITH(pari, \
272 [  --with-pari             build with pari ApInt routines])
273
274AC_ARG_WITH(saclib, \
275 [  --with-saclib           build with saclib ApInt routines])
276
277AC_ARG_WITH(tb, \
278 [  --with-tb               build with Toolbus device interface])
279
280AC_ARG_WITH(pvm, \
281 [  --with-pvm              build with Pvm saclib device interface])
282
283AC_ARG_WITH(debug, \
284 [  --with-debug            build with debug options and logging])
285
286AC_ARG_WITH(extra_cflags, \
287 [  --with-extra_cflags=cflags   build with 'cflags' appended to
288                                 CFLAGS given to the compiler])
289
290AC_ARG_WITH(rsh, \
291 [ --with-rsh=command      use 'command' as remote shell command])
292
293dnl evaluate specifications
294AC_DEFINE(MP_DUMMY, 0)
295AC_DEFINE(MP_GMP, 1)
296AC_DEFINE(MP_PARI, 2)
297AC_DEFINE(MP_SAC, 3)
298
299if test "$with_default_apint" = none; then
300  AC_DEFINE(MP_DEFAULT_APINT, MP_DUMMY)
301elif test "$with_default_apint" = pari; then
302  if test "$ac_cv_header_genpari_h" != yes; then
303    AC_MSG_WARN(Need genpari.h to use pari as default ApInt format)
304    AC_MSG_WARN(Use dummy as default MP ApInt format)
305    AC_DEFINE(MP_DEFAULT_APINT_FORMAT, MP_DUMMY) 
306  else
307    AC_DEFINE(MP_DEFAULT_APINT_FORMAT, MP_PARI)
308    AC_DEFINE(MP_HAVE_PARI)
309  fi
310elif test "$with_default_apint" = saclib; then
311  if test "$ac_cv_header_saclib_h" != yes; then
312    AC_MSG_WARN(Need saclib.h to use saclib as default ApInt format)
313    AC_MSG_WARN(Use dummy as default MP ApInt format)
314    AC_DEFINE(MP_DEFAULT_APINTFORMAT, MP_DUMMY) 
315  else
316    AC_DEFINE(MP_DEFAULT_APINT_FORMAT, MP_SAC)
317    AC_DEFINE(MP_HAVE_SACLIB)
318  fi
319else
320  if test "$ac_cv_header_gmp_h" != yes && test "$enable_gmp" != yes; then
321    AC_MSG_WARN(Need gmp.h to use gmp as default ApInt format)
322    AC_MSG_WARN(Use dummy as default MP ApInt format)
323    AC_DEFINE(MP_DEFAULT_APINTFORMAT, MP_DUMMY) 
324  elif test -z "$MPZ_PTR" && test "$enable_gmp" != yes; then
325    AC_MSG_WARN(Need gmp.h containing typedef of 'mpz_ptr' or 'MP_INT')
326    AC_MSG_WARN(Use dummy as default MP ApInt format)
327    AC_DEFINE(MP_DEFAULT_APINTFORMAT, MP_DUMMY)
328  else
329    AC_DEFINE(MP_DEFAULT_APINT_FORMAT, MP_GMP)
330    AC_DEFINE(MP_HAVE_GMP_APINT)
331    if test "$ac_cv_header_gmp_h" != yes; then
332      AC_MSG_WARN(Need gmp.h to use gmp as default ApInt format)
333      AC_MSG_WARN(Install gmp.h before making MP)
334    fi
335  fi
336fi
337
338if test "$with_default_apreal" = none; then
339  AC_DEFINE(MP_DEFAULT_APREAL, MP_DUMMY)
340else
341  if test "$ac_cv_header_gmp_h" != yes && test "$enable_gmp" != yes; then
342    AC_MSG_WARN(Need gmp.h to use gmp as default ApReal format)
343    AC_MSG_WARN(Use dummy as default MP ApReal format)
344    AC_DEFINE(MP_DEFAULT_APREALFORMAT, MP_DUMMY) 
345  elif test -z "$MPF_PTR" && test "$enable_gmp" != yes; then
346    AC_MSG_WARN(Need gmp.h containing tyedef of 'mpf_ptr')
347    AC_MSG_WARN(Use dummy as default MP ApReal format)
348    AC_DEFINE(MP_DEFAULT_APREALFORMAT, MP_DUMMY) 
349  else
350    AC_DEFINE(MP_DEFAULT_APREAL_FORMAT, MP_GMP)
351    AC_DEFINE(MP_HAVE_GMP_APREAL)
352    if test "$ac_cv_header_gmp_h" != yes ; then
353      AC_MSG_WARN(Need gmp.h to use gmp as default ApReal format)
354      AC_MSG_WARN(Install gmp.h before making MP)
355    fi
356  fi
357fi
358
359if test "$with_gmp" != no; then
360  if test "$ac_cv_header_gmp_h" != yes && test "$enable_gmp" != yes; then
361    AC_MSG_WARN(Can not build MP with gmp ApInt routines: Need gmp.h)
362  else
363    AC_DEFINE(MP_HAVE_GMP)
364    if test "$ac_cv_header_gmp_h" != yes; then
365      AC_MSG_WARN(Need gmp.h to build MP with gmp ApInt routines)
366      AC_MSG_WARN(Install gmp.h before making MP)
367    fi
368  fi
369fi
370
371if test "$with_saclib" = yes; then
372  if test "$ac_cv_header_saclib_h" != yes; then
373    AC_MSG_WARN(Can not build MP with saclib ApInt routines: Need saclib.h)
374  else
375    AC_DEFINE(MP_HAVE_SAC)
376  fi
377fi
378
379if test "$with_pari" = yes; then
380  if test "$ac_cv_header_genpari_h" != yes; then
381    AC_MSG_WARN(Can not build MP with pari ApInt routines: Need genpari.h)
382  else
383    AC_DEFINE(MP_HAVE_PARI)
384    AC_DEFINE(LONG_IS_32BIT)
385    AC_CHECK_TYPE(ulong, no)
386    if test "$ac_cv_type_ulong" = no; then
387        AC_DEFINE(ULONG_NOT_DEFINED)
388    fi
389  fi
390fi
391
392   
393
394if test "$with_tb" = yes; then
395  AC_CHECK_HEADER(TB.h)
396  if test "$ac_cv_header_TB_h" != yes; then
397    AC_MSG_WARN(Can not build with Toolbus: Need TB.h)
398  else
399    AC_DEFINE(MP_HAVE_TB)
400  fi
401fi
402
403if test "$with_pvm" = yes; then
404 AC_CHECK_HEADER(pvm3.h)
405 if test "$ac_cv_header_pvm3_h" != yes; then
406    AC_MSG_WARN(Can not build with Pvm: Need pvm3.h)
407  else
408    AC_DEFINE(MP_HAVE_PVM)
409  fi
410fi
411
412if test "${with_extra_cflags+set}" = set; then
413  CFLAGS="$CFLAGS ${with_extra_cflags}"
414fi
415
416if test "${with_rsh+set}" = set; then
417  AC_CHECK_PROG(with_rsh, ${with_rsh}, ${with_rsh})
418  if test "$ac_cv_prog_with_rsh" = $with_rsh; then
419    ac_rsh_programs=${with_rsh}
420  else
421   ac_rsh_programs=
422  fi
423fi
424
425
426
427AC_CHECK_PROG(mp_rsh, rsh, rsh, no)
428if test "$ac_cv_prog_mp_rsh" = rsh; then
429   ac_rsh_programs="$ac_rsh_programs rsh"
430fi
431
432AC_CHECK_PROG(mp_remsh, remsh, remsh, no)
433if test "$ac_cv_prog_mp_remsh" = remsh; then
434   ac_rsh_programs="$ac_rsh_programs remsh"
435fi
436
437AC_CHECK_PROG(mp_ssh, ssh, ssh, no)
438if test "$ac_cv_prog_mp_ssh" = ssh; then
439   ac_rsh_programs="$ac_rsh_programs ssh"
440fi
441
442AC_MSG_CHECKING(which remote shell command to use)
443for mp_rsh in $ac_rsh_programs; do
444    if $mp_rsh `hostname` -n uname \>\& /dev/null; then
445      mp_rsh_found=$mp_rsh
446      break;
447    else
448      mp_rsh_found=none
449    fi
450done
451AC_MSG_RESULT($mp_rsh_found)
452if test "${mp_rsh_found}" = none; then
453   AC_MSG_WARN("No working remote shell command found")
454else
455  AC_DEFINE_UNQUOTED(MP_RSH_COMMAND, "$mp_rsh_found")
456fi
457
458dnl Check for external memory managements
459AC_ARG_WITH(malloc, \
460 [ --with-malloc=HEADER     use external malloc routines declared in HEADER])
461
462if test "${with_malloc+set}" = set; then
463  AC_CHECK_HEADER(${with_malloc},,with_malloc=)
464fi
465AC_MSG_CHECKING(where malloc rotuines come from)
466if test "${with_malloc+set}" = set; then
467  AC_MSG_RESULT(${with_malloc})
468  AC_DEFINE(WITH_EXTERNAL_MALLOC)
469  AC_DEFINE_UNQUOTED(EXTERNAL_MALLOC_H, "${with_malloc}")
470else
471  AC_MSG_RESULT(stdlib.h)
472fi
473
474
475dnl Checks for typedefs, structures, and compiler characteristics.
476AC_C_BIGENDIAN
477AC_C_CONST
478AC_TYPE_SIZE_T
479AC_HEADER_TIME
480
481dnl miscellanous stuff
482dnl check for sizeof(long)
483AC_CHECK_SIZEOF(long, 4)
484if test "$ac_cv_sizeof_long" != 4; then
485  AC_MSG_ERROR(Need sizeof long to equal 4)
486fi
487
488dnl add some defines for if pari is used
489
490CLEAN="rm -f *~ a.out core *.o .log"
491AC_SUBST(CLEAN)
492
493dnl if we use GCC, then we know CFLAGS best and do not let user overwrite it
494if test "${GCC}" = yes && test "$ac_cv_cflags_not_set" = yes; then
495  if test "$with_debug" = yes; then
496    CFLAGS="-g -Wall -Wno-unused ${with_extra_cflags}"
497  else
498    CFLAGS="-O3 -w -fomit-frame-pointer ${with_extra_cflags}"
499  fi
500fi
501
502dnl check for args to pass to subconfigure
503if test "$prefix" = NONE; then
504  ac_configure_args="$ac_configure_args --prefix=$ac_default_prefix"
505fi
506   
507AC_CONFIG_SUBDIRS($CONFIG_SUBDIRS)
508
509AC_OUTPUT(Makefile MP/Makefile MPT/Makefile mpviewer/Makefile \
510        mp-pvm3/Makefile examples/Makefile, \
511        if test "$CONFIG_HEADERS"; then echo timestamp > MP/stamp-h; fi)
Note: See TracBrowser for help on using the repository browser.