#!/bin/sh -x
# Only make Makefile if it does not exist.
if [ -e Makefile ]; then
  exit 0
fi

TOPDIR=`cd ../../..; pwd`

# SU="eval sudo"
AR=mips-ar
CC=mips-gcc
# CP="${SU} ${TOPDIR}/brecis/holes/gzipelf/gzipelf.sh"
RANLIB=mips-ranlib

CPPFLAGS="-DHAVE_STRUCT_IN6_ADDR -DHAVE_STRUCT_SOCKADDR_IN6"

CFLAGS="-Os -Wno-error"

LDFLAGS=" -Wl,--no-undefined -Wl,--warn-once -Wl,--warn-common -Wl,--warn-constructors -Wl,--warn-multiple-gp"

INSTALL="${CP}"
INSTALL_PROGRAM="${INSTALL}"
INSTALL_DATA="${INSTALL}"
INSTALL_SCRIPT="${INSTALL}"
# INSTALL_MV="${SU} mv -f"
INSTALL_MV="echo"

export AR
export CC
export CFLAGS
export CPPFLAGS
export LDFLAGS
export LIBS
export RANLIB
export INSTALL
export INSTALL_PROGRAM
export INSTALL_DATA
export INSTALL_SCRIPT
export INSTALL_MV

ac_cv_path_PROG_LS=/bin/ls \
ac_cv_path_PROG_NETSTAT=/sbin/netstat \
ac_cv_path_PROG_ARP=/sbin/arp \
ac_cv_path_PROG_IFCONFIG=/sbin/ifconfig \
ac_cv_path_PROG_JSTAT=no \
ac_cv_path_PROG_PS=/bin/ps \
ac_cv_path_PROG_SAR=no \
ac_cv_path_PROG_W=no \
ac_cv_path_PROG_WHO=no \
ac_cv_path_PROG_LAST=no \
ac_cv_path_PROG_LASTLOG=no \
ac_cv_path_PROG_DF=/bin/df \
ac_cv_path_PROG_VMSTAT=no \
ac_cv_path_PROG_UPTIME=no \
ac_cv_path_PROG_IPCS=no \
ac_cv_path_PROG_TAIL=/bin/tail \
ac_cv_type_char=1 \
ac_cv_type_short_int=2 \
ac_cv_type_int=4 \
ac_cv_type_long_int=4 \
ac_cv_type_long_long_int=8 \
ac_cv_have_u_int=yes \
ac_cv_have_intxx_t=no \
ac_cv_have_int64_t=no \
ac_cv_have_u_intxx_t=no \
ac_cv_have_u_int64_t=no \
ac_cv_have_uintxx_t=no \
ac_cv_have_u_char=yes \
ac_cv_type_socklen_t=yes \
ac_cv_type_sig_atomic_t=yes \
ac_cv_have_size_t=yes \
ac_cv_have_ssize_t=yes \
ac_cv_have_clock_t=yes \
ac_cv_have_sa_family_t=yes \
ac_cv_have_pid_t=yes \
ac_cv_have_mode_t=yes \
ac_cv_have_struct_sockaddr_storage=yes \
ac_cv_have_struct_sockaddr_in6=no \
ac_cv_have_struct_in6_addr=no \
ac_cv_have_struct_addrinfo=yes \
ac_cv_have_struct_timeval=yes \
\
ac_cv_member_struct_stat_st_blksize=yes \
ac_cv_have_ss_family_in_struct_ss=yes \
ac_cv_have___ss_family_in_struct_ss=no \
ac_cv_have_pw_class_in_struct_passwd=no \
ac_cv_have_pw_expire_in_struct_passwd=no \
ac_cv_have_pw_change_in_struct_passwd=no \
ac_cv_have_accrights_in_msghdr=no \
ac_cv_have_control_in_msghdr=yes \
ac_cv_libc_defines___progname=yes \
ac_cv_cc_implements___FUNCTION__=yes \
ac_cv_cc_implements___func__=yes \
ac_cv_have_getopt_optreset=no \
ac_cv_libc_defines_sys_errlist=no \
ac_cv_libc_defines_sys_nerr=no \
with_xauth=no \
disable_ptmx_check=yes \
ac_cv_file___dev_ptc_=no \
ac_cv_path_NROFF=no \
\
ac_cv_func_getpgrp_void=yes \
ac_cv_func_daemon=yes \
ac_cv_func_utmpxname=no \
ac_cv_func_setutxent=no \
ac_cv_func_pututxline=no \
ac_cv_func_getutxline=no \
ac_cv_func_getutxid=no \
ac_cv_func_getutxent=no \
ac_cv_func_endutxent=not \
ac_cv_func_setutent=no \
ac_cv_func_getutline=no \
ac_cv_func_getutid=not \
ac_cv_func_getutent=no \
ac_cv_func_endutent=no \
ac_cv_func_time=yes \
ac_cv_func_dirname=yes \
ac_cv_func_snprintf=yes \
ac_cv_func___b64_ntop=no \
ac_cv_func_waitpid=yes \
ac_cv_func_vsnprintf=yes \
ac_cv_func_vhangup=yes \
ac_cv_func_truncate=yes \
ac_cv_func_tcgetpgrp=yes \
ac_cv_func_sysconf=yes \
ac_cv_func_strsep=yes \
ac_cv_func_strmode=no \
ac_cv_func_strlcpy=yes \
ac_cv_func_strlcat=yes \
ac_cv_func_socketpair=yes \
ac_cv_func_snprintf=yes \
ac_cv_func_sigvec=yes \
ac_cv_func_sigaction=yes \
ac_cv_func_setpcred=no \
ac_cv_func_setsid=yes \
ac_cv_func_setrlimit=yes \
ac_cv_func_setreuid=yes \
ac_cv_path_LOGIN_PROGRAM_FALLBACK=/bin/login \
ac_cv_func_filepriv=yes \
ac_cv_func_ent=no \
ac_cv_path_PERL=perl \
ac_cv_path_AR=mips-ar \
ac_cv_func_setresgid=yes \
ac_cv_func_setlogin=no \
ac_cv_func_setgroups=yes \
ac_cv_func_seteuid=yes \
ac_cv_func_setenv=yes \
ac_cv_func_setegid=yes \
ac_cv_func_sendmsg=yes \
ac_cv_func_rresvport_af=no \
ac_cv_func_recvmsg=yes \
ac_cv_func_openpty=yes \
ac_cv_func_mmap=no \
ac_cv_func_innetgr=no \
ac_cv_func_inet_ntop=yes \
ac_cv_func_inet_aton=yes \
ac_cv_func_getttyent=yes \
ac_cv_func_getrusage=yes \
ac_cv_func_getrlimit=yes \
ac_cv_func_getopt=yes \
ac_cv_func_getnameinfo=yes \
ac_cv_func_getgrouplist=no \
ac_cv_func_getaddrinfo=yes \
ac_cv_func_gai_strerror=yes \
ac_cv_func_freeaddrinfo=yes \
ac_cv_func_fchown=yes \
ac_cv_func_fchmod=yes \
ac_cv_func_clock=yes \
ac_cv_func_b64_ntop=no \
ac_cv_func_strftime=yes \
ac_cv_func_utimes=yes \
ac_cv_lib_z_deflate=yes \
ac_cv_func_setsockopt=yes \
\
ac_cv_func_setreuid=yes \
ac_cv_func_feof_unlocked=yes \
ac_cv_func_fgets_unlocked=yes \
ac_cv_func_getegid=yes \
ac_cv_func_geteuid=yes \
ac_cv_func_getgid=yes \
ac_cv_func_getuid=yes \
ac_cv_func_tsearch=yes \
lt_cv_sys_global_symbol_pipe=no \
\
ac_cv_func_getcwd=no \
ac_cv_func_dup2=yes \
ac_cv_func_ulimit=yes \
\
am_cv_lib_error_at_line=yes \
ac_cv_func_pathconf=yes \
ac_cv_func_strerror_r_works=yes \
ac_cv_search_nanosleep=no \
jm_cv_func_nanosleep_works=yes \
ac_cv_func_memcmp_working=yes \
jm_cv_func_working_getgroups=yes \
ac_cv_func_ftruncate=yes \
ac_cv_func_memcmp=yes \
ac_cv_func_rmdir=yes \
ac_cv_func_strndup=yes \
ac_cv_func_strnlen=yes \
ac_cv_func_getpass=yes \
ac_cv_func_memrchr=yes \
ac_cv_func_mkstemp=yes \
ac_cv_func_fchdir=yes \
ac_cv_func_fdatasync=yes \
ac_cv_func_fseeko=yes \
ac_cv_func_hasmntopt=yes \
ac_cv_func_mkfifo=yes \
ac_cv_func_realpath=yes \
am_cv_func_working_getline=yes \
ac_cv_func_getmntent=yes \
\
ac_cv_func_fnmatch_works=yes \
ac_cv_func_vprintf=yes \
su_cv_sys_c_line_in_termios=yes \
su_cv_func_ut_host_in_utmp=yes \
su_cv_func_ut_host_in_utmpx=yes \
ac_cv_func_mmap_fixed_mapped=yes \
ac_cv_func_uname=yes \
ac_cv_func_chroot=yes \
ac_cv_func_gethostid=yes \
ac_cv_func_alarm=yes \
ac_cv_func_working_mktime=yes \
jm_cv_func_memcmp_working=yes \
jm_cv_struct_dirent_d_type=yes \
ac_cv_func_strerror=yes \
ac_cv_func_strerror_r=yes \
ac_cv_func_bzero=yes \
ac_cv_func_bcopy=yes \
ac_cv_func_isascii=yes \
ac_cv_func_lchown=yes \
jm_cv_func_working_chown=yes \
ac_cv_func_localtime_r=yes \
jm_cv_func_working_realloc=yes \
jm_cv_func_working_malloc=yes \
jm_cv_func_working_readdir=yes \
ac_cv_func_strtoumax=yes \
ac_cv_func_strtoull=yes \
jm_cv_func_working_re_compile_pattern=yes \
ac_cv_func_strcasecmp=yes \
ac_cv_func_strncasecmp=yes \
ac_cv_func_dup2=yes \
ac_cv_func_memchr=yes \
ac_cv_func_memmove=yes \
ac_cv_func_getpagesize=yes \
ac_cv_func_getline=yes \
ac_cv_func_getdelim=yes \
ac_cv_func_gethostbyname=yes \
ac_cv_func_gethostbyaddr=yes \
ac_cv_func_inet_ntoa=yes \
ac_cv_func_endgrent=yes \
ac_cv_func_endpwent=yes \
ac_cv_func_ftime=yes \
ac_cv_func_getcwd=yes \
ac_cv_func_gettimeofday=yes \
ac_cv_func_memcpy=yes \
ac_cv_func_mempcpy=yes \
ac_cv_func_sethostname=yes \
ac_cv_func_strchr=yes \
ac_cv_func_strrchr=yes \
ac_cv_func_sysinfo=yes \
ac_cv_func_tzset=yes \
ac_cv_func_initgroups=yes \
ac_cv_func_syslog=yes \
ac_cv_func_gethostname=yes \
ac_cv_func_getusershell=yes \
ac_cv_func_memset=yes \
ac_cv_func_stime=yes \
ac_cv_func_strcspn=yes \
ac_cv_func_stpcpy=yes \
ac_cv_func_strstr=yes \
ac_cv_func_strtol=yes \
ac_cv_func_strtoul=yes \
ac_cv_func_strpbrk=yes \
ac_cv_func_getgroups=yes \
utils_cv_func_setpriority=yes \
utils_cv_func_nice=yes \
ac_cv_func_utmpname=yes \
am_cv_func_strtod=yes \
ac_cv_func_munmap=yes \
ac_cv_func_putenv=yes \
jm_cv_func_svid_putenv=yes \
ac_cv_func_setenv=yes \
ac_cv_func_strdup=yes \
\
ac_cv_prog_RANLIB=mips-ranlib \
ac_cv_func_setvbuf_reversed=no \
ac_cv_search_crypt="-lcrypt -lc" \
DESTDIR="${TOPDIR}/uC-src" \
./configure \
	--prefix="/" \
	--sysconfdir=/etc/ssh \
	--host=mips-linux-elf \
	--includedir=${TOPDIR}/uclibc/include \
	--libdir=${TOPDIR}/uclibc/lib/ \
	--without-included-regex \
	--disable-lastlog \
	--disable-utmp \
	--disable-utmpx \
	--disable-wtmp \
	--disable-wtmpx \
	--disable-libutil \
	--disable-pututline \
	--disable-pututxline \
	--disable-assert \
	--disable-nls \
	--with-cflags="${CFLAGS}" \
	--with-cppflags="${CPPFLAGS}" \
	--with-zlib=../zlib-1.1.4/ \
	--without-shadow \
	--with-ipaddr-display \
	--with-ipv4-default \
	--with-pid-dir=/var \
	--with-ssl-dir=${TOPDIR}/uC-src/real/openssl-0.9.6e/ \
	--with-included-gettext \
	--without-pam
#
#	--with-ldflags="${LDFLAGS}"
#	--target=mips-linux-elf
