Tom Tromey <[EMAIL PROTECTED]> writes: > >>>>> "Diego" == Diego Sevilla Ruiz <[EMAIL PROTECTED]> writes: > > Diego> IDL_DEPS(anyfile.idl) > > There was a discussion on this on the automake list in the past. > I don't remember the outcome. > > I think the best approach would be to have an autoconf macro to find > the IDL compiler, and then have that macro generate information used > by automake. This would mean extending automake to understand IDL as > well. > > I'm not planning to do this but I would check in clean patches which > did. > > Tom A year ago (or so) I proposed some patches to make automake support IDL files. Of course I've lost these patches since then, but here are some new ones. (diff -rc3 automake-1.4 automake-1.4.1) Attached is a patch for automake-1.4 to make it understand .idl. Since different idl-compilers breaks the basename of the idl-file in both a) adding a suffix to the filename and b) setting a new extention to the file I needed some means of specifying the modifiers. Here is the all extensible FAQ :-) 1. AM_PROG_IDLC(a, b) Macro for setting up compiler and option a) compiler-program name b) options to the compiler 2. AM_IDL_SERVER(SK,hh,HEI,cpp) Macro for setting server-side output-source-files something.idl -> somethingSK.hh something.idl -> somethingHEI.cpp 3. AM_IDL_CLIENT(a,b,c,d) Macro for setting client-side output-source-files Works like the AM_IDL_SERVER() but is used if server-side is different from client-side generated stubs You could leave some of the parameters blank if your compiler does not modify the basename of the idl-file. automake will add dependencies so that modifying an idl-file will automatically run the idl-compiler to regenerate the source-files. TODO: make maintainer-clean should remove the generated source-files and leave the idl files. I guess I've learned more perl since I wrote this patch and someone with perl-knowledge would probably clean it up better :-) Here is how I'm using it (excerpt from my configure.in) dnl omniORB2 compiler AM_PROG_IDLC(omniidl2,-s .cpp -h .h) AM_IDL_SERVER(,h,,cpp) dnl I think you could use this line for the tao-compiler dnl AM_PROG_IDLC(tao_idl,-ss _s.cc -hs _s.hh -hc _c.hh -cs _c.cc) dnl AM_PROG_SERVER(_s,hh,_c,cc) dnl orbix idl-compiler would probably work this way: dnl AM_PROG_IDLC(idl,-A -I. -B -cC.cxx -sS.cxx) dnl AM_IDL_SERVER(,hh,S,cxx) dnl AM_IDL_CLIENT(,,C,cxx) --- In addition I've supplied the following sniplet in acinclude.m4 to find the omniORB2 includes/libraries and setup the proper defines. Just call CDDB_CHECK_OMNIORB2 from configure.in to make configure support --with-omniorb2-dir=/usr/local/omniORB2. guess you would add something like this to find your idl-directories dnl ################################### dnl dnl Find omniORB2 package dnl AC_DEFUN(CDDB_CHECK_OMNIORB2, [ AC_MSG_CHECKING([for omniORB]) AC_ARG_WITH(omniorb2_dir, [ --with-omniorb2-dir=omniorb2-dir use omniORB2 installed in omniORB2 dir], [ ac_omniorb2_dir=$withval ], ac_omniorb2_dir=/usr/local/omniORB2 ) dnl Find omniorb2 include-path omniorb2_incdirs="$ac_omniorb2_dir $ac_omniorb2_dir/include /usr/local/include" AC_FIND_FILE(omnithread.h, $omniorb2_incdirs, omniorb2_incdir) if test ! -r $omniorb2_incdir/omnithread.h; then AC_MSG_ERROR(omnithread.h file not found in [$omniorb2_incdirs]) fi OMNIORB2INCLUDES=-I$omniorb2_incdir dnl Find omniorb2 lib-path omniorb2_libdirs="$ac_omniorb2_dir $ac_omniorb2_dir/lib /usr/local/lib" AC_FIND_FILE(libomniORB2.a, $omniorb2_libdirs, omniorb2_libdir) if test ! -r $omniorb2_libdir/libomniORB2.a; then AC_MSG_ERROR(-lomniORB2 not found in [$omniorb2_libdirs]) fi OMNIORB2LIBDIR=$omniorb2_libdir AC_MSG_RESULT([includes: $omniorb2_incdir libraries: $omniorb2_libdir]) AC_MSG_CHECKING([which defines should be set for omniORB2]) OMNIORB2CPPFLAGS= dnl set flags for specific opsys case "$host" in *-pc-linux*) AC_DEFINE(__x86__) AC_DEFINE(__linux__) AC_DEFINE(__OSVERSION__,2) AC_DEFINE(__OMNIORB2__) AC_DEFINE(UsePthread) OMNIORB2CPPFLAGS="-D__x86__ -D__linux__ -D__OSVERSION__=2 -D__OMNIORB2__ -DUsePthread" OMNIORB2LIBRARIES="-L$omniorb2_libdir -lomniORB2 -lomnithread -ltcpwrapGK -lomniLC" ;; *) AC_MSG_ERROR([Unknown target [$host], don't know how to define compile-flags and libraries for omniORB2]) ;; esac AC_MSG_RESULT([$OMNIORB2CPPFLAGS]) AC_SUBST(OMNIORB2INCLUDES) AC_SUBST(OMNIORB2LIBDIR) AC_SUBST(OMNIORB2LIBRARIES) AC_SUBST(OMNIORB2CPPFLAGS) ]) -- ------------------------------------------------------- Bjørn Wennberg email: [EMAIL PROTECTED] ms: +47 9599 2657
diff -rc3 automake-1.4/automake.in automake-1.4.1/automake.in *** automake-1.4/automake.in Fri Jan 15 01:42:36 1999 --- automake-1.4.1/automake.in Sun Mar 5 21:25:17 2000 *************** *** 56,61 **** --- 56,63 ---- $AC_CONFIG_AUX_DIR_PATTERN = "AC_CONFIG_AUX_DIR\\(([^)]+)\\)"; $AM_INIT_AUTOMAKE_PATTERN = "AM_INIT_AUTOMAKE\\([^,]*,([^,)]+)[,)]"; $AM_PACKAGE_VERSION_PATTERN = "^\\s*\\[?([^]\\s]+)\\]?\\s*\$"; + $AM_IDL_SERVER_PATTERN = "AM_IDL_SERVER\\((\.+)\\)"; + $AM_IDL_CLIENT_PATTERN = "AM_IDL_CLIENT\\((\.+)\\)"; # Note that there is no AC_PATH_TOOL. But we don't really care. $AC_CHECK_PATTERN = "AC_(CHECK|PATH)_(PROG|PROGS|TOOL)\\(\\[?(\\w+)"; $AM_MISSING_PATTERN = "AM_MISSING_PROG\\(\\[?(\\w+)"; *************** *** 214,219 **** --- 216,233 ---- # TRUE if we've seen AC_ENABLE_MULTILIB. $seen_multilib = 0; + # IDL-Compiler helpers + $idlc = 0; + $idlcflags = 0; + $idl_server_header_suffix = 0; + $idl_server_source_suffix = 0; + $idl_server_header_ext = 0; + $idl_server_source_ext = 0; + $idl_client_header_suffix = 0; + $idl_client_source_suffix = 0; + $idl_client_header_ext = 0; + $idl_client_source_ext = 0; + # Hash table of discovered configure substitutions. Keys are names, # values are `FILE:LINE' strings which are used by error message # generation. *************** *** 326,331 **** --- 340,346 ---- 'F'); ®ister_language ('ratfor', 'F77LINK', 0, 'r'); + ®ister_language ('idl', '', 0, 'idl'); # Parse command line. *************** *** 922,927 **** --- 937,943 ---- local ($non_c) = 1; foreach $ext (sort keys %extension_seen) { + #print "finish_language: extension '$ext'\n"; $lang = $extension_map{$ext}; next if defined $done{$lang}; $done{$lang} = 1; *************** *** 929,934 **** --- 945,951 ---- # Compute the function name of the finisher and then call it. $name = 'lang_' . $lang . '_finish'; + #print "$name\n"; do $name (); } *************** *** 951,956 **** --- 968,974 ---- } } + # Output a rule to build from a YACC source. The output from YACC is # compiled with C or C++, depending on the extension of the YACC file. sub output_yacc_build_rule *************** *** 1084,1131 **** $extension = $2; local ($lang) = $extension_map{$extension}; ! if ($lang) { &saw_extension ($extension); # Found the language, so see what it says. ! local ($subr) = 'lang_' . $lang . '_rewrite'; # Note: computed subr call. ! local ($r) = do $subr ($base, $extension); ! # Skip this entry if we were asked not to process it. next if ! $r; # Now extract linker and other info. $linker = $language_map{$lang . '-linker'}; ! if ($language_map{$lang . '-ansi-p'}) { ! $object = $base . $obj; } else { ! $object = $base . $nonansi_obj; } } - elsif ($extension =~ /^$source_suffix_pattern$/) - { - # We just rewrite it. Maybe we should do more. - $object = $base . '.' . $suffix_rules{$extension}; - $linker = ''; - } - else - { - # No error message here. Used to have one, but it was - # very unpopular. - next; - } - - $linkers_used{$linker} = 1; - - push (@result, $object); - - # Transform .o or $o file into .P file (for automatic - # dependency code). - $dep_files{'.deps/' . $base . '.P'} = 1; } } --- 1102,1175 ---- $extension = $2; local ($lang) = $extension_map{$extension}; ! if ($lang && $lang eq "idl") { &saw_extension ($extension); # Found the language, so see what it says. ! local ($subr) = 'lang_' . $lang . '_src_rewrite'; # Note: computed subr call. ! local ($r, @new_bases) = do $subr ($base, $extension); next if ! $r; + # Now extract linker and other info. $linker = $language_map{$lang . '-linker'}; + $linkers_used{$linker} = 1; ! local $new_base; ! foreach $new_base (@new_bases) { ! $object = $new_base . $nonansi_obj; ! push (@result, $object); ! ! # Transform .o or $o file into .P file (for automatic ! # dependency code). ! $dep_files{'.deps/' . $new_base . '.P'} = 1; ! } ! } ! else { ! if ($lang) ! { ! &saw_extension ($extension); ! # Found the language, so see what it says. ! local ($subr) = 'lang_' . $lang . '_rewrite'; ! # Note: computed subr call. ! local ($r) = do $subr ($base, $extension); ! # Skip this entry if we were asked not to process it. ! next if ! $r; ! ! # Now extract linker and other info. ! $linker = $language_map{$lang . '-linker'}; ! ! if ($language_map{$lang . '-ansi-p'}) ! { ! $object = $base . $obj; ! } ! else ! { ! $object = $base . $nonansi_obj; ! } ! } ! elsif ($extension =~ /^$source_suffix_pattern$/) { ! # We just rewrite it. Maybe we should do more. ! $object = $base . '.' . $suffix_rules{$extension}; ! $linker = ''; } else { ! # No error message here. Used to have one, but it was ! # very unpopular. ! next; } + + $linkers_used{$linker} = 1; + + push (@result, $object); + + # Transform .o or $o file into .P file (for automatic + # dependency code). + $dep_files{'.deps/' . $base . '.P'} = 1; } } } *************** *** 4215,4220 **** --- 4259,4273 ---- { $configure_vars{$1} = $filename . ':' . $.; } + + # Extract the information from the idl-compiler init-lin + if (/$AM_IDL_SERVER_PATTERN/) { + ($idl_server_header_suffix, $idl_server_header_ext, $idl_server_source_suffix, $idl_server_source_ext) = split(/,/,$1); + } + if (/$AM_IDL_CLIENT_PATTERN/) { + ($idl_client_header_suffix, $idl_client_header_ext, $idl_client_source_suffix, $idl_client_source_ext) = split(/,/,$1); + } + if (/$AC_CHECK_PATTERN/o) { $configure_vars{$3} = $filename . ':' . $.; *************** *** 4440,4445 **** --- 4493,4535 ---- return 0; } + # Special case. in the Makefile.am we specify a file name 'xxx.idl' + # but the idl-compiler will generate a 'xxxSK.cc' file, thus we need + # to rename the 'object'-output. + sub lang_idl_src_rewrite + { + local ($base, $ext) = @_; + + $idl_sources{$base . '.' . $ext} = 1; + + + if ($idl_server_header_ext) { + &saw_extension($idl_server_header_ext); + } + if ($idl_server_source_ext) { + &saw_extension($idl_server_source_ext); + } + if ($idl_client_header_ext) { + &saw_extension($idl_client_header_ext); + } + if ($idl_client_source_ext) { + &saw_extension($idl_client_source_ext); + } + + local @base_list = ($base); + local $idx = 0; + + if ($idl_server_skeleton_suffix) { + $base_list[0] = $base . $idl_server_skeleton_suffix; + $idx++; + } + if ($idl_client_stub_suffix && $idl_client_stub_suffix ne $idl_server_skeleton_suffix) { + $base_list[$idx]= $base . $idl_client_stub_suffix; + $idx++; + } + return (1, @base_list); + } + # Rewrite a single yacc file. sub lang_yacc_rewrite { *************** *** 4615,4620 **** --- 4705,4806 ---- } } + sub idl_extensions + { + local ($key, @r); + foreach $key (sort keys %extension_seen) + { + push (@r, '.' . $key) if $extension_map{$key} eq 'idl'; + } + return @r; + } + + sub lang_idl_finish + { + local (@idl_list) = &idl_extensions; + local ($idl_count) = scalar @idl_list; + + if ($idl_count) + { + push(@suffixes, @idl_list); + + &define_variable('IDLCOMPILE', '$(IDLC) $(IDLCFLAGS) $(INCLUDES) '); + + if (! defined $configure_vars{'IDLC'}) + { + &am_error ("IDL source seen but \'IDLC\' not defined in \'configure.in\'"); + } + } + + local (@idl_files) = sort keys %idl_sources; + + foreach $file (@idl_files) { + # print "$file\n"; + + $file =~ /^(.*)\.idl$/; + $base = $1; + + local ($idl_server_header_name, $idl_server_source_name, $idl_client_header_name, $idl_client_source_name) = (); + if ($idl_server_header_ext) { + $idl_server_header_name = $base; + if ($idl_server_header_suffix) { + $idl_server_header_name .= $idl_server_header_suffix; + } + $idl_server_header_name .= ("." . $idl_server_header_ext); + } + if ($idl_server_source_ext) { + $idl_server_source_name = $base; + if ($idl_server_source_suffix) { + $idl_server_source_name .= $idl_server_source_suffix; + } + $idl_server_source_name .= ("." . $idl_server_source_ext); + } + if ($idl_client_header_ext) { + $idl_client_header_name = $base; + if ($idl_client_header_suffix) { + $idl_client_header_name .= $idl_client_header_suffix; + } + $idl_client_header_name .= ("." . $idl_client_header_ext); + } + if ($idl_client_source_ext) { + $idl_client_source_name = $base; + if ($idl_client_source_suffix) { + $idl_client_source_name .= $idl_client_source_suffix; + } + $idl_client_source_name .= ("." . $idl_client_source_ext); + } + + if ($idl_server_header_name ne $idl_client_header_name) { + if ($idl_server_header_name) { + $output_rules .= "$idl_server_header_name "; + } + if ($idl_client_header_name) { + $output_rules .= "$idl_client_header_name "; + } + } + + if ($idl_server_source_name ne $idl_client_source_name) { + if ($idl_server_source_name) { + $output_rules .= "$idl_server_source_name "; + } + if ($idl_client_source_name) { + $output_rules .= "$idl_client_source_name "; + } + } + $output_rules .= (": $file\n" + . "\t\$(IDLCOMPILE) \$<\n"); + + # test + # $output_rules .= ("$base\@IDL_SERVER_HEADER_SUFFIX\@.\@IDL_SERVER_HEADER_EXT\@ " + # . "$base\@IDL_SERVER_SOURCE_SUFFIX\@.\@IDL_SERVER_SOURCE_EXT\@ " + # . "$base\@IDL_CLIENT_HEADER_SUFFIX\@.\@IDL_CLIENT_HEADER_EXT\@ " + # . "$base\@IDL_CLIENT_SOURCE_SUFFIX\@.\@IDL_CLIENT_SOURCE_EXT\@ " + # . ": $file\n" + # . "\t\$(IDLCOMPILE) \$<\n"); + } + + } + sub lang_header_finish { # Nothing to do. *************** *** 6361,6366 **** --- 6547,6553 ---- # filenames instead of raw count so that multiple instances are # counted correctly (eg one yacc file can appear in multiple # programs without harm). + %idl_sources = (); %yacc_sources = (); %lex_sources = (); diff -rc3 automake-1.4/m4/Makefile.am automake-1.4.1/m4/Makefile.am *** automake-1.4/m4/Makefile.am Wed Oct 28 02:49:16 1998 --- automake-1.4.1/m4/Makefile.am Sun Mar 5 21:25:17 2000 *************** *** 7,12 **** m4data_DATA = ccstdc.m4 cond.m4 dmalloc.m4 error.m4 header.m4 init.m4 \ lex.m4 lispdir.m4 maintainer.m4 missing.m4 mktime.m4 multi.m4 \ obstack.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strtod.m4 \ ! termios.m4 winsz.m4 EXTRA_DIST = $(m4data_DATA) --- 7,12 ---- m4data_DATA = ccstdc.m4 cond.m4 dmalloc.m4 error.m4 header.m4 init.m4 \ lex.m4 lispdir.m4 maintainer.m4 missing.m4 mktime.m4 multi.m4 \ obstack.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strtod.m4 \ ! termios.m4 winsz.m4 idl.m4 EXTRA_DIST = $(m4data_DATA) diff -rc3 automake-1.4/m4/Makefile.in automake-1.4.1/m4/Makefile.in *** automake-1.4/m4/Makefile.in Fri Jan 15 01:55:39 1999 --- automake-1.4.1/m4/Makefile.in Sun Mar 5 21:25:17 2000 *************** *** 67,73 **** MAINT_CHARSET = latin1 m4datadir = $(datadir)/aclocal ! m4data_DATA = ccstdc.m4 cond.m4 dmalloc.m4 error.m4 header.m4 init.m4 lex.m4 lispdir.m4 maintainer.m4 missing.m4 mktime.m4 multi.m4 obstack.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strtod.m4 termios.m4 winsz.m4 EXTRA_DIST = $(m4data_DATA) --- 67,73 ---- MAINT_CHARSET = latin1 m4datadir = $(datadir)/aclocal ! m4data_DATA = ccstdc.m4 cond.m4 dmalloc.m4 error.m4 header.m4 init.m4 lex.m4 lispdir.m4 maintainer.m4 missing.m4 mktime.m4 multi.m4 obstack.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strtod.m4 termios.m4 winsz.m4 idl.m4 EXTRA_DIST = $(m4data_DATA)