File: configure.in

package info (click to toggle)
scsh 0.5.1-2
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 6,540 kB
  • ctags: 8,656
  • sloc: lisp: 39,346; ansic: 13,466; sh: 1,669; makefile: 624
file content (376 lines) | stat: -rw-r--r-- 9,443 bytes parent folder | download
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
dnl Process this file with autoconf 2.x to produce a configure script.

dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
dnl Autoconf does not seems to fit the needs of dynamic linking well -bri

dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
dnl We might want AC_CHAR_UNSIGNED in the future.

dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
dnl The -cckr (K&R) flag is for the IRIX C compiler.  If this is left
dnl out, scheme48vm.c breaks because the rather pedantic SGI compiler
dnl decides that a char is not the same thing as an unsigned char.
dnl - Bryan O'Sullivan 3/94

AC_DEFUN(S48_CFLAG_CKR, [
  AC_MSG_CHECKING(${CC} for -cckr)
  AC_CACHE_VAL(s48_cv_cflag_ckr,[
    if test ${CC} != gcc; then
      echo "main(){int i=1;}" > conftest.c
      if CFLAGS="-cckr ${CFLAGS}" eval $ac_compile
      then
        s48_cv_cflag_ckr=yes
      else
        s48_cv_cflag_ckr=no
      fi
    else
      s48_cv_cflag_ckr=no
    fi
    rm -f conftest*])
  AC_MSG_RESULT($s48_cv_cflag_ckr)
  if test $s48_cv_cflag_ckr = yes; then
    CFLAGS=$CFLAGS
  fi
])

dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(S48_POSIX_LIBC, [
  AC_MSG_CHECKING(for RISC/OS POSIX library lossage)
  AC_CACHE_VAL(s48_cv_posix_libc,[
    if test -f /usr/posix/usr/lib/libc.a; then
      s48_cv_posix_libc=yes
    else
      s48_cv_posix_libc=no
    fi])
  AC_MSG_RESULT($s48_cv_posix_libc)
  if test $s48_cv_posix_libc = yes; then
    LIBS="${LIBS} /usr/posix/usr/lib/libc.a"
  fi
])

dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(S48_CFLAG_O2, [
  AC_MSG_CHECKING(whether we can use -O2)
  AC_CACHE_VAL(s48_cv_cflag_o2,[
    if test "z$CFLAGS" = "z"; then 
      if test "z$GCC" = "z"; then 
        s48_cv_cflag_o2=yes
      else 
        s48_cv_cflag_o2=no
      fi
    else
      s48_cv_cflag_o2=preset
    fi])
  AC_MSG_RESULT($s48_cv_cflag_o2)
  case "$s48_cv_cflag_o2" in
    yes )
      CFLAGS="-O"
    ;;
    no )
      CFLAGS="-O2 -g"
    ;;
  esac
])

dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(S48_USCORE, [
  AC_MSG_CHECKING(for underscore before symbols)
  AC_CACHE_VAL(s48_cv_uscore,[
    echo "main(){int i=1;}
    fnord(){int i=23; int ltuae=42;}" > conftest.c
    ${CC} conftest.c > /dev/null
    if (nm a.out | grep _fnord) > /dev/null; then
      s48_cv_uscore=yes
    else
      s48_cv_uscore=no
    fi])
  AC_MSG_RESULT($s48_cv_uscore)
  rm -f conftest.c a.out

  if test $s48_cv_uscore = yes; then
    AC_DEFINE(USCORE)

    if test $ac_cv_func_dlopen = yes ; then
	AC_MSG_CHECKING(whether dlsym always adds an underscore for us)
	AC_CACHE_VAL(s48_cv_dlsym_adds_uscore,AC_TRY_RUN( [
#include <dlfcn.h>
#include <stdio.h>
fnord() { int i=42;}
main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
    if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
    if(ptr1 && !ptr2) exit(0); } exit(1); } 
], [s48_cv_dlsym_adds_uscore=yes
	AC_DEFINE(DLSYM_ADDS_USCORE) ], s48_cv_dlsym_adds_uscore=no))

        AC_MSG_RESULT($s48_cv_dlsym_adds_uscore)
    fi
  fi
])

dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(S48_NLIST,[
  AC_MSG_CHECKING(for n_name)
  AC_CACHE_VAL(s48_cv_nlist,[
    AC_TRY_COMPILE([#include <nlist.h>], 
                   [struct nlist name_list;
                    name_list.n_name = "foo";],
                   s48_cv_nlist=yes,
                   s48_cv_nlist=no)])
  AC_MSG_RESULT($s48_cv_nlist)
  if test $s48_cv_nlist = yes; then
    AC_DEFINE(NLIST_HAS_N_NAME)
  fi
])

dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(S48__CNT,[
  AC_MSG_CHECKING(for _cnt)
  AC_CACHE_VAL(s48_cv__cnt,[
    AC_TRY_COMPILE([#include <stdio.h>], 
                   [return stdin->_cnt;],
                   s48_cv__cnt=yes,
                   s48_cv__cnt=no)])
  AC_MSG_RESULT($s48_cv__cnt)
  if test $s48_cv__cnt = yes; then
    AC_DEFINE(FILE_HAS__CNT)
  fi
])

dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(SCSH_TZNAME,[
  AC_MSG_CHECKING(for tzname)
  AC_CACHE_VAL(scsh_cv_tzname,[
    AC_TRY_COMPILE([#include <time.h>], 
		   [return (int) tzname;],
                   scsh_cv_tzname=yes,
                   scsh_cv_tzname=no)])
  AC_MSG_RESULT($scsh_cv_tzname)
  if test $scsh_cv_tzname = yes; then
    AC_DEFINE(HAVE_TZNAME)
  fi
])

dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(SCSH_GMTOFF,[
  AC_MSG_CHECKING(for gmtoff)
  AC_CACHE_VAL(scsh_cv_gmtoff,[
    AC_TRY_COMPILE([#include <time.h>], 
		   [struct tm time;
		    return time.tm_gmtoff;],
                   scsh_cv_gmtoff=yes,
                   scsh_cv_gmtoff=no)])
  AC_MSG_RESULT($scsh_cv_gmtoff)
  if test $scsh_cv_gmtoff = yes; then
    AC_DEFINE(HAVE_GMTOFF)
  fi
])

dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(SCSH_LINUX_ELF, [
  AC_MSG_CHECKING(for Linux using ELF)
  AC_CACHE_VAL(scsh_cv_linux_elf,[
    touch conftest.c
    if ${CC} -v conftest.c 2>&1 | grep -q __ELF__ ; then
      scsh_cv_linux_elf=yes
    else
      scsh_cv_linux_elf=no
    fi])
  AC_MSG_RESULT($scsh_cv_linux_elf)
  if test $scsh_cv_linux_elf = yes; then
    LDFLAGS=-rdynamic
  fi
  rm -f conftest.c a.out
])

dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(SCSH_LINUX_STATIC_DEBUG, [
  case "$host" in
    *-*-linux* )
    AC_MSG_CHECKING(for broken Linux that needs -static with -g)
    AC_CACHE_VAL(scsh_cv_linux_static_debug,[
      AC_TRY_LINK([],
  		  [],
  		  scsh_cv_linux_static_debug=no,
  		  scsh_cv_linux_static_debug=yes)])
    AC_MSG_RESULT($scsh_cv_linux_static_debug)
    if test $scsh_cv_linux_static_debug = yes; then
      LDFLAGS="-static ${LDFLAGS}"
    fi
  ;;
  esac
])

dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_DEFUN(SCSH_CONST_SYS_ERRLIST,[
  AC_MSG_CHECKING(for const sys_errlist)
  AC_CACHE_VAL(scsh_cv_const_sys_errlist,[
    AC_TRY_COMPILE([#include <errno.h>
                    #include <unistd.h>], 
		   [const extern char *sys_errlist[];],
                   scsh_cv_const_sys_errlist=yes,
                   scsh_cv_const_sys_errlist=no)])
  AC_MSG_RESULT($scsh_cv_const_sys_errlist)
  if test $scsh_cv_const_sys_errlist = yes; then
    AC_DEFINE(HAVE_CONST_SYS_ERRLIST)
  fi
])

dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
AC_INIT(scheme48vm.c)
AC_CONFIG_HEADER(sysdep.h)

AC_CANONICAL_HOST

AC_PROG_CC
AC_ISC_POSIX
SCSH_LINUX_STATIC_DEBUG
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_C_CONST

AC_C_BIGENDIAN
if test $ac_cv_c_bigendian = no ; then
  ENDIAN=little
else
  ENDIAN=big
fi

AR=${AR-"ar cq"}
TMPDIR=${TMPDIR-"/usr/tmp"}

case "$host" in

  ## CX/UX
  m88k-harris-cxux* )
    dir=cxux
    CC="cc -Xa"
    CFLAGS="-O"
    LDFLAGS="-O -Wl,-Bexport"
    AC_DEFINE(HAVE_HARRIS)
  ;;
    
  ## DEC Ultrix
  mips-dec-ultrix* )
    dir=ultrix
    if test ${CC} = cc; then
      LDFLAGS=-N
    fi
  ;;
  
  ## HP 9000 series 700 and 800, running HP/UX
  hppa*-hp-hpux* )
    dir=hpux
    LDFLAGS="-Wl,-E"
    if test ${CC} = cc; then
      CFLAGS="-Ae -O +Obb1800"
      AC_DEFINE(_HPUX_SOURCE)
      AC_DEFINE(hpux)
    fi
  ;;
  
  ## IBM AIX
  rs6000-ibm-aix*|powerpc-ibm-aix* )
    dir=aix
    LDFLAGS="-O"
    if test ${CC} = gcc; then
      LDFLAGS_AIX="-Xlinker -bexport:exportlist.aix"
    else
      LDFLAGS_AIX="-bexport:exportlist.aix"
    fi
    CFLAGS="-O"
    AIX_P="exportlist.aix"
  ;;
  
  ## Linux
  *-*-linux* )
    dir=linux
    # gross, but needed for some older a.out systems for 0.4.x
    LIBS=-lc
    SCSH_LINUX_ELF
  ;;
  
  ## NetBSD and FreeBSD ( and maybe 386BSD also)
  *-*-*bsd* )
    dir=bsd
  ;;
  
  ## NeXT
  *-next-* )
    dir=next
    CC="$CC -posix"
    AC_DEFINE(HAVE_SIGACTION)
  ;;
  
  ## SGI IRIX
  mips-sgi-irix* )
    dir=irix
    S48_CFLAG_CKR
    INSTALL='$(srcdir)/install-sh'
  ;;
  
  ## SunOS
  sparc*-sun-sunos* )
   dir=sunos
  ;;
  
  ## Solaris - Sparc and i386
  *-*-solaris* )
    dir=solaris
    AC_DEFINE(HAVE_NLIST)
  ;;
  
  ## Generic Configuration
  * )
    dir=generic
    echo "WARNING: "
    echo "WARNING: Using generic configuration."
    echo "WARNING: See doc/install.txt for more information."
    echo "WARNING: "
  ;;
