view configure.in @ 1483:73f2ad84d4ec

Fixed OS/2 windows being shown when setting position/size. Moved the OS/2 specific DW_OS2_NEW_WINDOW flag into os2/dw.c. Deprecated and essentially removed DW_FCF_SHELLPOSITION and DW_FCF_NOBYTEALIGN. These were OS/2 specific and are set automatically now... FCF_SHELLPOSITION was causing the positioning problems that necessitated the window being shown to set the size and position. Right now SHELLPOSITION isn't used at all... causing shell positioning to not work. I hope to have a way to allow shell positioning to work again soon but the idea I had to do this did not work.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 23 Dec 2011 15:58:13 +0000
parents 751f127439f7
children 6baf177f335c
line wrap: on
line source

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

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

AC_DEFUN([AC_DATAROOTDIR_CHECKED])

DW_DIR=gtk
DW_SRC=dw.c
DW_DEFINE=__UNIX__
SHAREDFLAG=-shared
SOSUFFIX=so
LIBSUFFIX=a
LIBPREFIX=lib

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
if test -d .svn; then 
   AC_CHECK_PROG(SVNVERSION, svnversion, svnversion)
fi
if test x"$SVNVERSION" = x; then
   SVNVERSION=0
else
   SVNVERSION="\` $SVNVERSION -n . | cut -d \":\" -f 1 | tr -d MS \`"
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 ---------------------- check for '--with-gtk3' switch -----------------
AC_ARG_WITH(gtk3,
   [  --with-gtk3             specify this to build with GTK+ 3.x if available],
   [with_gtk3=$withval],
   [with_gtk3=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, intel, 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(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF,1,Determine whether we have the vsnprintf 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"
            ;;
         intel)
            ARCH="-arch i386 -arch x86_64"
            ;;
         *)
            ARCH="-arch $with_arch"
            ;;
      esac
      SHAREDFLAG="-dynamiclib -flat_namespace -undefined suppress -headerpad_max_install_names"
      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_LIBS=""
      if test $with_gtk3 = "yes"; then
         GTK_PACKAGES="gtk+-3.0"
         GTK_LIBS=`$PKG_CFG --silence-errors --libs $GTK_PACKAGES`
      fi
      WEBKIT_PKG="webkit-1.1"
      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
         WEBKIT_PKG="webkitgtk-3.0"
      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
         # test for webkit-1.1 or webkitgtk-3.0 packages
         MOZEMBED_CFLAGS=`$PKG_CFG --silence-errors --cflags $WEBKIT_PKG`
         RPATH=`$PKG_CFG --silence-errors --libs-only-L $WEBKIT_PKG | cut -b 3-`
         if test x"$MOZEMBED_CFLAGS" = x; then
            # no webkit-1.1 or webkitgtk-3.0, look for webkit-1.0
            WEBKIT_PKG="webkit-1.0"
            MOZEMBED_CFLAGS=`$PKG_CFG --silence-errors --cflags $WEBKIT_PKG`
            RPATH=`$PKG_CFG --silence-errors --libs-only-L $WEBKIT_PKG | cut -b 3-`
            if test x"$MOZEMBED_CFLAGS" = x; then
               WEBKIT_PKG="WebKitGtk"
               MOZEMBED_LIBS=`$PKG_CFG --silence-errors --libs $WEBKIT_PKG`
               MOZEMBED_CFLAGS=`$PKG_CFG --silence-errors --cflags $WEBKIT_PKG`
               RPATH=`$PKG_CFG --silence-errors --libs-only-L $WEBKIT_PKG | cut -b 3-`
            else
               AC_DEFINE(USE_WEBKIT10)
               WEBKIT_LIB=$WEBKIT_PKG
               MOZEMBED_LIBS=`$PKG_CFG --silence-errors --libs $WEBKIT_PKG`
               RESULT=`echo $MOZEMBED_LIBS | grep lwebkitgtk-1.0`
               if test x"$RESULT" != x; then
                   WEBKIT_LIB=webkitgtk-1.0
               fi
            fi
         else
            AC_DEFINE(USE_WEBKIT11)
            WEBKIT_LIB=$WEBKIT_PKG
         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