Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
#!/bin/sh
#
# This file was generated by confgen version 2.
# Do not edit.
#

PREFIX='/usr'
#EXECPREFIX='$PREFIX'
INSTALLROOT=''
BINMODE='755'
MANMODE='644'

while [ x$1 != x ]; do case $1 in

	--help)
	cat <<EOF
Usage: configure [options]
    --help                Show this message
    --with-debug          Enable debugging
    --without-readline    Disable readline support
    --prefix=path         Prefix for location of files [/usr]
    --exec-prefix=path    Location for arch-depedent files [prefix]
    --installroot=root    Top of filesystem tree to install in [/]
    --binmode=mode        Mode for binaries [755]
    --manmode=mode        Mode for manual pages [644]
    --with-c-compiler=cc  Program for compiling C source [guessed]
    --enable-ipv6         Enable IPv6 support
EOF
	exit 0;;
	--verbose) ;;
	--quiet) ;;

	--subdir) . ../configure.defs;;

	--with-debug|--debug) DEBUG=1;;
	--prefix=*) PREFIX=`echo $1 | sed 's/^[^=]*=//'` ;;
	--exec-prefix=*) EXECPREFIX=`echo $1 | sed 's/^[^=]*=//'` ;;
	--installroot=*) INSTALLROOT=`echo $1 | sed 's/^[^=]*=//'` ;;
	--binmode=*) BINMODE=`echo $1 | sed 's/^[^=]*=//'` ;;
	--manmode=*) MANMODE=`echo $1 | sed 's/^[^=]*=//'` ;;
	--with-c-compiler=*) CC=`echo $1 | sed 's/^[^=]*=//'` ;;
	--without-readline|--disable-readline) WITHOUT_READLINE=1;;

	--disable-ipv6) ENABLE_IPV6=no;;
	--enable-ipv6=*) ENABLE_IPV6=`echo $1 | sed 's/^[^=]*=//'`;;
	--enable-ipv6) ENABLE_IPV6=yes;;

	*) echo "Unrecognized option: $1"; exit 1;;
esac 
shift
done

if [ x$EXECPREFIX = x ]; then 
	EXECPREFIX="$PREFIX"
fi

BINDIR="$EXECPREFIX/bin"
MANDIR="$PREFIX/share/man"

echo "Directories: $BINDIR $MANDIR "

if [ x$INSTALLROOT != x ]; then
    echo "Installing in chroot tree rooted at $INSTALLROOT"
fi

##################################################

WARNINGS='-Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline '

cat << EOF > __conftest.c
    int main() { int class=0; return class; }
EOF

if [ x"$CC" = x ]; then
    echo -n 'Looking for a C compiler... '
    for TRY in egcs gcc g++ CC c++ cc; do
       (
           $TRY __conftest.c -o __conftest || exit 1;
#           ./__conftest || exit 1;
       ) >/dev/null 2>&1 || continue;
       CC=$TRY
       break;
    done
    if [ x"$CC" = x ]; then
        echo 'failed.'
        echo 'Cannot find a C compiler. Run configure with --with-c-compiler.'
        rm -f __conftest*
        exit
    fi
    echo "$CC"
else
    echo -n 'Checking if C compiler works... '
    if (
          $CC __conftest.c -o __conftest || exit 1
#          ./__conftest || exit 1
       ) >/dev/null 2>&1; then
         echo 'yes'
     else
         echo 'no'
         echo 'Compiler '"$CC"' does not exist or cannot compile C; try another.'
         rm -f __conftest*
         exit
     fi
fi

echo -n "Checking if $CC accepts gcc warnings... "
if (
    $CC $WARNINGS __conftest.c -o __conftest || exit 1
   ) >/dev/null 2>&1; then
     echo 'yes'
     CC_WARNINGS=1
else
     echo 'no'
fi

if [ x$DEBUG = x ]; then
    echo -n "Checking if $CC accepts -O2... "
    if (
         $CC -O2 __conftest.c -o __conftest
       ) >/dev/null 2>&1; then
         echo 'yes'
         CFLAGS="$CFLAGS -O2"
    else
         echo 'no'
         echo -n "Checking if $CC accepts -O... "
         if (
              $CC -O __conftest.c -o __conftest
            ) >/dev/null 2>&1; then
              echo 'yes'
              CFLAGS="$CFLAGS -O"
         else
              echo 'no'
         fi
    fi

else
    echo -n "Checking if $CC accepts -g... "
    if (
         $CC -g __conftest.c -o __conftest
       ) >/dev/null 2>&1; then
         echo 'yes'
         CFLAGS="$CFLAGS -g"
    else
         echo 'no'
    fi

fi

LDFLAGS=$LDFLAGS
LIBS=$LIBS

rm -f __conftest*

