Forwarding the configure.ac, which was apparently just sent to me
and not to the bug address.

-------------------- Start of forwarded message --------------------
Delivery-date: Tue, 16 May 2006 06:57:07 -0700
Delivered-To: [EMAIL PROTECTED]
Subject: Re: Bug#367501: autoconf: checking for vsnprintf fails with
        cross-compilation error, while cross-compilation is not the case
From: Krzysztof Witkowski <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
In-Reply-To: <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
         <[EMAIL PROTECTED]>
Date: Tue, 16 May 2006 15:51:14 +0200
Message-Id: <[EMAIL PROTECTED]>

Dnia 16-05-2006, wto o godzinie 06:40 -0700, Ben Pfaff napisaƂ(a):
> Krzysztof Witkowski <[EMAIL PROTECTED]> writes:
> 
> > I'm using autoconf for my own project. Generated ./configure fails with 
> > error:
> > checking for C99-compatible vsnprintf()... configure: error: cannot run 
> > test program while cross compiling
> > See `config.log' for more details.
> >
> > But in config.log I have:
> > configure:2820: checking whether we are cross compiling
> > configure:2822: result: no
> >
> > Previous autoconf version 2.59a-9 worked fine.
> 
> Please provide a configure.ac that exhibits the problem.




AC_PREREQ(2.59)
AC_REVISION([$Id: configure.ac,v 1.13 2006/05/15 11:12:17 piotrdom Exp $])
AC_INIT([DRMAA Service Provider], [0.2], [EMAIL PROTECTED], [dsp])

AC_CONFIG_SRCDIR([src/service/cre.c])
AC_CONFIG_HEADER([config.h])

AC_CANONICAL_HOST

AM_INIT_AUTOMAKE([foreign])

dnl use /opt/dsp as default installation prefix
AC_PREFIX_DEFAULT([/opt/dsp])

dnl add preprocessor stuff here so tests always match the real situation
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -ansi -pedantic -D_REENTRANT -D_THREAD_SAFE"

case "$host_os" in
        *linux*)
                CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
        ;;
        *solaris*)
                CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
        ;;
        *freebsd*)
        ;;
        *)
                CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
        ;;
esac  

dnl checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_SED
AC_SUBST([SED])
AC_PATH_PROG(STRIP,strip,:)
AC_SUBST([STRIP])

dnl on Solaris, we need /usr/xpg4/bin/tr instead of /usr/bin/tr
AC_ARG_VAR([TR], [Location of the tr utility])
AC_PATH_PROG([TR], [tr],, [/usr/xpg4/bin:$PATH])

dnl on Solaris, ar lives in /usr/ccs/bin or /usr/xpg4/bin
AC_ARG_VAR([AR], [Location of the ar utility])
AC_PATH_TOOL([AR], [ar],, [$PATH:/usr/ccs/bin:/usr/xpg4/bin])

AC_ARG_VAR([PERL], [Location of the perl interpreter])
AC_PATH_PROG([PERL], [perl])

dnl checks for header files
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_DIRENT
AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h limits.h netdb.h netinet/in.h \
                  stdlib.h string.h strings.h sys/file.h sys/ioctl.h \
                  sys/socket.h sys/time.h sys/timeb.h unistd.h sched.h 
execinfo.h])

AH_TEMPLATE([HAVE_SYS_SELECT_H], [Define to 1 if you have the <sys/select.h> 
header file.])
AC_CHECK_HEADER([sys/select.h], [
        AC_CHECK_TYPE([fd_set], [AC_DEFINE([HAVE_SYS_SELECT_H])],,
                [#include <sys/select.h>])
])

dnl checks for typedefs, structures, and compiler characteristics
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_VOLATILE
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_TYPE_UID_T

AC_CHECK_TYPES([union semun],,, [
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
])

AH_TEMPLATE([sig_atomic_t], [Define to int if <signal.h> does not define.])
AC_CHECK_TYPES([sig_atomic_t], [], [AC_DEFINE([sig_atomic_t], [int])], [
#include <signal.h>
])

AH_TEMPLATE([PATH_MAX], [Use _POSIX_PATH_MAX if system does not define 
PATH_MAX.])
AC_CHECK_DECLS([PATH_MAX], [], [AC_DEFINE([PATH_MAX], [_POSIX_PATH_MAX])],
[
#include <limits.h>
])

AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_STRERROR_R
AC_FUNC_STRFTIME
AC_FUNC_STRTOD
AC_FUNC_VPRINTF

AC_CHECK_LIB([c], [sched_yield], [dsp_libc_sched="yes"], [dsp_libc_sched="no"])
if test "x$dsp_libc_sched" = "xno"; then
        AC_CHECK_LIB([rt], [sched_yield])
fi

AC_CHECK_FUNCS([atexit dup2 ftime gethostbyname_r gettimeofday localtime_r 
memset \
                mkdir munmap regcomp select socket strchr strdup strerror 
timegm \
                strstr strrchr strtol strtoul strtoull strtoll strtof gmtime_r \
                mkstemp wctomb mbtowc sscanf gethostbyname daemon strnlen 
mkdtemp \
                strlcpy strlcat setenv sched_yield])

AH_TEMPLATE([_XOPEN_SOURCE], [Enable X/Open extensions.])
AH_TEMPLATE([_GNU_SOURCE], [Enable GNU extensions.])
AH_TEMPLATE([__EXTENSIONS__], [Enable extended system interfaces on Solaris.])

AH_VERBATIM([_REENTRANT], 
[
#ifndef _REENTRANT
#  define  _REENTRANT 1
#endif])

AH_VERBATIM([_THREAD_SAFE], 
[
#ifndef _THREAD_SAFE
#  define  _THREAD_SAFE 1
#endif])

case "$host_os" in
        *linux*)
                AC_DEFINE([_GNU_SOURCE])
                ;;
        *solaris*)
                AC_DEFINE([_XOPEN_SOURCE], [500])
                AC_DEFINE([__EXTENSIONS__])
                ;;
        *freebsd*)
                ;;
        *)
                AC_DEFINE([_XOPEN_SOURCE], [500])
                ;;
esac

if test "$ac_cv_c_compiler_gnu" = yes; then
        WARNING_CPPFLAGS="-W -Wall -Wcast-align -Wmissing-declarations 
-Wmissing-prototypes -Wpointer-arith -Wno-long-long -std=iso9899:199409 
-pedantic -ansi"
        AC_SUBST([WARNING_CPPFLAGS])
fi 

AH_TEMPLATE([HAVE_C99_VSNPRINTF], [Define to 1 if you have C99-compatible 
vsnprintf function.])
AH_TEMPLATE([HAVE_VA_COPY], [Define to 1 if you have the va_copy function.])
AH_TEMPLATE([HAVE___VA_COPY], [Define to 1 if you have the __va_copy function.])

AC_MSG_CHECKING([for C99-compatible vsnprintf()])
AC_TRY_RUN(
        [
                #include <stdio.h>
                int main()
                {
                    char tmp;
                    return (snprintf(&tmp, sizeof(tmp), "test") != 4);
                }
        ], [
                AC_MSG_RESULT([yes])
                AC_DEFINE([HAVE_C99_VSNPRINTF])
        ], [
                AC_MSG_RESULT([no])
        ], [
                AC_MSG_RESULT([no])
        ]
])

AC_MSG_CHECKING([for va_copy])
AC_TRY_LINK([#include <stdarg.h>], [va_list a, b; va_copy(a, b);], 
[
        AC_MSG_RESULT([yes])
        AC_DEFINE([HAVE_VA_COPY])
        ], [
        AC_MSG_RESULT([no])
])

AC_MSG_CHECKING([for __va_copy])
AC_TRY_LINK([#include <stdarg.h>], [va_list a, b; __va_copy(a, b);], 
[
        AC_MSG_RESULT([yes])
        AC_DEFINE([HAVE___VA_COPY])
        ], [
        AC_MSG_RESULT([no])
])

AH_VERBATIM([__GNUC__], 
[/* Support non gcc compilers */
#ifndef __GNUC__
#  define  __attribute__(x)  /* NOTHING */
#endif])

AC_CACHE_SAVE

dnl check if any special linker/preprocessor flags are needed for pthreads
ACX_PTHREAD
if test "x$acx_pthread_ok" = "xno"; then
        AC_MSG_ERROR([Could not locate POSIX threads library.])
fi

dnl let's be consistent and use _CPPFLAGS everywhere, not _CFLAGS
PTHREAD_CPPFLAGS="$PTHREAD_CFLAGS"
AC_SUBST([PTHREAD_CPPFLAGS])

dnl check for libxml2
AM_PATH_XML2([2.6.17],, AC_MSG_ERROR([Could not locate mandatory libxml2 
library.]))

dnl check for unixODBC
AM_PATH_UNIXODBC([2.2.0], [dsp_unixodbc="yes"], [dsp_unixodbc="no"])

dnl check for iODBC
AM_PATH_IODBC([3.0.0], [dsp_iodbc="yes"], [dsp_iodbc="no"])

if test "x$dsp_unixodbc" = "xno" -a "x$dsp_iodbc" = "xno"; then
        AC_MSG_ERROR([Could not locate neither unixODBC nor iODBC. You must 
have at least one of them.])
fi

dnl if both unixODBC and iODBC are available, we have a conflict...
if test "x$dsp_unixodbc" = "xyes" -a "x$dsp_iodbc" = "xyes"; then

        dnl if user supplied path for unixODBC, use unixODBC
        if test "x$with_unixodbc" != "xno" -a "x$with_unixodbc" != "xauto"; then
                dsp_unixodbc="yes"
                dsp_iodbc="no"
        else 

                dnl if user supplied path for iODBC, use iODBC
                if test "x$with_iodbc" != "xno" -a "x$with_iodbc" != "xauto"; 
then
                        dsp_unixodbc="no"
                        dsp_iodbc="yes"

                dnl finally, prefer unixODBC
                else
                        dsp_unixodbc="yes"
                        dsp_iodbc="no"
                fi
        fi
fi

if test "x$dsp_unixodbc" = "xyes"; then
        ODBC_LIBS="$UNIXODBC_LIBS"
        ODBC_CPPFLAGS="$UNIXODBC_CPPFLAGS"
fi

if test "x$dsp_iodbc" = "xyes"; then
        ODBC_LIBS="$IODBC_LIBS"
        ODBC_CPPFLAGS="$IODBC_CPPFLAGS"
fi

AC_SUBST([ODBC_LIBS])
AC_SUBST([ODBC_CPPFLAGS])

AH_TEMPLATE([DSP_GSI], [Use Globus GSI auth])
AH_TEMPLATE([DSP_SSL], [Use OpenSSL auth])
AH_TEMPLATE([WITH_OPENSSL], [Tell gSOAP that we want to use OpenSSL])

dnl check for Globus GSI
DSP_GLOBUS_GSI

if test "x$dsp_globus_gsi" = "xyes"; then

        AC_DEFINE([DSP_GSI])

        GSOAP_GSI_CPPFLAGS="-I../../gsoap-gsi-plugin"
        GSOAP_GSI_LIB="../../gsoap-gsi-plugin/libgsigsoap.a"

        AC_SUBST([GSOAP_GSI_CPPFLAGS])
        AC_SUBST([GSOAP_GSI_LIB])
else
        dnl check for OpenSSL only if we don't use Globus OpenSSL libraries
        DSP_OPENSSL([0.9.7], [dsp_openssl="yes"], [dsp_openssl="no"])
fi

if test "x$dsp_openssl" = "xyes"; then
        AC_DEFINE([DSP_SSL])

        AC_DEFINE([WITH_OPENSSL])
fi

if test "x$dsp_openssl" = "xno" -a "x$dsp_globus_gsi" = "xno"; then
        AC_MSG_ERROR([Could not locate neither OpenSSL nor Globus GSI setup. 
You must have at least one of them.])
fi

dnl check for SAMLC library
DSP_SAMLC([1.0.0], [dsp_samlc="yes"], [dsp_samlc="no"])

dnl define authorization conditionals
AM_CONDITIONAL([GSI], [test "x$dsp_globus_gsi" = "xyes"])
AM_CONDITIONAL([SSL], [test "x$dsp_openssl" = "xyes"])
AM_CONDITIONAL([SAML], [test "x$dsp_samlc" = "xyes"])

DSP_SGE([dsp_sge="yes"], [dsp_sge="no"])
DSP_TORQUE([dsp_torque="yes"], [dsp_torque="no"])
DSP_CONDOR([dsp_condor="yes"], [dsp_condor="no"])

drm_list="sge torque condor"

drm_count=0
drm_chosen="sge"
for drm in $drm_list; do
        v="with_$drm"
        eval val=\$$v
        if test "x$val" != "xauto" -a "x$val" != "xno"; then
                drm_count=$(($drm_count+1))
                drm_chosen="$drm"
        fi
done

if test $drm_count -gt 1; then
        AC_MSG_ERROR([You cannot compile in more than one DRM support.])
fi

dnl as SGE is configured automatically, disable it if user has chosen other DRM
if test "x$drm_chosen" != "xsge"; then
        dsp_sge="no"
fi

dnl final sanity check
drm_count=0
for drm in $drm_list; do
        v="dsp_$drm"
        eval val=\$$v

        if test "x$val" = "xyes"; then
                drm_count=$(($drm_count+1))
        fi
done

if test $drm_count -ne 1; then
        AC_MSG_ERROR([Could not configure any DRM support.])
fi

AH_TEMPLATE([DSP_SGE], [Use Sun Grid Engine DRM])
AH_TEMPLATE([DSP_TORQUE], [Use Torque DRM])
AH_TEMPLATE([DSP_CONDOR], [Use Condor DRM])

name=`echo $drm_chosen | $TR 'a-z' 'A-Z'`
AC_DEFINE_UNQUOTED([DSP_$name])

AM_CONDITIONAL([SGE], [test "x$dsp_sge" = "xyes"])
AM_CONDITIONAL([TORQUE], [test "x$dsp_torque" = "xyes"])
AM_CONDITIONAL([CONDOR], [test "x$dsp_condor" = "xyes"])

drmaa_cppflags=`echo ${drm_chosen}_CPPFLAGS | $TR 'a-z' 'A-Z'`
drmaa_libs=`echo ${drm_chosen}_LIBS | $TR 'a-z' 'A-Z'`
eval DRMAA_CPPFLAGS="\$$drmaa_cppflags"
eval DRMAA_LIBS="\$$drmaa_libs"

AC_SUBST([DRMAA_CPPFLAGS])
AC_SUBST([DRMAA_LIBS])

dnl allow user to specify DSP system group
AC_ARG_WITH([dspgroup], AS_HELP_STRING([--with-dspgroup=GROUPNAME],
            [System group to use for DSP (optional). Defaults to 'dsp'.]),
            [dsp_group_name=$withval],
            [dsp_group_name="dsp"])

dsp_group_gid=`$PERL -e 'print getgrnam('$dsp_group_name') . "\n"'`

AC_MSG_CHECKING([if system group '$dsp_group_name' exists])
if test -z $dsp_group_gid; then
        AC_MSG_RESULT([no])
        AC_MSG_ERROR([Group '$dsp_group_name' does not exist! Please check your 
system configuration before proceeding with the instalation.])
fi
AC_MSG_RESULT([yes])

AH_TEMPLATE([DSP_GROUP_NAME], [System group name to use for DSP])
AH_TEMPLATE([DSP_GROUP_GID], [System group id to use for DSP])

AC_SUBST([DSP_GROUP_NAME], ["$dsp_group_name"])
AC_DEFINE_UNQUOTED([DSP_GROUP_NAME], ["$dsp_group_name"])
AC_SUBST([DSP_GROUP_GID], [$dsp_group_gid])
AC_DEFINE_UNQUOTED([DSP_GROUP_GID], [$dsp_group_gid])

AH_TEMPLATE([DSP_DIR_PREFIX], [The installation prefix])
AH_TEMPLATE([DSP_DIR_BIN], [Location of binary files])
AH_TEMPLATE([DSP_DIR_SBIN], [Location of system binary files])
AH_TEMPLATE([DSP_DIR_SYSCONF], [Location of system configuration files])
AH_TEMPLATE([DSP_DIR_LOCALSTATE], [Location of variable data files])
AH_TEMPLATE([DSP_DIR_DATA], [Location of package data files])

test "$prefix" = NONE && prefix="$ac_default_prefix"
test "$exec_prefix" = NONE && exec_prefix='${prefix}'

for i in bindir sbindir prefix localstatedir sysconfdir datadir; do
        name=`echo $i | $SED -e 's/dir$//' | $TR 'a-z' 'A-Z'`
        x="\$$i"        
        eval y="$x"
        while test "$x" != "$y"; do
                x="$y"
                eval y="$x"
        done
        AC_DEFINE_UNQUOTED([DSP_DIR_$name], ["$x"])
done

CPPFLAGS="$OLD_CPPFLAGS"

AC_CONFIG_FILES([\
                 Makefile \
                 etc/Makefile \
                 gsoap-gsi-plugin/Makefile \
                 src/client/Makefile \
                 src/common/Makefile \
                 src/ecm/Makefile \
                 src/service/Makefile \
                 src/utils/tests/Makefile \
                 tools/Makefile \
                 src/Makefile \
                 src/utils/Makefile \
                 jobs/Makefile \
                 ])
AC_OUTPUT

echo
echo "configured options:"
echo

echo "- libxml2"
        echo "    XML_CPPFLAGS=${XML_CPPFLAGS}"
        echo "    XML_LIBS=${XML_LIBS}"
        echo

echo "- unixODBC: ${dsp_unixodbc}"
if test "x$dsp_unixodbc" = "xyes"; then
        echo "    UNIXODBC_CPPFLAGS=${UNIXODBC_CPPFLAGS}"
        echo "    UNIXODBC_LIBS=${UNIXODBC_LIBS}"
fi
        echo

echo "- iODBC: ${dsp_iodbc}"
if test "x$dsp_iodbc" = "xyes"; then
        echo "    IODBC_CPPFLAGS=${IODBC_CPPFLAGS}"
        echo "    IDBC_LIBS=${IODBC_LIBS}"
fi
        echo

echo "- OpenSSL: ${dsp_openssl}"
if test "x$dsp_openssl" = "xyes"; then
        echo "    OPENSSL_CPPFLAGS=${OPENSSL_CPPFLAGS}"
        echo "    OPENSSL_LIBS=${OPENSSL_LIBS}"
fi
        echo

echo "- Globus GSI: ${dsp_globus_gsi}"
if test "x$dsp_globus_gsi" = "xyes"; then
        echo "    GSI_CPPFLAGS=${GSI_CPPFLAGS}"
        echo "    GSI_LIBS=${GSI_LIBS}"
fi
        echo

echo "- samlc: ${dsp_samlc}"
if test "x$dsp_samlc" = "xyes"; then
        echo "    SAMLC_CPPFLAGS=${SAMLC_CPPFLAGS}"
        echo "    SAMLC_LIBS=${SAMLC_LIBS}"
fi
        echo

echo "- Sun Grid Engine DRMAA: ${dsp_sge}"
if test "x$dsp_sge" = "xyes"; then
        echo "    SGE_CPPFLAGS=${SGE_CPPFLAGS}"
        echo "    SGE_LIBS=${SGE_LIBS}"
fi
        echo

echo "- Condor DRMAA: ${dsp_condor}"
if test "x$dsp_condor" = "xyes"; then
        echo "    CONDOR_CPPFLAGS=${CONDOR_CPPFLAGS}"
        echo "    CONDOR_LIBS=${CONDOR_LIBS}"
fi
        echo

echo "- Torque DRMAA: ${dsp_torque}"
if test "x$dsp_torque" = "xyes"; then
        echo "    TORQUE_CPPFLAGS=${TORQUE_CPPFLAGS}"
        echo "    TORQUE_LIBS=${TORQUE_LIBS}"
fi

echo
echo "DSP_DIR_PREFIX=${prefix}"
echo "DSP_GROUP_NAME=${dsp_group_name} (gid: ${dsp_group_gid})"
echo
-------------------- End of forwarded message --------------------

-- 
Ben Pfaff 
email: [EMAIL PROTECTED]
web: http://benpfaff.org

Reply via email to