File: configure.in

package info (click to toggle)
yorick 1.4-14
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,948 kB
  • ctags: 6,609
  • sloc: ansic: 63,898; yacc: 889; makefile: 605; sh: 65; lisp: 60; fortran: 19
file content (329 lines) | stat: -rw-r--r-- 9,321 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
dnl
dnl GNU autoconf configure.in to produce configure script for Yorick
dnl
dnl
AC_INIT(Yorick/yorick.c)
dnl
AC_ARG_WITH(gcc, [use gcc compiler if available],[
if test "x$withval" = "xno"; then :; else
AC_PROG_CC
fi
])dnl
if test "x$CC" = "x"; then CC=cc; fi
dnl
dnl HPUX needs special stuff
dnl
AC_EGREP_CPP(yes,
[#ifdef hpux
  yes
#endif
], [
AC_DEFINE(_HPUX_SOURCE)
if test $CC = cc; then CC="cc -Aa"; fi
])dnl
dnl
dnl Be sure we've found an ANSI compiler
dnl
AC_MSG_CHECKING(ANSI C compiler)
AC_TRY_LINK([
#include <stdio.h>
struct junk { int x; double y; } glob= { 1, -2.0 };
extern int oops(struct junk *dummy);      /* prototype */
static void *vtest= 0;                    /* void pointer */
int oops(struct junk *dummy) {            /* ANSI function definition */
  struct junk loc1= *dummy;               /* struct assign */
  struct junk loc2= { -3, 4.0 };          /* aggregate automatic init */
  void *vtest= &glob;                     /* implicit void pointer cast */
  printf("%p %d %g\n", vtest, loc1.x, loc2.y);
  return 0;
}
], [
  oops(&glob);
], AC_MSG_RESULT($CC looks like an ANSI compiler.  Good.), [
AC_MSG_RESULT($CC is not an ANSI C compiler)
AC_MSG_ERROR(Set env variable CC to your ANSI compiler and rerun configure.)
])dnl
dnl
dnl Get current version number
dnl
Y_VERSION=`cat ./VERSION`
AC_SUBST(Y_VERSION)
dnl
dnl Compute Y_SITE, Y_HOME, Y_BINDIR from prefix, exec_prefix
dnl
AC_ARG_ENABLE(share, [use GNU share/ directory layout],[
share_dir="${enableval}"
if test "x${share_dir}" = "xno"; then share_dir="lib"; fi
if test "x${share_dir}" = "xyes"; then share_dir="share"; fi
],[
share_dir="share"
])dnl
AC_ARG_ENABLE(suffix, [append architecture-dependent suffix to paths],[
arch_suffix="/$enableval"
if test "$arch_suffix" = "/no"; then arch_suffix=""; fi
if test "$arch_suffix" = "/yes"; then arch_suffix=""; fi
],[
arch_suffix=""
])dnl
if test "x${prefix}" = "xNONE"; then prefix=${ac_default_prefix}; fi
if test "x${exec_prefix}" = "xNONE"; then exec_prefix=${prefix}; fi
if test -r ${prefix}/Yorick/yorick.c; then
  if test "x${prefix}" = "x${exec_prefix}"; then exec_prefix=here; fi
  prefix=here
fi
if test "x${prefix}" = xhere; then
  prefix=`pwd`
  case "$prefix" in
    /tmp_mnt/*)
      tmp=`echo $prefix | sed 's,^/tmp_mnt,,'`
      if test -r ${tmp}/Yorick/yorick.c; then prefix="$tmp"
      else {
	tmp=`echo $tmp | sed 's,^/[^/]*/,/,'`
	if test -r ${tmp}/Yorick/yorick.c; then prefix="$tmp"; fi
      }
      fi ;;
    *) ;;
  esac
  if test "x${exec_prefix}" = xhere; then exec_prefix="$prefix"; fi
  Y_HOME=${exec_prefix}${arch_suffix}
  Y_SITE=${prefix}/Yorick
  YS_PRE1=
  YS_PRE2=
  YH_PRE1=
  YH_PRE2=
  YH_PRE3=
else
  Y_HOME=${exec_prefix}/lib/yorick/${Y_VERSION}${arch_suffix}
  Y_SITE=${prefix}/${share_dir}/yorick/${Y_VERSION}
  YS_PRE1=${prefix}/${share_dir}
  YS_PRE2=${prefix}/${share_dir}/yorick
  YH_PRE1=${exec_prefix}/lib
  YH_PRE2=${exec_prefix}/lib/yorick
  if test "x${arch_suffix}" = x; then
    YH_PRE3=
  else
    YH_PRE3=${exec_prefix}/lib/yorick/${Y_VERSION}
  fi
