hi all,

I'm trying to maintain a project that intensively uses a preprocessor called "gob2" to 
produce glib/gtk-compatible C. i kinda like it, and want to keep it, but it's 
integration to autoconf has quirks. i hope somebody on the list can give me some hints 
how to solve it better.

so, gob2 produces both .h and .c/.cc file from a source .gob. it has an option 
--no-touch-headers, that will only update the .h if it actually changes.

currently, i'm using the gob2.m4 that comes with the gob distribution, find it at the 
end of this message.

and insert "GOB2_CHECK(2.0.0)" into my configure.ac.
my Makefile.ams contain, for every .gob:
        BUILT_SOURCES = foo.cc foo.h
        pkginclude_HEADERS = foo.h
        foo_la_SOURCES = foo.gob foo.cc foo.h

and additionally:
        %.cc %.h %-private.h: %.gob
                @GOB2@ --for-cpp --no-private-header --no-touch-headers $<

this is the way suggested by the gob manpage, but i deem it unneccessary redundant. it 
is also quirky in other ways, dependencies dont work properly (the gob2 manpage states 
that --no-touch-headers will 'confuse' automake).

could there be an easier way, so i just have to add my source .gob (probably the .h if 
i want it installed) to the Makefile.am? and the dependencies work like supposed?

any help/hints/finished .m4 scripts are highly appreciated. i hope this is the right 
list for this question, if not, please notify me privately, and sorry.

-dan

gob2.m4 from the gob dist (http://www.5z.com/jirka/gob.html)
------------ 
dnl
dnl GOB_HOOK(script if found, fail)
dnl if fail = "failure", abort if GOB not found
dnl


AC_DEFUN(GOB2_HOOK,[
        AC_PATH_PROG(GOB2,gob2)
        if test ! x$GOB2 = x; then      
                if test ! x$1 = x; then 
                        AC_MSG_CHECKING(for gob-2 >= $1)
                        g_r_ve=`echo $1|sed 
's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
                        g_r_ma=`echo $1|sed 
's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
                        g_r_mi=`echo $1|sed 
's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
                        g_ve=`$GOB2 --version 2>&1|sed 's/Gob version 
\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
                        g_ma=`$GOB2 --version 2>&1|sed 's/Gob version 
\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
                        g_mi=`$GOB2 --version 2>&1|sed 's/Gob version 
\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`

                        if test $g_ve -eq $g_r_ve; then
                                if test $g_ma -ge $g_r_ma; then
                                        if test $g_mi -ge $g_r_mi; then
                                                AC_MSG_RESULT(ok)
                                        else
                                                if test $g_ma -gt $g_r_ma; then
                                                        AC_MSG_RESULT(ok)
                                                else
                                                        AC_MSG_ERROR("found 
$g_ve.$g_ma.$g_mi requires $g_r_ve.$g_r_ma.$g_r_mi")
                                                fi
                                        fi
                                else
                                        AC_MSG_ERROR("found $g_ve.$g_ma.$g_mi requires 
$g_r_ve.$g_r_ma.$g_r_mi")
                                fi
                        else
                                if test $g_ve -gt $g_r_ve; then
                                        AC_MSG_RESULT(ok)
                                else
                                        AC_MSG_ERROR(major version $g_ve found but 
$g_r_ve required)
                                fi
                        fi
        
                        unset gob_version
                        unset g_ve
                        unset g_ma
                        unset g_mi
                        unset g_r_ve
                        unset g_r_ma
                        unset g_r_mi
                fi
                AC_SUBST(GOB2)
                $2
        else            
                $3
        fi
])

AC_DEFUN([GOB2_CHECK],[
        GOB2_HOOK($1,[],[AC_MSG_WARN([Cannot find GOB-2, check 
http://www.5z.com/jirka/gob.html])])
])

------------ 


-- 
[EMAIL PROTECTED]
http://f3c.com/dan/



Reply via email to