##################################################
## Enable IPv6
echo -n "Whether to enable IPv6 support... "
if [ x"$ENABLE_IPV6" = x"yes" ]; then
    echo yes
    CFLAGS="$CFLAGS -DINET6"
else
    echo no
fi

rm -f __conftest*

## Search IPv6 Library / Headers
if [ x"$ENABLE_IPV6" = x"yes" ]; then
    echo -n "Search for IPv6 library... "
    inet6libdirs="/usr/local/v6/lib /usr/local/lib /usr /usr/inet6/lib"
    inet6libs="inet6"
    inet6found=no
    for inet6libdir in $inet6libdirs; do
        for inet6lib in $inet6libs; do
            if [ -d $inet6libdir ] && [ -f $inet6libdir/lib$inet6lib.a ]; then
                inet6found=yes
                break 2
            fi
        done
    done
    if [ x"$inet6found" = x"yes" ]; then
        echo "$inet6libdir/lib$inet6lib.a"
        LIBS="$LIBS -L$inet6libdir -l$inet6lib"
    else
        echo "not found"
    fi
fi

rm -f __conftest*

##################################################

echo -n 'Checking for BSD signal semantics... '
cat <<EOF >__conftest.c
#include <unistd.h>
#include <signal.h>
volatile int count=0;
void handle(int foo) { count++; write(1,"X",1);}
int main() {
    int pid=getpid();
    signal(SIGINT, handle);
    kill(pid,SIGINT);
    kill(pid,SIGINT);
    kill(pid,SIGINT);
    if (count!=3) return 1;
    return 0;
}

EOF
if (
      $CC $CFLAGS  __conftest.c  -o __conftest || exit 1
#      ./__conftest || exit 1
   ); then
    echo 'yes'
else
    if (
          $CC $CFLAGS -D__USE_BSD_SIGNAL __conftest.c  -o __conftest || exit 1
#          ./__conftest || exit 1
       ); then
        echo '-D__USE_BSD_SIGNAL'
        CFLAGS="$CFLAGS -D__USE_BSD_SIGNAL"
    else
        echo 'no'
        echo '***WARNING***: This package needs BSD signal semantics to run.'
	echo '***WARNING***: Assuming its just ia64 buildroot breakage.'
        CFLAGS="$CFLAGS -D__USE_BSD_SIGNAL"
    fi
fi
rm -f __conftest*

##################################################

echo -n 'Checking for ncurses... '
cat <<EOF >__conftest.c
#include <stdio.h>
#include <curses.h>
#ifndef KEY_DOWN
syntax error. /* not ncurses */
#endif
int main() {
    endwin();
    return 0;
}

EOF
if (
      $CC $CFLAGS  __conftest.c -lncurses -o __conftest || exit 1
   ) >/dev/null 2>&1; then
    echo 'yes'
    NCURSES=1
else
    if (
          $CC $CFLAGS -I/usr/include/ncurses __conftest.c -lncurses -o __conftest || exit 1
       ) >/dev/null 2>&1; then
        echo '-I/usr/include/ncurses'
        CFLAGS="$CFLAGS -I/usr/include/ncurses"
        NCURSES=1
    else
        echo 'no'
    fi
fi

if [ x$NCURSES != x ]; then
    LIBTERMCAP=-lncurses
else
    echo -n 'Checking for traditional termcap... '
cat <<EOF >__conftest.c
#include <stdio.h>
#include <termcap.h>
int main() {
    tgetent(NULL, NULL); return 0;
}

EOF
    if (
          $CC $CFLAGS  __conftest.c -ltermcap -o __conftest || exit 1
       ) >/dev/null 2>&1; then
        echo '-ltermcap'
        LIBTERMCAP=-ltermcap
    else
        echo 'not found'
        echo 'This package needs termcap to run.'
        rm -f __conftest*
        exit
    fi
fi
rm -f __conftest*

##################################################

echo -n 'Checking for GNU libc... '
cat <<EOF >__conftest.c
#include <stdio.h>
#if defined(__GLIBC__) && (__GLIBC__ >= 2)
int tester;
#endif
int main() { tester=6; return 0; }

EOF
if (
      $CC $CFLAGS  __conftest.c  -o __conftest || exit 1
   ) >/dev/null 2>&1; then
    echo 'yes'
    USE_GLIBC=1
else
    echo 'no'
fi
rm -f __conftest*

##################################################

echo -n 'Checking for libreadline... '
if [ x$WITHOUT_READLINE != x ]; then
    echo disabled
else
cat <<EOF >__conftest.c
#include <stdio.h>
#include <readline/readline.h>
#include <readline/tilde.h>
int main() { readline("foo"); return 0; }

EOF
if (
      $CC $CFLAGS  __conftest.c -lreadline $LIBTERMCAP -o __conftest || exit 1
   ) >/dev/null 2>&1; then
        echo 'yes'
        USE_READLINE=1
    else
        echo 'no'
    fi