fi
AC_ARG_ENABLE(bindir, [specify complete binary installation path],[
Y_BINDIR="${enableval}"
if test "x${Y_BINDIR}" = "xno"; then Y_BINDIR="${Y_HOME}/bin"; fi
],[
Y_BINDIR=${exec_prefix}/bin
])dnl
AC_SUBST(Y_SITE)dnl
AC_SUBST(Y_HOME)dnl
AC_SUBST(Y_BINDIR)dnl
AC_SUBST(YS_PRE1)dnl
AC_SUBST(YS_PRE2)dnl
AC_SUBST(YH_PRE1)dnl
AC_SUBST(YH_PRE2)dnl
AC_SUBST(YH_PRE3)dnl
dnl
dnl check for string.h header (defines size_t)
dnl Without this, there is no way to tell whether size_t is unsigned int
dnl or unsigned long.  In fact, on all known platforms, size_t is
dnl equivalent to unsigned long, but compilers may (gcc does) issue
dnl warnings if the prototypes for memcpy and memset in Yorick/defstr.h
dnl and Gist/draw.c do not match exactly.
dnl
AC_HEADER_STDC
dnl
dnl
dnl
AC_PROG_RANLIB
dnl LOWLIBS begins with any LIBS defined by environment variable
dnl just assume -lm is present AC_CHECK_LIB(m,main)dnl
LOWLIBS="-lm $LIBS"
dnl SIGFPE handler requires -lfpe on IRIX, -lsunmath on Solaris
AC_CHECK_LIB(fpe,main,LOWLIBS="$LOWLIBS -lfpe")dnl
AC_CHECK_LIB(sunmath,main,LOWLIBS="$LOWLIBS -lsunmath")dnl
AC_SUBST(LOWLIBS)dnl
dnl
dnl UNICOS doesn't have matherr, but can deliver SIGFPE with libmset
dnl
AC_CHECK_FUNC(libmset, D_HAS_LIBMSET="-DHAS_LIBMSET", D_HAS_LIBMSET=)
AC_SUBST(D_HAS_LIBMSET)dnl
dnl
dnl check if cuserid prototype is in stdio.h
dnl
AC_EGREP_HEADER('\bcuserid\b',stdio.h,D_CUSERID=,D_CUSERID="-DNEED_CUSERID")
AC_SUBST(D_CUSERID)dnl
dnl
AC_CHECK_FUNC(cuserid, D_HAS_CUSERID="-DHAS_CUSERID", D_HAS_CUSERID=)
AC_SUBST(D_HAS_CUSERID)dnl
dnl
AC_CHECK_FUNC(getcwd, D_HAS_GETCWD="-DHAS_GETCWD", D_HAS_GETCWD=)
AC_SUBST(D_HAS_GETCWD)dnl
dnl
AC_CHECK_FUNC(strtoul, D_NO_STRTOUL=, D_NO_STRTOUL="-DNO_STRTOUL")
AC_SUBST(D_NO_STRTOUL)dnl
dnl
dnl check for exp10, tcgetpgrp, and times functions
dnl
AC_CHECK_FUNC(exp10, D_HAS_EXP10="-DHAS_EXP10", D_HAS_EXP10=)
AC_SUBST(D_HAS_EXP10)dnl
dnl
D_HAVE_SYS_TERMIOS_H=
AC_CHECK_FUNC(tcgetpgrp,
D_NEED_TCGETPGRP=, D_NEED_TCGETPGRP="-DNEED_TCGETPGRP"
AC_CHECK_HEADER(sys/termios.h,D_HAVE_SYS_TERMIOS_H="-DHAVE_SYS_TERMIOS_H"))
AC_SUBST(D_NEED_TCGETPGRP)dnl
AC_SUBST(D_HAVE_SYS_TERMIOS_H)dnl
dnl
dnl SunOS looks like it has POSIX times function, but partially broken
AC_MSG_CHECKING(working times function)
AC_TRY_RUN([#include <time.h>
#include <sys/times.h>
#ifndef CLK_TCK
#include <unistd.h>
#ifndef CLK_TCK
#define CLK_TCK sysconf(_SC_CLK_TCK)
#endif
#endif
int main(argc,argv) int argc; char *argv[];
{ struct tms cpuTime;
  long wallTicks= times(&cpuTime);
  sleep(1); wallTicks= times(&cpuTime)-wallTicks;
  if (wallTicks<CLK_TCK/2) exit(1); else exit(0); }
], timer_test=yes, timer_test=no, timer_test=no)
AC_MSG_RESULT($timer_test)
if test "$timer_test" = yes; then
D_TIMER=
else
AC_CHECK_FUNC(getrusage, D_TIMER="-DBSD_TIMER",
  AC_CHECK_FUNC(times, D_TIMER=, D_TIMER="-DNO_TIMER"))dnl
if test "X$D_TIMER" = "X"; then
  AC_MSG_WARN(Using times for timer, but wall time is broken.)
fi
fi
AC_SUBST(D_TIMER)dnl
dnl
dnl check whether short is native CGM word format
dnl
AC_TRY_RUN([main() {
  union { short s; char c[2]; } u; u.s= 1;
  exit(sizeof(short)!=2 || u.c[1]!=1);}
], D_NOT_CGM_ORDER=, D_NOT_CGM_ORDER="-DNOT_CGM_ORDER",
    AC_MSG_WARN(To cross compile, you must set D_NOT_CGM_ORDER by hand.))
