Index: Makefile.in
==================================================================
--- Makefile.in
+++ Makefile.in
@@ -27,22 +27,28 @@
 libdir = @libdir@
 includedir = @includedir@
 
 LIBS = libconfig.$(AREXT) libconfig.$(SHOBJEXT)
 BINS =
+# The following two lines need to be kept syncronised.
 OBJS = libconfig.o conf_space.o conf_section.o conf_apache.o conf_colon.o conf_equal.o conf_xml.o
+SHOBJS = libconfig_shr.o conf_space_shr.o conf_section_shr.o conf_apache_shr.o conf_colon_shr.o conf_equal_shr.o conf_xml_shr.o
 
 all: $(LIBS) $(BINS)
-libconfig.$(SHOBJEXT): $(OBJS) @LIBOBJS@
-	@echo $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(SHOBJFLAGS) $(SHOBJLDFLAGS) -o $@ $(^:.o=.c); \
-	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(SHOBJFLAGS) $(SHOBJLDFLAGS) -o $@ $(^:.o=.c)
+libconfig.$(SHOBJEXT): $(SHOBJS) @LIBOBJS@
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(SHOBJFLAGS) $(SHOBJLDFLAGS) -o $@ $^
 
 libconfig.$(AREXT): $(OBJS) @LIBOBJS@
 	$(AR) rcu $@ $^
 	-$(RANLIB) $@
 
 libconfig.o: libconfig.c compat.h win32.h config.h libconfig.h
+libconfig_shr.o: libconfig.c compat.h win32.h config.h libconfig.h
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(SHOBJFLAGS) -c -o $@ libconfig.c
+
+%_shr.o: %.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(SHOBJFLAGS) -c -o $@ $^
 
 libconfig.h: libconfig.h.in
 	cat $^ | $(CPP) $(CPPFLAGS) - | grep -v '^#' | grep -v '^ *$$' | sed 's/^!/#  /g;s/__BLANK_LINE__//' > $@
 
 test-lc: $(LIBS) test-lc.c

Index: aclocal.m4
==================================================================
--- aclocal.m4
+++ aclocal.m4
@@ -31,70 +31,41 @@
 			break
 		fi
 	done
 ])
 
