From 563fbed02c1fc4bdf43f261548a2c3f47a426ed2 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Tue, 26 Jun 2001 06:01:47 +0000 Subject: More merges: 14973,14976, and some whitespace. --- aczsh.m4 | 173 ++++++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 132 insertions(+), 41 deletions(-) (limited to 'aczsh.m4') diff --git a/aczsh.m4 b/aczsh.m4 index 9ebb275c6..4ac1f6f2e 100644 --- a/aczsh.m4 +++ b/aczsh.m4 @@ -84,6 +84,7 @@ dnl specified directly as --enable-lfs="long long". dnl Sets the variable given in the second argument to the first argument dnl if the test worked, `no' otherwise. Be careful testing this, as it dnl may produce two words `long long' on an unquoted substitution. +dnl Also check that the compiler does not mind it being cast to int. dnl This macro does not produce messages as it may be run several times dnl before finding the right type. dnl @@ -97,6 +98,7 @@ AC_DEFUN(zsh_64_BIT_TYPE, main() { $1 foo = 0; + int bar = (int) foo; return sizeof($1) != 8; } ], $2="$1", $2=no, @@ -109,36 +111,63 @@ main() dnl -dnl zsh_SYS_DYNAMIC_BROKEN -dnl Check whether static/shared library linking is broken. +dnl zsh_SHARED_FUNCTION +dnl +dnl This is just a frontend to zsh_SHARED_SYMBOL +dnl +dnl Usage: zsh_SHARED_FUNCTION(name[,rettype[,paramtype]]) +dnl + +AC_DEFUN(zsh_SHARED_FUNCTION, +[zsh_SHARED_SYMBOL($1, ifelse([$2], ,[int ],[$2]) $1 [(]ifelse([$3], ,[ ],[$3])[)], $1)]) + +dnl +dnl zsh_SHARED_VARIABLE +dnl +dnl This is just a frontend to zsh_SHARED_SYMBOL +dnl +dnl Usage: zsh_SHARED_VARIABLE(name[,type]) +dnl + +AC_DEFUN(zsh_SHARED_VARIABLE, +[zsh_SHARED_SYMBOL($1, ifelse([$2], ,[int ],[$2]) $1, [&$1])]) + +dnl +dnl zsh_SHARED_SYMBOL +dnl Check whether symbol is available in static or shared library dnl dnl On some systems, static modifiable library symbols (such as environ) dnl may appear only in statically linked libraries. If this is the case, dnl then two shared libraries that reference the same symbol, each linked dnl with the static library, could be given distinct copies of the symbol. -dnl If this is the case then dynamic linking is FUBAR. +dnl +dnl Usage: zsh_SHARED_SYMBOL(name,declaration,address) +dnl Sets zsh_cv_shared_$1 cache variable to yes/no dnl -AC_DEFUN(zsh_SYS_DYNAMIC_BROKEN, -[AC_CACHE_CHECK([if static/shared library linking is broken], -zsh_cv_sys_dynamic_broken, +AC_DEFUN(zsh_SHARED_SYMBOL, +[AC_CACHE_CHECK([if $1 is available in shared libraries], +zsh_cv_shared_$1, [if test "$zsh_cv_func_dlsym_needs_underscore" = yes; then us=_ else us= fi echo ' - extern char **environ; - void *symlist1[[]] = { - (void *)&environ, - (void *)0 - }; +void *zsh_getaddr1() +{ +#ifdef __CYGWIN__ + __attribute__((__dllimport__)) +#endif + extern $2; + return $3; +}; ' > conftest1.c -sed 's/symlist1/symlist2/' < conftest1.c > conftest2.c -if $CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&5 2>&5 && -$DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&5 2>&5 && -$CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&5 2>&5 && -$DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&5 2>&5; then +sed 's/zsh_getaddr1/zsh_getaddr2/' < conftest1.c > conftest2.c +if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) && +AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AC_FD_CC) && +AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AC_FD_CC) && +AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AC_FD_CC); then AC_TRY_RUN([ #ifdef HPUXDYNAMIC #include @@ -170,25 +199,33 @@ char *zsh_gl_sym_addr ; main() { void *handle1, *handle2; - void **symlist1, **symlist2; + void *(*zsh_getaddr1)(), *(*zsh_getaddr2)(); + void *sym1, *sym2; handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); if(!handle1) exit(1); handle2 = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); if(!handle2) exit(1); - symlist1 = (void **) dlsym(handle1, "${us}symlist1"); - symlist2 = (void **) dlsym(handle2, "${us}symlist2"); - if(!symlist1 || !symlist2) exit(1); - for(; *symlist1; symlist1++, symlist2++) - if(*symlist1 != *symlist2) - exit(1); + zsh_getaddr1 = (void *(*)()) dlsym(handle1, "${us}zsh_getaddr1"); + zsh_getaddr2 = (void *(*)()) dlsym(handle2, "${us}zsh_getaddr2"); + sym1 = zsh_getaddr1(); + sym2 = zsh_getaddr2(); + if(!sym1 || !sym2) exit(1); + if(sym1 != sym2) exit(1); + dlclose(handle1); + handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); + if(!handle1) exit(1); + zsh_getaddr1 = (void *(*)()) dlsym(handle1, "${us}zsh_getaddr1"); + sym1 = zsh_getaddr1(); + if(!sym1) exit(1); + if(sym1 != sym2) exit(1); exit(0); } -], [zsh_cv_sys_dynamic_broken=no], -[zsh_cv_sys_dynamic_broken=yes], -[zsh_cv_sys_dynamic_broken=yes] +], [zsh_cv_shared_$1=yes], +[zsh_cv_shared_$1=no], +[zsh_cv_shared_$1=no] ) else - zsh_cv_sys_dynamic_broken=yes + zsh_cv_shared_$1=no fi ]) ]) @@ -208,10 +245,10 @@ else fi echo 'int fred () { return 42; }' > conftest1.c echo 'int fred () { return 69; }' > conftest2.c -if $CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&5 2>&5 && -$DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&5 2>&5 && -$CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&5 2>&5 && -$DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&5 2>&5; then +if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) && +AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AC_FD_CC) && +AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AC_FD_CC) && +AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AC_FD_CC); then AC_TRY_RUN([ #ifdef HPUXDYNAMIC #include @@ -283,10 +320,10 @@ else fi echo 'int fred () { return 42; }' > conftest1.c echo 'extern int fred(); int barney () { return fred() + 27; }' > conftest2.c -if $CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&5 2>&5 && -$DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&5 2>&5 && -$CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&5 2>&5 && -$DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&5 2>&5; then +if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) && +AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AC_FD_CC) && +AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&AC_FD_CC) && +AC_TRY_COMMAND($DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&AC_FD_CC); then AC_TRY_RUN([ #ifdef HPUXDYNAMIC #include @@ -353,8 +390,8 @@ else us= fi echo 'extern int fred(); int barney () { return fred() + 27; }' > conftest1.c -if $CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&5 2>&5 && -$DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&5 2>&5; then +if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) && +AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AC_FD_CC); then save_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" AC_TRY_RUN([ @@ -426,8 +463,8 @@ elif us= fi echo 'extern int fred(); int barney() { return fred() + 27; }' > conftest1.c - $CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&5 2>&5 && - $DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&5 2>&5; then + AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) && + AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&AC_FD_CC); then save_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS -s" AC_TRY_RUN([ @@ -495,8 +532,8 @@ else us= fi echo 'int fred () { return 42; }' > conftest1.c -if $CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&5 2>&5 && -$DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS -s conftest1.o $LIBS 1>&5 2>&5; then +if AC_TRY_COMMAND($CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&AC_FD_CC) && +AC_TRY_COMMAND($DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS -s conftest1.o $LIBS 1>&AC_FD_CC); then AC_TRY_RUN([ #ifdef HPUXDYNAMIC #include @@ -620,3 +657,57 @@ tzsh=`echo ${tzsh_name} | sed -f conftestsed` rm -f conftestsed AC_SUBST(tzsh)dnl ]) + +AC_DEFUN(zsh_COMPILE_FLAGS, + [AC_ARG_ENABLE(cppflags, + [ --enable-cppflags=... specify C preprocessor flags], + if test "$enableval" = "yes" + then CPPFLAGS="$1" + else CPPFLAGS="$enable_cppflags" + fi) + AC_ARG_ENABLE(cflags, + [ --enable-cflags=... specify C compiler flags], + if test "$enableval" = "yes" + then CFLAGS="$2" + else CFLAGS="$enable_cflags" + fi) + AC_ARG_ENABLE(ldflags, + [ --enable-ldflags=... specify linker flags], + if test "$enableval" = "yes" + then LDFLAGS="$3" + else LDFLAGS="$enable_ldflags" + fi) + AC_ARG_ENABLE(libs, + [ --enable-libs=... specify link libraries], + if test "$enableval" = "yes" + then LIBS="$4" + else LIBS="$enable_libs" + fi)]) + +dnl +dnl zsh_CHECK_SOCKLEN_T +dnl +dnl check type of third argument of some network functions; currently +dnl tested are size_t *, unsigned long *, int *. +dnl +AC_DEFUN([zsh_CHECK_SOCKLEN_T],[ + AC_CACHE_CHECK( + [base type of the third argument to accept], + [zsh_cv_type_socklen_t], + [zsh_cv_type_socklen_t= + for zsh_type in socklen_t int "unsigned long" size_t ; do + AC_TRY_COMPILE( + [#include + #include ], + [extern int accept (int, struct sockaddr *, $zsh_type *);], + [zsh_cv_type_socklen_t="$zsh_type"; break], + [] + ) + done + if test -z "$zsh_cv_type_socklen_t"; then + zsh_cv_type_socklen_t=int + fi] + ) + AC_DEFINE_UNQUOTED([SOCKLEN_T], [$zsh_cv_type_socklen_t])] +) + -- cgit 1.4.1