[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Optional GTK?
From: |
Mick |
Subject: |
Re: Optional GTK? |
Date: |
Mon, 14 Sep 2009 11:31:11 +1000 |
On Sun, 13 Sep 2009 21:21:06 -0400
"Patrick M. Rutkowski" <address@hidden> wrote:
> If I were to run something like AM_PATH_GTK_2_0 in my configure.ac,
> which checks for the presence of GTK, what would I do if GTK wasn't
> found?
>
> This might be the case on OS X, or on a KDE system.
>
> I can potentially compile this library of mine with the GTK features
> just left out, there's a lot more to the library that can still be
> useful
>
> But how do I do that?
>
> A) Is it possible to get automake to just NOT COMPILE the gtk related
> *.c files based on the autoconf results?
> or
> B) Do I take the gtk related *.c files and wrap them in big "#ifdef
> USE_GTK / #endif" wrappers?
>
> Is there a standard answer?
>
> -Patrick
you would use something like:
AC_ARG_ENABLE(gtk_v2,
[ --disable-gtk_v2 disable gtk v2.0.x support])
if test "x${GTK_CFLAGS}" != "x"; then
if test "x$enable_gtk_v2" != "xno"; then
echo yes
fi
if test "$enable_threads" != "no"; then
GTK_LIBS=`pkg-config --libs gtk+-2.0 gthread-2.0
2> /dev/null` else
GTK_LIBS=`pkg-config --libs gtk+-2.0 2> /dev/null`
fi
CFLAGS="${CFLAGS} ${GTK_CFLAGS}"
LIBS="${LIBS} ${GTK_LIBS}"
AC_DEFINE([USE_GTK2],[],[])
else
if test "x$enable_gtk_v2" != "xno"; then
echo no
fi
AM_PATH_GTK(1.2.0, ,
AC_MSG_WARN(Cannot find GTK: Is gtk-config in path?),
gthread)
AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?),
gthread)
in configure.in, can't remember what else but I hope this helps
Mik