Cヘッダーファイルの場合、次のようなヘッダーファイルが複数含まれるのを防ぐことができます。
#ifndef MY_FOO_H
#define MY_FOO_H
[...]
#endif
include()
同じファイルへの複数のマクロ呼び出しによってコンテンツが1回だけ含まれるように、m4で同じことを行うにはどうすればよいですか?
具体的には、マクロの使用を伴うifdefガードを実行したいと思います(コードを'schangequote
で乱雑にしないでください)。dnl
もともと、私が次のことをしたとき、複数の包含はまだ引用符を破壊します:
changequote_file.m4:
ifdef(my_foo_m4,,define(my_foo_m4,1)
changequote([,])
)
changequote_invocation.m4:
include(changequote_file.m4)
After first include invocation:
[I should not have brackets around me]
`I should have normal m4 quotes around me'
include(changequote_file.m4)
After second include invocation:
[I should not have brackets around me]
`I should have normal m4 quotes around me'
m4 changequote_invocation.m4
利回りで呼び出されます:
After first include invocation:
I should not have brackets around me
`I should have normal m4 quotes around me'
After second include invocation:
[I should not have brackets around me]
`I should have normal m4 quotes around me'