view configure.in @ 839:ccfa5173659f

Initial implementation of scrollboxes on Windows. Windows does not have a scrolledview/area widget like on other platforms, so I have created one. Implemented the layout system like I did on MacOS and discovered what likely is the issue on the Mac. There seems to be a bug in the layout system which is avoided by packing into a single expandable box. When used and padding are exactly the same, the layout engine drops out to prevent a divide by zero. Will look into fixing this in the layout engine, but for now using the container box workaround. The scrolled view widget is not finished, will need to implement the scrollbars but internally.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 29 Mar 2011 17:21:50 +0000
parents 5ec50e403a8a
children baf23fa69b99
line wrap: on
line source

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

DW_MAJOR_VERSION=1
DW_MINOR_VERSION=1
DW_SUB_VERSION=0

TARGET="dwindows"
TARGET2="dwcompat"
AC_SUBST(TARGET)
AC_SUBST(TARGET2)

DW_DIR=gtk
DW_SRC=dw.c
DW_DEFINE=__UNIX__
SHAREDFLAG=-shared
SOSUFFIX=so
LIBSUFFIX=a
LIBPREFIX=lib
AC_SUBST(DW_MAJOR_VERSION)
AC_SUBST(DW_MINOR_VERSION)
AC_SUBST(DW_SUB_VERSION)

INCLUDES="-I."

AC_PROG_CC
AC_PROG_CXX

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)

dnl Checks for system
AC_CANONICAL_SYSTEM

dnl ---------------------- check for '--with-compat' switch -----------------
AC_ARG_WITH(compat,
   [  --with-compat           specify this to build the optional dwcompat library],
   [with_compat=$withval],
   [with_compat=no],
)
dnl ---------------------- default targets to build -----------------
if test $with_compat = yes; then
   COMPAT_OBJECT="compat.o"
   INSTALL_COMPAT="installcompat"
   SYSCONF_LINK_TARGET_SHARED2="lib$TARGET2.$SOSUFFIX.$DW_MAJOR_VERSION.$DW_MINOR_VERSION"
else
   COMPAT_OBJECT=""
   INSTALL_COMPAT=""
   SYSCONF_LINK_TARGET_SHARED2=""
fi
SYSCONF_LINK_TARGET_SHARED="lib$TARGET.$SOSUFFIX.$DW_MAJOR_VERSION.$DW_MINOR_VERSION"
SYSCONF_LINK_TARGET_STATIC="lib$TARGET.a"

dnl ---------------------- check for '--with-gtk+' switch -----------------
AC_ARG_WITH(gtk,
   [  --with-gtk              specify this to build dwindows with GTK+ (only relevant for OSX)],
   [with_gtk=$withval],
   [with_gtk=no],
)

dnl ---------------------- check for '--with-gtkframework' switch -----------------
AC_ARG_WITH(gtkframework,
   [  --with-gtkframework     specify this to build dwindows with GTK+ Framework (only relevant for OSX)],
   [with_gtkframework=$withval],
   [with_gtkframework=no],
)

dnl ---------------------- check for '--with-gtkhtml' switch -----------------
AC_ARG_WITH(gtkhtml,
   [  --with-gtkhtml          specify this to build dwindows with libgtkhtml-2],
   [with_gtkhtml=$withval],
   [with_gtkhtml=no],
)

dnl ---------------------- check for '--with-gtkmozembed' switch -----------------
AC_ARG_WITH(gtkmozembed,
   [  --with-gtkmozembed      specify this to build dwindows with Mozilla gtkmozembed],
   [with_gtkmozembed=$withval],
   [with_gtkmozembed=no],
)

dnl ---------------------- check for '--with-arch' switch -----------------
AC_ARG_WITH(arch,
   [  --with-arch             specify architecture: one of all, 32bit, 64bit, ppc, ppc64, x86_64, i386],
   [with_arch=$withval],
   [with_arch=no],
)

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",)

build_gtk="yes"
check_pthreads="yes"
TARGETS="$SYSCONF_LINK_TARGET_SHARED $SYSCONF_LINK_TARGET_SHARED2"
PLATLIBS=""
SONAME=""
PLATCCFLAGS="-g -O2 -fPIC -Wall"
ARFLAGS="cqs"

