* configure.ac: Pass on original CPPFLAGS to config.mak.

* config/objc-con-autoload.m4: Test for constructors directly.
* config/objc-sys-dynamic.m4: Check for dl lib if we are using dladdr.

* Source/objc-load.m (objc_get_uninstalled_dtable): Remove unused.

* Source/Additions/GSXML.m (unparsedEntityDeclFunction): Add block
around START so it will compile on GCC 2.

* Testing/nsbundle.m: Errors to stdout.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16836 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2003-05-30 02:50:28 +00:00
parent 49667f3514
commit 8217aaae40
8 changed files with 143 additions and 120 deletions

View file

@ -1,3 +1,16 @@
2003-05-29 Adam Fedor <fedor@gnu.org>
* configure.ac: Pass on original CPPFLAGS to config.mak.
* config/objc-con-autoload.m4: Test for constructors directly.
* config/objc-sys-dynamic.m4: Check for dl lib if we are using dladdr.
* Source/objc-load.m (objc_get_uninstalled_dtable): Remove unused.
* Source/Additions/GSXML.m (unparsedEntityDeclFunction): Add block
around START so it will compile on GCC 2.
* Testing/nsbundle.m: Errors to stdout.
2003-05-26 Adam Fedor <fedor@gnu.org>
* Testing/Makefile.postamble (check): Define to run all

View file

@ -2707,7 +2707,8 @@ unparsedEntityDeclFunction(void *ctx, const unsigned char *name,
public: UTF8Str(publicId)
system: UTF8Str(systemId)
notationName: UTF8Str(notationName)];
START(unparsedEntityDecl:public:system:notationName:, void, (id,SEL,id,id,id,id));
{
START(unparsedEntityDecl:public:system:notationName:, void, (id,SEL,id,id,id,id));
if (imp != treeImp)
{
@ -2718,6 +2719,7 @@ unparsedEntityDeclFunction(void *ctx, const unsigned char *name,
{
TREEFUN(unparsedEntityDecl, (ctx,name,publicId,systemId,notationName));
}
}
}
static void

View file

@ -53,23 +53,6 @@
/* include the interface to the dynamic linker */
#include "dynamic-load.h"
/* From the objc runtime -- needed when invalidating the dtable */
#ifndef NeXT_RUNTIME
extern void __objc_install_premature_dtable(Class);
extern void sarray_free(struct sarray*);
#ifndef HAVE_OBJC_GET_UNINSTALLED_DTABLE
#ifndef objc_EXPORT
#define objc_EXPORT export
#endif
objc_EXPORT void *__objc_uninstalled_dtable;
static void *
objc_get_uninstalled_dtable()
{
return __objc_uninstalled_dtable;
}
#endif
#endif /* ! NeXT */
/* Declaration from NSBundle.m */
const char *objc_executable_location (void);

View file

@ -39,7 +39,7 @@ main(int argc, char *argv[], char **env)
printf(" Executable is in %s\n", [path cString]);
path = [NSBundle _absolutePathOfExecutable: path];
if (!path) {
fprintf(stderr, "* ERROR: Can't find executable\n");
fprintf(stdout, "* ERROR: Can't find executable\n");
exit(1);
}
printf(" Full directory is %s\n", [path cString]);
@ -54,7 +54,7 @@ main(int argc, char *argv[], char **env)
path = [NSBundle pathForResource:@"LoadMe" ofType:@"bundle"
inDirectory: path];
if (!path) {
fprintf(stderr, "* ERROR: Can't find LoadMe bundle\n");
fprintf(stdout, "* ERROR: Can't find LoadMe bundle\n");
exit(1);
}
printf(" Found LoadMe in: %s\n\n", [path cString]);
@ -62,12 +62,12 @@ main(int argc, char *argv[], char **env)
printf("Initializing LoadMe bundle...\n");
bundle = [[NSBundle alloc] initWithPath:path];
if (!bundle) {
fprintf(stderr, "* ERROR: Can't init LoadMe bundle\n");
fprintf(stdout, "* ERROR: Can't init LoadMe bundle\n");
exit(1);
}
path = [bundle pathForResource:@"NXStringTable" ofType:@"example"];
if (!path) {
fprintf(stderr, "* ERROR: Can't find example in LoadMe bundle\n");
fprintf(stdout, "* ERROR: Can't find example in LoadMe bundle\n");
exit(1);
}
printf(" Found example file: %s\n\n", [path cString]);
@ -77,29 +77,43 @@ main(int argc, char *argv[], char **env)
object = [bundle principalClass];
NS_HANDLER
object = nil;
fprintf(stderr, " ERROR: %s\n", [[localException reason] cString]);
fprintf(stderr, " Either there is a problem with dynamic loading,\n");
fprintf(stderr, " or there is no dynamic loader on your system\n");
fprintf(stdout, " ERROR: %s\n", [[localException reason] cString]);
fprintf(stdout, " Either there is a problem with dynamic loading,\n");
fprintf(stdout, " or there is no dynamic loader on your system\n");
exit(1);
NS_ENDHANDLER
if (!object) {
fprintf(stderr, "* ERROR: Can't find principal class\n");
exit(1);
}
printf(" Principal class is: %s\n", object_get_class_name (object));
if (!object)
{
printf("* ERROR: Can't find principal class\n");
}
else
printf(" Principal class is: %s\n", object_get_class_name (object));
printf("Testing LoadMe bundle classes...\n");
printf(" This is LoadMe:\n");
object = [[[bundle classNamed:@"LoadMe"] alloc] init];
[object afterLoad];
[object release];
if (!object)
{
printf("* ERROR: Can't find LoadMe class\n");
}
else
{
[object afterLoad];
[object release];
}
printf("\n This is SecondClass:\n");
object = [[[bundle classNamed:@"SecondClass"] alloc] init];
[object printName];
[object printMyName];
[object release];
if (!object)
{
printf("* ERROR: Can't find SecondClass class\n");
}
else
{
[object printName];
[object printMyName];
[object release];
}
[arp release];
return 0;
}

