autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AC_CHECK_LIB acts very strangely in Darwin


From: Aarno Syvänen
Subject: AC_CHECK_LIB acts very strangely in Darwin
Date: Wed, 31 Aug 2005 14:45:52 +0200

I try to configure a product to various platforms with following case:

case "$host" in
  *-sun-solaris*)
    CFLAGS="$CFLAGS -DSunOS=1"
    ;;
  *-cygwin*)
    EXE_EXT=".exe"
    ;;
  *apple-darwin*)
        #
        # MacOS X
        # lets try to find the newest installed SDK for compilation
        # so we know how to link against it
# the standard location /usr/include and /usr/lib are not good enough
        # it wouldnt build i386 architecture on a ppc system
        #
        DONE=0
        SDK=""
for E in "MacOSX10.4u.sdk" "MacOSX10.4.0.sdk" "MacOSX10.3.9.sdk" "MacOS$
        do
                if  [[ "$DONE" = 0 ]]
                then
                         if [[ -d "/Developer/SDKs/${E}" ]]
                        then
                                DONE="1"
                                SDK="${E}"
                        fi
                fi
        done
        if [[ "$SDK" = "MacOSX10.4u.sdk" ]]
        then
                ARCH="-arch ppc -arch i386"
echo "building for PPC and i386 architecture on MacOS X"
        fi

        if [[ "$SDK" ]]
        then
CFLAGS="$CFLAGS -DDARWIN=1 -L/Developer/SDKs/${SDK}/usr/ lib -I/Developer/SDKs/${SDK}/usr/include ${ARCH}"
        else
            CFLAGS="$CFLAGS -DDARWIN=1"
        fi
    LIBTOOL="libtool -static -o"
    ;;
  *-linux-*)
    CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE"
    LDFLAGS="$LDFLAGS -rdynamic"
    ;;
  *-*-openbsd* | *-*-freebsd*)
    CFLAGS="$CFLAGS -pthread"
AC_CHECK_LIB([c_r], [pthread_exit], [LIBS="$LIBS -lc_r"; pthread="yes"]) AC_CHECK_LIB([kse], [pthread_exit], [LIBS="$LIBS -lkse"; pthread="yes"])
    ;;
esac

After this, configure acts absolutely crazy

checking build system type... powerpc-apple-darwin8.2.0
checking host system type... powerpc-apple-darwin8.2.0
building for PPC and i386 architecture on MacOS X
checking for gcc... gcc
checking whether we are using the GNU C compiler... no
checking whether gcc accepts -g... no
checking for gcc option to accept ANSI C... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking for ranlib... ranlib
checking for bison... bison -y
checking for flex... flex
checking for yywrap in -lfl... yes
checking lex output file root... lex.yy
checking whether yytext is a pointer... yes
checking for convert... no
checking for perl... /usr/bin/perl
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... no
checking for sys/types.h... no
checking for sys/stat.h... no
checking for stdlib.h... no
checking for string.h... no
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... no
checking for stdint.h... no
checking for unistd.h... no
checking for short... no
checking size of short... 0
checking for int... no
checking size of int... 0
checking for long... no
checking size of long... 0
checking for long long... no
checking size of long long... 0
checking for log in -lm... yes
checking for accept in -lsocket... no
checking for inet_ntoa in -lnsl... no
checking for inet_ntop in -lresolv... yes
checking for inet_ntop in -lbind... no
checking for pthread_exit in -lpthread... yes
checking for libiconv in -liconv... yes
checking for ANSI C header files... (cached) no
checking sys/ioctl.h usability... no
checking sys/ioctl.h presence... yes
configure: WARNING: sys/ioctl.h: present but cannot be compiled
configure: WARNING: sys/ioctl.h: check for missing prerequisite headers?
configure: WARNING: sys/ioctl.h: see the Autoconf documentation
configure: WARNING: sys/ioctl.h: section "Present But Cannot Be Compiled" configure: WARNING: sys/ioctl.h: proceeding with the preprocessor's result configure: WARNING: sys/ioctl.h: in the future, the compiler will take precedence
configure: WARNING:     ## ------------------------------------------ ##
configure: WARNING:     ## Report this to the AC_PACKAGE_NAME lists.  ##
configure: WARNING:     ## ------------------------------------------ ##

When I check generated configure script, I noticed following:

case "$host" in
  *-sun-solaris*)
    CFLAGS="$CFLAGS -DSunOS=1"
    ;;
  *-cygwin*)
    EXE_EXT=".exe"
    ;;
  *apple-darwin*)
        #
        # MacOS X
        # lets try to find the newest installed SDK for compilation
        # so we know how to link against it
# the standard location /usr/include and /usr/lib are not good enough
        # it wouldnt build i386 architecture on a ppc system
        #
        DONE=0
        SDK=""
for E in "MacOSX10.4u.sdk" "MacOSX10.4.0.sdk" "MacOSX10.3.9.sdk" "MacOS$
        do
                if  [ "$DONE" = 0 ]
                then
                        if [ -d "/Developer/SDKs/${E}" ]
                        then
                                DONE="1"
                                SDK="${E}"
                        fi
                fi
        done
        if [ "$SDK" = "MacOSX10.4u.sdk" ]
        then
                ARCH="-arch ppc -arch i386"
echo "building for PPC and i386 architecture on MacOS X"
        fi

        if [ "$SDK" ]
        then
CFLAGS="$CFLAGS -DDARWIN=1 -L/Developer/SDKs/${SDK}/usr/ lib -I/Deve$
        else
            CFLAGS="$CFLAGS -DDARWIN=1"
        fi
        fi
    LIBTOOL="libtool -static -o"
    ;;
  *-linux-*)
    CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE"
    LDFLAGS="$LDFLAGS -rdynamic"
    ;;
  *-*-openbsd* | *-*-freebsd*)
    CFLAGS="$CFLAGS -pthread"
    ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program na$
set dummy ${ac_tool_prefix}gcc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6

So, autoconf just drops the end of the case statement.

If I comment out AC_CHECK_LIBS, everything is ok.

So what is the problem here ?

Aarno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]