aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile.in2
-rw-r--r--config.h.in92
-rwxr-xr-xconfigure567
-rw-r--r--configure.ac40
-rw-r--r--jim-aio.c273
-rw-r--r--jim-clock.c4
-rw-r--r--jim-exec.c7
-rw-r--r--jim-file.c68
-rw-r--r--jim-load.c28
-rw-r--r--jim-posix.c17
-rw-r--r--jim-regexp.c1
-rw-r--r--jim-win32compat.h2
-rw-r--r--jim.c15
-rw-r--r--jim.h.in14
15 files changed, 774 insertions, 357 deletions
diff --git a/.gitignore b/.gitignore
index fad8fa4..86b08e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
autom4te.cache
config.log
config.status
+config.h
tags
diff --git a/Makefile.in b/Makefile.in
index 80035d0..6e42b38 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -15,7 +15,7 @@ CFLAGS += -DTCL_LIBRARY=\"/lib/tcl6\"
CFLAGS += -DJIM_TCL_COMPAT -DJIM_REFERENCES
-CFLAGS += -Wall -g $(OPTIM) -I@SRCDIR@ -I. @EXTRA_CFLAGS@
+CFLAGS += -DHAVE_CONFIG_H -Wall -g $(OPTIM) -I@SRCDIR@ -I. @EXTRA_CFLAGS@
VPATH := @SRCDIR@
ifeq ($(jim_libtype),static)
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..58fc6d8
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,92 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the `backtrace' function. */
+#undef HAVE_BACKTRACE
+
+/* Define to 1 if you have the declaration of `mkdir', and to 0 if you don't.
+ */
+#undef HAVE_DECL_MKDIR
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the `geteuid' function. */
+#undef HAVE_GETEUID
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if the system has the type `long long'. */
+#undef HAVE_LONG_LONG
+
+/* Define to 1 if you have the `lstat' function. */
+#undef HAVE_LSTAT
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `mkstemp' function. */
+#undef HAVE_MKSTEMP
+
+/* Define to 1 if you have the `regcomp' function. */
+#undef HAVE_REGCOMP
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strptime' function. */
+#undef HAVE_STRPTIME
+
+/* Define to 1 if you have the `sysinfo' function. */
+#undef HAVE_SYSINFO
+
+/* Define to 1 if you have the `syslog' function. */
+#undef HAVE_SYSLOG
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the `ualarm' function. */
+#undef HAVE_UALARM
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define if mkdir(2) takes a single argument (no mode) */
+#undef MKDIR_ONE_ARG
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
diff --git a/configure b/configure
index 819189e..1fffbb6 100755
--- a/configure
+++ b/configure
@@ -1,12 +1,14 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.64 for jim 0.62.
+# Generated by GNU Autoconf 2.65 for jim 0.62.
#
# Report bugs to <steveb@workware.net.au>.
#
+#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
-# Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
@@ -527,7 +529,8 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-exec 7<&0 </dev/null 6>&1
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
@@ -592,11 +595,11 @@ ac_includes_default="\
ac_subst_vars='LTLIBOBJS
LIBOBJS
-LIBDL
SRCDIR
EXTRA_CFLAGS
JIM_LIBTYPE
JIM_EXTENSIONS
+LIBDL
SH_LDFLAGS
SH_CFLAGS
host_os
@@ -1288,7 +1291,7 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --disable-fork do not use fork (no exec, etc.)
+ --disable-fork do not use fork
--enable-math include support for math functions
Optional Packages:
@@ -1303,7 +1306,7 @@ Some influential environment variables:
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
- CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
@@ -1374,7 +1377,7 @@ test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
jim configure 0.62
-generated by GNU Autoconf 2.64
+generated by GNU Autoconf 2.65
Copyright (C) 2009 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
@@ -1421,7 +1424,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
- return $ac_retval
+ as_fn_set_status $ac_retval
} # ac_fn_c_try_compile
@@ -1512,7 +1515,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
- return $ac_retval
+ as_fn_set_status $ac_retval
} # ac_fn_c_try_cpp
@@ -1554,7 +1557,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
- return $ac_retval
+ as_fn_set_status $ac_retval
} # ac_fn_c_try_run
@@ -1631,7 +1634,7 @@ fi
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
- return $ac_retval
+ as_fn_set_status $ac_retval
} # ac_fn_c_try_link
@@ -1701,12 +1704,51 @@ $as_echo "$ac_res" >&6; }
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
} # ac_fn_c_check_func
+
+# ac_fn_c_check_decl LINENO SYMBOL VAR
+# ------------------------------------
+# Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
+ac_fn_c_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5
+$as_echo_n "checking whether $2 is declared... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $2
+ (void) $2;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_decl
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by jim $as_me 0.62, which was
-generated by GNU Autoconf 2.64. Invocation command line was
+generated by GNU Autoconf 2.65. Invocation command line was
$ $0 $@
@@ -1959,7 +2001,7 @@ fi
for ac_site_file in "$ac_site_file1" "$ac_site_file2"
do
test "x$ac_site_file" = xNONE && continue
- if test -r "$ac_site_file"; then
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
@@ -1968,9 +2010,9 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;}
done
if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
$as_echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
@@ -2052,6 +2094,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ac_config_headers="$ac_config_headers config.h"
+
# Checks for programs.
ac_ext=c
@@ -2376,32 +2420,30 @@ $as_echo "$ac_try_echo"; } >&5
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
- rm -f conftest.er1 conftest.err
fi
+ rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <stdio.h>
+
int
main ()
{
-FILE *f = fopen ("conftest.out", "w");
- return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out"
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
# The possible output files:
@@ -2463,10 +2505,10 @@ test "$ac_cv_exeext" = no && ac_cv_exeext=
else
ac_file=''
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
if test -z "$ac_file"; then :
- $as_echo "$as_me: failed program was:" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
@@ -2474,51 +2516,18 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ as_fn_set_status 77
as_fn_error "C compiler cannot create executables
See \`config.log' for more details." "$LINENO" 5; }; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
ac_exeext=$ac_cv_exeext
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." "$LINENO" 5; }
- fi
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
$as_echo_n "checking for suffix of executables... " >&6; }
if { { ac_try="$ac_link"
@@ -2551,13 +2560,72 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error "cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details." "$LINENO" 5; }
fi
-rm -f conftest$ac_cv_exeext
+rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
$as_echo "$ac_cv_exeext" >&6; }
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
if test "${ac_cv_objext+set}" = set; then :
@@ -3265,6 +3333,7 @@ HAVE_LONG_LONG="#define HAVE_LONG_LONG"
fi
+
# Shared library support. Because we don't believe in automake!
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
@@ -3379,7 +3448,7 @@ if test "${enable_fork+set}" = set; then :
if test "x$enableval" = "xno" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: * disabling fork" >&5
$as_echo "* disabling fork" >&6; }
- EXTRA_CFLAGS="-DJIM_NOFORK"
+ EXTRA_CFLAGS="-UHAVE_FORK"
fi
fi
@@ -3409,56 +3478,59 @@ if test "${with_jim_ext+set}" = set; then :
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: enabling jim extensions: $jim_extensions" >&5
-$as_echo "enabling jim extensions: $jim_extensions" >&6; }
-JIM_EXTENSIONS=$jim_extensions
-
-for i in $jim_extensions; do
- EXTRA_CFLAGS="$EXTRA_CFLAGS -Djim_ext_$i"
-done
-
-JIM_LIBTYPE=static
-
-# Check whether --with-jim-shared was given.
-if test "${with_jim_shared+set}" = set; then :
- withval=$with_jim_shared;
- if test "x$withval" = "xyes" ; then
- JIM_LIBTYPE=shared
- fi
+for ac_func in backtrace geteuid lstat mkstemp fork strptime sysinfo ualarm
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+ if test "x$as_val" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
fi
-
-JIM_LIBTYPE=$JIM_LIBTYPE
+done
-for ac_func in ualarm
+for ac_func in vfork
do :
- ac_fn_c_check_func "$LINENO" "ualarm" "ac_cv_func_ualarm"
-if test "x$ac_cv_func_ualarm" = x""yes; then :
+ ac_fn_c_check_func "$LINENO" "vfork" "ac_cv_func_vfork"
+if test "x$ac_cv_func_vfork" = x""yes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_UALARM 1
+#define HAVE_VFORK 1
_ACEOF
- EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_UALARM"
+
+else
+ IGNORE="$IGNORE exec posix signal eventloop"
fi
done
-for ac_func in sysinfo
+for ac_func in syslog
do :
- ac_fn_c_check_func "$LINENO" "sysinfo" "ac_cv_func_sysinfo"
-if test "x$ac_cv_func_sysinfo" = x""yes; then :
+ ac_fn_c_check_func "$LINENO" "syslog" "ac_cv_func_syslog"
+if test "x$ac_cv_func_syslog" = x""yes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_SYSINFO 1
+#define HAVE_SYSLOG 1
_ACEOF
- EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_SYSINFO"
+
+else
+ IGNORE="$IGNORE syslog"
fi
done
+for ac_func in regcomp
+do :
+ ac_fn_c_check_func "$LINENO" "regcomp" "ac_cv_func_regcomp"
+if test "x$ac_cv_func_regcomp" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_REGCOMP 1
+_ACEOF
-EXTRA_CFLAGS=$EXTRA_CFLAGS
-
-SRCDIR=`dirname $0`
-
+else
+ IGNORE="$IGNORE regexp"
+fi
+done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
$as_echo_n "checking for dlopen in -ldl... " >&6; }
@@ -3499,8 +3571,88 @@ $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
LIBDL=-ldl
+else
+ IGNORE="$IGNORE load"
+fi
+
+
+# Does mkdir() include a mode_t argument?
+ac_fn_c_check_decl "$LINENO" "mkdir" "ac_cv_have_decl_mkdir" "$ac_includes_default"
+if test "x$ac_cv_have_decl_mkdir" = x""yes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_MKDIR $ac_have_decl
+_ACEOF
+if test $ac_have_decl = 1; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if mkdir takes 2 arguments" >&5
+$as_echo_n "checking if mkdir takes 2 arguments... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/stat.h>
+ #include <sys/types.h>
+
+int
+main ()
+{
+(void)mkdir("dummy");
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define MKDIR_ONE_ARG /**/" >>confdefs.h
+
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+
+# Remove extensions in $IGNORE from $jim_extensions
+
+for i in $IGNORE; do
+ jim_extensions=`echo "$jim_extensions" | sed -e "s/$i//"`
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: enabling jim extensions: $jim_extensions" >&5
+$as_echo "enabling jim extensions: $jim_extensions" >&6; }
+JIM_EXTENSIONS=$jim_extensions
+
+for i in $jim_extensions; do
+ EXTRA_CFLAGS="$EXTRA_CFLAGS -Djim_ext_$i"
+done
+
+JIM_LIBTYPE=static
+
+# Check whether --with-jim-shared was given.
+if test "${with_jim_shared+set}" = set; then :
+ withval=$with_jim_shared;
+ if test "x$withval" = "xyes" ; then
+ JIM_LIBTYPE=shared
+ fi
+
+
fi
+JIM_LIBTYPE=$JIM_LIBTYPE
+
+
+
+EXTRA_CFLAGS=$EXTRA_CFLAGS
+
+SRCDIR=`dirname $0`
+
ac_config_files="$ac_config_files Makefile"
@@ -3585,43 +3737,7 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-#
-# If the first sed substitution is executed (which looks for macros that
-# take arguments), then branch to the quote section. Otherwise,
-# look for a macro that doesn't take arguments.
-ac_script='
-:mline
-/\\$/{
- N
- s,\\\n,,
- b mline
-}
-t clear
-:clear
-s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
-t quote
-s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
-t quote
-b any
-:quote
-s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
-s/\[/\\&/g
-s/\]/\\&/g
-s/\$/$$/g
-H
-:any
-${
- g
- s/^\n//
- s/\n/ /g
- p
-}
-'
-DEFS=`sed -n "$ac_script" confdefs.h`
-
+DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
@@ -4048,7 +4164,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# values after options handling.
ac_log="
This file was extended by jim $as_me 0.62, which was
-generated by GNU Autoconf 2.64. Invocation command line was
+generated by GNU Autoconf 2.65. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -4065,11 +4181,15 @@ case $ac_config_files in *"
"*) set x $ac_config_files; shift; ac_config_files=$*;;
esac
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
+config_headers="$ac_config_headers"
_ACEOF
@@ -4083,24 +4203,31 @@ Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
-q, --quiet, --silent
do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
Configuration files:
$config_files
+Configuration headers:
+$config_headers
+
Report bugs to <steveb@workware.net.au>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
jim config.status 0.62
-configured by $0, generated by GNU Autoconf 2.64,
- with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+configured by $0, generated by GNU Autoconf 2.65,
+ with options \\"\$ac_cs_config\\"
Copyright (C) 2009 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
@@ -4135,6 +4262,8 @@ do
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
$as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
@@ -4144,7 +4273,18 @@ do
esac
as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
- --he | --h | --help | --hel | -h )
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ as_fn_error "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+ --help | --hel | -h )
$as_echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
@@ -4200,6 +4340,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"jim.h") CONFIG_FILES="$CONFIG_FILES jim.h" ;;
@@ -4214,6 +4355,7 @@ done
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
fi
# Have a temporary directory for convenience. Make it in the build tree
@@ -4303,7 +4445,7 @@ s/'"$ac_delim"'$//
t delim
:nl
h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
t more1
s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
p
@@ -4317,7 +4459,7 @@ s/.\{148\}//
t nl
:delim
h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
t more2
s/["\\]/\\&/g; s/^/"/; s/$/"/
p
@@ -4391,8 +4533,116 @@ fi
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_FILES"
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
-eval set X " :F $CONFIG_FILES "
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_t=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_t"; then
+ break
+ elif $ac_last_try; then
+ as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ as_fn_error "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS "
shift
for ac_tag
do
@@ -4599,7 +4849,30 @@ which seems to be undefined. Please make sure it is defined." >&2;}
esac \
|| as_fn_error "could not create $ac_file" "$LINENO" 5
;;
-
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
+ } >"$tmp/config.h" \
+ || as_fn_error "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$tmp/config.h" "$ac_file" \
+ || as_fn_error "could not create $ac_file" "$LINENO" 5
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error "could not create -" "$LINENO" 5
+ fi
+ ;;
esac
diff --git a/configure.ac b/configure.ac
index befc2b3..3e17288 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,6 +3,7 @@
AC_PREREQ(2.57)
AC_INIT([jim], [0.62], [steveb@workware.net.au])
+AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CC
@@ -11,6 +12,7 @@ AC_PROG_MAKE_SET
# Checks for types
AC_CHECK_TYPES(long long,AC_SUBST(HAVE_LONG_LONG,["#define HAVE_LONG_LONG"]))
+
# Shared library support. Because we don't believe in automake!
AC_CANONICAL_HOST
case $host in
@@ -23,11 +25,11 @@ case $host in
esac
AC_ARG_ENABLE(fork,
- [ --disable-fork do not use fork (no exec, etc.)],
+ [ --disable-fork do not use fork],
[
if test "x$enableval" = "xno" ; then
AC_MSG_RESULT(* disabling fork)
- EXTRA_CFLAGS="-DJIM_NOFORK"
+ EXTRA_CFLAGS="-UHAVE_FORK"
fi
],
)
@@ -51,10 +53,38 @@ AC_ARG_WITH(jim-ext,
fi
]
)
+
+AC_CHECK_FUNCS([backtrace geteuid lstat mkstemp fork strptime sysinfo ualarm])
+
+AC_CHECK_FUNCS(vfork,,IGNORE="$IGNORE exec posix signal eventloop")
+AC_CHECK_FUNCS(syslog,,IGNORE="$IGNORE syslog")
+AC_CHECK_FUNCS(regcomp,,IGNORE="$IGNORE regexp")
+AC_CHECK_LIB(dl, dlopen, AC_SUBST(LIBDL,-ldl), IGNORE="$IGNORE load")
+
+# Does mkdir() include a mode_t argument?
+AC_CHECK_DECLS(mkdir,
+ [AC_MSG_CHECKING(if mkdir takes 2 arguments)
+ AC_TRY_COMPILE(
+ [#include <sys/stat.h>
+ #include <sys/types.h>
+ ],
+ [(void)mkdir("dummy");],
+ [AC_MSG_RESULT(no)
+ AC_DEFINE(MKDIR_ONE_ARG,[],[Define if mkdir(2) takes a single argument (no mode)])
+ ],
+ [AC_MSG_RESULT(yes)],
+ )]
+)
+
+# Remove extensions in $IGNORE from $jim_extensions
+
+for i in $IGNORE; do
+ jim_extensions=`echo "$jim_extensions" | sed -e "s/$i//"`
+done
+
AC_MSG_RESULT(enabling jim extensions: $jim_extensions)
AC_SUBST(JIM_EXTENSIONS,$jim_extensions)
for i in $jim_extensions; do
- dnl AC_DEFINE_UNQUOTED(jim_ext_$i)
EXTRA_CFLAGS="$EXTRA_CFLAGS -Djim_ext_$i"
done
@@ -69,14 +99,10 @@ AC_ARG_WITH(jim-shared,
)
AC_SUBST(JIM_LIBTYPE,$JIM_LIBTYPE)
-AC_CHECK_FUNCS([ualarm],EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_UALARM")
-AC_CHECK_FUNCS([sysinfo],EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_SYSINFO")
AC_SUBST(EXTRA_CFLAGS,$EXTRA_CFLAGS)
AC_SUBST(SRCDIR,`dirname $0`)
-AC_CHECK_LIB(dl, dlopen,AC_SUBST(LIBDL,-ldl))
-
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([jim.h])
AC_OUTPUT
diff --git a/jim-aio.c b/jim-aio.c
index 04af7e9..d61a04b 100644
--- a/jim-aio.c
+++ b/jim-aio.c
@@ -45,13 +45,16 @@
#include <errno.h>
#include <fcntl.h>
+#include "jim.h"
+
+#ifndef JIM_ANSIC
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
+#endif
-#include "jim.h"
#include "jim-eventloop.h"
#include "jim-subcmd.h"
@@ -68,16 +71,62 @@ typedef struct AioFile {
int type;
int OpenFlags; /* AIO_KEEPOPEN? keep FILE* */
int fd;
+#ifdef O_NDELAY
int flags;
+#endif
Jim_Obj *rEvent;
Jim_Obj *wEvent;
Jim_Obj *eEvent;
+#ifndef JIM_ANSIC
struct sockaddr sa;
struct hostent *he;
+#endif
} AioFile;
static int JimAioSubCmdProc(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
-static int JimParseIpAddress(Jim_Interp *interp, const char *hostport, struct sockaddr_in *sa);
+
+#ifndef JIM_ANSIC
+static int JimParseIpAddress(Jim_Interp *interp, const char *hostport, struct sockaddr_in *sa)
+{
+ char a[0x20];
+ char b[0x20];
+ const char* sthost;
+ const char* stport;
+ unsigned port;
+ struct hostent *he;
+
+ switch (sscanf(hostport,"%[^:]:%[^:]",a,b)) {
+ case 2: sthost = a; stport = b; break;
+ case 1: sthost = "0.0.0.0"; stport = a; break;
+ default:
+ return JIM_ERR;
+ }
+ if (0 == strncmp(sthost,"ANY",3)) {
+ sthost = "0.0.0.0";
+ }
+ port = atol(stport);
+ he = gethostbyname(sthost);
+
+ if (!he) {
+ Jim_SetResultString(interp,hstrerror(h_errno),-1);
+ return JIM_ERR;
+ }
+
+ sa->sin_family= he->h_addrtype;
+ memcpy(&sa->sin_addr, he->h_addr, he->h_length); /* set address */
+ sa->sin_port = htons(port);
+
+ return JIM_OK;
+}
+
+static int JimParseDomainAddress(Jim_Interp *interp, const char *path, struct sockaddr_un *sa)
+{
+ sa->sun_family = PF_UNIX;
+ strcpy(sa->sun_path, path);
+
+ return JIM_OK;
+}
+#endif
static void JimAioSetError(Jim_Interp *interp, Jim_Obj *name)
{
@@ -181,44 +230,6 @@ static int aio_cmd_read(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_OK;
}
-static int aio_cmd_recvfrom(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
-{
- AioFile *af = Jim_CmdPrivData(interp);
- char *buf;
- struct sockaddr_in sa;
- long len;
- socklen_t salen = sizeof(sa);
- int rlen;
-
- if (Jim_GetLong(interp, argv[0], &len) != JIM_OK) {
- return JIM_ERR;
- }
-
- buf = Jim_Alloc(len + 1);
-
- rlen = recvfrom(fileno(af->fp), buf, len, 0, (struct sockaddr *)&sa, &salen);
- if (rlen < 0) {
- Jim_Free(buf);
- JimAioSetError(interp, NULL);
- return JIM_ERR;
- }
- Jim_SetResult(interp, Jim_NewStringObjNoAlloc(interp, buf, rlen));
-
- if (argc > 1) {
- char buf[50];
-
- inet_ntop(sa.sin_family, &sa.sin_addr, buf, sizeof(buf) - 7);
- snprintf(buf + strlen(buf), 7, ":%d", ntohs(sa.sin_port));
-
- if (Jim_SetVariable(interp, argv[1], Jim_NewStringObj(interp, buf, -1)) != JIM_OK) {
- return JIM_ERR;
- }
- }
-
- return JIM_OK;
-}
-
-
static int aio_cmd_gets(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
AioFile *af = Jim_CmdPrivData(interp);
@@ -303,6 +314,45 @@ static int aio_cmd_puts(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_ERR;
}
+#ifndef JIM_ANSIC
+static int aio_cmd_recvfrom(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+{
+ AioFile *af = Jim_CmdPrivData(interp);
+ char *buf;
+ struct sockaddr_in sa;
+ long len;
+ socklen_t salen = sizeof(sa);
+ int rlen;
+
+ if (Jim_GetLong(interp, argv[0], &len) != JIM_OK) {
+ return JIM_ERR;
+ }
+
+ buf = Jim_Alloc(len + 1);
+
+ rlen = recvfrom(fileno(af->fp), buf, len, 0, (struct sockaddr *)&sa, &salen);
+ if (rlen < 0) {
+ Jim_Free(buf);
+ JimAioSetError(interp, NULL);
+ return JIM_ERR;
+ }
+ Jim_SetResult(interp, Jim_NewStringObjNoAlloc(interp, buf, rlen));
+
+ if (argc > 1) {
+ char buf[50];
+
+ inet_ntop(sa.sin_family, &sa.sin_addr, buf, sizeof(buf) - 7);
+ snprintf(buf + strlen(buf), 7, ":%d", ntohs(sa.sin_port));
+
+ if (Jim_SetVariable(interp, argv[1], Jim_NewStringObj(interp, buf, -1)) != JIM_OK) {
+ return JIM_ERR;
+ }
+ }
+
+ return JIM_OK;
+}
+
+
static int aio_cmd_sendto(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
AioFile *af = Jim_CmdPrivData(interp);
@@ -326,6 +376,42 @@ static int aio_cmd_sendto(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_OK;
}
+static int aio_cmd_accept(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+{
+ AioFile *serv_af = Jim_CmdPrivData(interp);
+ int sock;
+ socklen_t addrlen = sizeof(struct sockaddr_in);
+ AioFile *af;
+ char buf[AIO_CMD_LEN];
+ long fileId;
+ sock = accept(serv_af->fd,(struct sockaddr*)&serv_af->sa,&addrlen);
+ if (sock < 0)
+ return JIM_ERR;
+
+ /* Get the next file id */
+ fileId = Jim_GetId(interp);
+
+ /* Create the file command */
+ af = Jim_Alloc(sizeof(*af));
+ af->fd = sock;
+ af->filename = Jim_NewStringObj(interp, "accept", -1);
+ Jim_IncrRefCount(af->filename);
+ af->fp = fdopen(sock,"r+");
+ af->OpenFlags = 0;
+#ifdef O_NDELAY
+ af->flags = fcntl(af->fd,F_GETFL);
+#endif
+ af->rEvent = NULL;
+ af->wEvent = NULL;
+ af->eEvent = NULL;
+ sprintf(buf, "aio.sockstream%ld", fileId);
+ Jim_CreateCommand(interp, buf, JimAioSubCmdProc, af, JimAioDelProc);
+ Jim_SetResultString(interp, buf, -1);
+ return JIM_OK;
+}
+
+#endif
+
static int aio_cmd_flush(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
AioFile *af = Jim_CmdPrivData(interp);
@@ -411,38 +497,6 @@ static int aio_cmd_ndelay(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
}
#endif
-static int aio_cmd_accept(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
-{
- AioFile *serv_af = Jim_CmdPrivData(interp);
- int sock;
- socklen_t addrlen = sizeof(struct sockaddr_in);
- AioFile *af;
- char buf[AIO_CMD_LEN];
- long fileId;
- sock = accept(serv_af->fd,(struct sockaddr*)&serv_af->sa,&addrlen);
- if (sock < 0)
- return JIM_ERR;
-
- /* Get the next file id */
- fileId = Jim_GetId(interp);
-
- /* Create the file command */
- af = Jim_Alloc(sizeof(*af));
- af->fd = sock;
- af->filename = Jim_NewStringObj(interp, "accept", -1);
- Jim_IncrRefCount(af->filename);
- af->fp = fdopen(sock,"r+");
- af->OpenFlags = 0;
- af->flags = fcntl(af->fd,F_GETFL);
- af->rEvent = NULL;
- af->wEvent = NULL;
- af->eEvent = NULL;
- sprintf(buf, "aio.sockstream%ld", fileId);
- Jim_CreateCommand(interp, buf, JimAioSubCmdProc, af, JimAioDelProc);
- Jim_SetResultString(interp, buf, -1);
- return JIM_OK;
-}
-
#ifdef jim_ext_eventloop
static void JimAioFileEventFinalizer(Jim_Interp *interp, void *clientData)
{
@@ -554,13 +608,6 @@ static const jim_subcmd_type command_table[] = {
.maxargs = 2,
.description = "Read and return bytes from the stream. To eof if no len."
},
- { .cmd = "recvfrom",
- .args = "len ?addrvar?",
- .function = aio_cmd_recvfrom,
- .minargs = 1,
- .maxargs = 2,
- .description = "Receive up to 'len' bytes on the socket. Sets 'addrvar' with receive address, if set"
- },
{ .cmd = "gets",
.args = "?var?",
.function = aio_cmd_gets,
@@ -575,6 +622,14 @@ static const jim_subcmd_type command_table[] = {
.maxargs = 2,
.description = "Write the string, with newline unless -nonewline"
},
+#ifndef JIM_ANSIC
+ { .cmd = "recvfrom",
+ .args = "len ?addrvar?",
+ .function = aio_cmd_recvfrom,
+ .minargs = 1,
+ .maxargs = 2,
+ .description = "Receive up to 'len' bytes on the socket. Sets 'addrvar' with receive address, if set"
+ },
{ .cmd = "sendto",
.args = "str address",
.function = aio_cmd_sendto,
@@ -582,6 +637,11 @@ static const jim_subcmd_type command_table[] = {
.maxargs = 2,
.description = "Send 'str' to the given address (dgram only)"
},
+ { .cmd = "accept",
+ .function = aio_cmd_accept,
+ .description = "Server socket only: Accept a connection and return stream"
+ },
+#endif
{ .cmd = "flush",
.function = aio_cmd_flush,
.description = "Flush the stream"
@@ -606,6 +666,7 @@ static const jim_subcmd_type command_table[] = {
.function = aio_cmd_tell,
.description = "Returns the current seek position"
},
+#ifdef O_NDELAY
{ .cmd = "ndelay",
.args = "?0|1?",
.function = aio_cmd_ndelay,
@@ -613,10 +674,7 @@ static const jim_subcmd_type command_table[] = {
.maxargs = 1,
.description = "Set O_NDELAY (if arg). Returns current/new setting."
},
- { .cmd = "accept",
- .function = aio_cmd_accept,
- .description = "Server socket only: Accept a connection and return stream"
- },
+#endif
#ifdef jim_ext_eventloop
{ .cmd = "readable",
.args = "?readable-script ?eof-script??",
@@ -694,7 +752,9 @@ static int JimAioOpenCommand(Jim_Interp *interp, int argc,
af = Jim_Alloc(sizeof(*af));
af->fp = fp;
af->fd = fileno(fp);
+#ifdef O_NDELAY
af->flags = fcntl(af->fd,F_GETFL);
+#endif
af->filename = argv[1];
Jim_IncrRefCount(af->filename);
af->OpenFlags = OpenFlags;
@@ -706,47 +766,7 @@ static int JimAioOpenCommand(Jim_Interp *interp, int argc,
return JIM_OK;
}
-static int JimParseIpAddress(Jim_Interp *interp, const char *hostport, struct sockaddr_in *sa)
-{
- char a[0x20];
- char b[0x20];
- const char* sthost;
- const char* stport;
- unsigned port;
- struct hostent *he;
-
- switch (sscanf(hostport,"%[^:]:%[^:]",a,b)) {
- case 2: sthost = a; stport = b; break;
- case 1: sthost = "0.0.0.0"; stport = a; break;
- default:
- return JIM_ERR;
- }
- if (0 == strncmp(sthost,"ANY",3)) {
- sthost = "0.0.0.0";
- }
- port = atol(stport);
- he = gethostbyname(sthost);
-
- if (!he) {
- Jim_SetResultString(interp,hstrerror(h_errno),-1);
- return JIM_ERR;
- }
-
- sa->sin_family= he->h_addrtype;
- memcpy(&sa->sin_addr, he->h_addr, he->h_length); /* set address */
- sa->sin_port = htons(port);
-
- return JIM_OK;
-}
-
-static int JimParseDomainAddress(Jim_Interp *interp, const char *path, struct sockaddr_un *sa)
-{
- sa->sun_family = PF_UNIX;
- strcpy(sa->sun_path, path);
-
- return JIM_OK;
-}
-
+#ifndef JIM_ANSIC
/**
* Creates a channel for fd.
*
@@ -779,7 +799,9 @@ static int JimMakeChannel(Jim_Interp *interp, Jim_Obj *filename, const char *hdl
af->OpenFlags = 0;
af->filename = filename;
Jim_IncrRefCount(af->filename);
+#ifdef O_NDELAY
af->flags = fcntl(af->fd, F_GETFL);
+#endif
af->rEvent = NULL;
af->wEvent = NULL;
af->eEvent = NULL;
@@ -995,6 +1017,7 @@ wrongargs:
return JimMakeChannel(interp, argv[1], hdlfmt, sock, mode);
}
+#endif
FILE *Jim_AioFilehandle(Jim_Interp *interp, Jim_Obj *command)
{
@@ -1099,7 +1122,9 @@ Jim_aioInit(Jim_Interp *interp)
if (Jim_PackageProvide(interp, "aio", "1.0", JIM_ERRMSG) != JIM_OK)
return JIM_ERR;
Jim_CreateCommand(interp, "open", JimAioOpenCommand, NULL, NULL);
+#ifndef JIM_ANSIC
Jim_CreateCommand(interp, "socket", JimAioSockCommand, NULL, NULL);
+#endif
/* Takeover stdin, stdout and stderr */
Jim_EvalGlobal(interp, "open stdin; open stdout; open stderr");
diff --git a/jim-clock.c b/jim-clock.c
index 4e8a176..2f86f59 100644
--- a/jim-clock.c
+++ b/jim-clock.c
@@ -44,6 +44,7 @@ static int clock_cmd_format(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_OK;
}
+#ifdef HAVE_STRPTIME
static int clock_cmd_scan(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
char *pt;
@@ -68,6 +69,7 @@ static int clock_cmd_scan(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_OK;
}
+#endif
static int clock_cmd_seconds(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
@@ -90,6 +92,7 @@ static const jim_subcmd_type command_table[] = {
.maxargs = 3,
.description = "Format the given time"
},
+#ifdef HAVE_STRPTIME
{ .cmd = "scan",
.args = "str -format format",
.function = clock_cmd_scan,
@@ -97,6 +100,7 @@ static const jim_subcmd_type command_table[] = {
.maxargs = 3,
.description = "Determine the time according to the given format"
},
+#endif
{ 0 }
};
diff --git a/jim-exec.c b/jim-exec.c
index f9d19a5..50d2694 100644
--- a/jim-exec.c
+++ b/jim-exec.c
@@ -17,15 +17,16 @@
#include <string.h>
#include <unistd.h>
-#include <sys/wait.h>
#include <signal.h>
#include <fcntl.h>
#include <errno.h>
+#include <sys/wait.h>
#include "jim.h"
#include "jim-subcmd.h"
#include "jim-signal.h"
+
/* These two could be moved into the Tcl core */
static void Jim_SetResultErrno(Jim_Interp *interp, const char *msg)
{
@@ -66,7 +67,7 @@ static int Jim_AppendStreamToString(Jim_Interp *interp, int fd, Jim_Obj *strObj)
}
}
-#ifndef JIM_NOFORK
+#if defined(HAVE_FORK)
static int Jim_CreatePipeline(Jim_Interp *interp, int argc, Jim_Obj *const *argv,
int **pidArrayPtr, int *inPipePtr, int *outPipePtr, int *errFilePtr);
static void JimDetachPids(Jim_Interp *interp, int numPids, int *pidPtr);
@@ -989,7 +990,7 @@ Jim_CleanupChildren(Jim_Interp *interp, int numPids, int *pidPtr, int errorId)
return result;
}
-#else /* JIM_NOFORK */
+#else
static int
Jim_ExecCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
diff --git a/jim-file.c b/jim-file.c
index db7c465..cf21eea 100644
--- a/jim-file.c
+++ b/jim-file.c
@@ -86,10 +86,14 @@ static const char *GetFileType(int mode)
return "blockSpecial";
} else if (S_ISFIFO(mode)) {
return "fifo";
+#ifdef S_ISLNK
} else if (S_ISLNK(mode)) {
return "link";
+#endif
+#ifdef S_ISSOCK
} else if (S_ISSOCK(mode)) {
return "socket";
+#endif
}
return "unknown";
}
@@ -222,6 +226,7 @@ static int file_cmd_tail(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int file_cmd_normalize(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
+#ifdef HAVE_REALPATH
const char *path = Jim_GetString(argv[0], NULL);
char *newname = Jim_Alloc(MAXPATHLEN + 1);
@@ -233,6 +238,9 @@ static int file_cmd_normalize(Jim_Interp *interp, int argc, Jim_Obj *const *argv
Jim_SetResult(interp, argv[0]);
}
return JIM_OK;
+#else
+ return JIM_ERR;
+#endif
}
static int file_cmd_join(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
@@ -328,6 +336,12 @@ static int file_cmd_delete(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_OK;
}
+#ifdef MKDIR_ONE_ARG
+#define MKDIR_DEFAULT(PATHNAME) mkdir(PATHNAME)
+#else
+#define MKDIR_DEFAULT(PATHNAME) mkdir(PATHNAME, 0755)
+#endif
+
/**
* Create directory, creating all intermediate paths if necessary.
*
@@ -353,30 +367,30 @@ static int mkdir_all(char *path)
*slash = '/';
}
first:
- if (mkdir(path, 0755) == 0) {
- return 0;
- }
- if (errno == ENOENT) {
- /* Create the parent and try again */
- continue;
- }
- /* Maybe it already exists as a directory */
- if (errno == EEXIST) {
- struct stat sb;
-
- if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) {
+ if (MKDIR_DEFAULT(path) == 0) {
return 0;
}
- /* Restore errno */
- errno = EEXIST;
+ if (errno == ENOENT) {
+ /* Create the parent and try again */
+ continue;
+ }
+ /* Maybe it already exists as a directory */
+ if (errno == EEXIST) {
+ struct stat sb;
+
+ if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) {
+ return 0;
+ }
+ /* Restore errno */
+ errno = EEXIST;
+ }
+ /* Failed */
+ break;
}
- /* Failed */
- break;
+ return -1;
}
- return -1;
-}
-static int file_cmd_mkdir(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+ static int file_cmd_mkdir(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
while (argc--) {
char *path = Jim_StrDup(Jim_GetString(argv[0], NULL));
@@ -391,6 +405,7 @@ static int file_cmd_mkdir(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_OK;
}
+#ifdef HAVE_MKSTEMP
static int file_cmd_tempfile(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
int fd;
@@ -411,6 +426,7 @@ static int file_cmd_tempfile(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
Jim_SetResult(interp, Jim_NewStringObjNoAlloc(interp, filename, -1));
return JIM_OK;
}
+#endif
static int file_cmd_rename(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
@@ -453,6 +469,10 @@ static int file_stat(Jim_Interp *interp, Jim_Obj *filename, struct stat *sb)
return JIM_OK;
}
+#ifndef HAVE_LSTAT
+#define lstat stat
+#endif
+
static int file_lstat(Jim_Interp *interp, Jim_Obj *filename, struct stat *sb)
{
const char *path = Jim_GetString(filename, NULL);
@@ -528,23 +548,25 @@ static int file_cmd_isfile(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
int ret = 0;
if (file_stat(interp, argv[0], &sb) == JIM_OK) {
- ret = S_ISREG(sb.st_mode);
+ ret = S_ISREG(sb.st_mode);
}
Jim_SetResultInt(interp, ret);
return JIM_OK;
}
+#ifdef HAVE_GETEUID
static int file_cmd_owned(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
struct stat sb;
int ret = 0;
if (file_stat(interp, argv[0], &sb) == JIM_OK) {
- ret = (geteuid() == sb.st_uid);
+ ret = (geteuid() == sb.st_uid);
}
Jim_SetResultInt(interp, ret);
return JIM_OK;
}
+#endif
#ifdef S_IFLNK
static int file_cmd_readlink(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
@@ -701,6 +723,7 @@ static const jim_subcmd_type command_table[] = {
.maxargs = -1,
.description = "Creates the directories"
},
+#ifdef HAVE_MKSTEMP
{ .cmd = "tempfile",
.args = "?template?",
.function = file_cmd_tempfile,
@@ -708,6 +731,7 @@ static const jim_subcmd_type command_table[] = {
.maxargs = 1,
.description = "Creates a temporary filename"
},
+#endif
{ .cmd = "rename",
.args = "?-force? source dest",
.function = file_cmd_rename,
@@ -752,6 +776,7 @@ static const jim_subcmd_type command_table[] = {
.maxargs = 1,
.description = "Returns type of the file"
},
+#ifdef HAVE_GETEUID
{ .cmd = "owned",
.args = "name",
.function = file_cmd_owned,
@@ -759,6 +784,7 @@ static const jim_subcmd_type command_table[] = {
.maxargs = 1,
.description = "Returns 1 if owned by the current owner"
},
+#endif
{ .cmd = "isdirectory",
.args = "name",
.function = file_cmd_isdirectory,
diff --git a/jim-load.c b/jim-load.c
index 672b536..84a7d43 100644
--- a/jim-load.c
+++ b/jim-load.c
@@ -1,35 +1,13 @@
#include <jim.h>
+#include <string.h>
/* -----------------------------------------------------------------------------
* Dynamic libraries support (WIN32 not supported)
* ---------------------------------------------------------------------------*/
#ifdef JIM_DYNLIB
-#ifdef WIN32
-#define RTLD_LAZY 0
-void * dlopen(const char *path, int mode)
-{
- JIM_NOTUSED(mode);
- return (void *)LoadLibraryA(path);
-}
-int dlclose(void *handle)
-{
- FreeLibrary((HANDLE)handle);
- return 0;
-}
-void *dlsym(void *handle, const char *symbol)
-{
- return GetProcAddress((HMODULE)handle, symbol);
-}
-static char win32_dlerror_string[121];
-const char *dlerror(void)
-{
- FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
- LANG_NEUTRAL, win32_dlerror_string, 120, NULL);
- return win32_dlerror_string;
-}
-#endif /* WIN32 */
+#include <dlfcn.h>
int Jim_LoadLibrary(Jim_Interp *interp, const char *pathName)
{
@@ -44,7 +22,7 @@ int Jim_LoadLibrary(Jim_Interp *interp, const char *pathName)
libPathObjPtr = NULL;
} else {
Jim_IncrRefCount(libPathObjPtr);
- Jim_ListLength(interp, libPathObjPtr, &prefixc);
+ prefixc = Jim_ListLength(interp, libPathObjPtr);
}
for (i = -1; i < prefixc; i++) {
diff --git a/jim-posix.c b/jim-posix.c
index df8ed48..7aa266e 100644
--- a/jim-posix.c
+++ b/jim-posix.c
@@ -20,29 +20,26 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/wait.h>
-#ifdef HAVE_SYSINFO
-#include <sys/sysinfo.h>
-#endif
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
-#define JIM_EXTENSION
#include "jim.h"
+#ifdef HAVE_SYSINFO
+#include <sys/sysinfo.h>
+#endif
+
static void Jim_PosixSetError(Jim_Interp *interp)
{
Jim_SetResultString(interp, strerror(errno), -1);
}
+#ifdef HAVE_FORK
static int Jim_PosixForkCommand(Jim_Interp *interp, int argc,
Jim_Obj *const *argv)
{
-#ifdef JIM_NOFORK
- Jim_SetResultString(interp, "Not supported", -1);
- return JIM_ERR;
-#else
pid_t pid;
JIM_NOTUSED(argv);
@@ -56,8 +53,8 @@ static int Jim_PosixForkCommand(Jim_Interp *interp, int argc,
}
Jim_SetResultInt(interp, (jim_wide)pid);
return JIM_OK;
-#endif
}
+#endif
/*
* os.wait ?-nohang? pid
@@ -217,7 +214,9 @@ int Jim_posixInit(Jim_Interp *interp)
{
if (Jim_PackageProvide(interp, "posix", "1.0", JIM_ERRMSG) != JIM_OK)
return JIM_ERR;
+#ifdef HAVE_FORK
Jim_CreateCommand(interp, "os.fork", Jim_PosixForkCommand, NULL, NULL);
+#endif
Jim_CreateCommand(interp, "os.wait", Jim_PosixWaitCommand, NULL, NULL);
Jim_CreateCommand(interp, "os.getids", Jim_PosixGetidsCommand, NULL, NULL);
Jim_CreateCommand(interp, "os.gethostname", Jim_PosixGethostnameCommand, NULL, NULL);
diff --git a/jim-regexp.c b/jim-regexp.c
index f8e911d..663c303 100644
--- a/jim-regexp.c
+++ b/jim-regexp.c
@@ -51,7 +51,6 @@
#include <string.h>
#include <regex.h>
-#define JIM_EXTENSION
#include "jim.h"
void FreeRegexpInternalRep(Jim_Interp *interp, Jim_Obj *objPtr)
diff --git a/jim-win32compat.h b/jim-win32compat.h
index 7f9d85f..21edaf2 100644
--- a/jim-win32compat.h
+++ b/jim-win32compat.h
@@ -15,8 +15,6 @@
#pragma warning(disable:4146)
#endif
-#undef JIM_DYNLIB
-
#define strcasecmp _stricmp
#define jim_wide _int64
diff --git a/jim.c b/jim.c
index 3a7ac0e..ac92a0e 100644
--- a/jim.c
+++ b/jim.c
@@ -42,13 +42,8 @@
* are those of the authors and should not be interpreted as representing
* official policies, either expressed or implied, of the Jim Tcl Project.
**/
-#define __JIM_CORE__
#define JIM_OPTIMIZATION /* comment to avoid optimizations and reduce size */
-#if !defined(JIM_ANSIC) && !defined(NOMMU)
-#define JIM_DYNLIB /* Dynamic library support */
-#endif /* JIM_ANSIC */
-
#include <stdio.h>
#include <stdlib.h>
@@ -73,19 +68,9 @@
#define NEED_ENVIRON_EXTERN (1)
#endif
-#ifndef JIM_ANSIC
-#define JIM_DYNLIB /* Dynamic library support for UNIX and WIN32 */
-#endif /* JIM_ANSIC */
-
#include <stdarg.h>
#include <limits.h>
-/* Include the platform dependent libraries for
- * dynamic loading of libraries. */
-#ifdef JIM_DYNLIB
-#include <dlfcn.h>
-#endif /* JIM_DYNLIB */
-
#include <unistd.h>
#include <sys/time.h>
diff --git a/jim.h.in b/jim.h.in
index bbc7a8f..c1ae88b 100644
--- a/jim.h.in
+++ b/jim.h.in
@@ -81,11 +81,21 @@ extern "C" {
* System configuration
* autoconf (configure) will set these
* ---------------------------------------------------------------------------*/
-#if defined(_WIN32) || defined(WIN32)
+#if (defined(_WIN32) || defined(WIN32)) && !defined(__MINGW32__)
#include <jim-win32compat.h>
#else
-#ifndef JIM_NO_CONFIGURE
+#if defined(__MINGW32__)
+#define JIM_ANSIC
+#endif
+
+#if !defined(JIM_ANSIC) && !defined(NOMMU)
+#define JIM_DYNLIB /* Dynamic library support */
+#endif
+
+#if defined(HAVE_CONFIG_H)
+#include <config.h>
+#elif !defined(JIM_NO_CONFIGURE)
@HAVE_LONG_LONG@
#endif