Index: aclocal.m4 ================================================================== --- aclocal.m4 +++ aclocal.m4 @@ -67,12 +67,18 @@ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -mimpure-text], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic -Wl,-G,-z,textoff], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -Wl,-G,-z,textoff], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -dynamiclib -flat_namespace -undefined suppress -bind_at_load], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib -flat_namespace -undefined suppress -bind_at_load], [ - AC_MSG_RESULT(cant) - AC_MSG_ERROR([We are unable to make shared objects.]) + DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-Wl,-dynamiclib -Wl,-flat_namespace -Wl,-undefined,suppress -Wl,-bind_at_load], [ + DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamic -flat_namespace -undefined suppress], [ + DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamic], [ + AC_MSG_RESULT(cant) + AC_MSG_ERROR([We are unable to make shared objects.]) + ]) + ]) + ]) ]) ]) ]) ]) ]) @@ -182,11 +188,11 @@ fi if test -n "$6"; then AC_DEFINE($6, [1], [Define to 1 if you have $2 from $5]) fi LDFLAGS="$LDFLAGS $LIBSPECFLAGS" - LIBS="$LIBS -l$1" + LIBS="-l$1 $LIBS" ], [ CFLAGS="$OLDCFLAGS" CPPFLAGS="$OLDCPPFLAGS" AC_MSG_ERROR(Could not find $3) ]) @@ -194,5 +200,23 @@ AC_MSG_ERROR(Could not find $5) ], $LIBSPECFLAGS) ;; esac ]) + +AC_DEFUN(DC_ASK_SMALL, [ + SMALL=0 + AC_ARG_ENABLE(small, AC_HELP_STRING([--enable-small], [Enable small build of libconfig. (disabled)]), [ + case $enableval in + yes) + SMALL=1 + ;; + esac + ]) + + if test $SMALL = 0; then + dnl Use opennet if it's available AND not small + DC_ASK_OPTLIB(opennet, fopen_net, opennet.h, [ Enable opennet support (auto)], libopennet, HAVE_LIBOPENNET, HAVE_OPENNET_H) + else + AC_DEFINE(ENABLE_SMALL, [1], [Define to 1 if you want to produce a minimalistic build.]) + fi +]) Index: build/build_win32.sh ================================================================== --- build/build_win32.sh +++ build/build_win32.sh @@ -1,10 +1,10 @@ #! /bin/sh if [ ! -x configure ]; then cd ../; fi WIN32="${HOME}/root/windows-i386" -CFLAGS="-I${WIN32}/include" +CFLAGS="-I${WIN32}/include -march=i386" CPPFLAGS="${CFLAGS}" LDFLAGS="-L${WIN32}/lib" DATE="`date +%Y%m%d%H%M`" CROSS=i586-mingw32msvc if [ ! -z "${CROSS}" ]; then Index: config.h.in ================================================================== --- config.h.in +++ config.h.in @@ -1,6 +1,9 @@ /* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you want to produce a minimalistic build. */ +#undef ENABLE_SMALL /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H /* Define to 1 if you have the header file. */ Index: configure ================================================================== --- configure +++ configure @@ -1,9 +1,9 @@ #! /bin/sh # From configure.ac Revision . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for libconfig 0.1.14. +# Generated by GNU Autoconf 2.59 for libconfig 0.1.15. # # 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.1.14' -PACKAGE_STRING='libconfig 0.1.14' +PACKAGE_VERSION='0.1.15' +PACKAGE_STRING='libconfig 0.1.15' PACKAGE_BUGREPORT='' # Factoring default headers for most tests. ac_includes_default="\ #include @@ -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.1.14 to adapt to many kinds of systems. +\`configure' configures libconfig 0.1.15 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. @@ -837,18 +837,23 @@ _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libconfig 0.1.14:";; + short | recursive ) echo "Configuration of libconfig 0.1.15:";; esac cat <<\_ACEOF +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-small Enable small build of libconfig. (disabled) + Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-libopennet Enable opennet support + --with-libopennet Enable opennet support (auto) Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a @@ -953,11 +958,11 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -libconfig configure 0.1.14 +libconfig configure 0.1.15 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. @@ -967,11 +972,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.1.14, which was +It was created by libconfig $as_me 0.1.15, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF @@ -15228,10 +15233,25 @@ fi done + SMALL=0 + # Check whether --enable-small or --disable-small was given. +if test "${enable_small+set}" = set; then + enableval="$enable_small" + + case $enableval in + yes) + SMALL=1 + ;; + esac + +fi; + + if test $SMALL = 0; then + # Check whether --with-libopennet or --without-libopennet was given. if test "${with_libopennet+set}" = set; then withval="$with_libopennet" @@ -15708,11 +15728,11 @@ #define HAVE_LIBOPENNET 1 _ACEOF fi LDFLAGS="$LDFLAGS $LIBSPECFLAGS" - LIBS="$LIBS -lopennet" + LIBS="-lopennet $LIBS" else CFLAGS="$OLDCFLAGS" CPPFLAGS="$OLDCPPFLAGS" @@ -15732,10 +15752,18 @@ fi ;; esac + + else + +cat >>confdefs.h <<\_ACEOF +#define ENABLE_SMALL 1 +_ACEOF + + fi @@ -16336,15 +16364,204 @@ sed 's/^/| /' conftest.$ac_ext >&5 LDFLAGS="$OLD_LDFLAGS" - echo "$as_me:$LINENO: result: cant" >&5 + + + + + OLD_LDFLAGS="$LDFLAGS" + SHOBJFLAGS="" + + LDFLAGS="$OLD_LDFLAGS -fPIC -DPIC -Wl,-dynamiclib -Wl,-flat_namespace -Wl,-undefined,suppress -Wl,-bind_at_load" + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +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="-fPIC -DPIC"; SHOBJLDFLAGS="-Wl,-dynamiclib -Wl,-flat_namespace -Wl,-undefined,suppress -Wl,-bind_at_load" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + LDFLAGS="$OLD_LDFLAGS" + + + + + + OLD_LDFLAGS="$LDFLAGS" + SHOBJFLAGS="" + + LDFLAGS="$OLD_LDFLAGS -fPIC -DPIC -dynamic -flat_namespace -undefined suppress" + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +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="-fPIC -DPIC"; SHOBJLDFLAGS="-dynamic -flat_namespace -undefined suppress" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + LDFLAGS="$OLD_LDFLAGS" + + + + + + OLD_LDFLAGS="$LDFLAGS" + SHOBJFLAGS="" + + LDFLAGS="$OLD_LDFLAGS -fPIC -DPIC -dynamic" + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +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="-fPIC -DPIC"; SHOBJLDFLAGS="-dynamic" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + LDFLAGS="$OLD_LDFLAGS" + + echo "$as_me:$LINENO: result: cant" >&5 echo "${ECHO_T}cant" >&6 - { { echo "$as_me:$LINENO: error: We are unable to make shared objects." >&5 + { { echo "$as_me:$LINENO: error: We are unable to make shared objects." >&5 echo "$as_me: error: We are unable to make shared objects." >&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 @@ -17233,11 +17450,11 @@ ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by libconfig $as_me 0.1.14, which was +This file was extended by libconfig $as_me 0.1.15, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS @@ -17293,11 +17510,11 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -libconfig config.status 0.1.14 +libconfig config.status 0.1.15 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: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1,7 +1,7 @@ AC_REVISION($Revision $) -AC_INIT(libconfig, 0.1.14) +AC_INIT(libconfig, 0.1.15) AC_CONFIG_HEADER(config.h) dnl Find out about the host OS DC_CHK_OS_INFO @@ -19,12 +19,13 @@ DC_DO_TYPE(uint32_t, unsigned, 4) DC_DO_TYPE(int32_t, signed, 4) DC_DO_TYPE(uint16_t, unsigned, 2) DC_DO_TYPE(int16_t, signed, 2) -dnl Use opennet if it's available -DC_ASK_OPTLIB(opennet, fopen_net, opennet.h, [ Enable opennet support], libopennet, HAVE_LIBOPENNET, HAVE_OPENNET_H) +dnl This will cause optional libraries to be disabled even if they're +dnl available and specified. +DC_ASK_SMALL dnl Checks for Win32 specific things. DC_DO_WIN32 dnl Get shared objects flags, calls DC_SYNC_SHLIBOBJS but if libobjs is Index: libconfig.c ================================================================== --- libconfig.c +++ libconfig.c @@ -335,10 +335,11 @@ return(-1); } static int lc_process_environment(const char *appname) { +#ifndef ENABLE_SMALL struct lc_varhandler_st *handler = NULL; size_t appnamelen = 0; char varnamebuf[128] = {0}; char **currvar; char *sep = NULL, *value = NULL, *cmd = NULL; @@ -450,10 +451,11 @@ } } free(ucase_appname); +#endif return(0); } static int lc_process_cmdline(int argc, char **argv) { struct lc_varhandler_st *handler = NULL; Index: libconfig.spec ================================================================== --- libconfig.spec +++ libconfig.spec @@ -12,11 +12,11 @@ %description libconfig is common configuration file parsing library. %prep -%setup +%setup -q %build ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var || exit 1 make