source: git/MP/configure.in @ 4f006f

fieker-DuValspielwiese
Last change on this file since 4f006f was 3824e90, checked in by Anne Frühbis-Krüger <anne@…>, 23 years ago
*anne: Changes for Macintosh-darwin, new rsh tests git-svn-id: file:///usr/local/Singular/svn/trunk@5632 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 15.8 KB
Line 
1onl
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)
230
231dnl Wrong preprocessor statement in /usr/include/values.h causes
232dnl problems on FreeBSD
233AC_HEADER_CHECK(values.h, freebsd_problem=no
234                          no_values_h=no,
235                AC_CHECK_FILE(/usr/include/values.h,
236                              freebsd_problem=yes
237                              no_values_h=no,
238                              no_values_h=yes
239                              freebsd_problem=no))
240if test "${freebsd_problem}" != no; then
241  grep -v "#warning" /usr/include/values.h > ./values.h
242elif test "${no_values_h}" != no; then
243  cp ./values.h.subst ./values.h
244  AC_TRY_CPP( #include "values.h" ,
245              CPPFLAGS="-I. ${CPPFLAGS}",
246              echo "*** no values.h";exit)
247fi
248
249AC_HEADER_CHECK(fcntl.h,:, echo "*** no fcntl.h";exit)
250AC_HEADER_CHECK(sys/ioctl.h,:, echo "*** no sys/ioctl.h";exit)
251AC_HEADER_CHECK(sys/param.h,:, echo "*** no sys/param.h";exit)
252AC_HEADER_CHECK(sys/socket.h,:, echo "*** no sys/socket.h";exit)
253AC_HEADER_CHECK(sys/stat.h,:, echo "*** no sys/stat.h";exit)
254AC_HEADER_CHECK(sys/time.h,:, echo "*** no sys/time.h";exit)
255AC_HEADER_CHECK(sys/types.h,:, echo "*** no sys/types.h";exit)
256AC_HEADER_CHECK(sys/uio.h,:, echo "*** no sys/uio.h";exit)
257AC_HEADER_CHECK(sys/un.h,:, echo "*** no sys/un.h";exit)
258AC_HEADER_CHECK(unistd.h,:, echo "*** no unistd.h";exit)
259AC_HEADER_CHECK(math.h,:, echo "*** no math.h";exit)
260
261
262AC_CHECK_HEADERS(sys/select.h gmp.h genpari.h saclib.h)
263
264dnl Check whether mpz_ptr is defined (is not defined in earlier gmp versions)
265if test "$ac_cv_header_gmp_h" = yes; then
266  AC_EGREP_HEADER(mpz_ptr, gmp.h, MPZ_PTR=mpz_ptr)
267  if test ! "$MPZ_PTR" = mpz_ptr; then
268    AC_EGREP_HEADER(MP_INT, gmp.h, MPZ_PTR="MP_INT*")
269    AC_DEFINE_UNQUOTED(mpz_ptr, MP_INT*)
270    AC_DEFINE_UNQUOTED(_mp_alloc,alloc)
271    AC_DEFINE_UNQUOTED(_mp_size,size)
272    AC_DEFINE_UNQUOTED(_mp_d,d)
273  fi
274  AC_EGREP_HEADER(mpf_ptr, gmp.h, MPF_PTR=mpf_ptr)
275fi
276
277dnl
278dnl deal with Ap Number configuration
279dnl
280AC_ARG_WITH(apint, \
281 [  --with-default_apint=PACKAGE    use PACKAGE as MP's default ApInt format
282                           where PACKAGE can be: gmp (default), pari,
283                           saclib, none])
284AC_ARG_WITH(apreal, \
285 [  --with-default_apreal=PACKAGE   use PACKAGE as MP's default ApReal format
286                           where PACKAGE can be: gmp (default), none])
287AC_ARG_WITH(gmp, \
288 [  --without-gmp           build without gmp ApNumber routines])
289
290AC_ARG_WITH(pari, \
291 [  --with-pari             build with pari ApInt routines])
292
293AC_ARG_WITH(saclib, \
294 [  --with-saclib           build with saclib ApInt routines])
295
296AC_ARG_WITH(tb, \
297 [  --with-tb               build with Toolbus device interface])
298
299AC_ARG_WITH(pvm, \
300 [  --with-pvm              build with Pvm saclib device interface])
301
302AC_ARG_WITH(debug, \
303 [  --with-debug            build with debug options and logging])
304
305AC_ARG_WITH(extra_cflags, \
306 [  --with-extra_cflags=cflags   build with 'cflags' appended to
307                                 CFLAGS given to the compiler])
308
309AC_ARG_WITH(rsh, \
310 [ --with-rsh=command      use 'command' as remote shell command])
311
312dnl evaluate specifications
313AC_DEFINE(MP_DUMMY, 0)
314AC_DEFINE(MP_GMP, 1)
315AC_DEFINE(MP_PARI, 2)
316AC_DEFINE(MP_SAC, 3)
317
318if test "$with_default_apint" = none; then
319  AC_DEFINE(MP_DEFAULT_APINT, MP_DUMMY)
320elif test "$with_default_apint" = pari; then
321  if test "$ac_cv_header_genpari_h" != yes; then
322    AC_MSG_WARN(Need genpari.h to use pari as default ApInt format)
323    AC_MSG_WARN(Use dummy as default MP ApInt format)
324    AC_DEFINE(MP_DEFAULT_APINT_FORMAT, MP_DUMMY) 
325  else
326    AC_DEFINE(MP_DEFAULT_APINT_FORMAT, MP_PARI)
327    AC_DEFINE(MP_HAVE_PARI)
328  fi
329elif test "$with_default_apint" = saclib; then
330  if test "$ac_cv_header_saclib_h" != yes; then
331    AC_MSG_WARN(Need saclib.h to use saclib as default ApInt format)
332    AC_MSG_WARN(Use dummy as default MP ApInt format)
333    AC_DEFINE(MP_DEFAULT_APINTFORMAT, MP_DUMMY) 
334  else
335    AC_DEFINE(MP_DEFAULT_APINT_FORMAT, MP_SAC)
336    AC_DEFINE(MP_HAVE_SACLIB)
337  fi
338else
339  if test "$ac_cv_header_gmp_h" != yes && test "$enable_gmp" != yes; then
340    AC_MSG_WARN(Need gmp.h to use gmp as default ApInt format)
341    AC_MSG_WARN(Use dummy as default MP ApInt format)
342    AC_DEFINE(MP_DEFAULT_APINTFORMAT, MP_DUMMY) 
343  elif test -z "$MPZ_PTR" && test "$enable_gmp" != yes; then
344    AC_MSG_WARN(Need gmp.h containing typedef of 'mpz_ptr' or 'MP_INT')
345    AC_MSG_WARN(Use dummy as default MP ApInt format)
346    AC_DEFINE(MP_DEFAULT_APINTFORMAT, MP_DUMMY)
347  else
348    AC_DEFINE(MP_DEFAULT_APINT_FORMAT, MP_GMP)
349    AC_DEFINE(MP_HAVE_GMP_APINT)
350    if test "$ac_cv_header_gmp_h" != yes; then
351      AC_MSG_WARN(Need gmp.h to use gmp as default ApInt format)
352      AC_MSG_WARN(Install gmp.h before making MP)
353    fi
354  fi
355fi
356
357if test "$with_default_apreal" = none; then
358  AC_DEFINE(MP_DEFAULT_APREAL, MP_DUMMY)
359else
360  if test "$ac_cv_header_gmp_h" != yes && test "$enable_gmp" != yes; then
361    AC_MSG_WARN(Need gmp.h to use gmp as default ApReal format)
362    AC_MSG_WARN(Use dummy as default MP ApReal format)
363    AC_DEFINE(MP_DEFAULT_APREALFORMAT, MP_DUMMY) 
364  elif test -z "$MPF_PTR" && test "$enable_gmp" != yes; then
365    AC_MSG_WARN(Need gmp.h containing tyedef of 'mpf_ptr')
366    AC_MSG_WARN(Use dummy as default MP ApReal format)
367    AC_DEFINE(MP_DEFAULT_APREALFORMAT, MP_DUMMY) 
368  else
369    AC_DEFINE(MP_DEFAULT_APREAL_FORMAT, MP_GMP)
370    AC_DEFINE(MP_HAVE_GMP_APREAL)
371    if test "$ac_cv_header_gmp_h" != yes ; then
372      AC_MSG_WARN(Need gmp.h to use gmp as default ApReal format)
373      AC_MSG_WARN(Install gmp.h before making MP)
374    fi
375  fi
376fi
377
378if test "$with_gmp" != no; then
379  if test "$ac_cv_header_gmp_h" != yes && test "$enable_gmp" != yes; then
380    AC_MSG_WARN(Can not build MP with gmp ApInt routines: Need gmp.h)
381  else
382    AC_DEFINE(MP_HAVE_GMP)
383    if test "$ac_cv_header_gmp_h" != yes; then
384      AC_MSG_WARN(Need gmp.h to build MP with gmp ApInt routines)
385      AC_MSG_WARN(Install gmp.h before making MP)
386    fi
387  fi
388fi
389
390if test "$with_saclib" = yes; then
391  if test "$ac_cv_header_saclib_h" != yes; then
392    AC_MSG_WARN(Can not build MP with saclib ApInt routines: Need saclib.h)
393  else
394    AC_DEFINE(MP_HAVE_SAC)
395  fi
396fi
397
398if test "$with_pari" = yes; then
399  if test "$ac_cv_header_genpari_h" != yes; then
400    AC_MSG_WARN(Can not build MP with pari ApInt routines: Need genpari.h)
401  else
402    AC_DEFINE(MP_HAVE_PARI)
403    AC_DEFINE(LONG_IS_32BIT)
404    AC_CHECK_TYPE(ulong, no)
405    if test "$ac_cv_type_ulong" = no; then
406        AC_DEFINE(ULONG_NOT_DEFINED)
407    fi
408  fi
409fi
410
411   
412
413if test "$with_tb" = yes; then
414  AC_CHECK_HEADER(TB.h)
415  if test "$ac_cv_header_TB_h" != yes; then
416    AC_MSG_WARN(Can not build with Toolbus: Need TB.h)
417  else
418    AC_DEFINE(MP_HAVE_TB)
419  fi
420fi
421
422if test "$with_pvm" = yes; then
423 AC_CHECK_HEADER(pvm3.h)
424 if test "$ac_cv_header_pvm3_h" != yes; then
425    AC_MSG_WARN(Can not build with Pvm: Need pvm3.h)
426  else
427    AC_DEFINE(MP_HAVE_PVM)
428  fi
429fi
430
431if test "${with_extra_cflags+set}" = set; then
432  CFLAGS="$CFLAGS ${with_extra_cflags}"
433fi
434
435if test "${with_rsh+set}" = set; then
436  AC_CHECK_PROG(with_rsh, ${with_rsh}, ${with_rsh})
437  if test "$ac_cv_prog_with_rsh" = $with_rsh; then
438    mp_rsh_cmdline=${with_rsh}
439  else
440    mp_rsh_cmdline=no
441  fi
442else
443  mp_rsh_cmdline=no
444fi
445
446if test "$mp_rsh_cmdline" = no; then
447  AC_CHECK_PROG(mp_ssh, ssh, ssh, no)
448  AC_CHECK_PROG(mp_remsh, remsh, remsh, no)
449  AC_CHECK_PROG(mp_rsh, rsh, rsh, no)
450  if test "$ac_cv_prog_mp_ssh" = ssh; then
451     mp_rsh_found=ssh
452  elif test "$ac_cv_prog_mp_remsh" = remsh; then
453     mp_rsh_found=remsh
454  elif test "$ac_cv_prog_mp_rsh" = rsh; then
455     mp_rsh_found=rsh
456  else
457     mp_rsh_found=no
458  fi
459else
460  mp_rsh_found=${mp_rsh_cmdline}
461fi
462
463AC_MSG_CHECKING(which remote shell command to use)
464AC_MSG_RESULT(${mp_rsh_found})
465
466if test "$mp_rsh_found" = no; then
467   AC_MSG_WARN("No remote shell command found")
468else
469  AC_DEFINE_UNQUOTED(MP_RSH_COMMAND, "$mp_rsh_found")
470   # check whether it also works with localhost, instead of hostname
471   #if $mp_rsh localhost -n uname  > /dev/null 2>&1; then
472   #  AC_DEFINE(RSH_CAN_LOCALHOST)
473   #fi
474fi
475
476
477
478dnl Check for external memory managements
479AC_ARG_WITH(malloc, \
480 [ --with-malloc=HEADER     use external malloc routines declared in HEADER])
481
482if test "${with_malloc+set}" = set; then
483  AC_CHECK_HEADER(${with_malloc},,with_malloc=)
484fi
485AC_MSG_CHECKING(where malloc rotuines come from)
486if test "${with_malloc+set}" = set; then
487  AC_MSG_RESULT(${with_malloc})
488  AC_DEFINE(WITH_EXTERNAL_MALLOC)
489  AC_DEFINE_UNQUOTED(EXTERNAL_MALLOC_H, "${with_malloc}")
490else
491  AC_MSG_RESULT(stdlib.h)
492fi
493
494
495dnl Checks for typedefs, structures, and compiler characteristics.
496AC_C_BIGENDIAN
497AC_C_CONST
498AC_TYPE_SIZE_T
499AC_HEADER_TIME
500
501dnl miscellanous stuff
502dnl check for sizeof(long)
503AC_CHECK_SIZEOF(long, 4)
504if test "$ac_cv_sizeof_long" != 4; then
505  AC_MSG_ERROR(Need sizeof long to equal 4)
506fi
507
508dnl add some defines for if pari is used
509
510CLEAN="rm -f *~ a.out core *.o .log"
511AC_SUBST(CLEAN)
512
513dnl if we use GCC, then we know CFLAGS best and do not let user overwrite it
514if test "${GCC}" = yes && test "$ac_cv_cflags_not_set" = yes; then
515  if test "$with_debug" = yes; then
516    CFLAGS="-g -Wall -Wno-unused ${with_extra_cflags}"
517  else
518    CFLAGS="-O3 -w -fomit-frame-pointer ${with_extra_cflags}"
519  fi
520fi
521
522dnl check for args to pass to subconfigure
523if test "$prefix" = NONE; then
524  ac_configure_args="$ac_configure_args --prefix=$ac_default_prefix"
525fi
526   
527AC_CONFIG_SUBDIRS($CONFIG_SUBDIRS)
528
529AC_OUTPUT(Makefile MP/Makefile MPT/Makefile mpviewer/Makefile \
530        mp-pvm3/Makefile examples/Makefile, \
531        if test "$CONFIG_HEADERS"; then echo timestamp > MP/stamp-h; fi)
Note: See TracBrowser for help on using the repository browser.