View file

@ -15,23 +15,18 @@ AC_DEFUN(OBJC_CON_AUTOLOAD,
[dnl
AC_MSG_CHECKING(loading of constructor functions)
AC_CACHE_VAL(objc_cv_con_autoload,
[dnl
cat > conftest.constructor.c <<EOF
void cons_functions() __attribute__ ((constructor));
void cons_functions() {}
int main()
{
return 0;
}
EOF
${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.constructor.$ac_ext $LIBS 1>&5
[dnl
AC_TRY_RUN([static int loaded = 0;
void cons_functions() __attribute__ ((constructor));
void cons_functions() { loaded = 1; }
int main()
{
return ( (loaded == 1) ? 0 : 1);
}],
objc_cv_con_autoload=yes, objc_cv_con_autoload=no,
objc_cv_con_autoload=no)
case "$target_os" in
cygwin*) objc_cv_con_autoload=yes;;
*) if test -n "`nm conftest${ac_exeext} | grep global_ctors`"; then
objc_cv_con_autoload=yes
else
objc_cv_con_autoload=no
fi ;;
esac
])
if test $objc_cv_con_autoload = yes; then

View file

@ -26,18 +26,7 @@ AC_MSG_CHECKING([for dynamic linker type])
AC_MSG_RESULT([$DYNAMIC_LINKER])
if test $DYNAMIC_LINKER = simple; then
AC_MSG_CHECKING([checking if dladdr() is available])
old_LDFLAGS="$LDFLAGS"
case "$target_os" in
linux-gnu*) LDFLAGS="$old_LDFLAGS -ldl";;
solaris*) LDFLAGS="$old_LDFLAGS -ldl";;
sysv4.2*) LDFLAGS="$old_LDFLAGS -ldl";;
esac
AC_TRY_LINK([#include <dlfcn.h>], dladdr(0,0);,
AC_DEFINE(HAVE_DLADDR,1, [Define if you have dladdr])
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]))
LDFLAGS="$old_LDFLAGS"
AC_CHECK_LIB(dl, dladdr)
fi
AC_SUBST(DYNAMIC_LINKER)dnl

