1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-12-22 07:38:51 -05:00

configure: Improve various build flags

- Store openssl flags in own vars
- Share some common flags for plugins
- Fix building plugins on win32
- Store all glib flags in one var
- Don't link against every lib for each plugin
- Don't hardcode ldflags for sysinfo
This commit is contained in:
TingPing 2014-09-06 08:04:52 -04:00 committed by TingPing
parent 94568bc517
commit 0e4164ad0c
7 changed files with 60 additions and 63 deletions

View File

@ -74,6 +74,13 @@ else
fi fi
fi fi
platform_win32=no
case $host_os in
*mingw*|*cygwin*|*msys*)
platform_win32=yes;;
*);;
esac
dnl ********************************************************************* dnl *********************************************************************
dnl ** configure switches *********************************************** dnl ** configure switches ***********************************************
dnl ********************************************************************* dnl *********************************************************************
@ -183,17 +190,9 @@ dnl *********************************************************************
dnl ** GLIB ************************************************************* dnl ** GLIB *************************************************************
dnl ********************************************************************* dnl *********************************************************************
AM_PATH_GLIB_2_0(2.28.0, glib=yes, glib=no) AM_PATH_GLIB_2_0([2.28.0], [], [AC_MSG_ERROR([Glib not found!])], [gmodule gobject gio])
if test "$glib" = no; then COMMON_CFLAGS="$GLIB_CFLAGS -DG_DISABLE_SINGLE_INCLUDES"
AC_MSG_ERROR(Cannot find GLib!) COMMON_LIBS="$GLIB_LIBS"
fi
PKG_CHECK_MODULES([GOBJECT], [gobject-2.0], [], [AC_MSG_ERROR(Cannot find gobject-2.0!)])
PKG_CHECK_MODULES([GIO], [gio-2.0], [], [AC_MSG_ERROR(Cannot find gio-2.0!)])
PKG_CHECK_MODULES([GMODULE], [gmodule-2.0], [], [AC_MSG_ERROR(Cannot find gmodule-2.0!)])
COMMON_CFLAGS="$GLIB_CFLAGS $GIO_CFLAGS $GOBJECT_CFLAGS $GMODULE_CFLAGS -DG_DISABLE_SINGLE_INCLUDES"
COMMON_LIBS="$GLIB_LIBS $GIO_LIBS $GOBJECT_LIBS $GMODULE_LIBS"
dnl ********************************************************************* dnl *********************************************************************
dnl ** GTK ************************************************************** dnl ** GTK **************************************************************
@ -376,17 +375,14 @@ dnl *********************************************************************
retry=no retry=no
if test "$openssl" != no; then if test "$openssl" != no; then
AC_MSG_CHECKING(for openssl through pkg-config) PKG_CHECK_MODULES(OPENSSL, [openssl], [
if $PKG_CONFIG openssl --exists; then
CPPFLAGS="$CPPFLAGS `$PKG_CONFIG openssl --cflags`"
LIBS="$LIBS `$PKG_CONFIG openssl --libs`"
AC_DEFINE(USE_OPENSSL) AC_DEFINE(USE_OPENSSL)
AC_MSG_RESULT(yes)
openssl=yes openssl=yes
else COMMON_LIBS="$COMMON_LIBS $OPENSSL_LIBS"
AC_MSG_RESULT(no) COMMON_CFLAGS="$COMMON_CFLAGS $OPENSSL_CFLAGS"
], [
retry=yes retry=yes
fi ])
fi fi
if test "$retry" = "yes"; then if test "$retry" = "yes"; then
@ -395,30 +391,29 @@ if test "$retry" = "yes"; then
openssl_path=$openssl openssl_path=$openssl
fi fi
openssl=no openssl=no
OPENSSL_LIBS="-lcrypto"
if test -n "$openssl_path"; then
OPENSSL_LIBS="-L$openssl_path/lib $OPENSSL_LIBS"
fi
SAVED_LIBS=$LIBS SAVED_LIBS=$LIBS
LIBS="$LIBS -lcrypto" LIBS="$LIBS $OPENSSL_LIBS"
AC_CHECK_LIB(ssl, SSL_new, [
if test -n "$openssl_path"; then if test -n "$openssl_path"; then
LIBS="-L$openssl_path/lib $LIBS" OPENSSL_CFLAGS="-I$openssl_path/include"
fi fi
AC_CHECK_LIB(ssl, SSL_new, have_openssl=yes) SAVED_CFLAGS=$CFLAGS
LIBS=$SAVED_LIBS CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
if test "$have_openssl" = yes; then AC_CHECK_HEADERS(openssl/ssl.h, [
SAVED_CPPFLAGS=$CPPFLAGS
if test -n "$openssl_path"; then
CPPFLAGS="-I$openssl_path/include $CPPFLAGS"
fi
AC_CHECK_HEADERS(openssl/ssl.h, have_openssl_h=yes)
if test "$have_openssl_h" = yes; then
openssl=yes openssl=yes
AC_DEFINE(USE_OPENSSL) AC_DEFINE(USE_OPENSSL)
LIBS="$LIBS -lssl -lcrypto" OPENSSL_LIBS="$OPENSSL_LIBS -lssl"
if test -n "$openssl_path"; then
LIBS="-L$openssl_path/lib $LIBS" COMMON_LIBS="$COMMON_LIBS $OPENSSL_LIBS"
fi COMMON_CFLAGS="$COMMON_CFLAGS $OPENSSL_CFLAGS"
else ])
CPPFLAGS=$SAVED_CPPFLAGS CFLAGS=$SAVED_CFLAGS
fi ])
fi LIBS=$SAVED_LIBS
fi fi
dnl ********************************************************************* dnl *********************************************************************
@ -447,6 +442,10 @@ dnl *********************************************************************
if test "$plugin" = yes; then if test "$plugin" = yes; then
AC_DEFINE(USE_PLUGIN) AC_DEFINE(USE_PLUGIN)
PLUGIN_LDFLAGS="-avoid-version"
if test "$platform_win32" = yes; then
PLUGIN_LDFLAGS="$PLUGIN_LDFLAGS -no-undefined"
fi
fi fi
dnl ********************************************************************* dnl *********************************************************************
@ -524,8 +523,7 @@ if test "x$dbus" = "xyes" ; then
dbus=no dbus=no
]) ])
AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no) AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal, no) if test "x$DBUS_BINDING_TOOL" = "xno" || test "x$dbus" = "xno" ; then
if test "x$DBUS_BINDING_TOOL" = "xno" || test "x$GLIB_GENMARSHAL" = "xno" || test "x$dbus" = "xno" ; then
dbus="no" dbus="no"
else else
COMMON_LIBS="$COMMON_LIBS $DBUS_LIBS" COMMON_LIBS="$COMMON_LIBS $DBUS_LIBS"
@ -805,12 +803,12 @@ AC_SUBST(PY_CFLAGS)
AC_SUBST(PY_LIBS) AC_SUBST(PY_LIBS)
AC_SUBST(DBUS_CFLAGS) AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS) AC_SUBST(DBUS_LIBS)
AC_SUBST(OPENSSL_LIBS)
AC_SUBST(OPENSSL_CFLAGS)
AC_SUBST(PLUGIN_LDFLAGS)
m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], AC_SUBST([pkgconfigdir], ${libdir}/pkgconfig)) m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], AC_SUBST([pkgconfigdir], ${libdir}/pkgconfig))
PLUGIN_INCLUDES='-I$(top_srcdir)/plugins'
AC_SUBST(PLUGIN_INCLUDES)
dnl for plugin.c and pixmaps.c dnl for plugin.c and pixmaps.c
test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix="$prefix" test "x$exec_prefix" = xNONE && exec_prefix="$prefix"

