Skip to content

Commit

Permalink
applied Dima patches and brought up to current be13_api, dfxml and ht…
Browse files Browse the repository at this point in the history
…tp-parser
  • Loading branch information
simsong committed May 29, 2014
1 parent 151cafb commit dcd8a94
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 22 deletions.
50 changes: 30 additions & 20 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ AC_PROG_CXX
AM_PROG_CC_C_O dnl allow per-product flags
AC_PROG_INSTALL

m4_include([m4/slg_searchdirs.m4])
m4_include([m4/slg_gcc_all_warnings.m4])


# use C++11 mode if available; HAVE_CXX11 is defined in config.h if so. Don't
# use the GNU C++11 extensions for portability's sake (noext).
AC_LANG_PUSH(C++)
Expand Down Expand Up @@ -104,7 +108,6 @@ fi
# causes configure to crash on gcc-4.2.1: -Wsign-compare-Winline
# causes warnings with unistd.h: -Wnested-externs
# Just causes too much annoyance: -Wmissing-format-attribute

# Check GCC
WARNINGS_TO_TEST="-MD -D_FORTIFY_SOURCE=2 -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes \
-Wshadow -Wwrite-strings -Wcast-align -Waggregate-return \
Expand Down Expand Up @@ -285,32 +288,39 @@ AC_LANG_POP()
################################################################
# drawing support via cairo
#
cairo=test
AC_ARG_ENABLE([cairo],[ --enable-cairo=false to disable libcairo even if present])
if test "${enable_cairo}" = false ; then
cairo=false
fi

# Cairo requires these to be explicitly included on mingw (and perhaps others):
AC_CHECK_LIB([expat],[XML_ParserCreate])
AC_CHECK_LIB([pixman-1],[pixman_region_init])
AC_CHECK_LIB([bz2],[BZ2_bzDecompress])
AC_CHECK_LIB([freetype],[FT_Init_FreeType]) # requires bz2
AC_CHECK_LIB([fontconfig],[FcBlanksCreate]) # requires freetype expat

AC_CHECK_HEADERS([cairo/cairo.h cairo/cairo-pdf.h])
AC_CHECK_HEADERS([cairo.h cairo-pdf.h])
AC_CHECK_LIB([cairo],[cairo_create], , [
AC_MSG_WARN([
*** cairo libraries not detected.
*** Please install cairo-devel to get 1-page PDF summary generation.
])
Fmissing_library="cairo-devel $missing_library "
Umissing_library="libcairo2-dev $missing_library "
Mmissing_library="cairo-devel "
])
if test $cairo = test ; then
# Cairo requires these to be explicitly included on mingw (and perhaps others):
AC_CHECK_LIB([expat],[XML_ParserCreate])
AC_CHECK_LIB([pixman-1],[pixman_region_init])
AC_CHECK_LIB([bz2],[BZ2_bzDecompress])
AC_CHECK_LIB([freetype],[FT_Init_FreeType]) # requires bz2
AC_CHECK_LIB([fontconfig],[FcBlanksCreate]) # requires freetype expat

AC_CHECK_HEADERS([cairo/cairo.h cairo/cairo-pdf.h])
AC_CHECK_HEADERS([cairo.h cairo-pdf.h])
AC_CHECK_LIB([cairo],[cairo_create], , [
AC_MSG_WARN([
*** cairo libraries not detected.
*** Please install cairo-devel to get 1-page PDF summary generation.
])
Fmissing_library="cairo-devel $missing_library "
Umissing_library="libcairo2-dev $missing_library "
Mmissing_library="cairo-devel "
])
fi

################################################################
# pcap support. A bit more involved than normal due to the error message
#
pcap=test
AC_ARG_ENABLE([pcap],[ --enable-pcap=false to disable libpcap even if present])
if test "${enableval}" = false ; then
if test "${enable_pcap}" = false ; then
pcap=false
fi

Expand Down
106 changes: 106 additions & 0 deletions m4/slg_gcc_all_warnings.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
################################################################
#
# Enable all the compiler debugging we can find
# Simson L. Garfinkel
#
# This is originally from PhotoRec, but modified substantially by Simson
# Figure out which flags we can use with the compiler.
#
# These I don't like:
# -Wdeclaration-after-statement -Wconversion
# doesn't work: -Wunreachable-code
# causes configure to crash on gcc-4.2.1: -Wsign-compare-Winline
# causes warnings with unistd.h: -Wnested-externs
# Just causes too much annoyance: -Wmissing-format-attribute

