Bug 115167

Summary: kst links to netcdf unconditionally
Product: [Applications] kst Reporter: Marcus D. Hanwell <marcus>
Component: generalAssignee: kst
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.1.0   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description Marcus D. Hanwell 2005-10-27 01:46:55 UTC
Version:           1.1.0 (using KDE KDE 3.4.92)
Installed from:    Gentoo Packages
Compiler:          GCC 3.4.4 
OS:                Linux

kst-1.1.0 now links to netcdf if it is installed unconditionally. Passing --without-netcdf does not disable it as expected.
Comment 1 George Staikos 2005-10-27 04:18:30 UTC
On Wednesday 26 October 2005 19:46, Marcus D.Hanwell wrote:
> kst-1.1.0 now links to netcdf if it is installed unconditionally. Passing
> --without-netcdf does not disable it as expected.


   There is no --without-netcdf.  We could add one, but I'm curious as to why 
this is needed.  It's just used by a plugin.
Comment 2 Marcus D. Hanwell 2005-10-27 08:59:02 UTC
When packaging it breaks dependencies when configure scripts automatically link to stuff that is installed, and won't respect --without-. This behaviour is generally discouraged. There is also currently an issue with linking to netcdf on the amd64 architecture and so ebuilds will fail when netcdf is present on the system. If it isn't a hard dependency it generally helps all packagers if linking can be disabled.
Comment 3 George Staikos 2005-10-27 15:13:02 UTC
On Thursday 27 October 2005 02:59, Marcus D.Hanwell wrote:
> When packaging it breaks dependencies when configure scripts automatically
> link to stuff that is installed, and won't respect --without-. This
> behaviour is generally discouraged.


   Well the idea was that we just automatically use it if we find it.  The 
argument just adds more search paths...

> There is also currently an issue with 
> linking to netcdf on the amd64 architecture and so ebuilds will fail when
> netcdf is present on the system. 


   That's what I wanted to hear. :)

> If it isn't a hard dependency it generally 
> helps all packagers if linking can be disabled.


    Agreed.  I'll do that.
Comment 4 Marcus D. Hanwell 2005-10-30 13:34:12 UTC
Just to add that packagers generally need this feature anyway. Certainly enable stuff by default, but if we don't have a disable/without option then we have to hack at the configure files or do even nastier things. If it isn't a hard dep then IMHO it should always have an enable/disable option. We have patched the Gentoo ebuild for now anyway. Stuff that opportunistically links introduces unknown dependencies, and can cause linking bugs in PIC sensitive architectures like amd64.

Thanks for agreeing to patch the configure files - it does help us.
Comment 5 George Staikos 2005-11-01 21:59:22 UTC
SVN commit 476701 by staikos:

add --without-netcdf
BUG: 115167


 M  +18 -14    configure.in.in  


--- trunk/extragear/graphics/kst/configure.in.in #476700:476701
@@ -7,7 +7,7 @@
 AC_HEADER_TIME
 AC_CHECK_HEADERS(sys/time.h)
 
-KST_VERSION=1.2.0_devel
+KST_VERSION="1.2.0_devel"
 KST_LIBKST_VERSION=1:2:0
 
 AC_SUBST([KST_VERSION])
@@ -114,22 +114,26 @@
     [  ac_netcdf_includes="-I$withval/include"
        ac_netcdf_libraries="-L$withval/lib"
     ])
+AC_ARG_WITH(nonetcdf,
+    AC_HELP_STRING([--without-netcdf],[disable NetCDF support]),[build_netcdf=no],[build_netcdf=maybe])
 
-all_includes_save="$all_includes"
-all_includes="$all_includes $ac_netcdf_includes"
-KDE_CHECK_HEADER(netcdfcpp.h, AC_DEFINE(HAVE_NETCDFCPP_H, 1, [If we have NetCDF CPP headers]) have_netcdfcpp_h=yes NETCDFINCLUDES="$ac_netcdf_includes", , )
-all_includes="$all_includes_save"
+if test "$build_netcdf" = "maybe"; then
+  all_includes_save="$all_includes"
+  all_includes="$all_includes $ac_netcdf_includes"
+  KDE_CHECK_HEADER(netcdfcpp.h, AC_DEFINE(HAVE_NETCDFCPP_H, 1, [If we have NetCDF CPP headers]) have_netcdfcpp_h=yes NETCDFINCLUDES="$ac_netcdf_includes", , )
+  all_includes="$all_includes_save"
 
-ldflags_save="$LDFLAGS"
-LDFLAGS="$LDFLAGS $ac_netcdf_libraries"
-KDE_CHECK_LIB(netcdf, nc_open, NETCDFLIBS="$ac_netcdf_libraries -lnetcdf_c++ -lnetcdf $NETCDFLIBS", , )
-LDFLAGS="$ldflags_save"
+  ldflags_save="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $ac_netcdf_libraries"
+  KDE_CHECK_LIB(netcdf, nc_open, NETCDFLIBS="$ac_netcdf_libraries -lnetcdf_c++ -lnetcdf $NETCDFLIBS", , )
+  LDFLAGS="$ldflags_save"
 
-if test $ac_cv_lib_netcdf_nc_open = yes; then
-  if test $have_netcdfcpp_h = yes; then
-    AC_SUBST(NETCDFLIBS)
-    AC_SUBST(NETCDFINCLUDES)
-    AC_DEFINE(KST_HAVE_NETCDF, 1, [If we have the NetCDF libraries.])
+  if test $ac_cv_lib_netcdf_nc_open = yes; then
+    if test $have_netcdfcpp_h = yes; then
+      AC_SUBST(NETCDFLIBS)
+      AC_SUBST(NETCDFINCLUDES)
+      AC_DEFINE(KST_HAVE_NETCDF, 1, [If we have the NetCDF libraries.])
+    fi
   fi
 fi