122
configure vendored
View file

@ -2336,16 +2336,15 @@ fi
#--------------------------------------------------------------------
# specific target_os options
#--------------------------------------------------------------------
# CPPFLAGS are not used anywhere except during configuration. If they
# are needed, they should have been set when configuring gnustep-make
# INCLUDE_FLAGS will go into base.make(CONFIG_SYSTEM_INCL)
INCLUDE_FLAGS=""
INCLUDE_FLAGS="$CPPFLAGS"
LIBS="$LDFLAGS $LIBS"
# This is just for configuring. Later, in config.make, INCLUDE_FLAGS
# goes in CONFIG_SYSTEM_INCL and LIBS goes in CONFIG_SYSTEM_LIBS
case "$target_os" in
freebsd*) CPPFLAGS="$CPPFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib";;
netbsd*) CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
LDFLAGS="$LDFLAGS -L/usr/pkg/lib";;
esac
#----------------------------------------------------------------
@ -5849,22 +5848,43 @@ echo $ECHO_N "checking loading of constructor functions... $ECHO_C" >&6
if test "${objc_cv_con_autoload+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat > conftest.constructor.c <<EOF
void cons_functions() __attribute__ ((constructor));
void cons_functions() {}
int main()
{
return 0;
}
EOF
${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.constructor.$ac_ext $LIBS 1>&5
if test "$cross_compiling" = yes; then
objc_cv_con_autoload=no
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
static int loaded = 0;
void cons_functions() __attribute__ ((constructor));
void cons_functions() { loaded = 1; }
int main()
{
return ( (loaded == 1) ? 0 : 1);
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./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
objc_cv_con_autoload=yes
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
( exit $ac_status )
objc_cv_con_autoload=no
fi
rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
case "$target_os" in
cygwin*) objc_cv_con_autoload=yes;;
*) if test -n "`nm conftest${ac_exeext} | grep global_ctors`"; then
objc_cv_con_autoload=yes
else
objc_cv_con_autoload=no
fi ;;
esac
fi
@ -6329,18 +6349,25 @@ echo "$as_me:$LINENO: result: $DYNAMIC_LINKER" >&5
echo "${ECHO_T}$DYNAMIC_LINKER" >&6
if test $DYNAMIC_LINKER = simple; then
echo "$as_me:$LINENO: checking checking if dladdr() is available" >&5
echo $ECHO_N "checking checking if dladdr() is available... $ECHO_C" >&6
old_LDFLAGS="$LDFLAGS"
case "$target_os" in
linux-gnu*) LDFLAGS="$old_LDFLAGS -ldl";;
solaris*) LDFLAGS="$old_LDFLAGS -ldl";;
sysv4.2*) LDFLAGS="$old_LDFLAGS -ldl";;
esac
cat >conftest.$ac_ext <<_ACEOF
echo "$as_me:$LINENO: checking for dladdr in -ldl" >&5
echo $ECHO_N "checking for dladdr in -ldl... $ECHO_C" >&6
if test "${ac_cv_lib_dl_dladdr+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <dlfcn.h>
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char dladdr ();
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
@ -6350,7 +6377,7 @@ echo $ECHO_N "checking checking if dladdr() is available... $ECHO_C" >&6
int
main ()
{
dladdr(0,0);
dladdr ();
;
return 0;
}
@ -6367,21 +6394,26 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_DLADDR 1
_ACEOF
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
ac_cv_lib_dl_dladdr=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
ac_cv_lib_dl_dladdr=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LDFLAGS="$old_LDFLAGS"
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dladdr" >&5
echo "${ECHO_T}$ac_cv_lib_dl_dladdr" >&6
if test $ac_cv_lib_dl_dladdr = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBDL 1
_ACEOF
LIBS="-ldl $LIBS"
fi
fi
@ -9767,7 +9799,6 @@ else
fi
if test "$zlib_ok" = yes; then
base_libs="$LIBS"
LIBS="$LIBS -lz"
USE_ZLIB=1
fi
@ -11901,7 +11932,6 @@ fi
fi
if test "$gmp_ok" = yes; then
base_libs="$LIBS"
LIBS="$LIBS -lgmp"
USE_GMP=1
fi
@ -12003,11 +12033,11 @@ if test "${with_libiconv_library+set}" = set; then
else
libiconv_libdir="no"
fi;
cppflags_temp="$CPPFLAGS"
ldflags_temp="$LDFLAGS"
if test "$libiconv_libdir" != "no"; then
CPPFLAGS="$CPPFLAGS -L$libiconv_libdir"
INCLUDE_FLAGS="$INCLUDE_FLAGS -L$libiconv_libdir"
LDFLAGS="$LDFLAGS -L$libiconv_libdir"
LIBS="$LIBS -L$libiconv_libdir"
fi
# BSDs install this lib as libgiconv
@ -12149,7 +12179,7 @@ _ACEOF
fi
fi
CPPFLAGS="$cppflags_temp"
LDFLAGS="$ldflags_temp"
fi

