From aa27bc87e4d116606358f7b2458221a2c530876f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20D=C5=82ugo=C5=82=C4=99cki?= Date: Fri, 5 Jul 2013 22:39:46 +0200 Subject: [PATCH] Made vlp compilable using autotools. Safe checking for dependencies using pkg-config. --- Makefile.am | 96 ++++++++++++++++++++++++++++++++++++++-------------- configure.ac | 31 +++++++++++++++-- 2 files changed, 99 insertions(+), 28 deletions(-) diff --git a/Makefile.am b/Makefile.am index f5f5687..60646f6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,21 +1,12 @@ AUTOMAKE_OPTIONS = gnu subdir-objects ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} +MOC = ${MOCDIR}/${MOCNAME} -### moc compiler directory -MOCDIR=/usr/bin -### moc compiler -MOC=$(MOCDIR)/moc -### Includes for QT library -QINC=/usr/include/qt3 -### QT library directory -QLIB=/usr/lib/ +#AM_CXXFLAGS= -Wall -pedantic -Wextra -fno-strength-reduce +#AM_CXXFLAGS = -m32 +AM_LDFLAGS= -fPIC -AM_CFLAGS= -Wall -pedantic -Wextra -fPIC -fno-strength-reduce -I$(QINC) -I/usr/X11R6/include -AM_LDFLAGS= -lqt-mt -L$(QLIB) - -%.moc: %.cpp - $(MOC) $< -o $@ bin_PROGRAMS = \ graph/loggraph \ @@ -27,49 +18,102 @@ bin_PROGRAMS = \ preproc/logcomp \ help/loghelp +BUILT_SOURCES = \ + graph/loggraph.moc \ + net/lognet.moc \ + kernel/kernel.moc \ + edit/editor.moc \ + lgconfig/lgconfig.moc \ + preproc/prep.moc \ + help/help.moc +# int/logint.moc graph_loggraph_SOURCES = graph/loggraph.cpp graph_loggraph_CPPFLAGS = $(graph_loggraph_CFLAGS) -graph_loggraph_OBJECTS : graph/loggraph.moc graph_loggraph_LDADD = $(graph_loggraph_LIBS) +$(graph_loggraph_OBJECTS) : graph/loggraph.moc +graph/loggraph.moc: + $(MOC) -i graph/loggraph.cpp -o graph/loggraph.moc + +clean-loggraph-extra: + rm graph/*.moc net_lognet_SOURCES = net/lognet.cpp net_lognet_CPPFLAGS = $(net_lognet_CFLAGS) -net_lognet_OBJECTS : net/lognet.moc net_lognet_LDADD = $(net_lognet_LIBS) +$(net_lognet_OBJECTS) : net/lognet.moc +net/lognet.moc: + $(MOC) -i net/lognet.cpp -o net/lognet.moc +clean-lognet-extra: + rm net/*.moc + kernel_logker_SOURCES = kernel/kernel.cpp kernel_logker_CPPFLAGS = $(kernel_logker_CFLAGS) -kernel_logker_OBJECTS : kernel/kernel.moc kernel_logker_LDADD = $(kernel_logker_LIBS) - +$(kernel_logker_OBJECTS) : kernel/kernel.moc +kernel/kernel.moc: + $(MOC) -i kernel/kernel.cpp -o kernel/kernel.moc + +clean-logker-extra: + rm kernel/*.moc + #int_logint_SOURCES = kernel/kernel.moc -edit_logedit_SOURCES = edit/editor.cpp + + +edit_logedit_SOURCES = edit/editor.moc edit_logedit_CPPFLAGS = $(edit_logedit_CFLAGS) -edit_logedit_OBJECTS : edit/editor.moc edit_logedit_LDADD = $(edit_logedit_LIBS) +$(edit_logedit_OBJECTS) : edit/editor.moc +edit/editor.moc: + $(MOC) -i edit/editor.cpp -o edit/editor.moc + +clean-logedit-extra: + rm edit/*.moc -lgconfig_lgconfig_SOURCES = lgconfig/lgconfig.cpp +lgconfig_lgconfig_SOURCES = lgconfig/lgconfig.moc lgconfig_lgconfig_CPPFLAGS = $(lgconfig_lgconfig_CFLAGS) -lgconfig_lgconfig_OBJECTS : lgconfig/lgconfig.moc lgconfig_lgconfig_LDADD = $(lgconfig_lgconfig_LIBS) +$(lgconfig_lgconfig_OBJECTS) : lgconfig/lgconfig.moc +lgconfig/lgconfig.moc: + $(MOC) -i lgconfig/lgconfig.cpp -o lgconfig/lgconfig.moc + +clean-lgconfig-extra: + rm lgconfig/*.moc -preproc_logcomp_SOURCES = preproc/logcomp.cpp +preproc_logcomp_SOURCES = preproc/prep.moc preproc_logcomp_CPPFLAGS = $(preproc_logcomp_CFLAGS) -preproc_logcomp_OBJECTS : preproc/logcomp.moc preproc_logcomp_LDADD = $(preproc_logcomp_LIBS) +$(preproc_logcomp_OBJECTS) : preproc/prep.moc +preproc/prep.moc: + $(MOC) -i preproc/prep.cpp -o preproc/prep.moc +clean-logcomp-extra: + rm preproc/*.moc -help_loghelp_SOURCES = help/help.cpp +help_loghelp_SOURCES = help/help.moc help_loghelp_CPPFLAGS = $(help_loghelp_CFLAGS) -help_loghelp_OBJECTS : help/help.moc help_loghelp_LDADD = $(help_loghelp_LIBS) +$(help_loghelp_OBJECTS) : help/help.moc +help/help.moc: + $(MOC) -i help/help.cpp -o help/help.moc +clean-loghelp-extra: + rm help/*.moc CLEANFILES = \ %.moc \ %.o \ %.bak \ - %~ + %~ + +clean-am: \ + clean-loggraph-extra \ + clean-lognet-extra \ + clean-logker-extra \ + clean-logedit-extra \ + clean-lgconfig-extra \ + clean-logcomp-extra \ + clean-loghelp-extra dist_noinst_SCRIPTS = autogen.sh diff --git a/configure.ac b/configure.ac index 10e6db0..8f3f70b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Virtual Loglan Processor], [2.6], [rafal@dlugolecki.net.pl], [vlp], [http://dlugolecki.net.pl/software/vlp/]) +AC_INIT([Virtual Loglan Processor], [2.6], [bugz@dlugolecki.net.pl], [vlp], [http://dlugolecki.net.pl/software/vlp/]) AC_PREREQ([2.59]) AM_INIT_AUTOMAKE([1.10 no-define]) AC_CONFIG_HEADERS([config.h]) @@ -7,6 +7,33 @@ AC_PROG_CXX AM_PROG_CC_C_O AC_CONFIG_FILES([Makefile]) -#PKG_CHECK_MODULES([vlp], [gtk+-3.0 libxml-2.0]) + +# libqt3-mt:i386 +# libqt3-mt-dev:i386 +# qt3-dev-tools:i386 +PKG_CHECK_MODULES([graph_loggraph], [qt-mt < 4.0]) +PKG_CHECK_MODULES([net_lognet], [qt-mt < 4.0]) +PKG_CHECK_MODULES([kernel_logker], [qt-mt < 4.0]) +#PKG_CHECK_MODULES([int_logint], [qt-mt < 4.0]) +PKG_CHECK_MODULES([edit_logedit], [qt-mt < 4.0]) +PKG_CHECK_MODULES([lgconfig_lgconfig], [qt-mt < 4.0]) +PKG_CHECK_MODULES([preproc_logcomp], [qt-mt < 4.0]) +PKG_CHECK_MODULES([help_loghelp], [qt-mt < 4.0]) + +# Get Qt3 library and include locations +AC_ARG_WITH([moc-compiler-name], + [AS_HELP_STRING([--with-moc-compiler-name], + [filename of MOC compiler, defaults to: moc])], + [MOCNAME="$withval"], + [MOCNAME='moc']) +AC_SUBST([MOCNAME]) + +AC_ARG_WITH([moc-compiler-dir], + [AS_HELP_STRING([--with-moc-compiler-dir], + [location of MOC compiler, defaults to: /usr/bin])], + [MOCDIR="$withval"], + [MOCDIR='/usr/bin']) +AC_SUBST([MOCDIR]) + AC_OUTPUT -- 2.30.2