better build + no qt keywords

master
Marc Wäckerlin 10 years ago
parent fccd88b94f
commit f0e6fcee07
  1. 32
      ax_check_qt.m4
  2. 48
      ax_init_standard_project.m4
  3. 56
      bootstrap.sh
  4. 7
      configure.ac

@ -82,6 +82,7 @@ AC_DEFUN([AX_CHECK_VALID_FLAG], [
AC_DEFUN([AX_CHECK_QT], [ AC_DEFUN([AX_CHECK_QT], [
qt_modules="$2" qt_modules="$2"
qt_modules_optional="$3"
AX_CXX_QT_TOOLS AX_CXX_QT_TOOLS
HAVE_$1=0 HAVE_$1=0
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
@ -89,35 +90,58 @@ AC_DEFUN([AX_CHECK_QT], [
HAVE_$1=1 HAVE_$1=1
AC_DEFINE([HAVE_$1]) AC_DEFINE([HAVE_$1])
AM_CPPFLAGS+=" ${[$1]5_CFLAGS}" AM_CPPFLAGS+=" ${[$1]5_CFLAGS}"
MOC_FLAGS+=" -DHAVE_$1=1 ${[$1]5_CFLAGS}"
AM_CXXFLAGS+=" ${[$1]5_CFLAGS}" AM_CXXFLAGS+=" ${[$1]5_CFLAGS}"
LIBS+=" ${[$1]5_LIBS}" LIBS+=" ${[$1]5_LIBS}"
if test -n "${qt_modules_optional}"; then
PKG_CHECK_MODULES([$1]5_OPTIONAL, [${qt_modules_optional//Qt/Qt5}], [
AM_CPPFLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
MOC_FLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
AM_CXXFLAGS+=" ${[$1]5_OPTIONAL_CFLAGS}"
LIBS+=" ${[$1]5_OPTIONAL_LIBS}"
], [
AC_MSG_NOTICE([Not found: ${qt_modules_optional//Qt/Qt5}])
])
fi
], [ ], [
PKG_CHECK_MODULES([$1], [${qt_modules}], [ PKG_CHECK_MODULES([$1], [${qt_modules}], [
HAVE_$1=1 HAVE_$1=1
AC_DEFINE([HAVE_$1]) AC_DEFINE([HAVE_$1])
AM_CPPFLAGS+=" ${$1_CFLAGS}" AM_CPPFLAGS+=" ${$1_CFLAGS}"
MOC_FLAGS+=" -DHAVE_$1=1 ${$1_CFLAGS}"
AM_CXXFLAGS+=" ${$1_CFLAGS}" AM_CXXFLAGS+=" ${$1_CFLAGS}"
LIBS+=" ${$1_LIBS}" LIBS+=" ${$1_LIBS}"
if test -n "$3"; then
PKG_CHECK_MODULES($1_OPTIONAL, [${qt_modules_optional}], [
AM_CPPFLAGS+=" ${$1_OPTIONAL_CFLAGS}"
MOC_FLAGS+=" ${$1_OPTIONAL_CFLAGS}"
AM_CXXFLAGS+=" ${$1_OPTIONAL_CFLAGS}"
LIBS+=" ${$1_OPTIONAL_LIBS}"
], [
AC_MSG_NOTICE([Not found: ${qt_modules_optional}])
])
fi
], [HAVE_$1=0]) ], [HAVE_$1=0])
]) ])
AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1) AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1)
AX_CHECK_VALID_FLAG([-fPIC -fPIE], [position independent code flag]) AX_CHECK_VALID_FLAG([-fPIC -fPIE], [position independent code flag])
AC_SUBST(AM_CPPFLAGS) AC_SUBST(AM_CPPFLAGS)
AC_SUBST(MOC_FLAGS)
AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_CXXFLAGS)
AX_ADDITIONAL_QT_RULES_HACK=' AX_ADDITIONAL_QT_RULES_HACK='
ui_%.hxx: %.ui ui_%.hxx: %.ui
${UIC} -o [$][@] $< $(UIC) -o [$][@] $<
moc_%.cxx: %.hxx moc_%.cxx: %.hxx
${MOC} -o [$][@] $< $(MOC) $(MOC_FLAGS) -o [$][@] $<
qrc_%.cxx: %.qrc qrc_%.cxx: %.qrc
${RCC} -o [$][@] $<' $(RCC) -o [$][@] $<'
AC_SUBST(AX_ADDITIONAL_QT_RULES_HACK) AC_SUBST(AX_ADDITIONAL_QT_RULES_HACK)
]) ])
AC_DEFUN([AX_REQUIRE_QT], [ AC_DEFUN([AX_REQUIRE_QT], [
AX_CHECK_QT([$1], [$2]) AX_CHECK_QT([$1], [$2], [$3])
if ! test "$HAVE_$1" -eq 1; then if ! test "$HAVE_$1" -eq 1; then
AC_MSG_ERROR([Required Qt modules not found: $2]) AC_MSG_ERROR([Required Qt modules not found: $2])
fi fi

@ -104,8 +104,8 @@ AC_DEFUN([AX_USE_CXX], [
AC_CONFIG_FILES([src/makefile]) AC_CONFIG_FILES([src/makefile])
AM_CPPFLAGS='-I ${top_srcdir}/src -I ${top_builddir}/src' AM_CPPFLAGS='-I ${top_srcdir}/src -I ${top_builddir}/src -I ${srcdir} -I ${builddir}'
AM_LDFLAGS='-L ${top_srcdir}/src -I ${top_builddir}/src' AM_LDFLAGS='-L ${top_srcdir}/src -L ${top_builddir}/src'
# Get rid of that stupid -O2 -g opions! # Get rid of that stupid -O2 -g opions!
CXXFLAGS="${CXXFLAGS:-}" CXXFLAGS="${CXXFLAGS:-}"
@ -140,6 +140,13 @@ AC_DEFUN([AX_USE_CXX], [
AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_CXXFLAGS)
AC_SUBST(AM_CPPFLAGS) AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_LDFLAGS) AC_SUBST(AM_LDFLAGS)
AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-cxx-targets], [src/makefile.in])
test -f src/makefile.in && cat >> src/makefile.in <<EOF
#### Begin: Appended by $0
maintainer-clean-cxx-targets:
-rm makefile.in
#### End: $0
EOF
]) ])
AC_DEFUN([AX_USE_CPPUNIT], [ AC_DEFUN([AX_USE_CPPUNIT], [
@ -154,6 +161,13 @@ AC_DEFUN([AX_USE_CPPUNIT], [
AC_DEFUN([AX_BUILD_EXAMPLES], [ AC_DEFUN([AX_BUILD_EXAMPLES], [
AC_CONFIG_FILES([examples/makefile]) AC_CONFIG_FILES([examples/makefile])
AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-example-targets], [examples/makefile.in])
test -f examples/makefile.in && cat >> examples/makefile.in <<EOF
#### Begin: Appended by $0
maintainer-clean-example-targets:
-rm makefile.in
#### End: $0
EOF
]) ])
AC_DEFUN([AX_USE_LIBTOOL], [ AC_DEFUN([AX_USE_LIBTOOL], [
@ -167,6 +181,20 @@ AC_DEFUN([AX_USE_LIBTOOL], [
AC_SUBST(LIB_VERSION) AC_SUBST(LIB_VERSION)
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
AC_CONFIG_FILES([src/${PACKAGE_NAME}.pc]) AC_CONFIG_FILES([src/${PACKAGE_NAME}.pc])
AX_ADD_MAKEFILE_TARGET_DEP([install-data-am], [install-data-libtool-pkg], [src/makefile.in])
AX_ADD_MAKEFILE_TARGET_DEP([uninstall-am], [uninstall-data-am], [src/makefile.in])
AX_ADD_MAKEFILE_TARGET_DEP([uninstall-data-am], [uninstall-data-libtool-pkg], [src/makefile.in])
test -f src/makefile.in && cat >> src/makefile.in <<EOF
#### Begin: Appended by $0
install-data-libtool-pkg:
test -d \$(DESTDIR)\${libdir}/pkgconfig || mkdir -p \$(DESTDIR)\${libdir}/pkgconfig
chmod -R u+w \$(DESTDIR)\${libdir}/pkgconfig
cp \${PACKAGE_NAME}.pc \$(DESTDIR)\${libdir}/pkgconfig/
uninstall-data-libtool-pkg:
-chmod -R u+w \$(DESTDIR)\${libdir}/pkgconfig
-rm -f \$(DESTDIR)\${libdir}/pkgconfig/\${PACKAGE_NAME}.pc
#### End: $0
EOF
]) ])
AC_DEFUN([AX_USE_DEBIAN_PACKAGING], [ AC_DEFUN([AX_USE_DEBIAN_PACKAGING], [
@ -264,3 +292,19 @@ AC_DEFUN([AX_PKG_REQUIRE], [
AC_SUBST(AM_CPPFLAGS) AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_CXXFLAGS)
]) ])
AC_DEFUN([AX_PKG_CHECK], [
PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES([$1], [m4_default([$2], [$1])], [
HAVE_$1=1
AM_CPPFLAGS+=" ${$1_CFLAGS}"
AM_CXXFLAGS+=" ${$1_CFLAGS}"
LIBS+=" ${$1_LIBS}"
], [
HAVE_$1=0
])
AM_CONDITIONAL(HAVE_$1, test $HAVE_$1 -eq 1)
AC_SUBST(HAVE_$1)
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_CXXFLAGS)
])

@ -47,22 +47,22 @@ run() {
esac esac
shift; shift;
done done
echo -n "-> running: $* ..." echo -en "\e[1m-> running:\e[0m $* ..."
result=$($* 2>&1) result=$($* 2>&1)
res=$? res=$?
if test $res -ne 0; then if test $res -ne 0; then
if test $check -eq 1; then if test $check -eq 1; then
echo " error" echo -e " \e[31merror\e[0m"
echo "*** Failed with return code: $res" echo -e "\e[1m*** Failed with return code: $res\e[0m"
if test -n "$result"; then if test -n "$result"; then
echo "$result" echo "$result"
fi fi
exit 1 exit 1
else else
echo " ignored" echo -e " \e[33mignored\e[0m"
fi fi
else else
echo " success" echo -e " \e[32msuccess\e[0m"
fi fi
} }
@ -92,18 +92,18 @@ to() {
return return
fi fi
checkdir "$(dirname ${1})" checkdir "$(dirname ${1})"
echo -n "-> generating $1 ..." echo -en "\e[1m-> generating:\e[0m $1 ..."
result=$(cat > "$1" 2>&1) result=$(cat > "$1" 2>&1)
res=$? res=$?
if test $res -ne 0; then if test $res -ne 0; then
echo " error" echo -e " \e[31merror\e[0m"
echo "*** Failed with return code: $res" echo -e "\e[1m*** Failed with return code: $res\e[0m"
if test -n "$result"; then if test -n "$result"; then
echo "$result" echo "$result"
fi fi
exit 1 exit 1
else else
echo " success" echo -e " \e[32msuccess\e[0m"
fi fi
run svn add "$1" run svn add "$1"
run svn propset svn:keywords "Id" "$1" run svn propset svn:keywords "Id" "$1"
@ -118,12 +118,12 @@ copy() {
} }
doxyreplace() { doxyreplace() {
echo -n "-> doxyfile: configure $1 ..." echo -en "\e[1m-> doxyfile:\e[0m configure $1 ..."
if sed -i 's|\(^'"$1"' *=\) *|\1'" $2"'|g' doc/doxyfile.in; then if sed -i 's|\(^'"$1"' *=\) *|\1'" $2"'|g' doc/doxyfile.in; then
echo " success" echo -e " \e[32msuccess\e[0m"
else else
echo " error" echo -e " \e[31merror\e[0m"
echo "**** command: sed -i 's|\(^'"$1"' *=\) *|\1'" $2"'|g' doc/doxyfile.in;" echo -e "\e[1m**** command: sed -i 's|\(^'"$1"' *=\) *|\1'" $2"'|g' doc/doxyfile.in;\e[0m"
exit 1 exit 1
fi fi
} }
@ -133,6 +133,7 @@ copy ${MY_NAME}
copy ax_init_standard_project.m4 copy ax_init_standard_project.m4
copy ax_cxx_compile_stdcxx_11.m4 copy ax_cxx_compile_stdcxx_11.m4
copy ax_check_qt.m4 copy ax_check_qt.m4
copy AUTHORS
if ! test -f configure.ac; then if ! test -f configure.ac; then
to configure.ac <<EOF to configure.ac <<EOF
${HEADER}m4_define(x_package_name, ${DEFAULT_PROJECT_NAME}) # project's name ${HEADER}m4_define(x_package_name, ${DEFAULT_PROJECT_NAME}) # project's name
@ -160,11 +161,21 @@ EOF
fi fi
PACKAGE_NAME=$(sed -n 's/.*m4_define *( *x_package_name *, *\([^ ]*\) *).*/\1/p' configure.ac) PACKAGE_NAME=$(sed -n 's/.*m4_define *( *x_package_name *, *\([^ ]*\) *).*/\1/p' configure.ac)
echo "${HEADER}" | to --condition AX_USE_CXX src/makefile.am echo "${HEADER}" | to --condition AX_USE_CXX src/makefile.am
echo "${HEADER}" | to --condition AX_USE_CPPUNIT test/makefile.am
echo "${HEADER}" | to --condition AX_USE_DOXYGEN doc/makefile.am echo "${HEADER}" | to --condition AX_USE_DOXYGEN doc/makefile.am
echo "${HEADER}" | to --condition AX_BUILD_EXAMPLES examples/makefile.am to --condition AX_USE_CPPUNIT test/makefile.am <<EOF
${HEADER}AM_CPPFLAGS = -I${top_srcdir}/src -I${top_builddir}/src
AM_LDFLAGS = -L${top_builddir}/src/.libs
LDADD = -l${PACKAGE_NAME}
EOF
to --condition AX_BUILD_EXAMPLES examples/makefile.am <<EOF
${HEADER}AM_CPPFLAGS = -I${top_srcdir}/src -I${top_builddir}/src
AM_LDFLAGS = -L${top_builddir}/src/.libs
LDADD = -l${PACKAGE_NAME}
EOF
if testtag AX_USE_DOXYGEN && ! test -f doc/doxyfile.in; then if testtag AX_USE_DOXYGEN && ! test -f doc/doxyfile.in; then
run doxygen -g doc/doxyfile.in run doxygen -g doc/doxyfile.in
run svn add doc/doxyfile.in
run svn propset svn:keywords "Id" doc/doxyfile.in
doxyreplace PROJECT_NAME "@PACKAGE_NAME@" doxyreplace PROJECT_NAME "@PACKAGE_NAME@"
doxyreplace PROJECT_NUMBER "@PACKAGE_VERSION@" doxyreplace PROJECT_NUMBER "@PACKAGE_VERSION@"
doxyreplace PROJECT_BRIEF "@DESCRIPTION@" doxyreplace PROJECT_BRIEF "@DESCRIPTION@"
@ -237,7 +248,7 @@ $( if testtag AX_USE_LIBTOOL; then
Package: @PACKAGE_NAME@-dev Package: @PACKAGE_NAME@-dev
Section: libdevel Section: libdevel
Architecture: any Architecture: any
Depends: @PACKAGE_NAME@ (= ${binary:Version}) Depends: @PACKAGE_NAME@ (= \${binary:Version})
Description: @DESCRIPTION@ - Development Package Description: @DESCRIPTION@ - Development Package
@README_DEB@ @README_DEB@
EOF2 EOF2
@ -250,6 +261,7 @@ EOF
to debian/${PACKAGE_NAME}.install <<EOF to debian/${PACKAGE_NAME}.install <<EOF
usr/bin/* usr/bin/*
usr/lib/lib*.so.* usr/lib/lib*.so.*
$(if ! testtag AX_USE_LIBTOOL; then echo "usr/share/doc/${PACKAGE_NAME}/html"; fi)
EOF EOF
to debian/${PACKAGE_NAME}.dirs <<EOF to debian/${PACKAGE_NAME}.dirs <<EOF
usr/lib usr/lib
@ -261,7 +273,7 @@ usr/lib/lib*.a
usr/lib/lib*.so usr/lib/lib*.so
usr/lib/pkgconfig/* usr/lib/pkgconfig/*
usr/lib/*.la usr/lib/*.la
usr/share/pkgconfig/* $(if testtag AX_USE_LIBTOOL; then echo "usr/share/doc/${PACKAGE_NAME}/html"; fi)
EOF EOF
to debian/${PACKAGE_NAME}-dev.dirs <<EOF to debian/${PACKAGE_NAME}-dev.dirs <<EOF
usr/lib usr/lib
@ -270,7 +282,7 @@ EOF
fi fi
to debian/rules <<EOF to debian/rules <<EOF
${HEADER}%: ${HEADER}%:
dh $@ dh \$@
EOF EOF
echo 7 | to debian/compat echo 7 | to debian/compat
fi fi
@ -284,14 +296,14 @@ fi
to --condition AX_USE_LIBTOOL src/${PACKAGE_NAME}.pc.in <<EOF to --condition AX_USE_LIBTOOL src/${PACKAGE_NAME}.pc.in <<EOF
${HEADER}prefix=@prefix@ ${HEADER}prefix=@prefix@
exec_prefix=@exec_prefix@ exec_prefix=@exec_prefix@
libdir=${exec_prefix}/lib libdir=\${exec_prefix}/lib
includedir=${prefix}/include includedir=\${prefix}/include
Name: @PACKAGE_NAME@ Name: @PACKAGE_NAME@
Description: @DESCRIPTION@ Description: @DESCRIPTION@
Version: @VERSION@ Version: @VERSION@
Libs: -L${libdir} -l@PACKAGE_NAME@ @LDFLAGS@ Libs: -L\${libdir} -l@PACKAGE_NAME@ @LDFLAGS@
Cflags: -I${includedir} @CPPFLAGS@ Cflags: -I\${includedir} @CPPFLAGS@
EOF EOF
#### Cleanup If Makefile Exists #### #### Cleanup If Makefile Exists ####

@ -18,12 +18,9 @@ AX_USE_RPM_PACKAGING
AX_BUILD_EXAMPLES AX_BUILD_EXAMPLES
# qt features # qt features
AX_CHECK_QT([QTGUI], [QtCore QtGui]) AX_CHECK_QT([QTGUI], [QtCore QtGui], [QtWidgets])
AX_CHECK_QT([QTWIDGETS], [QtWidgets]) # optional, needed only for qt5
AX_CHECK_QT([QTNETWORK], [QtNetwork]) AX_CHECK_QT([QTNETWORK], [QtNetwork])
AM_CPPFLAGS+=" -DQT_NO_KEYWORDS"
# programs
#PKG_PROG_PKG_CONFIG
# libraries # libraries
AC_ARG_ENABLE(pkcs11-download, AC_ARG_ENABLE(pkcs11-download,

Loading…
Cancel
Save