fi
rm -f __conftest*

##################################################

echo -n 'Checking for socklen_t... '
cat <<EOF >__conftest.c
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int main() {
    struct sockaddr_in sn;
    socklen_t len = sizeof(sn);
    getpeername(0, (struct sockaddr *)&sn, &len);
    return 0;
}

EOF
if (
      $CC $CFLAGS  __conftest.c  -o __conftest || exit 1
   ) >/dev/null 2>&1; then
    echo 'yes'
else
    if (
          $CC $CFLAGS -Dsocklen_t=int __conftest.c  -o __conftest || exit 1
       ) >/dev/null 2>&1; then
        echo 'int'
        CFLAGS="$CFLAGS -Dsocklen_t=int"
    else
        if (
              $CC $CFLAGS -Dsocklen_t=size_t __conftest.c  -o __conftest || exit 1
           ) >/dev/null 2>&1; then
            echo 'size_t'
            CFLAGS="$CFLAGS -Dsocklen_t=size_t"
        else
            echo 'no'
            echo 'Cannot work out what to use for socklen_t. Help...'
            rm -f __conftest*
            exit
        fi
    fi
fi
rm -f __conftest*

##################################################

echo -n 'Checking for snprintf declaration... '
cat <<EOF >__conftest.c
#include <stdio.h>
int main() {
    void *x = (void *)snprintf;
    printf("%lx", (long)x);
    return 0;
}

EOF
if (
      $CC $CFLAGS  __conftest.c  -o __conftest || exit 1
   ) >/dev/null 2>&1; then
    echo 'ok'
else
    if (
          $CC $CFLAGS -D_GNU_SOURCE __conftest.c  -o __conftest || exit 1
#          ./__conftest || exit 1
       ) >/dev/null 2>&1; then
        echo '-D_GNU_SOURCE'
        CFLAGS="$CFLAGS -D_GNU_SOURCE"
    else
        echo 'manual'
        CFLAGS="$CFLAGS -DDECLARE_SNPRINTF"
    fi
fi
rm -f __conftest*

echo -n 'Checking for snprintf implementation... '
cat <<EOF >__conftest.c
#include <stdio.h>
#include <string.h>
#ifdef DECLARE_SNPRINTF
#ifdef __cplusplus
extern "C"
#endif /*__cplusplus*/
int snprintf(char *, int, const char *, ...);
#endif /*DECLARE_SNPRINTF*/
int main() {
    char buf[32];
    snprintf(buf, 8, "%s", "1234567890");
    if (strlen(buf)!=7) return 1;
    return 0;
}

EOF
if (
      $CC $CFLAGS  __conftest.c $LIBBSD -o __conftest || exit 1
#      ./__conftest || exit 1
   ) >/dev/null 2>&1; then
    echo 'ok'
else
    if (
          $CC $CFLAGS  __conftest.c -lsnprintf $LIBBSD -o __conftest || exit 1
#          ./__conftest || exit 1
       ) >/dev/null 2>&1; then
        echo '-lsnprintf'
        LIBS="$LIBS -lsnprintf"
    else
        if (
              $CC $CFLAGS  __conftest.c -ldb $LIBBSD -o __conftest || exit 1
#              ./__conftest || exit 1
           ) >/dev/null 2>&1; then
            echo '-ldb'
            LIBS="$LIBS -ldb"
        else
            echo 'missing'
            echo 'This package requires snprintf.'
            rm -f __conftest*
            exit
        fi
    fi
fi
rm -f __conftest*

##################################################

## libbsd should go last in case it's broken
if [ "x$LIBBSD" != x ]; then
    LIBS="$LIBS $LIBBSD"
fi

echo 'Generating MCONFIG...'
(
    echo -n '# Generated by configure (confgen version 2) on '
    date
    echo '#'
    echo

    echo "BINDIR=$BINDIR"
    echo "MANDIR=$MANDIR"
    echo "BINMODE=$BINMODE"
    echo "MANMODE=$MANMODE"
    echo "PREFIX=$PREFIX"
    echo "EXECPREFIX=$EXECPREFIX"
    echo "INSTALLROOT=$INSTALLROOT"
    echo "CC=$CC"
    if [ x$CC_WARNINGS != x ]; then
        CFLAGS="$CFLAGS $WARNINGS"
    fi

    echo "CFLAGS=$CFLAGS" | sed 's/= */=/'
    echo "LDFLAGS=$LDFLAGS" | sed 's/= */=/'
    echo "LIBS=$LIBS" | sed 's/= */=/'

    echo "LIBTERMCAP=$LIBTERMCAP"
    echo "USE_GLIBC=$USE_GLIBC"
    echo "USE_READLINE=$USE_READLINE"
) > MCONFIG