-AC_DEFUN(DC_GET_SHOBJFLAGS, [
+dnl Usage:
+dnl    DC_TEST_SHOBJFLAGS(shobjflags, shobjldflags, action-if-not-found)
+dnl
+AC_DEFUN(DC_TEST_SHOBJFLAGS, [
   AC_SUBST(SHOBJFLAGS)
   AC_SUBST(SHOBJLDFLAGS)
 
-  AC_MSG_CHECKING(how to create shared objects)
   OLD_LDFLAGS="$LDFLAGS"
   SHOBJFLAGS=""
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff -rdynamic -fPIC"
-    AC_TRY_LINK([#include <stdio.h>
-int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-shared -Wl,-G,-z,textoff -fPIC"; SHOBJLDFLAGS="-rdynamic" ], SHOBJFLAGS="", SHOBJFLAGS="");
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff -rdynamic"
-    AC_TRY_LINK([#include <stdio.h>
-int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-shared -Wl,-G,-z,textoff"; SHOBJLDFLAGS="-rdynamic" ], SHOBJFLAGS="", SHOBJFLAGS="");
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff -fPIC"
-    AC_TRY_LINK([#include <stdio.h>
-int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-shared -Wl,-G,-z,textoff -fPIC"; SHOBJLDFLAGS="" ], SHOBJFLAGS="", SHOBJFLAGS="");
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff"
-    AC_TRY_LINK([#include <stdio.h>
-int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-shared -Wl,-G,-z,textoff"; SHOBJLDFLAGS="" ], SHOBJFLAGS="", SHOBJFLAGS="");
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff -rdynamic -fPIC"
-    AC_TRY_LINK([#include <stdio.h>
-int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-Wl,-G,-z,textoff -fPIC"; SHOBJLDFLAGS="-rdynamic" ], SHOBJFLAGS="", SHOBJFLAGS="");
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff -rdynamic"
-    AC_TRY_LINK([#include <stdio.h>
-int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-Wl,-G,-z,textoff"; SHOBJLDFLAGS="-rdynamic" ], SHOBJFLAGS="", SHOBJFLAGS="");
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff -fPIC"
-    AC_TRY_LINK([#include <stdio.h>
-int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-Wl,-G,-z,textoff -fPIC"; SHOBJLDFLAGS="" ], SHOBJFLAGS="", SHOBJFLAGS="");
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff"
-    AC_TRY_LINK([#include <stdio.h>
-int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-Wl,-G,-z,textoff"; SHOBJLDFLAGS="" ], SHOBJFLAGS="", SHOBJFLAGS="");
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$LDFLAGS -shared -rdynamic -fPIC"
-    AC_TRY_LINK([#include <stdio.h>
-int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-shared -fPIC"; SHOBJLDFLAGS="-rdynamic" ], SHOBJFLAGS="", SHOBJFLAGS="");
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -shared -fPIC"
-    AC_TRY_LINK([#include <stdio.h>
-int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-shared -fPIC"; SHOBJLDFLAGS="" ], SHOBJFLAGS="", SHOBJFLAGS="");
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -shared"
-    AC_TRY_LINK([#include <stdio.h>
-int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="-shared"; SHOBJLDFLAGS="" ], SHOBJFLAGS="", SHOBJFLAGS="");
-  fi
+
+  LDFLAGS="$OLD_LDFLAGS $1 $2"
+
+  AC_TRY_LINK([#include <stdio.h>
+int unrestst(void);], [ printf("okay\n"); unrestst(); return(0); ], [ SHOBJFLAGS="$1"; SHOBJLDFLAGS="$2" ], [
+  LDFLAGS="$OLD_LDFLAGS"
+  $3
+])
+
   LDFLAGS="$OLD_LDFLAGS"
+])
+
+AC_DEFUN(DC_GET_SHOBJFLAGS, [
+  AC_MSG_CHECKING(how to create shared objects)
+
+  DC_TEST_SHOBJFLAGS([-shared -fPIC], [-rdynamic], [
+    DC_TEST_SHOBJFLAGS([-shared -fPIC], [], [
+      DC_TEST_SHOBJFLAGS([-shared -fPIC], [-rdynamic -Wl,-G,-z,textoff], [
+        DC_TEST_SHOBJFLAGS([-shared -fPIC], [-Wl,-G,-z,textoff], [
+          AC_MSG_ERROR(cant)
+        ])
+      ])
+    ])
+  ])
+
   AC_MSG_RESULT($SHOBJLDFLAGS $SHOBJFLAGS)
 ])

Index: configure
==================================================================
--- configure
+++ configure
@@ -1,9 +1,9 @@
 #! /bin/sh
 # From configure.in Revision .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for libconfig 0.0.2.
+# Generated by GNU Autoconf 2.59 for libconfig 0.0.4.
 #
 # Copyright (C) 2003 Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
 ## --------------------- ##
@@ -266,12 +266,12 @@
 : ${ac_max_here_lines=38}
 
 # Identity of this package.
 PACKAGE_NAME='libconfig'
 PACKAGE_TARNAME='libconfig'
-PACKAGE_VERSION='0.0.2'
-PACKAGE_STRING='libconfig 0.0.2'
+PACKAGE_VERSION='0.0.4'
+PACKAGE_STRING='libconfig 0.0.4'
 PACKAGE_BUGREPORT=''
 
 # Factoring default headers for most tests.
 ac_includes_default="\
 #include <stdio.h>
@@ -776,11 +776,11 @@
 #
 if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libconfig 0.0.2 to adapt to many kinds of systems.
+\`configure' configures libconfig 0.0.4 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
 To assign environment variables (e.g., CC, CFLAGS...), specify them as
 VAR=VALUE.  See below for descriptions of some of the useful variables.
@@ -833,11 +833,11 @@
 _ACEOF
 fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libconfig 0.0.2:";;
+     short | recursive ) echo "Configuration of libconfig 0.0.4:";;
    esac
   cat <<\_ACEOF
 
 Some influential environment variables:
   CC          C compiler command
@@ -944,11 +944,11 @@
 fi
 
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-libconfig configure 0.0.2
+libconfig configure 0.0.4
 generated by GNU Autoconf 2.59
 
 Copyright (C) 2003 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
@@ -958,11 +958,11 @@
 exec 5>config.log
 cat >&5 <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libconfig $as_me 0.0.2, which was
+It was created by libconfig $as_me 0.0.4, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
 
 _ACEOF
@@ -15725,420 +15725,23 @@
 done
 
 
 
 
-
-
-
   echo "$as_me:$LINENO: checking how to create shared objects" >&5
 echo $ECHO_N "checking how to create shared objects... $ECHO_C" >&6
+
+
+
+
+
   OLD_LDFLAGS="$LDFLAGS"
   SHOBJFLAGS=""
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff -rdynamic -fPIC"
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdio.h>
-int unrestst(void);
-int
-main ()
-{
- printf("okay\n"); unrestst(); return(0);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-   SHOBJFLAGS="-shared -Wl,-G,-z,textoff -fPIC"; SHOBJLDFLAGS="-rdynamic"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-SHOBJFLAGS=""
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext;
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff -rdynamic"
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdio.h>
-int unrestst(void);
-int
-main ()
-{
- printf("okay\n"); unrestst(); return(0);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-   SHOBJFLAGS="-shared -Wl,-G,-z,textoff"; SHOBJLDFLAGS="-rdynamic"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-SHOBJFLAGS=""
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext;
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff -fPIC"
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdio.h>
-int unrestst(void);
-int
-main ()
-{
- printf("okay\n"); unrestst(); return(0);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-   SHOBJFLAGS="-shared -Wl,-G,-z,textoff -fPIC"; SHOBJLDFLAGS=""
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-SHOBJFLAGS=""
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext;
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -shared -Wl,-G,-z,textoff"
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdio.h>
-int unrestst(void);
-int
-main ()
-{
- printf("okay\n"); unrestst(); return(0);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-   SHOBJFLAGS="-shared -Wl,-G,-z,textoff"; SHOBJLDFLAGS=""
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-SHOBJFLAGS=""
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext;
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff -rdynamic -fPIC"
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdio.h>
-int unrestst(void);
-int
-main ()
-{
- printf("okay\n"); unrestst(); return(0);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-   SHOBJFLAGS="-Wl,-G,-z,textoff -fPIC"; SHOBJLDFLAGS="-rdynamic"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-SHOBJFLAGS=""
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext;
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff -rdynamic"
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdio.h>
-int unrestst(void);
-int
-main ()
-{
- printf("okay\n"); unrestst(); return(0);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-   SHOBJFLAGS="-Wl,-G,-z,textoff"; SHOBJLDFLAGS="-rdynamic"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-SHOBJFLAGS=""
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext;
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff -fPIC"
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdio.h>
-int unrestst(void);
-int
-main ()
-{
- printf("okay\n"); unrestst(); return(0);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-   SHOBJFLAGS="-Wl,-G,-z,textoff -fPIC"; SHOBJLDFLAGS=""
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-SHOBJFLAGS=""
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext;
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -Wl,-G,-z,textoff"
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdio.h>
-int unrestst(void);
-int
-main ()
-{
- printf("okay\n"); unrestst(); return(0);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"
-			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-   SHOBJFLAGS="-Wl,-G,-z,textoff"; SHOBJLDFLAGS=""
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-SHOBJFLAGS=""
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext;
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$LDFLAGS -shared -rdynamic -fPIC"
-    cat >conftest.$ac_ext <<_ACEOF
+
+  LDFLAGS="$OLD_LDFLAGS -shared -fPIC -rdynamic"
+
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
@@ -16177,18 +15780,23 @@
    SHOBJFLAGS="-shared -fPIC"; SHOBJLDFLAGS="-rdynamic"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-SHOBJFLAGS=""
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext;
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -shared -fPIC"
-    cat >conftest.$ac_ext <<_ACEOF
+
+  LDFLAGS="$OLD_LDFLAGS"
+
+
+
+
+
+  OLD_LDFLAGS="$LDFLAGS"
+  SHOBJFLAGS=""
+
+  LDFLAGS="$OLD_LDFLAGS -shared -fPIC "
+
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
@@ -16227,18 +15835,78 @@
    SHOBJFLAGS="-shared -fPIC"; SHOBJLDFLAGS=""
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-SHOBJFLAGS=""
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext;
-  fi
-  if test -z "$SHOBJFLAGS"; then
-    LDFLAGS="$OLD_LDFLAGS -shared"
-    cat >conftest.$ac_ext <<_ACEOF
+
+  LDFLAGS="$OLD_LDFLAGS"
+
+
+
+
+
+  OLD_LDFLAGS="$LDFLAGS"
+  SHOBJFLAGS=""
+
+  LDFLAGS="$OLD_LDFLAGS -shared -fPIC -rdynamic -Wl,-G,-z,textoff"
+
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdio.h>
+int unrestst(void);
+int
+main ()
+{
+ printf("okay\n"); unrestst(); return(0);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+   SHOBJFLAGS="-shared -fPIC"; SHOBJLDFLAGS="-rdynamic -Wl,-G,-z,textoff"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+  LDFLAGS="$OLD_LDFLAGS"
+
+
+
+
+
+  OLD_LDFLAGS="$LDFLAGS"
+  SHOBJFLAGS=""
+
+  LDFLAGS="$OLD_LDFLAGS -shared -fPIC -Wl,-G,-z,textoff"
+
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
@@ -16272,21 +15940,54 @@
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-   SHOBJFLAGS="-shared"; SHOBJLDFLAGS=""
+   SHOBJFLAGS="-shared -fPIC"; SHOBJLDFLAGS="-Wl,-G,-z,textoff"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-SHOBJFLAGS=""
+
+  LDFLAGS="$OLD_LDFLAGS"
+
+          { { echo "$as_me:$LINENO: error: cant" >&5
+echo "$as_me: error: cant" >&2;}
+   { (exit 1); exit 1; }; }
+
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+
+  LDFLAGS="$OLD_LDFLAGS"
+
+
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+
+  LDFLAGS="$OLD_LDFLAGS"
+
+
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+
+  LDFLAGS="$OLD_LDFLAGS"
+
+
+
 fi
 rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext;
-  fi
+      conftest$ac_exeext conftest.$ac_ext
+
   LDFLAGS="$OLD_LDFLAGS"
+
+
   echo "$as_me:$LINENO: result: $SHOBJLDFLAGS $SHOBJFLAGS" >&5
 echo "${ECHO_T}$SHOBJLDFLAGS $SHOBJFLAGS" >&6
 
 
                                                             ac_config_files="$ac_config_files Makefile lc_geterrno.3 lc_process.3 lc_register_var.3 lc_geterrstr.3 lc_register_callback.3"
@@ -16650,11 +16351,11 @@
 ## Running $as_me. ##
 _ASBOX
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by libconfig $as_me 0.0.2, which was
+This file was extended by libconfig $as_me 0.0.4, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
   CONFIG_LINKS    = $CONFIG_LINKS
@@ -16710,11 +16411,11 @@
 Report bugs to <bug-autoconf@gnu.org>."
 _ACEOF
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-libconfig config.status 0.0.2
+libconfig config.status 0.0.4
 configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
 Copyright (C) 2003 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation

Index: libconfig.h.in
==================================================================
--- libconfig.h.in
+++ libconfig.h.in
@@ -13,12 +13,12 @@
 } lc_conf_type_t;
 
 __BLANK_LINE__
 
 typedef enum {
-        LC_VAR_UNKNOWN,			/* Requires no arguments. */
-        LC_VAR_NONE,			/* Requires no arguments. */
+        LC_VAR_UNKNOWN,
+        LC_VAR_NONE,
         LC_VAR_STRING,
         LC_VAR_LONG_LONG,
         LC_VAR_LONG,
         LC_VAR_INT,
         LC_VAR_SHORT,
@@ -32,18 +32,19 @@
         LC_VAR_TIME,
         LC_VAR_DATE,
         LC_VAR_SECTION,
         LC_VAR_SECTIONSTART,
         LC_VAR_SECTIONEND,
-	LC_VAR_BOOL_BY_EXISTANCE	/* Requires no arguments. */
+        LC_VAR_BOOL_BY_EXISTANCE
 } lc_var_type_t;
 
 __BLANK_LINE__
 
 typedef enum {
         LC_FLAGS_VAR,
         LC_FLAGS_CMDLINE,
+        LC_FLAGS_ENVIRON,
         LC_FLAGS_SECTIONSTART,
         LC_FLAGS_SECTIONEND
 } lc_flags_t;
 
 __BLANK_LINE__