如何正确创建 netcdf 4.x 的 autoconf 设置?

发布于 2024-12-21 22:16:01 字数 1619 浏览 2 评论 0原文

我不确定我的问题到底是什么,因为我被 autoconf/automake/libtoolize 等严重扭转了。我们中的几个人正在尝试 autoconferize mbsystem。我在这里提交了迄今为止的工作报告:

https://bitbucket.org/schwehr/mbsystem

我正在尝试改进 netcdf 设置以使用 nc-config,但不确定如何正确执行此操作。我正在configure.in 上工作。在 INCLUDES="$INCLUDES ``$nc_config --cflags``" 之后似乎无法找到带有 AC_CHECK_HEADER("netcdfcpp.h") 的标头(请原谅不正确的反引号) gdl netcdf 检查。从 nc-config --cflags 更新路径的正确方法是什么?

http://gnudatalanguage.cvs.sourceforge.net/viewvc /gnudatalanguage/gdl/configure.in?revision=1.121

然后我尝试使用 AX_PATH_GENERIC 并陷入困境m4_include([m4/ax_path_generic.m4]) 出现此错误

Running autoconf ...
configure.in:29: error: possibly undefined macro: AC_SUBST
      If this token and others are legitimate, please use m4_pattern_allow.
     See the Autoconf documentation.
configure:12992: error: possibly undefined macro: AC_MSG_RESULT

任何有助于更好地创建 netcdf 检查的帮助,该检查实际上可以通过 nc-config 与时髦的非标准安装位置一起使用,并弄清楚如何正确地将宏放入 m4 目录中将会有很大的帮助。

指向一个真正干净地执行此操作的包的指针将是一个超级帮助。我一直在查看 netcdf、gdal、geos 和 gdl 源的示例。像 octopus netcdf 检查这样的东西不使用 nc-config... http://www.tddft.org/trac/octopus/browser/trunk/m4/netcdf.m4

netcdf 4.x 的 fink 当前设置:

nc-config --cflags --libs
-I/sw/opt/netcdf7/include -I/sw/include
-L/sw/opt/netcdf7/lib -lnetcdf

谢谢!

I am not sure exactly what my question is as I get seriously turned around by autoconf/automake/libtoolize etc. Several of us are trying to autoconferize mbsystem. I've thrown a repo up of the work to date here:

https://bitbucket.org/schwehr/mbsystem

I'm trying to improve the netcdf setup to use nc-config, but am uncertain how to do this correctly. I am working on configure.in. It seems unable to find a header with AC_CHECK_HEADER("netcdfcpp.h") after INCLUDES="$INCLUDES ``$nc_config --cflags``" (pardon the incorrect back ticks) as taken from the gdl netcdf check. What is the correct way to update the path from nc-config --cflags?

http://gnudatalanguage.cvs.sourceforge.net/viewvc/gnudatalanguage/gdl/configure.in?revision=1.121

I then tried to use AX_PATH_GENERIC and get stuck on this error with m4_include([m4/ax_path_generic.m4])

Running autoconf ...
configure.in:29: error: possibly undefined macro: AC_SUBST
      If this token and others are legitimate, please use m4_pattern_allow.
     See the Autoconf documentation.
configure:12992: error: possibly undefined macro: AC_MSG_RESULT

Any help in getting better at creating a netcdf check that actually will work with funky non-standard install locations via nc-config and figuring out how to properly put a macro in the m4 directory would be a huge help.

A pointer to a package doing this really cleanly would be a super help. I've been looking at the netcdf, gdal, geos and gdl sources for examples. And things like the octopus netcdf check do not use nc-config... http://www.tddft.org/trac/octopus/browser/trunk/m4/netcdf.m4

The current setup with fink for netcdf 4.x:

nc-config --cflags --libs
-I/sw/opt/netcdf7/include -I/sw/include
-L/sw/opt/netcdf7/lib -lnetcdf

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一身骄傲 2024-12-28 22:16:01

请参阅 Makefile .am:如何在configure.ac中使用curl-config和xml2-config?并用netcdf替换xml2/curl。

只需

PKG_CHECK_MODULES([libnetcdf], [netcdf])

configure.ac 中使用,然后在 Makefile.am 中使用:

AM_CPPFLAGS = ${libnetcdf_CFLAGS}
bin_PROGRAMS = foo
foo_SOURCES = ...
foo_LDADD = ${libnetcdf_LIBS}

See Makefile.am: How to use curl-config and xml2-config in configure.ac? and substitute xml2/curl by netcdf.

Just use

PKG_CHECK_MODULES([libnetcdf], [netcdf])

in configure.ac, and then, in Makefile.am:

AM_CPPFLAGS = ${libnetcdf_CFLAGS}
bin_PROGRAMS = foo
foo_SOURCES = ...
foo_LDADD = ${libnetcdf_LIBS}
ゃ懵逼小萝莉 2024-12-28 22:16:01

使用第三方 m4 宏的“正确”方法是使用 aclocal(通常通过 automake)生成 aclocal.m4。如果您使用automake,只需添加

ACLOCAL_AMFLAGS = -I m4

到Makefile.am并放入

AC_CONFIG_MACRO_DIR([m4])

configure.ac(重命名configure.in后)。

如果您不使用 automake,请在调用 aclocal 时添加“-I m4”。如果您不使用 aclocal,那么您必须将宏的定义附加到 aclocal.m4 的末尾(并且小心不要运行 aclocal,因为这会覆盖该文件。)

没有很好的示例使用conf脚本进行构建的干净方法,因为使用此类脚本本质上是有缺陷的方法。一个稍微干净的方法是停止使用自定义脚本并通过 PKG_CHECK_MODULES 使用 pkg-config,但最干净的方法是教育您的用户。如果用户想要在时髦的非标准位置安装库,那么他们需要接受足够的教育才能正确设置 LDFLAGS 和 CPPFLAGS。

The "correct" way to use a third party m4 macro is to use aclocal (usually via automake) to generate aclocal.m4. If you are using automake, just add

ACLOCAL_AMFLAGS = -I m4

to Makefile.am and put

AC_CONFIG_MACRO_DIR([m4])

in configure.ac (after renaming configure.in).

If you are not using automake, add '-I m4' when you invoke aclocal. If you are not using aclocal, then you'll have to append the definition of the macro to the end of aclocal.m4 (and be careful to never run aclocal, as that will overwrite the file.)

There is no good example of a clean way to use conf scripts to do a build because using such scripts is an inherently flawed approach. A slightly cleaner approach is to stop using custom scripts and use pkg-config via PKG_CHECK_MODULES, but the cleanest way to do this is to educate your users. If the user wants to install the library in funky non-standard locations then they need to be educated enough to set LDFLAGS and CPPFLAGS appropriately.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文