summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2022-12-29 11:02:46 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2022-12-29 11:02:46 (GMT)
commit41db261acccf3494aa93b71a181cde9e8605a841 (patch)
tree07a00f88920a8e601268d415131630052ef85988 /configure.ac
parentc27f884ec1d18d9cff0d19d6ba8de1dd54d991c4 (diff)
Refactor Makefiles to exclude GTK on demand.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac131
1 files changed, 96 insertions, 35 deletions
diff --git a/configure.ac b/configure.ac
index 32a9c05..62ccef5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -214,6 +214,10 @@ AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug], [compile with debugging support [default=no]]),
[], [enable_debug=no])
+AC_ARG_ENABLE([gtk-support],
+ AS_HELP_STRING([--disable-gtk-support], [disable GTK support [default=no]]),
+ [], [enable_gtk_support=yes])
+
AC_ARG_ENABLE([python-bindings],
AS_HELP_STRING([--disable-python-bindings], [disable Python bindings [default=no]]),
[], [enable_python_bindings=yes])
@@ -249,52 +253,69 @@ if test "x$enable_rpath" = "xno"; then
fi
-#--- Small enumerations
+#--- Small enumerations and other basic flags
-CFLAGS="$CFLAGS -fshort-enums -D_LARGEFILE64_SOURCE"
+CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
+CFLAGS="$CFLAGS -fshort-enums"
-#--- Is debug mode needed ?
-if test "x$with_gobject_leak_tracker" = "xyes"; then
- enable_debug="yes"
+#--- Build binaries for Python package only?
+
+if test "x$build_python_package" = "xyes"; then
+ CPPFLAGS="$CPPFLAGS -DPYTHON_PACKAGE"
fi
-if test "x$enable_debug" = "xyes"; then
- DEBUG_CFLAGS="$DEBUG_CFLAGS -O0 -ggdb -gdwarf-2 -DDEBUG"
-else
- DEBUG_CFLAGS="$DEBUG_CFLAGS -DNDEBUG"
+
+#--- Discard local sources when looking for resources?
+
+if test "x$with_local_resources" = "xno"; then
+ CPPFLAGS="$CPPFLAGS -DDISCARD_LOCAL"
fi
-AC_SUBST(DEBUG_CFLAGS)
+
+#--- Is debug mode needed?
AM_CONDITIONAL([TRACK_GOBJECT_LEAKS], [test "x$with_gobject_leak_tracker" = "xyes"])
if test "x$with_gobject_leak_tracker" = "xyes"; then
AC_DEFINE(TRACK_GOBJECT_LEAKS, 1,
[Define to 1 to enable code for dumping remaining GObject instances at exit.])
+ enable_debug="yes"
fi
+if test "x$enable_debug" = "xyes"; then
+ DEBUG_CPPFLAGS="-DDEBUG"
+ DEBUG_CFLAGS="-O0 -ggdb -gdwarf-2"
+else
+ DEBUG_CPPFLAGS="-DNDEBUG"
+fi
-#--- Discard local sources when looking for resources ?
-if test "x$build_python_package" = "xyes"; then
- CFLAGS="$CFLAGS -DPYTHON_PACKAGE"
-fi
+#--- Compilation warnings
-AC_SUBST(CFLAGS)
+WARNING_CFLAGS="-Wall -Wimplicit -Wreturn-type -Wunused -Wswitch -Wcomment -Wuninitialized -Wparentheses -Wpointer-arith -Wmissing-prototypes"
+
+#-Wcast-qual -Wconversion -Wsign-compare -Wdisabled-optimization
+
+# _BSD_SOURCE: htobe64, be64toh
+# _XOPEN_SOURCE: strdup, snprintf
+# _ISOC99_SOURCE: INFINITY; NAN
+# GTK_DISABLE_DEPRECATED: on reste conforme au C99
+#COMPLIANCE_FLAGS="-D_BSD_SOURCE -D_GNU_SOURCE -DGTK_DISABLE_DEPRECATED"
+COMPLIANCE_CPPFLAGS="-D_DEFAULT_SOURCE -D_GNU_SOURCE"
-#--- Discard local sources when looking for resources ?
+#--- Final exports
-if test "x$with_local_resources" = "xno"; then
- CFLAGS="$CFLAGS -DDISCARD_LOCAL"
-fi
+CPPFLAGS="$CPPFLAGS $DEBUG_CPPFLAGS $COMPLIANCE_CPPFLAGS"
+CFLAGS="$CFLAGS $DEBUG_CFLAGS $WARNING_CFLAGS"
+AC_SUBST(CPPFLAGS)
AC_SUBST(CFLAGS)
-#--- Custom destination for desktop resources ?
+#--- Custom destination for desktop resources?
if test "x$with_desktop_dir" != x; then
DESKTOP_DATADIR=$with_desktop_dir
@@ -306,26 +327,40 @@ AM_CONDITIONAL(DESKTOP_DATADIR, test "x$with_desktop_dir" != xno)
AC_SUBST(DESKTOP_DATADIR)
-#--- Compilation warnings
+#--- Checks for GTK 3.0 / GObject 2.0
-#-Wall -Wimplicit -Wreturn-type -Wunused -Wswitch -Wcomment -Wuninitialized -Wparentheses -Wpointer-arith -Wmissing-prototypes
+AM_CONDITIONAL([BUILD_GTK_SUPPORT], [test "x$enable_gtk_support" = "xyes"])
-WARNING_FLAGS="-Wall -Wimplicit -Wreturn-type -Wunused -Wswitch -Wcomment -Wuninitialized -Wparentheses -Wpointer-arith -Wmissing-prototypes"
+if test "x$BUILD_GTK_SUPPORT_TRUE" = "x"; then
+ AC_DEFINE(HAVE_GTK_SUPPORT, 1,
+ [Define to 1 if the GTK support is available and enabled.])
+fi
-#-Wcast-qual -Wconversion -Wsign-compare -Wdisabled-optimization
-AC_SUBST(WARNING_FLAGS)
+PKG_CHECK_MODULES(LIBGOBJ,gobject-2.0 >= 2.66.8,[libgobj_found=yes],[libgobj_found=no])
-# _BSD_SOURCE: htobe64, be64toh
-# _XOPEN_SOURCE: strdup, snprintf
-# _ISOC99_SOURCE: INFINITY; NAN
-# GTK_DISABLE_DEPRECATED: on reste conforme au C99
-#COMPLIANCE_FLAGS="-D_BSD_SOURCE -D_GNU_SOURCE -DGTK_DISABLE_DEPRECATED"
-COMPLIANCE_FLAGS="-D_DEFAULT_SOURCE -D_GNU_SOURCE"
+if test "$libgobj_found" = "yes"; then
+ libgobj_version=`pkg-config gobject-2.0 --modversion`
+else
+ libgobj_version='-'
+fi
-AC_SUBST(COMPLIANCE_FLAGS)
+PKG_CHECK_MODULES(LIBGTHREAD,gthread-2.0 >= 2.66.8,[libgthread_found=yes],[libgthread_found=no])
+
+if test "$libgthread_found" = "yes"; then
+ libgthread_version=`pkg-config gthread-2.0 --modversion`
+else
+ libgthread_version='-'
+fi
+
+PKG_CHECK_MODULES(LIBGMOD,gmodule-2.0 >= 2.66.8,[libgmod_found=yes],[libgmod_found=no])
+
+if test "$libgmod_found" = "yes"; then
+ libgmod_version=`pkg-config gmodule-2.0 --modversion`
+else
+ libgmod_version='-'
+fi
-#--- Checks for GTK 2.0
PKG_CHECK_MODULES(LIBGTK,gtk+-3.0 >= 3.8.6,[libgtk_found=yes],[libgtk_found=no])
@@ -335,8 +370,24 @@ else
libgtk_version='-'
fi
-AC_SUBST(LIBGTK_CFLAGS)
-AC_SUBST(LIBGTK_LIBS)
+
+if test "x$enable_gtk_support" = "xyes"; then
+
+ TOOLKIT_CFLAGS="$LIBGTK_CFLAGS $LIBGTHREAD_CFLAGS $LIBGMOD_CFLAGS"
+ TOOLKIT_LIBS="$LIBGTK_LIBS $LIBGTHREAD_LIBS $LIBGMOD_LIBS"
+
+ AC_SUBST(TOOLKIT_CFLAGS)
+ AC_SUBST(TOOLKIT_LIBS)
+
+else
+
+ TOOLKIT_CFLAGS="$LIBGOBJ_CFLAGS $LIBGTHREAD_CFLAGS $LIBGMOD_CFLAGS"
+ TOOLKIT_LIBS="$LIBGOBJ_LIBS $LIBGTHREAD_LIBS $LIBGMOD_LIBS"
+
+ AC_SUBST(TOOLKIT_CFLAGS)
+ AC_SUBST(TOOLKIT_LIBS)
+
+fi
#--- Checks for libxml2
@@ -640,6 +691,9 @@ echo -n $PACKAGE r
echo AC_PACKAGE_VERSION
echo
+echo The GLib and object library.................. : $libgobj_version
+echo The thread support for GLib.................. : $libgthread_version
+echo The dynamic module loader for GLib........... : $libgmod_version
echo The GNU Image Manipulation Program Toolkit... : $libgtk_version
echo The XML C parser and toolkit of Gnome........ : $libxml_version
echo The flexible interface for archives I/O...... : $libarchive_version
@@ -655,6 +709,12 @@ echo
echo Found lexical analyzer generator............. : $LEX_INST
echo Found general-purpose parser generator....... : $YACC_INST
+if test "x$enable_gtk_support" = "xyes"; then
+ disable_gtk_support="no"
+else
+ disable_gtk_support="yes"
+fi
+
if test "x$enable_python_bindings" = "xyes"; then
disable_python_bindings="no"
else
@@ -664,6 +724,7 @@ fi
echo
echo Print debugging messages..................... : $enable_debug
echo Consider local resources..................... : $with_local_resources
+echo Disable GTK support.......................... : $disable_gtk_support
echo Disable Python bindings...................... : $disable_python_bindings
echo Build a Python binary distribution........... : $build_python_package