5267b71995-08-09Fredrik Hübinette (Hubbe) AC_INIT(interpret.c) AC_PROG_CC
26e7e71996-04-23Fredrik Hübinette (Hubbe) AC_C_CROSS
5267b71995-08-09Fredrik Hübinette (Hubbe) 
dcad551996-08-03Fredrik Hübinette (Hubbe) #############################################################################
5267b71995-08-09Fredrik Hübinette (Hubbe) 
5c8e891995-10-29Fredrik Hübinette (Hubbe) # We need some special hacks when running slowaris AC_PATH_PROG(uname_prog,uname,no) AC_MSG_CHECKING(operating system)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_sys_os,
5c8e891995-10-29Fredrik Hübinette (Hubbe) [ if test "$uname_prog" != "no"; then
06983f1996-09-22Fredrik Hübinette (Hubbe)  pike_cv_sys_os="`uname`"
5c8e891995-10-29Fredrik Hübinette (Hubbe) 
06983f1996-09-22Fredrik Hübinette (Hubbe)  if test "$pike_cv_sys_os" = "SunOS"; then
5c8e891995-10-29Fredrik Hübinette (Hubbe)  case "`uname -r`" in
06983f1996-09-22Fredrik Hübinette (Hubbe)  5.*) pike_cv_sys_os="Solaris";
5c8e891995-10-29Fredrik Hübinette (Hubbe)  esac fi else
06983f1996-09-22Fredrik Hübinette (Hubbe)  pike_cv_sys_os="Not Solaris"
5c8e891995-10-29Fredrik Hübinette (Hubbe) fi ])
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_MSG_RESULT($pike_cv_sys_os)
5c8e891995-10-29Fredrik Hübinette (Hubbe)  dnl dnl This enables a mutex lock around accept() unfortunately dnl accept bangs out every 20000th time or so when linked dnl with libthreads. Solaris... dnl
06983f1996-09-22Fredrik Hübinette (Hubbe) dnl if test "$pike_cv_sys_os" = "Solaris"; then
5c8e891995-10-29Fredrik Hübinette (Hubbe) dnl AC_DEFINE(SOLARIS) dnl LIBS="$LIBS -lthread" dnl fi dnl
dcad551996-08-03Fredrik Hübinette (Hubbe) #############################################################################
5267b71995-08-09Fredrik Hübinette (Hubbe) OLD_CFLAGS="$CFLAGS" OPTIMIZE="";
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_MSG_CHECKING(-fast) AC_CACHE_VAL(pike_cv_option_fast,
5267b71995-08-09Fredrik Hübinette (Hubbe) [
06983f1996-09-22Fredrik Hübinette (Hubbe)  CFLAGS="$OLD_CFLAGS -fast" AC_TRY_LINK([],[ exit(0); ],pike_cv_option_fast=yes,pike_cv_option_fast=no)
5267b71995-08-09Fredrik Hübinette (Hubbe) ])
06983f1996-09-22Fredrik Hübinette (Hubbe) CFLAGS="$OLD_CFLAGS" if test "$pike_cv_option_fast" = "yes" ; then OPTIMIZE="$OPTIMIZE -fast" AC_MSG_RESULT(-fast found)
5267b71995-08-09Fredrik Hübinette (Hubbe) else
06983f1996-09-22Fredrik Hübinette (Hubbe)  AC_MSG_RESULT(-fast not found) AC_MSG_CHECKING(-O) AC_CACHE_VAL(pike_cv_option_opt, [ CFLAGS="$OLD_CFLAGS -O" AC_TRY_LINK([],[ exit(0); ],pike_cv_option_opt=yes,pike_cv_option_opt=no) ]) if test "$pike_cv_option_opt" = "yes" ; then CFLAGS="$OLD_CFLAGS -O" OPTIMIZE="$OPTIMIZE -O" AC_MSG_RESULT(-O found) else AC_MSG_RESULT(-O not found) fi CFLAGS="$OLD_CFLAGS"
5267b71995-08-09Fredrik Hübinette (Hubbe) fi
5c8e891995-10-29Fredrik Hübinette (Hubbe)  if test "$GCC" = "yes"; then
7cfda71996-05-13Fredrik Hübinette (Hubbe)  WARN="-g -W -Wformat"
d10ed51995-11-15Fredrik Hübinette (Hubbe)  AC_MSG_CHECKING(-pipe)
06983f1996-09-22Fredrik Hübinette (Hubbe)  AC_CACHE_VAL(pike_cv_option_pipe,
d10ed51995-11-15Fredrik Hübinette (Hubbe)  [ CFLAGS="$OLD_CFLAGS -pipe"
06983f1996-09-22Fredrik Hübinette (Hubbe)  AC_TRY_LINK([],[ exit(0); ],pike_cv_option_pipe=yes,pike_cv_option_pipe=no)
d10ed51995-11-15Fredrik Hübinette (Hubbe)  ])
06983f1996-09-22Fredrik Hübinette (Hubbe)  if test "$pike_cv_option_pipe" = "yes" ; then
d10ed51995-11-15Fredrik Hübinette (Hubbe)  CFLAGS="$OLD_CFLAGS -pipe" OPTIMIZE="$OPTIMIZE -pipe" AC_MSG_RESULT(-pipe found) else AC_MSG_RESULT(-pipe not found) CFLAGS="$OLD_CFLAGS" fi
5c8e891995-10-29Fredrik Hübinette (Hubbe) else WARN="" # # Special hack for HP-UX stupid cc #
06983f1996-09-22Fredrik Hübinette (Hubbe)  if test "$pike_cv_sys_os" = "HP-UX"; then
5c8e891995-10-29Fredrik Hübinette (Hubbe)  OLD_CC="${CC-cc}" CC="$CC -Aa -D_HPUX_SOURCE +Olibcalls" AC_TRY_LINK([int foo(int bar);],[ exit(0); ],[],[CC="$OLD_CC"]) fi fi
dcad551996-08-03Fredrik Hübinette (Hubbe) #############################################################################
5c8e891995-10-29Fredrik Hübinette (Hubbe) AC_MSG_CHECKING(ansi prototype capability)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_sys_ansi_prototypes,
5267b71995-08-09Fredrik Hübinette (Hubbe) [
5c8e891995-10-29Fredrik Hübinette (Hubbe)  AC_TRY_LINK([int foo(int bar);],[ exit(0); ],
06983f1996-09-22Fredrik Hübinette (Hubbe)  [pike_cv_sys_ansi_prototypes=yes], [pike_cv_sys_ansi_prototypes=no])
5267b71995-08-09Fredrik Hübinette (Hubbe) ])
06983f1996-09-22Fredrik Hübinette (Hubbe) if test "$pike_cv_sys_ansi_prototypes" = "yes"; then
5c8e891995-10-29Fredrik Hübinette (Hubbe)  AC_MSG_RESULT(yes) else AC_MSG_RESULT(no, giving up...) exit 1 fi
5267b71995-08-09Fredrik Hübinette (Hubbe) 
dcad551996-08-03Fredrik Hübinette (Hubbe) #############################################################################
5267b71995-08-09Fredrik Hübinette (Hubbe) AC_CONFIG_HEADER(machine.h) AC_PROG_INSTALL AC_PROG_CPP AC_PROG_RANLIB AC_SET_MAKE
dcad551996-08-03Fredrik Hübinette (Hubbe) #############################################################################
26e7e71996-04-23Fredrik Hübinette (Hubbe) AC_MSG_CHECKING(for yacc clone that handles %pure_parser)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_prog_working_yacc,
26e7e71996-04-23Fredrik Hübinette (Hubbe) [ for YACC in byacc "bison -y" yacc "echo Get bison if you want to make export" ; do set dummy $YACC; ac_word=$2 has_it=no IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then has_it="yes" break
8f42881996-03-01Fredrik Hübinette (Hubbe)  fi
26e7e71996-04-23Fredrik Hübinette (Hubbe)  done IFS="$ac_save_ifs" if test "$has_it" = "yes"; then cat >conftest.y<<\EOF %pure_parser %{ void parse(); void yyerror(char *); %} %% all: foo bar foo: 'f' 'o' 'o' { parse(); } ; bar: 'b' 'a' 'r' ; %% int context;
8f42881996-03-01Fredrik Hübinette (Hubbe) 
26e7e71996-04-23Fredrik Hübinette (Hubbe) int yylex(YYSTYPE *yylval) { switch(context++) { case 0: return 'f'; case 1: return 'o'; case 2: return 'o'; case 3: return 'b'; case 4: return 'a'; case 5: return 'r'; default: return 0; } } int depth=0; void parse() { int tmp; if(depth++>5) return; tmp=context; context=0; yyparse(); context=tmp; } int errors=0; void yyerror(char *fel) { errors++; } int main() { parse(); exit(errors); } EOF if $YACC -d conftest.y 1>&5 2>&5; then AC_TRY_RUN([ #include "y.tab.c" ],pure_parser_works=yes,pure_parser_works=no) if test "$pure_parser_works" = "yes"; then break fi fi
8f42881996-03-01Fredrik Hübinette (Hubbe)  fi
26e7e71996-04-23Fredrik Hübinette (Hubbe) done
06983f1996-09-22Fredrik Hübinette (Hubbe) pike_cv_prog_working_yacc="$YACC"
26e7e71996-04-23Fredrik Hübinette (Hubbe) ])
06983f1996-09-22Fredrik Hübinette (Hubbe) YACC="$pike_cv_prog_working_yacc"
26e7e71996-04-23Fredrik Hübinette (Hubbe) AC_MSG_RESULT($YACC)
5267b71995-08-09Fredrik Hübinette (Hubbe) 
dcad551996-08-03Fredrik Hübinette (Hubbe) #############################################################################
5267b71995-08-09Fredrik Hübinette (Hubbe) AC_MSG_CHECKING(first yacc define)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_yacc_first,
5267b71995-08-09Fredrik Hübinette (Hubbe) [ cat >conftest.y <<\EOF %token GURKA %% all: GURKA %% EOF
06983f1996-09-22Fredrik Hübinette (Hubbe) pike_cv_yacc_first=257;
26e7e71996-04-23Fredrik Hübinette (Hubbe) if $YACC -d conftest.y 1>&5 2>&5; then
5267b71995-08-09Fredrik Hübinette (Hubbe)  if test -f y.tab.h; then
06983f1996-09-22Fredrik Hübinette (Hubbe)  pike_cv_yacc_first=`egrep GURKA y.tab.h | sed 's/^#[^0-9]*\([0-9]*\)[^0-9]*$/\1/'` echo $pike_cv_yacc_first >conftest.out
5267b71995-08-09Fredrik Hübinette (Hubbe)  if egrep '^(0|1|2|3|4|5|6|7|8|9)+$' conftest.out >/dev/null 2>&1; then echo >/dev/null else
06983f1996-09-22Fredrik Hübinette (Hubbe)  pike_cv_yacc_first=257
5267b71995-08-09Fredrik Hübinette (Hubbe)  fi fi fi ])
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_MSG_RESULT($pike_cv_yacc_first) AC_DEFINE_UNQUOTED(F_OFFSET,$pike_cv_yacc_first)
5267b71995-08-09Fredrik Hübinette (Hubbe)  rm -rf conftest.y y.tab.c y.tab.h conftest.out
dcad551996-08-03Fredrik Hübinette (Hubbe) #############################################################################
6930181996-02-25Fredrik Hübinette (Hubbe) AC_HEADER_TIME AC_HEADER_STDC
5ebdb51996-09-22Fredrik Hübinette (Hubbe) AC_CHECK_HEADERS(sys/rusage.h time.h sys/time.h sys/types.h unistd.h stdlib.h \ memory.h values.h string.h fcntl.h sys/filio.h sys/sockio.h crypt.h locale.h \
2d31fb1996-08-12Fredrik Hübinette (Hubbe) sys/resource.h sys/select.h sys/mman.h setjmp.h)
5267b71995-08-09Fredrik Hübinette (Hubbe)  AC_SIZEOF_TYPE(char *) AC_SIZEOF_TYPE(long) AC_SIZEOF_TYPE(int) AC_SIZEOF_TYPE(short) AC_SIZEOF_TYPE(float) AC_SIZEOF_TYPE(double)
6930181996-02-25Fredrik Hübinette (Hubbe) AC_TYPE_SIZE_T AC_TYPE_PID_T AC_TYPE_UID_T AC_TYPE_SIGNAL
5267b71995-08-09Fredrik Hübinette (Hubbe) AC_CHECK_TYPE(time_t,INT32)
dcad551996-08-03Fredrik Hübinette (Hubbe) dnl AC_CHECK_LIB(PW, alloca)
b04d5f1996-07-08Fredrik Hübinette (Hubbe)  dnl AC_CHECK_LIB(crypt, crypt)
5c8e891995-10-29Fredrik Hübinette (Hubbe) AC_CHECK_LIB(m, floor)
06983f1996-09-22Fredrik Hübinette (Hubbe) if test "${ac_cv_lib_m}" = "no" -a "${pike_cv_sys_os}" = "Linux"; then
d10ed51995-11-15Fredrik Hübinette (Hubbe)  AC_MSG_WARN(I will compensate for this by adding -lc -lm) LIBS="${LIBS} -lc -lm" fi
5c8e891995-10-29Fredrik Hübinette (Hubbe) 
549f8b1996-05-02Fredrik Hübinette (Hubbe) AC_CHECK_LIB(crypt, crypt)
5c8e891995-10-29Fredrik Hübinette (Hubbe) 
5267b71995-08-09Fredrik Hübinette (Hubbe) OLD_LIBOBJS="${LIBOBJS}" AC_FUNC_MEMCMP if test "${OLD_LIBOBJS}" = "${LIBOBJS}" ; then AC_DEFINE(HAVE_MEMCMP) fi LIBOBJS="${OLD_LIBOBJS}"
6930181996-02-25Fredrik Hübinette (Hubbe) AC_FUNC_STRCOLL
dcad551996-08-03Fredrik Hübinette (Hubbe) AC_FUNC_MMAP
6930181996-02-25Fredrik Hübinette (Hubbe)  AC_CHECK_FUNCS(
cb22561995-10-11Fredrik Hübinette (Hubbe)  _crypt \ bcopy \ bzero \ clock \ crypt \ fchmod \ getenv \ getrlimit \ getrusage \
067bc11996-06-21Fredrik Hübinette (Hubbe)  gettimeofday \
cb22561995-10-11Fredrik Hübinette (Hubbe)  index \
dcad551996-08-03Fredrik Hübinette (Hubbe)  localtime \
cb22561995-10-11Fredrik Hübinette (Hubbe)  memchr \ memcpy \ memset \ rindex \ setlocale \ setrlimit \
93b8081995-11-02Fredrik Hübinette (Hubbe)  sigaction \ sigvec \
cb22561995-10-11Fredrik Hübinette (Hubbe)  strcasecmp \ strchr \ strcspn \ strrchr \ strtod \ strtok \ strtol \ times \ vfprintf \ vsprintf \
6930181996-02-25Fredrik Hübinette (Hubbe)  wait3 \
65887d1995-11-15Fredrik Hübinette (Hubbe)  wait4 \ waitpid \
dcad551996-08-03Fredrik Hübinette (Hubbe)  munmap \
cb22561995-10-11Fredrik Hübinette (Hubbe) )
5267b71995-08-09Fredrik Hübinette (Hubbe) 
067bc11996-06-21Fredrik Hübinette (Hubbe) AC_STRUCT_TM
dcad551996-08-03Fredrik Hübinette (Hubbe) #############################################################################
067bc11996-06-21Fredrik Hübinette (Hubbe) AC_MSG_CHECKING(extern int timezone)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_has_external_timezone,[
067bc11996-06-21Fredrik Hübinette (Hubbe) AC_TRY_LINK([ #include <time.h> ],[ int _tz; _tz=timezone;
06983f1996-09-22Fredrik Hübinette (Hubbe) ],pike_cv_has_external_timezone=yes,pike_cv_has_external_timezone=no)
067bc11996-06-21Fredrik Hübinette (Hubbe) ])
06983f1996-09-22Fredrik Hübinette (Hubbe) if test "$pike_cv_has_external_timezone" = "yes"; then
067bc11996-06-21Fredrik Hübinette (Hubbe)  AC_DEFINE(HAVE_EXTERNAL_TIMEZONE) fi
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_MSG_RESULT($pike_cv_has_external_timezone)
dcad551996-08-03Fredrik Hübinette (Hubbe)  #############################################################################
e0b9561996-07-02Fredrik Hübinette (Hubbe) # No test for this yet... AC_DEFINE(HAVE_STRUCT_TIMEVAL)
dcad551996-08-03Fredrik Hübinette (Hubbe) #############################################################################
067bc11996-06-21Fredrik Hübinette (Hubbe) 
e0b9561996-07-02Fredrik Hübinette (Hubbe) AC_MSG_CHECKING(if gettimeofday takes two arguments)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_func_gettimeofday_has_two_args,
e0b9561996-07-02Fredrik Hübinette (Hubbe) [ AC_TRY_RUN([ #if TIME_WITH_SYS_TIME # include <sys/time.h> # include <time.h> #else # if HAVE_SYS_TIME_H # include <sys/time.h> # else # if HAVE_TIME_H # include <time.h> # endif # endif #endif #ifndef HAVE_STRUCT_TIMEVAL struct timeval { long tv_sec; long tv_usec; }; #endif int main() { struct timeval tv; gettimeofday(&tv,(void *)0); exit(0); } ],
06983f1996-09-22Fredrik Hübinette (Hubbe) pike_cv_func_gettimeofday_has_two_args=yes, pike_cv_func_gettimeofday_has_two_args=no)])
e0b9561996-07-02Fredrik Hübinette (Hubbe) 
06983f1996-09-22Fredrik Hübinette (Hubbe) if test $pike_cv_func_gettimeofday_has_two_args = yes; then
e0b9561996-07-02Fredrik Hübinette (Hubbe)  AC_DEFINE(GETTIMEOFDAY_TAKES_TWO_ARGS) fi
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_MSG_RESULT($pike_cv_func_gettimeofday_has_two_args)
067bc11996-06-21Fredrik Hübinette (Hubbe)  AC_MSG_CHECKING(if struct tm has tm_gmtoff)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_struct_tm_has_gmtoff,[
067bc11996-06-21Fredrik Hübinette (Hubbe) AC_TRY_LINK([ #ifdef TM_IN_SYS_TIME #include <sys/time.h> #endif #include <time.h> #else ],[ int _tz; struct tm foo; _tz=foo->tm_gmtoff;
06983f1996-09-22Fredrik Hübinette (Hubbe) ],pike_cv_struct_tm_has_gmtoff=yes,pike_cv_struct_tm_has_gmtoff=no)
067bc11996-06-21Fredrik Hübinette (Hubbe) ])
06983f1996-09-22Fredrik Hübinette (Hubbe) if test "$pike_cv_struct_tm_has_gmtoff" = "yes"; then
067bc11996-06-21Fredrik Hübinette (Hubbe)  AC_DEFINE(STRUCT_TM_HAS_GMTOFF) fi
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_MSG_RESULT($pike_cv_struct_tm_has_gmtoff)
067bc11996-06-21Fredrik Hübinette (Hubbe) 
5267b71995-08-09Fredrik Hübinette (Hubbe) define(MY_CHECK_HEADERS, [ AC_MSG_CHECKING(for $1 declaration)
06983f1996-09-22Fredrik Hübinette (Hubbe)  AC_CACHE_VAL(pike_cv_decl_$1,
5267b71995-08-09Fredrik Hübinette (Hubbe)  [
06983f1996-09-22Fredrik Hübinette (Hubbe)  pike_cv_decl_$1=nonexistant
5267b71995-08-09Fredrik Hübinette (Hubbe)  for a in $2 do
06983f1996-09-22Fredrik Hübinette (Hubbe)  AC_EGREP_HEADER($1,$a,pike_cv_decl_$1=existant; break)
5267b71995-08-09Fredrik Hübinette (Hubbe)  done ])
06983f1996-09-22Fredrik Hübinette (Hubbe)  AC_MSG_RESULT($pike_cv_decl_$1) if test "$pike_cv_decl_$1" = nonexistant; then
5267b71995-08-09Fredrik Hübinette (Hubbe)  AC_DEFINE(translit($1,[a-z],[A-Z])[]_DECL_MISSING) fi ]) MY_CHECK_HEADERS(strchr,string.h unistd.h stdlib.h) MY_CHECK_HEADERS(malloc,memory.h unistd.h stdlib.h) MY_CHECK_HEADERS(getpeername,sys/socket.h sys/socketvar.h sys/socketio.h) MY_CHECK_HEADERS(popen,stdio.h unistd.h) MY_CHECK_HEADERS(getenv,unistd.h stdlib.h) MY_CHECK_HEADERS(gethostname,unistd.h)
067bc11996-06-21Fredrik Hübinette (Hubbe) 
5267b71995-08-09Fredrik Hübinette (Hubbe) AC_MSG_CHECKING(return type of free)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_sys_free_return,
5267b71995-08-09Fredrik Hübinette (Hubbe) [AC_TRY_LINK([ #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) #include <memory.h> #endif void free(); ], [],
06983f1996-09-22Fredrik Hübinette (Hubbe)  pike_cv_sys_free_return='char *'
5267b71995-08-09Fredrik Hübinette (Hubbe) ,
06983f1996-09-22Fredrik Hübinette (Hubbe)  pike_cv_sys_free_return='void'
5267b71995-08-09Fredrik Hübinette (Hubbe) )])
06983f1996-09-22Fredrik Hübinette (Hubbe) if test "$pike_cv_sys_free_return" = void; then
5267b71995-08-09Fredrik Hübinette (Hubbe)  AC_DEFINE(FREE_RETURNS_VOID) AC_MSG_RESULT([void]); else AC_MSG_RESULT([not void]) fi AC_MSG_CHECKING([void* or char* from malloc])
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_sys_malloc_return,
5267b71995-08-09Fredrik Hübinette (Hubbe) [ AC_TRY_LINK([ #include <sys/types.h> #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) #include <memory.h> #endif #define POINTER void * POINTER malloc(size_t); #ifdef FREE_RETURNS_VOID void free(POINTER); #else int free(POINTER); #endif ], [],
06983f1996-09-22Fredrik Hübinette (Hubbe)  pike_cv_sys_malloc_return="void *"
5267b71995-08-09Fredrik Hübinette (Hubbe) ,
06983f1996-09-22Fredrik Hübinette (Hubbe)  pike_cv_sys_malloc_return="char *"
5267b71995-08-09Fredrik Hübinette (Hubbe) )])
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_MSG_RESULT($pike_cv_sys_malloc_return) AC_DEFINE_UNQUOTED(POINTER,$pike_cv_sys_malloc_return)
5267b71995-08-09Fredrik Hübinette (Hubbe) 
5c8e891995-10-29Fredrik Hübinette (Hubbe) 
5267b71995-08-09Fredrik Hübinette (Hubbe) AC_ALLOCA
6930181996-02-25Fredrik Hübinette (Hubbe) AC_C_CONST AC_C_INLINE
5267b71995-08-09Fredrik Hübinette (Hubbe)  AC_REPLACE_FUNCS(ualarm) case "$LIBOBJS" in *ualarm.o*) ;; *) AC_DEFINE(HAVE_UALARM)
06983f1996-09-22Fredrik Hübinette (Hubbe)  AC_MSG_CHECKING(no of arguments to ualarm) AC_CACHE_VAL(pike_cv_ualarm_takes_two_args, [ AC_TRY_LINK([ #include <unistd.h> ],[ int main() { ualarm(0,0); } ],pike_cv_ualarm_takes_two_args=yes,pike_cv_ualarm_takes_two_args=no) if test "$pike_cv_ualarm_takes_two_args" = yes; then AC_MSG_RESULT(2) AC_DEFINE(UALARM_TAKES_TWO_ARGS) else AC_MSG_RESULT(1) fi ])
5267b71995-08-09Fredrik Hübinette (Hubbe)  ;; esac AC_MSG_CHECKING(byteorder)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_hardware_byteorder,
5267b71995-08-09Fredrik Hübinette (Hubbe) [ AC_TRY_RUN([ #include <stdio.h> int main() {
5c8e891995-10-29Fredrik Hübinette (Hubbe) #if SIZEOF_INT == 4
5267b71995-08-09Fredrik Hübinette (Hubbe) #define T int #else #define T long #endif FILE *f; T a; int e; for(e=0;e<sizeof(T);e++) ((char *)&a)[e]=(e+1) % 10; f=fopen("conftest.out.2","w"); for(e=0;e<sizeof(T);e++) { fprintf(f,"%d",(int)(a & 255)); a>>=8; } fprintf(f,"\n"); fclose(f); return 0; }],
06983f1996-09-22Fredrik Hübinette (Hubbe) pike_cv_hardware_byteorder=`cat conftest.out.2`
5267b71995-08-09Fredrik Hübinette (Hubbe) ,
06983f1996-09-22Fredrik Hübinette (Hubbe) pike_cv_hardware_byteorder=0
5267b71995-08-09Fredrik Hübinette (Hubbe) )])
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_MSG_RESULT($pike_cv_hardware_byteorder) AC_DEFINE_UNQUOTED(BYTEORDER,$pike_cv_hardware_byteorder)
5267b71995-08-09Fredrik Hübinette (Hubbe)  AC_MSG_CHECKING(for working memmem)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_func_memmem,
5267b71995-08-09Fredrik Hübinette (Hubbe) [ AC_TRY_RUN([ #include <string.h> char *a="foo bar gazonk"; char *b="foo"; char *c="bar"; char *d="gazonk";
cb22561995-10-11Fredrik Hübinette (Hubbe) int main()
5267b71995-08-09Fredrik Hübinette (Hubbe) { if(memmem(b,strlen(b),a,strlen(a))!=a || memmem(c,strlen(c),a,strlen(a))!=(a+4) || memmem(d,strlen(d),a,strlen(a))!=(a+8) || memmem(d,0,a,strlen(a))!=a || memmem(d,strlen(d)+1,a,strlen(a))!=0) exit(1); exit(0); }
06983f1996-09-22Fredrik Hübinette (Hubbe) ],pike_cv_func_memmem=yes,pike_cv_func_memmem=no)])
5267b71995-08-09Fredrik Hübinette (Hubbe) 
06983f1996-09-22Fredrik Hübinette (Hubbe) if test "$pike_cv_func_memmem" = yes; then
5267b71995-08-09Fredrik Hübinette (Hubbe)  AC_MSG_RESULT(yes) AC_DEFINE(HAVE_MEMMEM) else AC_MSG_RESULT(no) fi AC_MSG_CHECKING(for working memmove)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_func_memmove,
5267b71995-08-09Fredrik Hübinette (Hubbe) [ AC_TRY_RUN([ #include <string.h> char buf[100];
cb22561995-10-11Fredrik Hübinette (Hubbe) int main()
5267b71995-08-09Fredrik Hübinette (Hubbe) { strcpy(buf,"foo bar gazonk elefantsnabel."); if(strcmp(buf,"foo bar gazonk elefantsnabel.")) exit(1);
cb22561995-10-11Fredrik Hübinette (Hubbe)  memmove(buf,buf+1,7);
5267b71995-08-09Fredrik Hübinette (Hubbe)  if(strcmp(buf,"oo bar gazonk elefantsnabel.")) exit(1); memmove(buf+1,buf+1,9); if(strcmp(buf,"oo bar gazonk elefantsnabel.")) exit(1); memmove(buf+1,buf,11); if(strcmp(buf,"ooo bar gaznk elefantsnabel.")) exit(1); exit(0); }
06983f1996-09-22Fredrik Hübinette (Hubbe) ],pike_cv_func_memmove=yes,pike_cv_func_memmove=no)])
5267b71995-08-09Fredrik Hübinette (Hubbe) 
06983f1996-09-22Fredrik Hübinette (Hubbe) if test "$pike_cv_func_memmove" = yes; then
5267b71995-08-09Fredrik Hübinette (Hubbe)  AC_MSG_RESULT(yes) AC_DEFINE(HAVE_MEMMOVE) else AC_MSG_RESULT(no) fi AC_MSG_CHECKING(how to extract an unsigned char)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_method_extract_uchar,
5267b71995-08-09Fredrik Hübinette (Hubbe) [ AC_TRY_RUN([
cb22561995-10-11Fredrik Hübinette (Hubbe) int main()
5267b71995-08-09Fredrik Hübinette (Hubbe) { char i,*p; i=-10; p=&i; if(*(unsigned char *)(p)!= 0x100 - 10) exit(1); exit(0); }
06983f1996-09-22Fredrik Hübinette (Hubbe) ],pike_cv_method_extract_uchar=by_cast, pike_cv_method_extract_uchar=not_by_cast)])
5267b71995-08-09Fredrik Hübinette (Hubbe) 
06983f1996-09-22Fredrik Hübinette (Hubbe) if test "$pike_cv_method_extract_uchar" = by_cast; then
5267b71995-08-09Fredrik Hübinette (Hubbe)  AC_MSG_RESULT(by cast) AC_DEFINE(EXTRACT_UCHAR_BY_CAST) else AC_MSG_RESULT(not by cast) fi AC_MSG_CHECKING(how to extract a signed char)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_method_extract_char,
5267b71995-08-09Fredrik Hübinette (Hubbe) [ AC_TRY_RUN([
cb22561995-10-11Fredrik Hübinette (Hubbe) int main()
5267b71995-08-09Fredrik Hübinette (Hubbe) { char i,*p; i=-10; p=&i; if(*(signed char *)(p)!= -10) exit(1); exit(0); }
06983f1996-09-22Fredrik Hübinette (Hubbe) ],pike_cv_method_extract_char=by_cast, pike_cv_method_extract_char=not_by_cast)])
5267b71995-08-09Fredrik Hübinette (Hubbe) 
06983f1996-09-22Fredrik Hübinette (Hubbe) if test "$pike_cv_method_extract_char" = by_cast; then
5267b71995-08-09Fredrik Hübinette (Hubbe)  AC_MSG_RESULT(by cast) AC_DEFINE(EXTRACT_CHAR_BY_CAST) else AC_MSG_RESULT(not by cast) fi
93b8081995-11-02Fredrik Hübinette (Hubbe) 
c8a4ce1995-11-20Fredrik Hübinette (Hubbe) AC_MSG_CHECKING(if signal handlers reset automatically)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_sys_signal_oneshot,
93b8081995-11-02Fredrik Hübinette (Hubbe) [ AC_TRY_RUN([ #include <signal.h> char sigrun=0; RETSIGTYPE func(int sig) { sigrun=1; } int main() { #define sig SIGSEGV #ifdef HAVE_SIGACTION { struct sigaction action; action.sa_handler= func; sigfillset(&action.sa_mask); #ifdef SA_INTERRUPT action.sa_flags=SA_INTERRUPT; #endif sigaction(sig,&action,0); } #else #ifdef HAVE_SIGVEC { struct sigvec action; action.sv_handler= func; action.sv_mask=-1; #ifdef SV_INTERRUPT action.sv_flags=SV_INTERRUPT; #endif sigvec(sig,&action,0); } #else signal(sig, func); #endif #endif kill(getpid(), sig); while(!sigrun) sleep(1); sigrun=0; kill(getpid(), sig); while(!sigrun) sleep(1); sigrun=0; exit(0); }
06983f1996-09-22Fredrik Hübinette (Hubbe) ],pike_cv_sys_signal_oneshot=no,pike_cv_sys_signal_oneshot=yes)])
93b8081995-11-02Fredrik Hübinette (Hubbe) 
06983f1996-09-22Fredrik Hübinette (Hubbe) if test "$pike_cv_sys_signal_oneshot" = yes; then
93b8081995-11-02Fredrik Hübinette (Hubbe)  AC_MSG_RESULT(yes) AC_DEFINE(SIGNAL_ONESHOT) else AC_MSG_RESULT(no) fi
5267b71995-08-09Fredrik Hübinette (Hubbe) AC_MSG_CHECKING(available file descriptors)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_max_open_fd,
5267b71995-08-09Fredrik Hübinette (Hubbe) [ AC_TRY_RUN([ #include <stdio.h> #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #endif #ifdef HAVE_SYS_RESOURCE_H #include <sys/resource.h> #endif #ifndef MAX_FD #define MAX_FD 256 #endif int main() { FILE *f;
f90e541995-08-17Fredrik Hübinette (Hubbe)  long limit;
5c8e891995-10-29Fredrik Hübinette (Hubbe) 
2a50961995-08-23Fredrik Hübinette (Hubbe) #if !defined(RLIMIT_NOFILE) && defined(RLIMIT_OFILE)
f90e541995-08-17Fredrik Hübinette (Hubbe) #define RLIMIT_NOFILE RLIMIT_OFILE #endif
5c8e891995-10-29Fredrik Hübinette (Hubbe) 
cb22561995-10-11Fredrik Hübinette (Hubbe) #if defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE)
5267b71995-08-09Fredrik Hübinette (Hubbe)  struct rlimit lim; if(getrlimit(RLIMIT_NOFILE,&lim)) { limit = MAX_FD; }else{
f90e541995-08-17Fredrik Hübinette (Hubbe)  if(lim.rlim_max == RLIM_INFINITY) {
5267b71995-08-09Fredrik Hübinette (Hubbe)  limit=16384; /* noone needs more */
f90e541995-08-17Fredrik Hübinette (Hubbe)  }else{ limit=lim.rlim_max; if(limit > 16384) limit=16384; }
5267b71995-08-09Fredrik Hübinette (Hubbe)  } #else limit = MAX_FD; #endif f=fopen("conftest.out.2","w");
f90e541995-08-17Fredrik Hübinette (Hubbe)  fprintf(f,"%ld\n",(long)limit);
5267b71995-08-09Fredrik Hübinette (Hubbe)  fclose(f); return 0; } ],
06983f1996-09-22Fredrik Hübinette (Hubbe) pike_cv_max_open_fd=`cat conftest.out.2`
5267b71995-08-09Fredrik Hübinette (Hubbe) ,
06983f1996-09-22Fredrik Hübinette (Hubbe) pike_cv_max_open_fd=256
5267b71995-08-09Fredrik Hübinette (Hubbe) )])
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_MSG_RESULT($pike_cv_max_open_fd) AC_DEFINE_UNQUOTED(MAX_OPEN_FILEDESCRIPTORS,$pike_cv_max_open_fd)
5267b71995-08-09Fredrik Hübinette (Hubbe)  AC_MSG_CHECKING(full availability of struct rusage members)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_func_getrusage_full,
5267b71995-08-09Fredrik Hübinette (Hubbe) [ AC_TRY_LINK([ #include <sys/time.h> #ifdef HAVE_SYS_RUSAGE_H #include <sys/rusage.h> #endif #include <sys/resource.h> #ifndef RUSAGE_SELF #define RUSAGE_SELF 0 #endif ],[ struct rusage rus; long *v = (long *)main; getrusage(RUSAGE_SELF, &rus); *v++ = rus.ru_maxrss; *v++ = rus.ru_ixrss; *v++ = rus.ru_idrss; *v++ = rus.ru_isrss; *v++ = rus.ru_minflt; *v++ = rus.ru_majflt; *v++ = rus.ru_nswap; *v++ = rus.ru_inblock; *v++ = rus.ru_oublock; *v++ = rus.ru_msgsnd; *v++ = rus.ru_msgrcv; *v++ = rus.ru_nsignals; *v++ = rus.ru_nvcsw; *v++ = rus.ru_nivcsw; ],
06983f1996-09-22Fredrik Hübinette (Hubbe)  pike_cv_func_getrusage_full=yes
5267b71995-08-09Fredrik Hübinette (Hubbe) ,
06983f1996-09-22Fredrik Hübinette (Hubbe)  pike_cv_func_getrusage_full=no
5267b71995-08-09Fredrik Hübinette (Hubbe) )])
06983f1996-09-22Fredrik Hübinette (Hubbe) if test "$pike_cv_func_getrusage_full" = yes; then
5267b71995-08-09Fredrik Hübinette (Hubbe)  AC_MSG_RESULT(all there) else AC_MSG_RESULT(getrusage is restricted) AC_DEFINE(GETRUSAGE_RESTRICTED) fi AC_MSG_CHECKING(getrusage() through procfs)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_getrusage_procfs,
5267b71995-08-09Fredrik Hübinette (Hubbe) [ AC_TRY_LINK([ #include <sys/procfs.h> #include <sys/fcntl.h> int proc_fd; char proc_name[20]; ],[ sprintf(proc_name, "/proc/%05d", getpid()); proc_fd = open(proc_name, O_RDONLY);
06983f1996-09-22Fredrik Hübinette (Hubbe)  ioctl(proc_fd, PIOCUSAGE, &pru); ioctl(proc_fd, PIOCSTATUS, &prs);
5267b71995-08-09Fredrik Hübinette (Hubbe) ],
06983f1996-09-22Fredrik Hübinette (Hubbe)  pike_cv_getrusage_procfs=yes
5267b71995-08-09Fredrik Hübinette (Hubbe) ,
06983f1996-09-22Fredrik Hübinette (Hubbe)  pike_cv_getrusage_procfs=no
5267b71995-08-09Fredrik Hübinette (Hubbe) )])
06983f1996-09-22Fredrik Hübinette (Hubbe) if test "$pike_cv_getrusage_procfs" = yes; then
5267b71995-08-09Fredrik Hübinette (Hubbe)  AC_MSG_RESULT(yes) AC_DEFINE(GETRUSAGE_THROUGH_PROCFS) else AC_MSG_RESULT(no) fi AC_MSG_CHECKING(checking for volatile)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_volatile,
5267b71995-08-09Fredrik Hübinette (Hubbe) [
06983f1996-09-22Fredrik Hübinette (Hubbe)  AC_TRY_LINK([],[ volatile int foo=1;], pike_cv_volatile=yes,pike_cv_volatile=no)
5267b71995-08-09Fredrik Hübinette (Hubbe) ])
06983f1996-09-22Fredrik Hübinette (Hubbe) if test "$pike_cv_volatile" = yes; then
5267b71995-08-09Fredrik Hübinette (Hubbe)  AC_MSG_RESULT(yes) AC_DEFINE(VOLATILE,volatile) else AC_MSG_RESULT(no) AC_DEFINE(VOLATILE,) fi AC_MSG_CHECKING(for gcc function attributes)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_gcc_attributes,
5267b71995-08-09Fredrik Hübinette (Hubbe) [ AC_TRY_RUN([ #include <stdarg.h> void fatal(char *foo,...) __attribute__ ((noreturn,format (printf,1,2))); int sqr(int x) __attribute__ ((const)); int sqr(int x) { return x*x; } void fatal(char *foo,...) { va_list args; va_start(foo,args); printf(foo,args); va_end(args); exit(2); } main() { exit(0); }
06983f1996-09-22Fredrik Hübinette (Hubbe) ], pike_cv_gcc_attributes=yes, pike_cv_gcc_attributes=no)])
5267b71995-08-09Fredrik Hübinette (Hubbe) 
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_MSG_RESULT($pike_cv_gcc_attributes) if test "$pike_cv_gcc_attributes" = yes; then
5267b71995-08-09Fredrik Hübinette (Hubbe)  AC_DEFINE(HAVE_FUNCTION_ATTRIBUTES) fi AC_MSG_CHECKING(how to set things nonblocking)
06983f1996-09-22Fredrik Hübinette (Hubbe) AC_CACHE_VAL(pike_cv_sys_nonblock,
5267b71995-08-09Fredrik Hübinette (Hubbe) [ AC_TRY_RUN([ #define TESTING #define USE_FCNTL_FNDELAY #include "$srcdir/fd_control.c"
06983f1996-09-22Fredrik Hübinette (Hubbe) ],pike_cv_sys_nonblock=USE_FCNTL_FNDELAY,
5267b71995-08-09Fredrik Hübinette (Hubbe) AC_TRY_RUN([ #define TESTING #define USE_FCNTL_O_NDELAY #include "$srcdir/fd_control.c"
06983f1996-09-22Fredrik Hübinette (Hubbe) ],pike_cv_sys_nonblock=USE_FCNTL_O_NDELAY,
5267b71995-08-09Fredrik Hübinette (Hubbe) AC_TRY_RUN([ #define TESTING #define USE_FCNTL_O_NONBLOCK #include "$srcdir/fd_control.c"
06983f1996-09-22Fredrik Hübinette (Hubbe) ],pike_cv_sys_nonblock=USE_FCNTL_O_NONBLOCK,
5267b71995-08-09Fredrik Hübinette (Hubbe) AC_TRY_RUN([ #define TESTING #define USE_IOCTL_FIONBIO #include "$srcdir/fd_control.c"
06983f1996-09-22Fredrik Hübinette (Hubbe) ],pike_cv_sys_nonblock=USE_IOCTL_FIONBIO, unset pike_cv_sys_nonblock
5267b71995-08-09Fredrik Hübinette (Hubbe) ))))])
06983f1996-09-22Fredrik Hübinette (Hubbe) if test "${pike_cv_sys_nonblock}" = ""; then
5267b71995-08-09Fredrik Hübinette (Hubbe)  AC_MSG_RESULT(none found) else
06983f1996-09-22Fredrik Hübinette (Hubbe)  AC_MSG_RESULT($pike_cv_sys_nonblock) AC_DEFINE_UNQUOTED($pike_cv_sys_nonblock)
5267b71995-08-09Fredrik Hübinette (Hubbe) fi rm -f core
5c8e891995-10-29Fredrik Hübinette (Hubbe) LIBDIR=`(cd $srcdir/../lib ; pwd)` BINDIR=`(cd $srcdir/../bin ; pwd)`
5683de1995-11-06Fredrik Hübinette (Hubbe) DOCDIR=`(cd $srcdir/../doc ; pwd)`
5c8e891995-10-29Fredrik Hübinette (Hubbe) BUILDDIR=`pwd`
5267b71995-08-09Fredrik Hübinette (Hubbe) 
067bc11996-06-21Fredrik Hübinette (Hubbe) AC_CONFIG_SUBDIRS(modules)
5267b71995-08-09Fredrik Hübinette (Hubbe) 
26e7e71996-04-23Fredrik Hübinette (Hubbe) AC_SUBST(YACC)
5267b71995-08-09Fredrik Hübinette (Hubbe) AC_SUBST(INSTALL) AC_SUBST(WARN) AC_SUBST(OPTIMIZE) AC_SUBST(EXTRA_OBJS) AC_SUBST(RANLIB)
5c8e891995-10-29Fredrik Hübinette (Hubbe) AC_SUBST(LIBDIR) AC_SUBST(BINDIR) AC_SUBST(BUILDDIR)
5683de1995-11-06Fredrik Hübinette (Hubbe) AC_SUBST(DOCDIR)
5267b71995-08-09Fredrik Hübinette (Hubbe) 
067bc11996-06-21Fredrik Hübinette (Hubbe) AC_OUTPUT(Makefile,[echo foo >stamp-h])
5267b71995-08-09Fredrik Hübinette (Hubbe)