source: git/MP/configure.in @ 89eb77

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