case "$target" in
   *cygwin*)
   ;;
   *mingw32)
      AC_DEFINE(DW_USE_GTK)
   ;;
   *linux*)
      SONAME="-Wl,-soname,lib$TARGET.so.$DW_MAJOR_VERSION"
   ;;
   *nto-qnx*)
      DW_DIR="photon"
      DW_DEFINE=__PHOTON__
      build_gtk="no"
   ;;
   *qnx*)
      DW_DIR="photon"
      DW_DEFINE=__PHOTON__
      build_gtk="no"
      check_pthreads="no"
      LIBSUFFIX="lib"
      LIBPREFIX=""
      SYSCONF_LINK_TARGET_STATIC="$TARGET.lib"
      TARGETS="$TARGET.lib"
      PLATCCFLAGS=""
      PLATLIBS="-lphoton_s -lphexlib3r"
      ARFLAGS="r"
   ;;
   *apple-darwin*)
      case "$with_arch" in
         no)
            ARCH=""
            ;;
         all)
            ARCH="-arch ppc -arch ppc64 -arch x86_64 -arch i386"
            ;;
         32bit)
            ARCH="-arch ppc -arch i386"
            ;;
         64bit)
            ARCH="-arch ppc64 -arch x86_64"
            ;;
         *)
            ARCH="-arch $with_arch"
            ;;
      esac
      SHAREDFLAG="-dynamiclib -flat_namespace -undefined suppress"
      SOSUFFIX=dylib
      if test $with_gtkframework = yes; then
         DW_DIR=gtk
         LIBS="$LIBS -framework Gtk -framework Glib -framework Cairo"
         GTK_CFLAGS="-I/Library/Frameworks/Gtk.framework/Headers -I/Library/Frameworks/Glib.framework/Headers -I/Library/Frameworks/Cairo.framework/Headers"
         build_gtk="no"
      elif test $with_gtk = yes; then
         build_gtk="yes"
      else
         DW_DIR=mac
         DW_SRC=dw.m
         DW_DEFINE=__MAC__
         LIBS="$LIBS -framework Cocoa -framework WebKit"
         build_gtk="no"
      fi
   ;;
   *)
   ;;
esac

if test $build_gtk = "yes"; then
   AC_CHECK_PROG(PKG_CFG, pkg-config, pkg-config)
   if test x"$PKG_CFG" != x; then
      GTK_PACKAGES="gtk+-3.0"
      GTK_LIBS=`$PKG_CFG --silence-errors --libs $GTK_PACKAGES`
      if test x"$GTK_LIBS" = x; then
         GTK_PACKAGES="gtk+-2.0 gthread-2.0"
         GTK_LIBS=`$PKG_CFG --silence-errors --libs $GTK_PACKAGES`
      else
         DW_DIR=gtk3
      fi
      if test $with_gtkmozembed = yes; then
         MOZEMBED_LIBS=`$PKG_CFG --silence-errors --libs firefox-gtkmozembed`
         MOZEMBED_CFLAGS=`$PKG_CFG --silence-errors --cflags firefox-gtkmozembed`
         RPATH=`$PKG_CFG --silence-errors --libs-only-L firefox-gtkmozembed | cut -b 3-`
         if test x"$MOZEMBED_LIBS" = x; then
            MOZEMBED_LIBS=`$PKG_CFG --silence-errors --libs mozilla-gtkmozembed`
            MOZEMBED_CFLAGS=`$PKG_CFG --silence-errors --cflags mozilla-gtkmozembed`
            RPATH=`$PKG_CFG --silence-errors --libs-only-L mozilla-gtkmozembed | cut -b 3-`
         fi
      elif test $with_gtkhtml = yes; then
         MOZEMBED_LIBS=`$PKG_CFG --silence-errors --libs libgtkhtml-2.0`
         MOZEMBED_CFLAGS=`$PKG_CFG --silence-errors --cflags libgtkhtml-2.0`
         RPATH=`$PKG_CFG --silence-errors --libs-only-L libgtkhtml-2.0 | cut -b 3-`
      else
         WEBKIT_LIB="webkit-1.1"
         MOZEMBED_CFLAGS=`$PKG_CFG --silence-errors --cflags $WEBKIT_LIB`
         RPATH=`$PKG_CFG --silence-errors --libs-only-L $WEBKIT_LIB | cut -b 3-`
         if test x"$MOZEMBED_CFLAGS" = x; then
            WEBKIT_LIB="webkit-1.0"
            MOZEMBED_CFLAGS=`$PKG_CFG --silence-errors --cflags $WEBKIT_LIB`
            RPATH=`$PKG_CFG --silence-errors --libs-only-L $WEBKIT_LIB | cut -b 3-`
            if test x"$MOZEMBED_CFLAGS" = x; then
               WEBKIT_LIB="WebKitGtk"
