# configure.in -- Process this file with autoconf to produce configure # Copyright (C) 2000 Gary V. Vaughan # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. AC_INIT(sic/eval.c) AC_CONFIG_AUX_DIR(config) AM_CONFIG_HEADER(config.h:config-h.in) AM_INIT_AUTOMAKE(sic, 0.7) AC_PROG_CC AM_PROG_CC_STDC AM_PROG_LIBTOOL AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(stdlib.h unistd.h errno.h assert.h) AC_CHECK_HEADERS(string.h strings.h, break) # @start 2 # am_cv_prog_cc_stdc is set by AM_PROG_CC_STDC case $am_cv_prog_cc_stdc,$ac_cv_header_varargs_h in no,) # Non-ANSI compiler, so we must use varargs.h. AC_CHECK_HEADERS(varargs.h) ;; *,yes) # Parent package is using varargs.h which is incompatible with # stdarg.h, so we do the same (recheck to generate checking... # message). AC_CHECK_HEADERS(varargs.h) ;; *) # If stdarg.h is present define HAVE_STDARG_H. AC_CHECK_HEADERS(stdarg.h) ;; esac case x$ac_cv_header_stdarg_h$ac_cv_header_varargs_h in x*yes*) ;; *) AC_MSG_ERROR(Could not find stdarg.h or varargs.h, one of which \ is required for the build to proceed.) ;; esac # @end 2 AC_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T SIC_WITH_READLINE SIC_VAR_SYS_ERRLIST SIC_VAR_SYS_SIGLIST AC_CHECK_FUNCS(bzero memset, break) AC_CHECK_FUNCS(calloc strchr strrchr) AC_REPLACE_FUNCS(basename strspn strcspn strerror strsignal vfprintf waitpid) save_LIBS="$LIBS" test x"${with_readline-no}" != xno && LIBS="$LIBS -lreadline" AC_REPLACE_FUNCS(readline) AC_CHECK_FUNCS(add_history) LIBS="$save_LIBS" # @start 5 # ---------------------------------------------------------------------- # Add code to config.status to create an installable host dependent # configuration file. # ---------------------------------------------------------------------- AC_OUTPUT_COMMANDS([ if test -n "$CONFIG_FILES" && test -n "$CONFIG_HEADERS"; then # If both these vars are non-empty, then config.status wasn't run by # automake rules (which always set one or the other to empty). CONFIG_OTHER=${CONFIG_OTHER-sic/common.h} fi case "$CONFIG_OTHER" in *sic/common.h*) outfile=sic/common.h stampfile=sic/stamp-common tmpfile=${outfile}T dirname="sed s,^.*/,,g" echo creating $outfile cat > $tmpfile << _EOF_ /* -*- Mode: C -*- * -------------------------------------------------------------------- * DO NOT EDIT THIS FILE! It has been automatically generated * from: configure.in and `echo $outfile|$dirname`.in * on host: `(hostname || uname -n) 2>/dev/null | sed 1q` * -------------------------------------------------------------------- */ #ifndef SIC_COMMON_H #define SIC_COMMON_H 1 #include #include _EOF_ # @end 5 # @start 4 # Add the code to include these headers only if autoconf has # shown them to be present. if test x$ac_cv_header_stdlib_h = xyes; then echo '#include ' >> $tmpfile fi if test x$ac_cv_header_unistd_h = xyes; then echo '#include ' >> $tmpfile fi if test x$ac_cv_header_sys_wait_h = xyes; then echo '#include ' >> $tmpfile fi if test x$ac_cv_header_errno_h = xyes; then echo '#include ' >> $tmpfile fi cat >> $tmpfile << '_EOF_' #ifndef errno /* Some sytems #define this! */ extern int errno; #endif _EOF_ if test x$ac_cv_header_string_h = xyes; then echo '#include ' >> $tmpfile elif test x$ac_cv_header_strings_h = xyes; then echo '#include ' >> $tmpfile fi if test x$ac_cv_header_assert_h = xyes; then cat >> $tmpfile << '_EOF_' #include #define SIC_ASSERT assert _EOF_ else echo '#define SIC_ASSERT(expr) ((void) 0)' >> $tmpfile fi # @end 4 # @start 3 # Make a choice between the two different API's for variadic # functions. In general, prefer stdarg.h over varargs.h, except # where varargs.h has already been chosen by the parent package. if test x$ac_cv_header_stdarg_h = xyes \ && test x$ac_cv_header_varargs_h != xyes then cat >> $tmpfile << '_EOF_' #include #ifndef VA_START # define VA_START(a, f) va_start(a, f) #endif /* !VA_START */ _EOF_ else cat >> $tmpfile << '_EOF_' #include #ifndef VA_START # define VA_START(a, f) va_start(a) #endif /* !VA_START */ _EOF_ fi # @end 3 # @start 5 if test x$ac_cv_func_bzero = xno && \ test x$ac_cv_func_memset = xyes; then cat >> $tmpfile << '_EOF_' #define bzero(buf, bytes) ((void) memset (buf, 0, bytes)) _EOF_ fi if test x$ac_cv_func_strchr = xno; then echo '#define strchr index' >> $tmpfile fi if test x$ac_cv_func_strrchr = xno; then echo '#define strrchr rindex' >> $tmpfile fi # The ugly but portable cpp stuff comes from here infile=$srcdir/sic/`echo $outfile | sed 's,.*/,,g;s,\..*$,,g'`-h.in sed '/^##.*$/d' $infile >> $tmpfile # @end 5 ${RM-/bin/rm -f} ${tmpfile}2 2>/dev/null if test x$ac_cv_func_basename = xno; then echo 'extern char *basename PARAMS((const char *path));' >> ${tmpfile}2 fi if test x$ac_cv_func_strcspn = xno; then echo 'extern size_t strcspn PARAMS((const char *string, const char *accept));' >> ${tmpfile}2 fi if test x$ac_cv_func_strerror = xno; then echo 'extern char *strerror PARAMS((int err));' >> ${tmpfile}2 fi if test x$ac_cv_func_strsignal = xno; then echo 'extern char *strsignal PARAMS((int signo));' >> ${tmpfile}2 fi if test x$ac_cv_func_strspn = xno; then echo 'extern size_t strspn PARAMS((const char *string, const char *reject));' >> ${tmpfile}2 fi if test x$ac_cv_func_vfprintf = xno; then echo 'extern int vfprintf PARAMS((FILE *file, const char *format, va_list ap));' >> ${tmpfile}2 fi if test x$ac_cv_func_waitpid = xno; then echo 'extern pid_t waitpid PARAMS((pid_t pid, int *pstatus, int options));' >> ${tmpfile}2 fi if test -f ${tmpfile}2; then cat >> $tmpfile << '_EOF_' BEGIN_C_DECLS _EOF_ cat ${tmpfile}2 >> $tmpfile echo 'END_C_DECLS' >> $tmpfile ${RM-/bin/rm -f} ${tmpfile}2 2>/dev/null fi cat >> $tmpfile << '_EOF_' #endif /* !SIC_COMMON_H */ _EOF_ if cmp -s $tmpfile $outfile; then echo $outfile is unchanged rm -f $tmpfile else mv $tmpfile $outfile touch $stampfile fi ;; esac # @start 5 ],[ srcdir=$srcdir ac_cv_func_bzero=$ac_cv_func_bzero ac_cv_func_memset=$ac_cv_func_memset ac_cv_func_strchr=$ac_cv_func_strchr ac_cv_func_strrchr=$ac_cv_func_strrchr # @end 5 ac_cv_func_basename=$ac_cv_func_basename ac_cv_func_strcspn=$ac_cv_func_strcspn ac_cv_func_strerror=$ac_cv_func_strerror ac_cv_func_strsignal=$ac_cv_func_strsignal ac_cv_func_strspn=$ac_cv_func_strspn ac_cv_func_vfprintf=$ac_cv_func_vfprintf ac_cv_func_waitpid=$ac_cv_func_waitpid ac_cv_header_assert_h=$ac_cv_header_assert_h ac_cv_header_errno_h=$ac_cv_header_errno_h ac_cv_header_stdlib_h=$ac_cv_header_stdlib_h ac_cv_header_stdarg_h=$ac_cv_header_stdarg_h ac_cv_header_string_h=$ac_cv_header_string_h ac_cv_header_strings_h=$ac_cv_header_strings_h ac_cv_header_sys_wait_h=$ac_cv_header_sys_wait_h ac_cv_header_unistd_h=$ac_cv_header_unistd_h ac_cv_header_varargs_h=$ac_cv_header_varargs_h # @start 5 ]) # @end 5 # @start 1 Xsed="sed -e s/^X//" LTLIBOBJS=`echo X"$LIBOBJS" | \ [$Xsed -e 's,\.[^.]* ,.lo ,g;s,\.[^.]*$,.lo,']` AC_SUBST(LTLIBOBJS) # @end 1 AC_SUBST(ac_aux_dir) AC_OUTPUT([Makefile replace/Makefile sic/Makefile src/Makefile \ tests/Makefile doc/Makefile], [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h.in]) echo \ "------------------------------------------------------------------------ Configuration: Source code location: ${srcdir} Compiler: ${CC} Compiler flags: ${CFLAGS} Host System Type: ${host} Install path: ${prefix} See config.h for further configuration information. ------------------------------------------------------------------------"