View File

@ -2,6 +2,6 @@ libdir = $(hexchatlibdir)
lib_LTLIBRARIES = checksum.la lib_LTLIBRARIES = checksum.la
checksum_la_SOURCES = checksum.c checksum_la_SOURCES = checksum.c
checksum_la_LDFLAGS = -avoid-version -module checksum_la_LDFLAGS = $(PLUGIN_LDFLAGS) -module
checksum_la_LIBADD = checksum_la_LIBADD = $(GLIB_LIBS)
AM_CPPFLAGS = $(COMMON_CFLAGS) -I$(srcdir)/../../src/common checksum_la_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)/src/common

View File

@ -2,7 +2,7 @@ libdir = $(hexchatlibdir)
lib_LTLIBRARIES = doat.la lib_LTLIBRARIES = doat.la
doat_la_SOURCES = doat.c doat_la_SOURCES = doat.c
doat_la_LDFLAGS = -avoid-version -module doat_la_LDFLAGS = $(PLUGIN_LDFLAGS) -module
doat_la_LIBADD = doat_la_LIBADD =
AM_CPPFLAGS = $(COMMON_CFLAGS) -I$(srcdir)/../../src/common doat_la_CFLAGS = -I$(top_srcdir)/src/common

View File

@ -4,6 +4,6 @@ libdir = $(hexchatlibdir)
lib_LTLIBRARIES = fishlim.la lib_LTLIBRARIES = fishlim.la
fishlim_la_SOURCES = fish.c irc.c keystore.c misc.c plugin_hexchat.c fishlim_la_SOURCES = fish.c irc.c keystore.c misc.c plugin_hexchat.c
fishlim_la_LDFLAGS = -avoid-version -module fishlim_la_LDFLAGS = $(PLUGIN_LDFLAGS) -module
fishlim_la_LIBADD = fishlim_la_LIBADD = $(GLIB_LIBS) $(OPENSSL_LIBS)
AM_CPPFLAGS = $(COMMON_CFLAGS) -I$(srcdir)/../../src/common fishlim_la_CFLAGS = $(GLIB_CFLAGS) $(OPENSSL_CFLAGS) -I$(top_srcdir)/src/common

