view configure.in @ 672:388f2a48aaae

Missed one function to typedef. Fixed errors in the test program and switched to using the new HICN type after making sure the code built on the other platforms unmodified.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 27 Feb 2011 19:25:21 +0000
parents d7badd5606ca
children 39d848c20c05
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
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 ---------------------- 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],
)
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"
AC_SUBST(SYSCONF_LINK_TARGET_SHARED)
AC_SUBST(SYSCONF_LINK_TARGET_SHARED2)

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

SONAME=""
OPSYSTEM=`uname -s`
case "$OPSYSTEM" in
   MINGW32*)
      AC_DEFINE(DW_USE_GTK)
   ;;
   *Linux*)
      SONAME="-Wl,-soname,lib$TARGET.so.$DW_MAJOR_VERSION"
   ;;
esac

if test $OPSYSTEM = "Darwin"; then
   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 ppc84 -arch x86_64"
         ;;
      *)
         ARCH="-arch $with_arch"
         ;;
   esac
   SHAREDFLAG="-dynamiclib -flat_namespace -undefined suppress"
   SOSUFFIX=dylib
   if test $with_gtk = yes; then
      DW_DIR=gtk
      DW_SRC=dw.c
      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"
   else
      DW_DIR=mac
      DW_SRC=dw.m
      DW_DEFINE=__MAC__
      LIBS="$LIBS -framework Cocoa -framework WebKit"
   fi
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`
      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+-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. dwindows cannot build without it.
                                                   )
                                      )
                         )
            )

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"

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_SUBST(SHAREDFLAG)
AC_SUBST(SOSUFFIX)
AC_SUBST(SONAME)

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