Date: Thu, 13 Oct 2011 16:47:13 GMT From: Garrett Cooper <gcooper@ixsystems.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/161549: Bugs with aio_suspend configure test in net/samba35 Message-ID: <201110131647.p9DGlDoQ055120@red.freebsd.org> Resent-Message-ID: <201110131650.p9DGo60d063369@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 161549 >Category: ports >Synopsis: Bugs with aio_suspend configure test in net/samba35 >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Oct 13 16:50:06 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Garrett Cooper >Release: 9.0-BETA2 >Organization: iXsystems, Inc. >Environment: FreeBSD bayonetta.local 9.0-BETA2 FreeBSD 9.0-BETA2 #0 r225653M: Tue Sep 20 08:36:49 PDT 2011 gcooper@bayonetta.local:/usr/obj/usr/src/sys/BAYONETTA amd64 >Description: The current autoconf test is written improperly per POSIX and fails as follows: configure:33543: checking for aio_suspend configure:33550: cc -o conftest -O2 -pipe -fno-strict-aliasing -pipe -O2 -march=core2 -DLDAP_DEPRECATED -I/usr/include -I/usr/include -I/usr/local/include -Iinclude -I./include -I. -I. -I./../lib/replace -I./../lib/tevent -I./libaddns -I./librpc -I./.. -I./../lib/popt -I/usr/local/include -DLDAP_DEPRECATED -L/usr/local/lib -L./bin -L/usr/local/lib conftest.c -lexecinfo -liconv -lrt >&5 conftest.c: In function 'main': conftest.c:462: error: 'NULL' undeclared (first use in this function) conftest.c:462: error: (Each undeclared identifier is reported only once conftest.c:462: error: for each function it appears in.) conftest.c:462: warning: passing argument 1 of 'aio_suspend' from incompatible pointer type configure:33550: $? = 1 The problem is two-fold: 1. NULL must be pulled in from an approved header. The OpenGroup manpages state that stdlib.h must define NULL so I will use that. 2. Better typing and pointer casting needs to be done with the struct aiocb* that's passed into aio_suspend. Bottom line is that the following autoconf testcase should be used instead of the current one: #include <aio.h> #include <stdlib.h> int main() { struct aiocb *a[1]; return aio_suspend((const struct aiocb**)a, 1, NULL); } >How-To-Repeat: - Run 'make configure WITH_AIO_SUPPORT=y' on FreeBSD 8.x+. - Check $WRKDIR/source3/config.log for errors related to aio_suspend. >Fix: The revised net/samba35/files/patch-source3__configure.in is attached. Unfortunately my anoncvs is fubared and doesn't have this port for some odd reason. Patch attached with submission follows: --- source3/configure.in.orig 2011-10-13 09:20:12.000000000 -0700 +++ source3/configure.in 2011-10-13 09:43:06.000000000 -0700 @@ -23,6 +23,7 @@ m4_include(pkg.m4) AC_LIBREPLACE_CC_CHECKS +AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR m4_include(../lib/tevent/libtevent.m4) @@ -755,9 +756,13 @@ AC_PATH_PROG(CUPS_CONFIG, cups-config) if test "x$CUPS_CONFIG" != x; then + ac_save_PRINT_CPPFLAGS=$CPPFLAGS + ac_save_PRINT_LDFLAGS=$LDFLAGS - ac_save_LDFLAGS=$LDFLAGS ac_save_PRINT_LIBS=$PRINT_LIBS + CPPFLAGS="$CPPFLAGS `$CUPS_CONFIG --cflags`" + LDFLAGS="$LDFLAGS `$CUPS_CONFIG --ldflags`" + AC_CHECK_HEADERS(cups/cups.h cups/language.h) if test x"$ac_cv_header_cups_cups_h" = xyes -a \ @@ -766,8 +771,8 @@ # underlinked. With cups-config --libs we pull in unwanted and unneeded # dendencies including thread libraries - use cups-config only if really # required. - AC_CHECK_LIB_EXT(cups, ac_save_PRINT_LIBS , httpConnect, - [PRINT_LIBS"$ac_save_PRINT_LIBS -lcups"], + AC_CHECK_LIB_EXT(cups, ac_save_PRINT_LIBS, httpConnect, + [PRINT_LIBS="$ac_save_PRINT_LIBS -lcups"], [AC_MSG_WARN([your cups library doesn't link with -lcups alone, it might be underlinked.]) ; PRINT_LIBS="$ac_save_PRINT_LIBS `$CUPS_CONFIG --libs`"]) @@ -776,10 +781,10 @@ AC_CHECK_LIB_EXT(cups, PRINT_LIBS, httpConnectEncrypt) else AC_MSG_WARN([cups-config around but cups-devel not installed]) - CFLAGS=$ac_save_CFLAGS - LDFLAGS=$ac_save_LDFLAGS PRINT_LIBS=$ac_save_PRINT_LIBS fi + CPPFLAGS=$ac_save_PRINT_CPPFLAGS + LDFLAGS=$ac_save_PRINT_LDFLAGS elif test x"$enable_cups" = x"yes"; then AC_MSG_ERROR(Cups support required but cups-config not located. Make sure cups-devel related files are installed.) @@ -1730,8 +1735,12 @@ AC_MSG_RESULT($BLDSHARED) -saved_before_as_needed_ldflags="$LDFLAGS" -for flags in "-Wl,--as-needed" "-Wl,-z,ignore" "-z ignore" ; do +AC_ARG_ENABLE(as-needed, + [AS_HELP_STRING([--enable-as-needed], + [Turn on as-needed support if available (default=auto)])]) +if test "x$enable_as_needed" != xno; then + saved_before_as_needed_ldflags="$LDFLAGS" + for flags in "-Wl,--as-needed" "-Wl,-z,ignore" "-z ignore" ; do saved_ldflags="$LDFLAGS" AC_MSG_CHECKING([if $flags works]) LDFLAGS="$flags $saved_ldflags" @@ -1742,7 +1751,46 @@ AC_MSG_RESULT([no])) LDFLAGS="$LD_AS_NEEDED_FLAG $saved_ldflags" test x"$ld_as_needed_flag_found" = xyes && break -done + done +fi + +if test x$ld_as_needed_flag_found = xyes ; then +# check if ld has bug described in https://bugzilla.samba.org/show_bug.cgi?id=7209#c17 + AC_MSG_CHECKING([if $LD_AS_NEEDED_FLAG has explicit external libs bug]) +cat > conftest_shb.c <<END +void b() {} +END +cat > conftest_sha.c <<END +extern void b(); +void a() { + b(); +} +END +cat > conftest.c <<END +extern void a(); +int main() { + a(); + return 0; +} +END + + rm -fr conftest + AC_TRY_COMMAND([$CC $CPPFLAGS $CFLAGS $PICFLAG -c -o conftest_sha.o conftest_sha.c 1>&AS_MESSAGE_LOG_FD 2>&1]) + AC_TRY_COMMAND([$CC $CPPFLAGS $CFLAGS $PICFLAG -c -o conftest_shb.o conftest_shb.c 1>&AS_MESSAGE_LOG_FD 2>&1]) + TESTCMD="`eval echo \"$SHLD $LDSHFLAGS $PICFLAG\"`" + AC_TRY_COMMAND([$TESTCMD -o libconftest_shb.$SHLIBEXT conftest_shb.o 1>&AS_MESSAGE_LOG_FD 2>&1]) + AC_TRY_COMMAND([$TESTCMD -o libconftest_sha.$SHLIBEXT conftest_sha.o 1>&AS_MESSAGE_LOG_FD 2>&1]) + AC_TRY_COMMAND([$CC -o conftest conftest.c $LDFLAGS -L. -lconftest_sha -lconftest_shb 1>&AS_MESSAGE_LOG_FD 2>&1]) + if AC_TRY_COMMAND([eval "$LIB_PATH_VAR=. ./conftest 1>&AS_MESSAGE_LOG_FD 2>&1"]) + then + AC_MSG_RESULT([no]) + else + ld_as_needed_flag_found=no + LDFLAGS="$saved_before_as_needed_ldflags" + AC_MSG_RESULT([yes]) + fi + rm conftest* libconftest* +fi # check if we have to disable LD_AS_NEEDED_FLAG: # On some systems for a veriety of reasons linking with @@ -1806,9 +1854,6 @@ AC_MSG_CHECKING([PICFLAG]) AC_MSG_RESULT([$PICFLAG]) -AC_MSG_CHECKING([NSSSONAMEVERSIONSUFFIX]) -AC_MSG_RESULT([$NSSSONAMEVERSIONSUFFIX]) - AC_CACHE_CHECK([whether building shared libraries actually works], [ac_cv_shlib_works],[ # try building a trivial shared library @@ -1845,7 +1890,6 @@ AC_DEFINE_UNQUOTED(SHLIBEXT, "$SHLIBEXT", [Shared library extension]) -AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR ########################################################### @@ -4287,10 +4331,10 @@ ################################################################ # first test for Active Directory support being enabled - #if test x"$with_ads_support" = x"no"; then - # AC_MSG_ERROR(Active Directory support is required to enable DNS Update support) - # with_dnsupdate_support=no - #fi + if test x"$with_ads_support" = x"no"; then + AC_MSG_ERROR(Active Directory support is required to enable DNS Update support) + with_dnsupdate_support=no + fi ################################################################## # then test for uuid.h (necessary to generate unique DNS keynames # (uuid.h is required for this test) @@ -4535,15 +4579,51 @@ x"$ac_cv_header_pam_pam_modules_h" = x"no" ; then if test x"${try_pam}" = x"yes";then AC_MSG_ERROR([--with-pam=yes but pam_modules.h not found]) - fi + fi create_pam_modules=no - fi + fi if test x"$use_pam" = x"yes"; then - AC_DEFINE(WITH_PAM,1,[Whether to include PAM support]) + AC_DEFINE(WITH_PAM,1,[Whether to include PAM support]) AC_DEFINE(HAVE_LIBPAM,1,[Whether libpam is available]) AUTH_LIBS="$AUTH_LIBS $PAM_LIBS" - with_pam_for_crypt=yes + with_pam_for_crypt=yes + + AC_VERIFY_C_PROTOTYPE( + [int pam_get_data(const pam_handle_t *pamh, const char *module_data_name, const void **data)], + [return 0;], + [AC_DEFINE(PAM_GET_DATA_ARG3_CONST_VOID_PP, 1, [Whether pam_get_data 3 argument is a const pointer to pointer])], + [ + dnl Old OpenPAM declaration + AC_VERIFY_C_PROTOTYPE( + [int pam_get_data(pam_handle_t *pamh, const char *module_data_name, void **data)], + [return 0;], + [AC_DEFINE(PAM_GET_DATA_ARG3_VOID_PP, 1, [Whether pam_get_data 3 argument is a void pointer to pointer])], + [], [ + #include <sys/types.h> + #if HAVE_SECURITY_PAM_APPL_H + #include <security/pam_appl.h> + #endif + #if HAVE_PAM_PAM_APPL_H + #include <pam/pam_appl.h> + #endif + #if HAVE_SECURITY_PAM_MODULES_H + #include <security/pam_modules.h> + #endif + ] + )],[ + #include <sys/types.h> + #if HAVE_SECURITY_PAM_APPL_H + #include <security/pam_appl.h> + #endif + #if HAVE_PAM_PAM_APPL_H + #include <pam/pam_appl.h> + #endif + #if HAVE_SECURITY_PAM_MODULES_H + #include <security/pam_modules.h> + #endif + ] + ) if test x"$create_pam_modules" = x"yes"; then AC_DEFINE(WITH_PAM_MODULES,1,[Whether to include PAM MODULES support]) @@ -4553,7 +4633,7 @@ AC_CHECK_HEADERS(pam/pam_ext.h pam/_pam_macros.h) AC_CHECK_FUNC_EXT(pam_vsyslog,$PAM_LIBS) else - AC_MSG_WARN([PAM support detected but PAM MODULES support is missing]) + AC_MSG_WARN([PAM support detected but PAM MODULES support is missing]) fi fi AC_MSG_CHECKING(whether to use PAM support) @@ -5545,7 +5625,8 @@ esac fi # with_acl_support - +# check for NFSv4 acl +AC_CHECK_LIB(sunacl, acl, [ACL_LIBS="$ACL_LIBS -lsunacl"]) ################################################# # check for AIO support @@ -5626,7 +5707,12 @@ AC_MSG_CHECKING(for aio_suspend) AC_LINK_IFELSE([#include <aio.h> -int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }], +#include <stdlib.h> +int main() { + struct aiocb &a[1]; + return aio_suspend((const struct aiocb**)&a, 1, NULL); +} +], [AC_DEFINE(HAVE_AIO_SUSPEND, 1, [Have aio_suspend]) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) fi @@ -6086,6 +6172,7 @@ NSSSONAMEVERSIONSUFFIX=".1" WINBIND_NSS_EXTRA_OBJS="../nsswitch/winbind_nss_freebsd.o \ ../nsswitch/winbind_nss_linux.o" + WINBIND_WINS_NSS_EXTRA_OBJS="../nsswitch/wins_freebsd.o" WINBIND_NSS="../nsswitch/nss_winbind.$SHLIBEXT" WINBIND_WINS_NSS="../nsswitch/nss_wins.$SHLIBEXT" ;; @@ -6176,17 +6263,10 @@ AC_DEFINE(WITH_WINBIND,1,[Whether to link to wbclient]) EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/wbinfo\$(EXEEXT)" else - if test x"$enable_developer" = x"yes" -a x"$LINK_LIBWBCLIENT" = x"STATIC" ; then - BUILD_LIBWBCLIENT_SHARED=no - else - BUILD_LIBWBCLIENT_SHARED=yes - fi - LIBWBCLIENT_SHARED_TARGET=bin/libwbclient.$SHLIBEXT LIBWBCLIENT_STATIC_TARGET=bin/libwbclient.a LIBWBCLIENT_SOVER=0 if test $BLDSHARED = true -a x"$HAVE_WINBIND" = x"yes" -a x"$BUILD_LIBWBCLIENT_SHARED" = x"yes"; then - NSS_MODULES="${WINBIND_NSS} ${WINBIND_WINS_NSS}" ## Only worry about libwbclient if we have shared # library support LIBWBCLIENT_SHARED=$LIBWBCLIENT_SHARED_TARGET @@ -6206,19 +6286,26 @@ EXTRA_BIN_PROGS="$EXTRA_BIN_PROGS bin/wbinfo\$(EXEEXT)" EXTRA_SBIN_PROGS="$EXTRA_SBIN_PROGS bin/winbindd\$(EXEEXT)" - if test $BLDSHARED = true -a x"$create_pam_modules" = x"yes"; then + if test $BLDSHARED = true; then + NSS_MODULES="${WINBIND_NSS} ${WINBIND_WINS_NSS}" + if test x"$create_pam_modules" = x"yes"; then PAM_MODULES="$PAM_MODULES pam_winbind" INSTALL_PAM_MODULES="installpammodules" UNINSTALL_PAM_MODULES="uninstallpammodules" + fi fi else AC_MSG_RESULT(no$winbind_no_reason) fi +AC_MSG_CHECKING([NSSSONAMEVERSIONSUFFIX]) +AC_MSG_RESULT([$NSSSONAMEVERSIONSUFFIX]) + AC_SUBST(WINBIND_NSS) -AC_SUBST(WINBIND_WINS_NSS) AC_SUBST(WINBIND_NSS_LDSHFLAGS) AC_SUBST(WINBIND_NSS_EXTRA_OBJS) +AC_SUBST(WINBIND_WINS_NSS) +AC_SUBST(WINBIND_WINS_NSS_EXTRA_OBJS) AC_SUBST(NSSSONAMEVERSIONSUFFIX) AC_SUBST(WINBIND_KRB5_LOCATOR) @@ -6486,13 +6573,21 @@ # Start AC_CHECK_FUNC(getmntent) -AC_CHECK_HEADERS(sys/statfs.h) +AC_CHECK_HEADERS(sys/statfs.h sys/mount.h) AC_MSG_CHECKING([vfs_fileid: checking for statfs() and struct statfs.f_fsid)]) AC_CACHE_VAL(vfsfileid_cv_statfs,[ AC_TRY_RUN([ #include <sys/types.h> + #ifdef HAVE_SYS_PARAM_H + #include <sys/param.h> + #endif + #ifdef HAVE_SYS_MOUNT_H + #include <sys/mount.h> + #endif + #ifdef HAVE_SYS_STATFS_H #include <sys/statfs.h> + #endif int main(void) { struct statfs fsd; @@ -6823,6 +6918,16 @@ LIBS="$LIBS -ldmalloc" fi +AC_ARG_ENABLE(dmalloc, [AS_HELP_STRING([--enable-dmalloc], [Enable heap debugging [default=no]])]) + +if test "x$enable_dmalloc" = xyes +then + AC_DEFINE(ENABLE_DMALLOC, 1, [Define to turn on dmalloc debugging]) + AC_DEFINE(DMALLOC_FUNC_CHECK, 1, + [Define to check invariants around some common functions]) + LIBS="$LIBS -ldmalloc" +fi + dnl Remove -L/usr/lib/? from LDFLAGS and LIBS LIB_REMOVE_USR_LIB(LDFLAGS) LIB_REMOVE_USR_LIB(LIBS) >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110131647.p9DGlDoQ055120>