view configure.in @ 0:879c2819a48d

Initial commit.
author Brian Smith <brian@dbsoft.org>
date Fri, 18 Feb 2011 08:45:38 -0600
parents
children
line wrap: on
line source

AC_INIT(install.c)
AC_CONFIG_HEADER(config.h)

INCLUDES="-I."

AC_PROG_CC

AC_CHECK_PROG(MAKE, gmake, gmake)
if test x"$MAKE" = x; then
  AC_CHECK_PROG(MAKE, make, make)
fi

AC_PROG_INSTALL

AC_SUBST(MAKE)

AC_HEADER_STDC
AC_HEADER_DIRENT
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(sys/stat.h)

AC_CHECK_FUNCS(pipe, AC_DEFINE(HAVE_PIPE,1,Determine whether we have the pipe function))                      

AC_CHECK_FUNCS(connect)
if test x"$ac_cv_func_connect" = x"no"; then
  if test -z "$libsocket"; then
    AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket",)
  fi

  dnl this is for isc.  need the nsl_s library as well.
  if test -z "$libinet"; then
    AC_CHECK_LIB(inet, socket, libnsl=1; LIBS="$LIBS -linet -lnsl_s",)
  fi

  if test -z "$libnsl"; then
    AC_CHECK_LIB(nsl, gethostname, LIBS="$LIBS -lnsl",)
  fi
fi

AC_CHECK_LIB(sun, getpwnam, LIBS="$LIBS -lsun",)
AC_CHECK_LIB(dgc, inet_addr, LIBS="$LIBS -ldgc",)
AC_CHECK_LIB(resolv, gethostbyname, LIBS="$LIBS -lresolv",)

OPSYSTEM=`uname -s`

if test $OPSYSTEM = "Darwin"; then
	DW_SRC=mac
        DW_DEFINE=__MAC__
	SHAREDFLAG=-dynamiclib
	SOSUFFIX=dylib
	LIBS="$LIBS -framework Carbon"
else
	AC_CHECK_PROG(PKG_CFG, pkg-config, pkg-config)
	if test x"$PKG_CFG" != x; then
	  GTK_LIBS=`$PKG_CFG --silence-errors --libs gtk+-2.0 gthread-2.0`
	fi

	if test x"$GTK_LIBS" = x; then
	  AM_PATH_GLIB(1.2.0,,AC_MSG_ERROR(AC_MSG_ERROR(Cannot find GLIB: Is glib-config in path?)))
	  AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?)), gthread)
	  AM_PATH_GDK_IMLIB(1.9.4, AC_DEFINE(USE_IMLIB), AC_MSG_ERROR(IMLIB not found or too old. Dynamic Windows cannot build without it.))
	else
	  GTK_CFLAGS=`$PKG_CFG --cflags gtk+-2.0 gthread-2.0`
	  GTK_LIBS=`$PKG_CFG --libs gtk+-2.0 gthread-2.0`
	fi
fi

AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([pthread header not found. Dynamic Windows cannot build without it.]))
AC_CHECK_LIB(pthread, pthread_attr_init, PTHREAD_LIBS="-lpthread",
AC_CHECK_LIB(pthreads, pthread_attr_init, PTHREAD_LIBS="-lpthreads",
  AC_CHECK_LIB(c_r, pthread_attr_init, PTHREAD_LIBS="-lc_r",
      AC_MSG_ERROR(pthread library not found. HandyFTP cannot build without it.
      )
    )
  )
)

CFLAGS="$CFLAGS $GTK_CFLAGS $GDK_IMLIB_FLAGS"
LIBS="$LIBS $GTK_LIBS $PTHREAD_LIBS $GDK_IMLIB_LIBS"

RM="rm -f"
LN="ln -s"
CP="cp"
MV="mv"
MKDIR="mkdir"


AC_SUBST(INCLUDES)
AC_SUBST(RM)
AC_SUBST(LN)
AC_SUBST(CP)
AC_SUBST(MV)
AC_SUBST(MKDIR)

AC_CONFIG_FILES([
Makefile
sfxace/Makefile
sfxzip/Makefile
packace/Makefile
packzip/Makefile
uninst/Makefile ])
AC_OUTPUT