View file

@ -60,16 +60,15 @@ AC_PATH_PROG(WHOAMI, whoami, echo, $PATH:/usr/ucb)
#--------------------------------------------------------------------
# specific target_os options
#--------------------------------------------------------------------
# CPPFLAGS are not used anywhere except during configuration. If they
# are needed, they should have been set when configuring gnustep-make
# INCLUDE_FLAGS will go into base.make(CONFIG_SYSTEM_INCL)
INCLUDE_FLAGS=""
INCLUDE_FLAGS="$CPPFLAGS"
LIBS="$LDFLAGS $LIBS"
# This is just for configuring. Later, in config.make, INCLUDE_FLAGS
# goes in CONFIG_SYSTEM_INCL and LIBS goes in CONFIG_SYSTEM_LIBS
case "$target_os" in
freebsd*) CPPFLAGS="$CPPFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib";;
netbsd*) CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
LDFLAGS="$LDFLAGS -L/usr/pkg/lib";;
esac
#----------------------------------------------------------------
@ -618,7 +617,6 @@ AC_CHECK_HEADERS(zlib.h)
if test $ac_cv_header_zlib_h = yes; then
AC_CHECK_LIB(z, gzseek, zlib_ok=yes, zlib_ok=no)
if test "$zlib_ok" = yes; then
base_libs="$LIBS"
LIBS="$LIBS -lz"
USE_ZLIB=1
fi
@ -959,7 +957,6 @@ if test $ac_cv_header_gmp_h = yes; then
AC_CHECK_LIB(gmp, __gmpf_abs, gmp_ok=yes, gmp_ok=no)
fi
if test "$gmp_ok" = yes; then
base_libs="$LIBS"
LIBS="$LIBS -lgmp"
USE_GMP=1
fi
@ -981,11 +978,11 @@ if test $ac_cv_func_iconv = no; then
AC_ARG_WITH(libiconv-library,
[ --with-libiconv-library=PATH library path for libiconv libraries],
libiconv_libdir="$withval", libiconv_libdir="no")
cppflags_temp="$CPPFLAGS"
ldflags_temp="$LDFLAGS"
if test "$libiconv_libdir" != "no"; then
CPPFLAGS="$CPPFLAGS -L$libiconv_libdir"
INCLUDE_FLAGS="$INCLUDE_FLAGS -L$libiconv_libdir"
LDFLAGS="$LDFLAGS -L$libiconv_libdir"
LIBS="$LIBS -L$libiconv_libdir"
fi
# BSDs install this lib as libgiconv
@ -999,7 +996,7 @@ if test $ac_cv_func_iconv = no; then
AC_DEFINE(HAVE_ICONV,1, [Define if you have this function])
fi
fi
CPPFLAGS="$cppflags_temp"
LDFLAGS="$ldflags_temp"
fi
AC_SUBST(INCLUDE_FLAGS)