source: git/MP/configure.in @ 854bb7

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