# First, see if we are using CLANG
using_clang=no
if (g++ --version 2>&1 | grep clang > /dev/null) ;
then
AC_MSG_NOTICE([g++ is really clang++])
using_clang=yes
fi
if test x$CXX == "xclang++" ; then
using_clang=yes
fi



# Check GCC
C_WARNINGS_TO_TEST="-MD -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes \
-Wshadow -Wwrite-strings -Wcast-align -Waggregate-return \
-Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wdisabled-optimization \
-Wfloat-equal -Wmultichar -Wc++-compat -Wmissing-noreturn "

if test x"${mingw}" != "xyes" ; then
# add the warnings we do not want to do on mingw
C_WARNINGS_TO_TEST="$C_WARNINGS_TO_TEST -Wall -Wstrict-prototypes"
fi

if test $using_clang == "no" ; then
# -Wstrict-null-sentinel is not supported under clang
CXX_WARNINGS_TO_TEST="$CXX_WARNINGS_TO_TEST -Wstrict-null-sentinel"
fi



echo "C Warnings to test: $C_WARNINGS_TO_TEST"

for option in $C_WARNINGS_TO_TEST
do
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $option"
AC_MSG_CHECKING([whether gcc understands $option])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[has_option=yes],
[has_option=no; CFLAGS="$SAVE_CFLAGS"])
AC_MSG_RESULT($has_option)
unset has_option
unset SAVE_CFLAGS
if test $option = "-Wmissing-format-attribute" ; then
AC_DEFINE(HAVE_MISSING_FORMAT_ATTRIBUTE_WARNING,1,
[Indicates that we have the -Wmissing-format-attribute G++ warning])
fi
done
unset option


# Check G++
# We don't use these warnings:
# -Waggregate-return -- aggregate returns are GOOD; they simplify code design
# We can use these warnings after ZLIB gets upgraded:
# -Wundef --- causes problems with zlib
# -Wcast-qual
# -Wmissing-format-attribute --- Just too annoying
AC_LANG_PUSH(C++)
AC_CHECK_HEADERS([string])
CXX_WARNINGS_TO_TEST="-Wall -MD -D_FORTIFY_SOURCE=2 -Wpointer-arith \
-Wshadow -Wwrite-strings -Wcast-align \
-Wredundant-decls -Wdisabled-optimization \
-Wfloat-equal -Wmultichar -Wmissing-noreturn \
-Woverloaded-virtual -Wsign-promo \
-funit-at-a-time"

if test x"${mingw}" != "xyes" ; then
# add the warnings we don't want to do on mingw
CXX_WARNINGS_TO_TEST="$CXX_WARNINGS_TO_TEST -Weffc++"
fi

echo "C++ Warnings to test: $CXX_WARNINGS_TO_TEST"

for option in $CXX_WARNINGS_TO_TEST
do
SAVE_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $option"
AC_MSG_CHECKING([whether g++ understands $option])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[has_option=yes],
[has_option=no; CXXFLAGS="$SAVE_CXXFLAGS"])
AC_MSG_RESULT($has_option)
unset has_option
unset SAVE_CXXFLAGS
done
unset option
AC_LANG_POP()


26 changes: 26 additions & 0 deletions m4/slg_searchdirs.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
if test x"${mingw}" != "xyes" ; then

case $host in
*mingw*)
AC_MSG_NOTICE([Compiling under mingw; will not search other directories.])
;;
*)
AC_MSG_NOTICE(Compiling under $host.)
# Bring additional directories where things might be found into our
# search path. I don't know why autoconf doesn't do this by default
for spfx in /usr/local /opt/local /sw /usr/local/ssl; do
AC_MSG_NOTICE([checking ${spfx}/include])
if test -d ${spfx}/include; then
CPPFLAGS="-I${spfx}/include $CPPFLAGS"
LDFLAGS="-L${spfx}/lib $LDFLAGS"
AC_MSG_NOTICE([ *** ADDING ${spfx}/include to CPPFLAGS *** ])
AC_MSG_NOTICE([ *** ADDING ${spfx}/lib to LDFLAGS *** ])
fi
done
AC_MSG_NOTICE([ CPPFLAGS = ${CPPFLAGS} ])
AC_MSG_NOTICE([ LDFLAGS = ${LDFLAGS} ])
;;
esac
fi


2 changes: 1 addition & 1 deletion src/be13_api
Submodule be13_api updated from cc3951 to 20b02b

0 comments on commit dcd8a94

Please sign in to comment.