#               MOZEMBED_LIBS=`$PKG_CFG --silence-errors --libs $WEBKIT_LIB`
               MOZEMBED_CFLAGS=`$PKG_CFG --silence-errors --cflags $WEBKIT_LIB`
               RPATH=`$PKG_CFG --silence-errors --libs-only-L $WEBKIT_LIB | cut -b 3-`
            else
               AC_DEFINE(USE_WEBKIT10)
            fi
         else
            AC_DEFINE(USE_WEBKIT11)
         fi
         AC_DEFINE_UNQUOTED(WEBKIT_LIB, "$WEBKIT_LIB")
      fi
      if test x"$RPATH" != x; then
         RPATH="-Wl,-R$RPATH"
      fi
   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_PACKAGES`
      GTK_LIBS=`$PKG_CFG --libs $GTK_PACKAGES`
   fi
fi

if test $check_pthreads = "yes"; then
   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_CHECK_LIB(c,
                                                       pthread_attr_init,
                                                       PTHREAD_LIBS="-lc",
                                                       AC_MSG_ERROR(pthread library not found. dwindows cannot build without it.)
                                                      )
                                         )
                            )
               )
fi

CFLAGS="$CFLAGS $GTK_CFLAGS $GDK_IMLIB_FLAGS $MOZEMBED_CFLAGS"

BROWSER_OBJECT=""
if test x"$MOZEMBED_CFLAGS" != x; then
   SAVE_LIBS="$LIBS"
   LIBS="$RPATH $LIBS $GTK_LIBS $PTHREAD_LIBS $GDK_IMLIB_LIBS $MOZEMBED_LIBS"
   BROWSER_OBJECT="browser.o"
   if test $with_gtkmozembed = yes; then
      AC_CHECK_LIB(gtkembedmoz,gtk_moz_embed_new,AC_DEFINE(USE_GTKMOZEMBED),BROWSER_OBJECT="")
   elif test $with_gtkhtml = yes; then
      AC_CHECK_LIB(gtkhtml-2,html_document_new,AC_DEFINE(USE_LIBGTKHTML2),BROWSER_OBJECT="")
   else
      AC_CHECK_LIB($WEBKIT_LIB,webkit_web_view_new,AC_DEFINE(USE_WEBKIT),BROWSER_OBJECT="")
      BROWSER_OBJECT=""
   fi
   LIBS="$SAVE_LIBS"
fi

LIBS="$RPATH $LIBS $GTK_LIBS $PTHREAD_LIBS $GDK_IMLIB_LIBS $MOZEMBED_LIBS $PLATLIBS"

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

AC_SUBST(SYSCONF_LINK_TARGET_SHARED)
AC_SUBST(SYSCONF_LINK_TARGET_SHARED2)
AC_SUBST(SYSCONF_LINK_TARGET_STATIC)

AC_SUBST(INCLUDES)
AC_SUBST(PLATCCFLAGS)
AC_SUBST(ARFLAGS)
AC_SUBST(RM)
AC_SUBST(LN)
AC_SUBST(CP)
AC_SUBST(MV)
AC_SUBST(MKDIR)
AC_SUBST(SHAREDFLAG)
AC_SUBST(SOSUFFIX)
AC_SUBST(LIBSUFFIX)
AC_SUBST(LIBPREFIX)
AC_SUBST(SONAME)
AC_SUBST(TARGETS)

AC_SUBST(DW_SRC)
AC_SUBST(DW_DIR)
AC_SUBST(DW_DEFINE)
AC_SUBST(BROWSER_OBJECT)
AC_SUBST(COMPAT_OBJECT)
AC_SUBST(INSTALL_COMPAT)

AC_SUBST(ARCH)

AC_CONFIG_FILES([
Makefile
dwindows-config ])
AC_OUTPUT