source: git/MP/configure.in @ 296946

spielwiese
Last change on this file since 296946 was 296946, checked in by Hans Schönemann <hannes@…>, 24 years ago
*hannes: aded CXX git-svn-id: file:///usr/local/Singular/svn/trunk@2998 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)
173
174if test "$ac_check_prog" = yes; then
175  AC_CHECK_LIB(m, atof)
176  AC_CHECK_LIB(bsd, socket)
177  AC_CHECK_LIB(gmp, mpz_init)
178
179  if test "$ac_cv_lib_gmp_mpz_init" != yes || "$enable_gmp" != no; then
180    AC_MSG_WARN(Did not find gmp library: Linking programs with MP will fail)
181    NEED_LIBS=$LIBS
182  else
183    NEED_LIBS="-lgmp $LIBS"
184  fi
185 
186  AC_CHECK_FUNCS(select socket gethostname gethostbyname strtol strstr)
187  if test "$ac_cv_func_select" != yes; then
188    AC_MSG_WARN(Did not find library containing function select)
189    AC_MSG_WARN(Linking programs with MP might fail)
190  fi
191  if test "$ac_cv_func_gethostname" != yes; then
192    AC_MSG_WARN(Did not find library containing gethostname)
193    AC_MSG_WARN(Linking programs with MP might fail)
194  fi
195
196  if test "$ac_cv_func_gethostbyname" != yes; then
197    AC_CHECK_LIB(nsl, gethostbyname)
198    if test "$ac_cv_lib_nsl_gethostbyname" != yes; then
199      AC_MSG_WARN(Did not find library containing gethostname)
200      AC_MSG_WARN(Linking programs with MP might fail)
201    fi
202  fi
203
204  if test "$ac_cv_func_socket" != yes; then
205    AC_CHECK_LIB(socket, socket)
206    if test "$ac_cv_lib_socket_socket" != yes; then
207      AC_MSG_WARN(Did not find library containing socket)
208      AC_MSG_WARN(Linking programs with MP might fail)
209    fi
210  fi
211fi
212AC_SUBST(NEED_LIBS)
213
214dnl Do the header checks now
215AC_HEADER_STDC
216AC_HEADER_CHECK(arpa/inet.h,:, echo "*** no arpa/inet.h";exit)
217AC_HEADER_CHECK(assert.h,:, echo "*** no assert.h";exit)
218AC_HEADER_CHECK(ctype.h,:, echo "*** no ctype.h";exit)
219AC_HEADER_CHECK(errno.h,:, echo "*** no errno.h";exit)
220AC_HEADER_CHECK(netdb.h,:, echo "*** no netdb.h";exit)
221AC_HEADER_CHECK(netinet/in.h,:, echo "*** no netinet/in.h";exit)
222AC_HEADER_CHECK(netinet/tcp.h,:, echo "*** no netinet/tcp.h";exit)
223AC_HEADER_CHECK(signal.h,:, echo "*** no sihnal.h";exit)
224AC_HEADER_CHECK(stdarg.h,:, echo "*** no stdarg.h";exit)
225AC_HEADER_CHECK(stdio.h,:, echo "*** no stdio.h";exit)
226AC_HEADER_CHECK(stdlib.h,:, echo "*** no stdlib.h";exit)
227AC_HEADER_CHECK(string.h,:, echo "*** no string.h";exit)
228AC_HEADER_CHECK(stddef.h,:, echo "*** no stddef.h";exit)
229AC_HEADER_CHECK(values.h,:, echo "*** no values.h";exit)
230
231AC_HEADER_CHECK(fcntl.h,:, echo "*** no fcntl.h";exit)
232AC_HEADER_CHECK(sys/ioctl.h,:, echo "*** no sys/ioctl.h";exit)
233AC_HEADER_CHECK(sys/param.h,:, echo "*** no sys/param.h";exit)
234AC_HEADER_CHECK(sys/socket.h,:, echo "*** no sys/socket.h";exit)
235AC_HEADER_CHECK(sys/stat.h,:, echo "*** no sys/stat.h";exit)
236AC_HEADER_CHECK(sys/time.h,:, echo "*** no sys/time.h";exit)
237AC_HEADER_CHECK(sys/types.h,:, echo "*** no sys/types.h";exit)
238AC_HEADER_CHECK(sys/uio.h,:, echo "*** no sys/uio.h";exit)
239AC_HEADER_CHECK(sys/un.h,:, echo "*** no sys/un.h";exit)
240AC_HEADER_CHECK(unistd.h,:, echo "*** no unistd.h";exit)
241AC_HEADER_CHECK(math.h,:, echo "*** no math.h";exit)
242
243
244AC_CHECK_HEADERS(sys/select.h gmp.h genpari.h saclib.h)
245
246dnl Check whether mpz_ptr is defined (is not defined in earlier gmp versions)
247if test "$ac_cv_header_gmp_h" = yes; then
248  AC_EGREP_HEADER(mpz_ptr, gmp.h, MPZ_PTR=mpz_ptr)
249  if test ! "$MPZ_PTR" = mpz_ptr; then
250    AC_EGREP_HEADER(MP_INT, gmp.h, MPZ_PTR="MP_INT*")
251    AC_DEFINE_UNQUOTED(mpz_ptr, MP_INT*)
252    AC_DEFINE_UNQUOTED(_mp_alloc,alloc)
253    AC_DEFINE_UNQUOTED(_mp_size,size)
254    AC_DEFINE_UNQUOTED(_mp_d,d)
255  fi
256  AC_EGREP_HEADER(mpf_ptr, gmp.h, MPF_PTR=mpf_ptr)
257fi
258
259dnl
260dnl deal with Ap Number configuration
261dnl
262AC_ARG_WITH(apint, \
263 [  --with-default_apint=PACKAGE    use PACKAGE as MP's default ApInt format
264                           where PACKAGE can be: gmp (default), pari,
265                           saclib, none])
266AC_ARG_WITH(apreal, \
267 [  --with-default_apreal=PACKAGE   use PACKAGE as MP's default ApReal format
268                           where PACKAGE can be: gmp (default), none])
269AC_ARG_WITH(gmp, \
270 [  --without-gmp           build without gmp ApNumber routines])
271
272AC_ARG_WITH(pari, \
273 [  --with-pari             build with pari ApInt routines])
274
275AC_ARG_WITH(saclib, \
276 [  --with-saclib           build with saclib ApInt routines])
277
278AC_ARG_WITH(tb, \
279 [  --with-tb               build with Toolbus device interface])
280
281AC_ARG_WITH(pvm, \
282 [  --with-pvm              build with Pvm saclib device interface])
283
284AC_ARG_WITH(debug, \
285 [  --with-debug            build with debug options and logging])
286
287AC_ARG_WITH(extra_cflags, \
288 [  --with-extra_cflags=cflags   build with 'cflags' appended to
289                                 CFLAGS given to the compiler])
290
291AC_ARG_WITH(rsh, \
292 [ --with-rsh=command      use 'command' as remote shell command])
293
294dnl evaluate specifications
295AC_DEFINE(MP_DUMMY, 0)
296AC_DEFINE(MP_GMP, 1)
297AC_DEFINE(MP_PARI, 2)
298AC_DEFINE(MP_SAC, 3)
299
300if test "$with_default_apint" = none; then
301  AC_DEFINE(MP_DEFAULT_APINT, MP_DUMMY)
302elif test "$with_default_apint" = pari; then
303  if test "$ac_cv_header_genpari_h" != yes; then
304    AC_MSG_WARN(Need genpari.h to use pari as default ApInt format)
305    AC_MSG_WARN(Use dummy as default MP ApInt format)
306    AC_DEFINE(MP_DEFAULT_APINT_FORMAT, MP_DUMMY) 
307  else
308    AC_DEFINE(MP_DEFAULT_APINT_FORMAT, MP_PARI)
309    AC_DEFINE(MP_HAVE_PARI)
310  fi
311elif test "$with_default_apint" = saclib; then
312  if test "$ac_cv_header_saclib_h" != yes; then
313    AC_MSG_WARN(Need saclib.h to use saclib as default ApInt format)
314    AC_MSG_WARN(Use dummy as default MP ApInt format)
315    AC_DEFINE(MP_DEFAULT_APINTFORMAT, MP_DUMMY) 
316  else
317    AC_DEFINE(MP_DEFAULT_APINT_FORMAT, MP_SAC)
318    AC_DEFINE(MP_HAVE_SACLIB)
319  fi
320else
321  if test "$ac_cv_header_gmp_h" != yes && test "$enable_gmp" != yes; then
322    AC_MSG_WARN(Need gmp.h to use gmp as default ApInt format)
323    AC_MSG_WARN(Use dummy as default MP ApInt format)
324    AC_DEFINE(MP_DEFAULT_APINTFORMAT, MP_DUMMY) 
325  elif test -z "$MPZ_PTR" && test "$enable_gmp" != yes; then
326    AC_MSG_WARN(Need gmp.h containing typedef of 'mpz_ptr' or 'MP_INT')
327    AC_MSG_WARN(Use dummy as default MP ApInt format)
328    AC_DEFINE(MP_DEFAULT_APINTFORMAT, MP_DUMMY)
329  else
330    AC_DEFINE(MP_DEFAULT_APINT_FORMAT, MP_GMP)
331    AC_DEFINE(MP_HAVE_GMP_APINT)
332    if test "$ac_cv_header_gmp_h" != yes; then
333      AC_MSG_WARN(Need gmp.h to use gmp as default ApInt format)
334      AC_MSG_WARN(Install gmp.h before making MP)
335    fi
336  fi
337fi
338
339if test "$with_default_apreal" = none; then
340  AC_DEFINE(MP_DEFAULT_APREAL, MP_DUMMY)
341else
342  if test "$ac_cv_header_gmp_h" != yes && test "$enable_gmp" != yes; then
343    AC_MSG_WARN(Need gmp.h to use gmp as default ApReal format)
344    AC_MSG_WARN(Use dummy as default MP ApReal format)
345    AC_DEFINE(MP_DEFAULT_APREALFORMAT, MP_DUMMY) 
346  elif test -z "$MPF_PTR" && test "$enable_gmp" != yes; then
347    AC_MSG_WARN(Need gmp.h containing tyedef of 'mpf_ptr')
348    AC_MSG_WARN(Use dummy as default MP ApReal format)
349    AC_DEFINE(MP_DEFAULT_APREALFORMAT, MP_DUMMY) 
350  else
351    AC_DEFINE(MP_DEFAULT_APREAL_FORMAT, MP_GMP)
352    AC_DEFINE(MP_HAVE_GMP_APREAL)
353    if test "$ac_cv_header_gmp_h" != yes ; then
354      AC_MSG_WARN(Need gmp.h to use gmp as default ApReal format)
355      AC_MSG_WARN(Install gmp.h before making MP)
356    fi
357  fi
358fi
359
360if test "$with_gmp" != no; then
361  if test "$ac_cv_header_gmp_h" != yes && test "$enable_gmp" != yes; then
362    AC_MSG_WARN(Can not build MP with gmp ApInt routines: Need gmp.h)
363  else
364    AC_DEFINE(MP_HAVE_GMP)
365    if test "$ac_cv_header_gmp_h" != yes; then
366      AC_MSG_WARN(Need gmp.h to build MP with gmp ApInt routines)
367      AC_MSG_WARN(Install gmp.h before making MP)
368    fi
369  fi
370fi
371
372if test "$with_saclib" = yes; then
373  if test "$ac_cv_header_saclib_h" != yes; then
374    AC_MSG_WARN(Can not build MP with saclib ApInt routines: Need saclib.h)
375  else
376    AC_DEFINE(MP_HAVE_SAC)
377  fi
378fi
379
380if test "$with_pari" = yes; then
381  if test "$ac_cv_header_genpari_h" != yes; then
382    AC_MSG_WARN(Can not build MP with pari ApInt routines: Need genpari.h)
383  else
384    AC_DEFINE(MP_HAVE_PARI)
385    AC_DEFINE(LONG_IS_32BIT)
386    AC_CHECK_TYPE(ulong, no)
387    if test "$ac_cv_type_ulong" = no; then
388        AC_DEFINE(ULONG_NOT_DEFINED)
389    fi
390  fi
391fi
392
393   
394
395if test "$with_tb" = yes; then
396  AC_CHECK_HEADER(TB.h)
397  if test "$ac_cv_header_TB_h" != yes; then
398    AC_MSG_WARN(Can not build with Toolbus: Need TB.h)
399  else
400    AC_DEFINE(MP_HAVE_TB)
401  fi
402fi
403
404if test "$with_pvm" = yes; then
405 AC_CHECK_HEADER(pvm3.h)
406 if test "$ac_cv_header_pvm3_h" != yes; then
407    AC_MSG_WARN(Can not build with Pvm: Need pvm3.h)
408  else
409    AC_DEFINE(MP_HAVE_PVM)
410  fi
411fi
412
413if test "${with_extra_cflags+set}" = set; then
414  CFLAGS="$CFLAGS ${with_extra_cflags}"
415fi
416
417if test "${with_rsh+set}" = set; then
418  AC_CHECK_PROG(with_rsh, ${with_rsh}, ${with_rsh})
419  if test "$ac_cv_prog_with_rsh" = $with_rsh; then
420    ac_rsh_programs=${with_rsh}
421  else
422   ac_rsh_programs=
423  fi
424fi
425
426
427
428AC_CHECK_PROG(mp_rsh, rsh, rsh, no)
429if test "$ac_cv_prog_mp_rsh" = rsh; then
430   ac_rsh_programs="$ac_rsh_programs rsh"
431fi
432
433AC_CHECK_PROG(mp_remsh, remsh, remsh, no)
434if test "$ac_cv_prog_mp_remsh" = remsh; then
435   ac_rsh_programs="$ac_rsh_programs remsh"
436fi
437
438AC_CHECK_PROG(mp_ssh, ssh, ssh, no)
439if test "$ac_cv_prog_mp_ssh" = ssh; then
440   ac_rsh_programs="$ac_rsh_programs ssh"
441fi
442
443AC_MSG_CHECKING(which remote shell command to use)
444for mp_rsh in $ac_rsh_programs; do
445    if $mp_rsh `hostname` -n uname \>\& /dev/null; then
446      mp_rsh_found=$mp_rsh
447      break;
448    else
449      mp_rsh_found=none
450    fi
451done
452AC_MSG_RESULT($mp_rsh_found)
453if test "${mp_rsh_found}" = none; then
454   AC_MSG_WARN("No working remote shell command found")
455else
456  AC_DEFINE_UNQUOTED(MP_RSH_COMMAND, "$mp_rsh_found")
457fi
458
459dnl Check for external memory managements
460AC_ARG_WITH(malloc, \
461 [ --with-malloc=HEADER     use external malloc routines declared in HEADER])
462
463if test "${with_malloc+set}" = set; then
464  AC_CHECK_HEADER(${with_malloc},,with_malloc=)
465fi
466AC_MSG_CHECKING(where malloc rotuines come from)
467if test "${with_malloc+set}" = set; then
468  AC_MSG_RESULT(${with_malloc})
469  AC_DEFINE(WITH_EXTERNAL_MALLOC)
470  AC_DEFINE_UNQUOTED(EXTERNAL_MALLOC_H, "${with_malloc}")
471else
472  AC_MSG_RESULT(stdlib.h)
473fi
474
475
476dnl Checks for typedefs, structures, and compiler characteristics.
477AC_C_BIGENDIAN
478AC_C_CONST
479AC_TYPE_SIZE_T
480AC_HEADER_TIME
481
482dnl miscellanous stuff
483dnl check for sizeof(long)
484AC_CHECK_SIZEOF(long, 4)
485if test "$ac_cv_sizeof_long" != 4; then
486  AC_MSG_ERROR(Need sizeof long to equal 4)
487fi
488
489dnl add some defines for if pari is used
490
491CLEAN="rm -f *~ a.out core *.o .log"
492AC_SUBST(CLEAN)
493
494dnl if we use GCC, then we know CFLAGS best and do not let user overwrite it
495if test "${GCC}" = yes && test "$ac_cv_cflags_not_set" = yes; then
496  if test "$with_debug" = yes; then
497    CFLAGS="-g -Wall -Wno-unused ${with_extra_cflags}"
498  else
499    CFLAGS="-O3 -w -fomit-frame-pointer ${with_extra_cflags}"
500  fi
501fi
502
503dnl check for args to pass to subconfigure
504if test "$prefix" = NONE; then
505  ac_configure_args="$ac_configure_args --prefix=$ac_default_prefix"
506fi
507   
508AC_CONFIG_SUBDIRS($CONFIG_SUBDIRS)
509
510AC_OUTPUT(Makefile MP/Makefile MPT/Makefile mpviewer/Makefile \
511        mp-pvm3/Makefile examples/Makefile, \
512        if test "$CONFIG_HEADERS"; then echo timestamp > MP/stamp-h; fi)
Note: See TracBrowser for help on using the repository browser.