dnl
AC_SUBST(D_NOT_CGM_ORDER)dnl
dnl
dnl find X window system headers and libraries
dnl
AC_PATH_X
if test -z "${no_x}"; then
  D_NO_XLIB=
  if test -z "$x_includes"; then
    XINCLUDE=
  else
    XINCLUDE=-I$x_includes
  fi
  if test -z "$x_libraries"; then
    XLOAD=-lX11
  else
    XLOAD="-L$x_libraries -lX11"
  fi
  XOBJS="xfancy.o xbasic.o xicky.o xfont.o"
  DISPOBJS="dispat.o dispas.o dispax.o"
else
  D_NO_XLIB="-DNO_XLIB"
  XINCLUDE=
  XLOAD=
  XOBJS=
  DISPOBJS="dispat.o dispas.o"
fi
AC_SUBST(D_NO_XLIB)dnl
AC_SUBST(XINCLUDE)dnl
AC_SUBST(XLOAD)dnl
AC_SUBST(XOBJS)dnl
AC_SUBST(DISPOBJS)dnl
dnl
dnl IRIX (SGI) select function broken, must use poll function instead
dnl
AC_EGREP_CPP(yes,
[#ifdef sgi
  yes
#endif
], D_USE_POLL="-DUSE_POLL", D_USE_POLL=)dnl
AC_SUBST(D_USE_POLL)dnl
dnl
dnl Intel x86 chips benefit from double alignment hack
dnl
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
case "${UNAME_MACHINE}" in
    i?86|i86pc)
	AC_DEFINE(PAD_ARRAY)dnl
    	;;
esac
dnl
dnl Try to find out a little bit about FORTRAN
dnl
fortran=${FC}
if test -z "${fortran}"; then
fortran=`make -p -f - </dev/null 2>/dev/null | grep "FC *= *" | sed -e "s/FC *= *//"`
if test -z "${fortran}"; then fortran=f77; fi
fi
AC_CHECK_PROG(FC, ${fortran}, ${fortran}, )dnl
if test -z "${FC}"; then
AC_CHECK_PROG(FC, cf77, cf77, )dnl
fi
FORTRAN_LIBS=
FORTRAN_LINKAGE=
if test ! -z "${FC}"; then
AC_CHECK_LIB(F77,main,
  [AC_CHECK_LIB(M77,main, FORTRAN_LIBS="-lM77 -lF77", FORTRAN_LIBS=-lF77)],
  [AC_CHECK_LIB(cl,main,
    [AC_CHECK_LIB(vec,main, FORTRAN_LIBS="-lvec -lcl", FORTRAN_LIBS=-lcl)],
    [AC_CHECK_LIB(ots,main, FORTRAN_LIBS=-lots,
      [AC_CHECK_LIB(f,main, FORTRAN_LIBS=-lf,
        [AC_CHECK_LIB(f2c,main, FORTRAN_LIBS=-lf2c)])])])])dnl
if test -z "$FORTRAN_LIBS"; then
AC_MSG_WARN(FORTRAN_LIBS not set (you may not care about Fortran).)
fi
rm -fr conftest*
cat > conftest.f <<EOF
      subroutine conjnk(x,y)
      real x, y
      x= x+y
      return
      end
EOF
fcompile='${FC} -c conftest.f -o conftest.o >/dev/null 2>&1'
eval $fcompile
if test -r conftest.o; then
nm conftest.o >conftest.n
fcompile=`grep CONJNK conftest.n`
if test ! -z "${fcompile}"; then
fcompile=`grep CONJNK_ conftest.n`
if test ! -z "${fcompile}"; then FORTRAN_LINKAGE=-DF_LINKAGE_
else FORTRAN_LINKAGE=-DF_LINKAGE; fi
else
fcompile=`grep conjnk_ conftest.n`
if test ! -z "${fcompile}"; then FORTRAN_LINKAGE=-Df_linkage_
else FORTRAN_LINKAGE=-Df_linkage; fi
fi
rm -fr conftest*
fi
if test -z "$FORTRAN_LINKAGE"; then
  AC_MSG_WARN(Unable to determine Fortran linkage convention.  Oh well.)
fi
fi
if test -z "$FORTRAN_LINKAGE"; then FORTRAN_LINKAGE=-Df_linkage_; fi
AC_SUBST(FC)dnl
AC_SUBST(FORTRAN_LIBS)dnl
AC_SUBST(FORTRAN_LINKAGE)dnl
dnl
dnl Find C++ compiler if any
dnl
AC_PROG_CXX
AC_SUBST(CXX)dnl
dnl
dnl check for LDFLAGS environment variables
dnl
if test ! -z "$LDFLAGS"; then LDOPTS=$LDFLAGS; echo using LDOPTS=$LDOPTS;  fi
AC_SUBST(LDOPTS)dnl
dnl
dnl
dnl
AC_OUTPUT(Makefile Gist/Makefile Browser/Makefile Yorick/Maketmpl)