esac

/bin/rm -f $srcdir/scsh/machine
ln -s $srcdir/$dir $srcdir/scsh/machine

AC_CHECK_LIB(m, sqrt)
AC_CHECK_LIB(gen, pathfind)
AC_CHECK_LIB(nsl, gethostbyaddr)
AC_CHECK_LIB(socket, socket)
dnl Solaris 2.3 seems to need -lelf for nlist().  (tnx Bryan O'Sullivan)
AC_CHECK_LIB(elf, nlist)
AC_CHECK_LIB(ld, ldopen)
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(dld, shl_findsym)
dnl	AC_CHECK_LIB(mld, main)

AC_RETSIGTYPE
AC_HAVE_HEADERS(libgen.h sys/timeb.h posix/time.h sys/select.h nlist.h)
AC_HAVE_FUNCS(strerror pathfind)
AC_HAVE_FUNCS(dlopen gettimeofday ftime nlist select setitimer sigaction)
AC_HAVE_FUNCS(socket chroot)

S48_POSIX_LIBC
S48_CFLAG_O2
S48_USCORE
S48_NLIST
S48__CNT

SCSH_TZNAME
SCSH_GMTOFF
SCSH_CONST_SYS_ERRLIST

CFLAGS1=${CFLAGS}

AC_SUBST(AIX_P)
AC_SUBST(AR)
AC_SUBST(CC)
AC_SUBST(CFLAGS)
AC_SUBST(CFLAGS1)
AC_SUBST(ENDIAN)
AC_SUBST(LDFLAGS)
AC_SUBST(LDFLAGS_AIX)
AC_SUBST(LIBS)
AC_SUBST(TMPDIR)

AC_OUTPUT(Makefile scsh/regexp/Makefile scsh/endian.scm scsh/static.scm)
chmod +x scsh/static.scm