From: Mazet Laurent Date: Fri, 28 Nov 2025 15:11:38 +0000 (+0100) Subject: add compilation options X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=0b2922a1e9c47f0df8f6027d59cb8a04b1391116;p=libviterbi.git add compilation options --- diff --git a/Makeconf.in b/Makeconf.in index ca8a976..55095a8 100644 --- a/Makeconf.in +++ b/Makeconf.in @@ -39,7 +39,7 @@ SH_LD = @SH_LD@ SH_LDFLAGS = @LDFLAGS@ @SH_LDFLAGS@ @SONAME_FLAGS@ LD = @LD@ -LIBS = @LIBS@ -L$(top_srcdir)/src -l@LIBRARY@ +LIBS = @LIBS@ -L$(top_srcdir)/src -l@LIBRARY@ -lm LDFLAGS = @LDFLAGS@ RLDFLAG = @RLD_FLAG@ diff --git a/configure b/configure index a1f7113..3bb3ccd 100755 --- a/configure +++ b/configure @@ -4201,6 +4201,62 @@ printf "%s\n" "no" >&6; } + ac_safe=`echo "-W" | sed 'y%./+-%__p_%'` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${CC-gcc} accepts -W" >&5 +printf %s "checking whether ${CC-gcc} accepts -W... " >&6; } + if eval test \${libviterbi_cv_cc_flag_$ac_safe+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + XCCFLAGS="$CCFLAGS" + CCFLAGS="$CCFLAGS -W" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + eval "libviterbi_cv_cc_flag_$ac_safe=yes" +else $as_nop + eval "libviterbi_cv_cc_flag_$ac_safe=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CCFLAGS="$XCCFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +fi + + if eval "test \"`echo '$libviterbi_cv_cc_flag_'$ac_safe`\" = yes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + CCFLAGS="$CCFLAGS -W" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi + + ac_safe=`echo "-Wall" | sed 'y%./+-%__p_%'` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${CC-gcc} accepts -Wall" >&5 printf %s "checking whether ${CC-gcc} accepts -Wall... " >&6; } @@ -4257,6 +4313,62 @@ printf "%s\n" "no" >&6; } fi + ac_safe=`echo "-Wextra" | sed 'y%./+-%__p_%'` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${CC-gcc} accepts -Wextra" >&5 +printf %s "checking whether ${CC-gcc} accepts -Wextra... " >&6; } + if eval test \${libviterbi_cv_cc_flag_$ac_safe+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + XCCFLAGS="$CCFLAGS" + CCFLAGS="$CCFLAGS -Wextra" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + eval "libviterbi_cv_cc_flag_$ac_safe=yes" +else $as_nop + eval "libviterbi_cv_cc_flag_$ac_safe=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CCFLAGS="$XCCFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +fi + + if eval "test \"`echo '$libviterbi_cv_cc_flag_'$ac_safe`\" = yes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + CCFLAGS="$CCFLAGS -Wextra" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi + + # Find a good install program. We prefer a C program (faster), @@ -4815,7 +4927,7 @@ then : withval=$with_debug; if test "$withval" = no; then DEBUG=false; else DEBUG=true; fi else $as_nop - DEBUG=false + DEBUG=true fi @@ -4953,6 +5065,62 @@ printf "%s\n" "yes" >&6; } printf "%s\n" "no" >&6; } fi + + ac_safe=`echo "-g" | sed 'y%./+-%__p_%'` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${CC-gcc} accepts -g" >&5 +printf %s "checking whether ${CC-gcc} accepts -g... " >&6; } + if eval test \${libviterbi_cv_cc_ldflag_$ac_safe+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + XLDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + eval "libviterbi_cv_cc_ldflag_$ac_safe=yes" +else $as_nop + eval "libviterbi_cv_cc_ldflag_$ac_safe=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$XLDFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +fi + + if eval "test \"`echo '$libviterbi_cv_cc_ldflag_'$ac_safe`\" = yes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + LDFLAGS="$LDFLAGS -g" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi + if test "$libviterbi_cv_cc_flag__g" = "no"; then as_fn_error $? "Can't add debugging information with this compiler!" "$LINENO" 5 fi diff --git a/configure.ac b/configure.ac index 486d512..10c6c11 100644 --- a/configure.ac +++ b/configure.ac @@ -44,7 +44,9 @@ fi LIBVITERBI_CC_FLAG(-pipe) +LIBVITERBI_CC_FLAG(-W) LIBVITERBI_CC_FLAG(-Wall) +LIBVITERBI_CC_FLAG(-Wextra) dnl Checks for programs. @@ -128,7 +130,7 @@ AC_ARG_WITH(debug, [ --with-debug add debug information], [if test "$withval" = no; then DEBUG=false; else DEBUG=true; fi], - DEBUG=false) + DEBUG=true) AC_SUBST(DEBUG) ### with profiling information @@ -149,6 +151,7 @@ if test "$DEBUG" = true; then LIBVITERBI_CC_FLAG(-ggdb3) if test "$libviterbi_cv_cc_flag__ggdb3" = "no"; then LIBVITERBI_CC_FLAG(-g) + LIBVITERBI_CC_LDFLAG(-g) if test "$libviterbi_cv_cc_flag__g" = "no"; then AC_MSG_ERROR([Can't add debugging information with this compiler!]) fi