View File

@ -6,12 +6,13 @@ libdir = $(hexchatlibdir)
lib_LTLIBRARIES = perl.la lib_LTLIBRARIES = perl.la
perl_la_SOURCES = perl.c perl_la_SOURCES = perl.c
perl_la_LDFLAGS = -avoid-version -module perl_la_LDFLAGS = $(PERL_LDFLAGS) $(PLUGIN_LDFLAGS) -module
perl_la_LIBADD = $(PERL_LDFLAGS) perl_la_LIBADD = $(PERL_LIBS)
perl_la_CFLAGS = $(PERL_CFLAGS) -I$(top_srcdir)/src/common
BUILT_SOURCES = hexchat.pm.h irc.pm.h BUILT_SOURCES = hexchat.pm.h irc.pm.h
#CFLAGS = @CFLAGS@ -Wno-unused CLEANFILES = $(BUILT_SOURCES)
AM_CPPFLAGS = $(PERL_CFLAGS) $(COMMON_CFLAGS) -I$(srcdir)/../../src/common
CLEANFILES = hexchat.pm.h irc.pm.h
hexchat.pm.h irc.pm.h: lib/HexChat.pm lib/Xchat.pm lib/HexChat/Embed.pm \ hexchat.pm.h irc.pm.h: lib/HexChat.pm lib/Xchat.pm lib/HexChat/Embed.pm \
lib/HexChat/List/Network.pm lib/HexChat/List/Network/Entry.pm \ lib/HexChat/List/Network.pm lib/HexChat/List/Network/Entry.pm \
lib/HexChat/List/Network/AutoJoin.pm lib/IRC.pm lib/HexChat/List/Network/AutoJoin.pm lib/IRC.pm

View File

@ -1,10 +1,8 @@
EXTRA_DIST =
libdir = $(hexchatlibdir) libdir = $(hexchatlibdir)
lib_LTLIBRARIES = python.la lib_LTLIBRARIES = python.la
python_la_SOURCES = python.c python_la_SOURCES = python.c
python_la_LDFLAGS = -avoid-version -module python_la_LDFLAGS = $(PLUGIN_LDFLAGS) -module
python_la_LIBADD = $(PY_LIBS) python_la_LIBADD = $(PY_LIBS) $(GLIB_LIBS)
AM_CPPFLAGS = $(PY_CFLAGS) $(COMMON_CFLAGS) -I$(srcdir)/../../src/common python_la_CFLAGS = $(PY_CFLAGS) $(GLIB_CFLAGS) -I$(top_srcdir)/src/common

View File

@ -2,6 +2,6 @@ libdir = $(hexchatlibdir)
lib_LTLIBRARIES = sysinfo.la lib_LTLIBRARIES = sysinfo.la
sysinfo_la_SOURCES = match.c parse.c pci.c xsys.c sysinfo_la_SOURCES = match.c parse.c pci.c xsys.c
sysinfo_la_LDFLAGS = -avoid-version -module sysinfo_la_LDFLAGS = $(PLUGIN_LDFLAGS) -module
sysinfo_la_LIBADD = -lpci sysinfo_la_LIBADD = $(LIBPCI_LIBS) $(GLIB_LIBS)
AM_CPPFLAGS = $(COMMON_CFLAGS) -I$(srcdir)/../../src/common sysinfo_la_CFLAGS = $(LIBPCI_CFLAGS) $(GLIB_CFLAGS) -I$(srcdir)/../../src/common