MLpcap-0.9/0040755000175000017500000000000010061700632010353 5ustar x25x25MLpcap-0.9/Changelog0100644000175000017500000000200710057136116012166 0ustar x25x25release 0.9: o added libpcap 0.8 compatibility with libpcap 0.7 backward compatibility o added following new API functions: pcap_list_datalinks pcap_set_datalink pcap_datalink_name_to_val pcap_datalink_val_to_name pcap_datalink_val_to_description pcap_breakloop pcap_dump_flush pcap_lib_version pcap_get_selectable o license fix, changed from GPL to LGPL o more configure arguments for enhanced configurability release 0.8: o added autoconf support for library and tests o split the C functions in a different file o some compatibility fixes o fixing configure.in and pcap.idl syntax o makefile bug fixes o various bugfixes and patches from Sylvain Le Gall release 0.7: o added function pcap_findalldevs o changed pcap_datalink so that it returns directly a value of type datalink (e.g. DLT_EN10MB) o IDL file is now included to generate the stub code o changed Makefiles o fixed example bugs release 0.5: o initial release MLpcap-0.9/pcap.idl0100644000175000017500000001521110057137515011776 0ustar x25x25/* * MLpcap: pcap bindings for OCaml. * Copyright (C) 2003-2004 Jonathan Heusser * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ quote(C, "\n\ #include \n\ #include \n\ #include \"utils.h\"\n\ \n\ extern void _pcap_callback (void *, va_alist);\n\ ") /* type defitions */ typedef [abstract, ptr] void * pcap_handle; typedef [abstract, ptr] void * bpf_program; typedef [abstract, ptr] void * pcap_dumper; typedef [abstract, ptr] void * file_t; /* more complicated functions, externally defined in utils.c */ quote(mli, "external pcap_findalldevs : unit -> pcap_if array\n\t\ =\"camlidl_pcap_pcap_findalldevs\"\n"); quote(ml, "external pcap_findalldevs : unit -> pcap_if array\n\t\ = \"camlidl_pcap_pcap_findalldevs\"\n"); /* only libpcap 0.8 */ quote(mli, "external pcap_list_datalinks: pcap_handle -> int * int array\n\t\ =\"camlidl_pcap_pcap_list_datalinks\"\n"); quote(ml, "external pcap_list_datalinks: pcap_handle -> int * int array\n\t\ =\"camlidl_pcap_pcap_list_datalinks\"\n"); /* some none-abstract typedefs */ struct timeval { int tv_sec; int tv_usec; }; typedef struct { struct timeval ts; int caplen; int len; } pcap_pkthdr; typedef struct { unsigned int ps_recv; unsigned int ps_drop; unsigned int ps_ifdrop; } pcap_stat; typedef struct { [ignore] struct pcap_if *next; [string] char* name; [string] char *description; //struct pcap_addr *addresses; int flags; } pcap_if; /* function definitions */ /* callback handler from the ML view */ typedef [abstract,mltype("string -> pcap_pkthdr -> string -> unit")] void *pcap_callback; pcap_handle pcap_open_live([in,string] char *dev, [in] int snaplen, [in] int promisc, [in] int to_ms) quote(call, "\ {\ char errbuf[256];\ \ _res = pcap_open_live(dev, snaplen, promisc, to_ms, errbuf);\ if(_res == NULL) {\ failwith(errbuf);\ }\ }"); void pcap_close(pcap_handle p); [string] char *pcap_lookupdev() quote(call, "\ {\ char errbuf[256];\ \ _res = pcap_lookupdev(errbuf);\ if(_res == NULL) {\ failwith(errbuf);\ } \ }"); int pcap_lookupnet([in,string] char *device, [out] int *netp, [out] int *maskp) quote(call, "\ {\ char errbuf[256];\ \ _res = pcap_lookupnet(device, netp, maskp, errbuf);\ if(_res == -1) {\ failwith(errbuf);\ }\ }"); int pcap_loop([in] pcap_handle p, [in] int cnt, [in] pcap_callback callback, [in,string] char *user) quote(call, "\ {\ value* p_call_back;\ __TR_function cback;\ p_call_back = stat_alloc(sizeof(value));\ *p_call_back = _v_callback;\ register_global_root(p_call_back);\ cback = alloc_callback(_pcap_callback, p_call_back);\ _res = pcap_loop(p, cnt, (pcap_callback) cback, user);\ \ }\ "); int pcap_dispatch([in] pcap_handle p, [in] int cnt, [in] pcap_callback callback, [in,string] char *user) quote(call, "\ {\ value* p_call_back;\ __TR_function cback;\ p_call_back = stat_alloc(sizeof(value));\ *p_call_back = _v_callback;\ register_global_root(p_call_back);\ cback = alloc_callback(_pcap_callback, p_call_back);\ \ _res = pcap_dispatch(p, cnt, (pcap_callback) cback, user);\ }\ "); /* untested */ pcap_handle pcap_open_dead([in] int linktype, [in] int snaplen); /* XXX: used with pcap_stats returns wrong stats */ pcap_handle pcap_open_offline([in,string] char *fname) quote(call, "\ {\ char errbuf[256];\ \ _res = pcap_open_offline(fname, errbuf);\ if(_res == NULL) {\ failwith(errbuf);\ }\ }"); pcap_dumper pcap_dump_open([in] pcap_handle p, [in,string] char *fname) quote(call, "\ {\ char *errbuf;\ \ _res = pcap_dump_open(p, fname);\ if(_res == NULL) {\ errbuf = pcap_geterr(p);\ failwith(errbuf);\ }\ }"); /* FIXME: segfaults when called directly, only working when */ /* used as a callback function from pcap_loop/dispatch */ void pcap_dump_direct([in] pcap_dumper user,[in,ref] pcap_pkthdr *h, [in,string] unsigned char *sp) quote(call, "\ {\ u_char *casted_user = (u_char*) user;\ \ pcap_dump(casted_user, h, sp);\ }"); void pcap_dump_close([in] pcap_dumper p); /* not sure if pcap_freealldevs() is needed or if the garbage collector * cleans up the allocated pcap_if array */ int pcap_compile([in] pcap_handle p, [out] bpf_program fp, [in,string] char *str, [in] int optimize, [in] int netmask); int pcap_setfilter([in] pcap_handle p, [in] bpf_program fp); void pcap_freecode(bpf_program fp); int pcap_setnonblock([in] pcap_handle p, [in] int nonblock) quote(call, "\ {\ char errbuf[256];\ \ _res = pcap_setnonblock(p, nonblock, errbuf);\ if(_res == -1) {\ failwith(errbuf);\ }\ }"); int pcap_getnonblock([in] pcap_handle p) quote(call, "\ {\ char errbuf[256];\ \ _res = pcap_getnonblock(p, errbuf);\ if(_res == -1) {\ failwith(errbuf);\ }\ }"); int pcap_datalink([in] pcap_handle p); int pcap_snapshot([in] pcap_handle p); int pcap_is_swapped([in] pcap_handle p); int pcap_major_version([in] pcap_handle p); int pcap_minor_version([in] pcap_handle p); /* ok */ int pcap_stats([in] pcap_handle p, [out] pcap_stat *ps); /* XXX: is this of any use in ocaml ?? */ file_t pcap_file([in] pcap_handle p); int pcap_fileno([in] pcap_handle p); void pcap_perror([in] pcap_handle p, [in,string] char *prefix); [string] char *pcap_geterr([in] pcap_handle p); [string] char *pcap_strerror([in] int error); /* NEW */ quote(C,"\n\ #ifdef HAVE_PCAP08\n\ \n\ "); int pcap_set_datalink([in] pcap_handle p, [in] int dlt); int pcap_datalink_name_to_val([in, string] char *name); [string] const char* pcap_datalink_val_to_name([in] int dlt) quote(call,"\ {\ _res = (char*)pcap_datalink_val_to_name(dlt);\ }"); [string] const char* pcap_datalink_val_to_description([in] int dlt) quote(call,"\ {\ _res = (char*)pcap_datalink_val_to_description(dlt);\ }"); int pcap_dump_flush([in] pcap_dumper p); //FILE *pcap_dump_file(pcap_dumper_t *p) void pcap_breakloop([in] pcap_handle p); int pcap_get_selectable_fd([in] pcap_handle p); [string] char* pcap_lib_version(void) quote(call,"\ {\ _res = (char*)pcap_lib_version();\ }"); quote(C,"\n\ #endif\n\ "); MLpcap-0.9/configure.in0100644000175000017500000000731010057136324012670 0ustar x25x25AC_INIT(pcap.idl) AC_MSG_CHECKING(for version) VERSION="`etc/shtool version -l txt -d short VERSION`" AC_MSG_RESULT "Configuring Version $VERSION" AC_SUBST(VERSION) AC_MSG_CHECKING(for platform) ARCH="`etc/shtool guessos`" AC_MSG_RESULT "$ARCH" AC_SUBST(ARCH) AC_CHECKING(for ocaml compiler and tools) AC_CHECK_PROG(ocamlc,ocamlc,ocamlc) AC_CHECK_PROG(ocamlopt,ocamlopt,ocamlopt) AC_CHECK_PROG(ocamlfind,ocamlfind,ocamlfind,ocamlidl) AC_PROG_INSTALL AC_SUBST(INSTALL) AC_CHECKING(for C compiler) AC_PROG_CC AC_CHECKING(for C header files) AC_HEADER_STDC # camlidldir="" camlidllibdir="" ffcalldir="" ffcallarchive="" libpcapdir="" cp4flag="" # AC_ARG_ENABLE(examples, [ --enable-examples build example programs [default=no]],,enable_examples="no") # AC_CHECKING(libraries) #AC_CHECKING(for pcap library) #if test "$ac_cv_lib_pcap" == "no"; then # #dirs="/usr/local/lib # # /usr/local/lib # # /usr/lib # # /lib" # dirs="/home/x25/code/MLpcap/libpcap-0.8.3" # for d in $dirs; do # test -f "$d/libpcap.a" && LDFLAGS="-L$d" # done # AC_CHECKING(in more locations) # unset ac_cv_lib_pcap #fi if test "x$enable_examples" = "xyes"; then AC_ARG_WITH(camlidl-lib, [ --with-camlidl-lib[=DIR] libcamlidl.a location], [ camlidllibdir=$withval if ! test -f "$camlidllibdir/libcamlidl.a"; then AC_MSG_ERROR(can't find libcamlidl.a in $camlidllibdir) fi ], [ AC_MSG_ERROR(missing --with-camlidl-lib) ]) AC_CHECKING(for ffcall callback library) dirs="/usr/local/lib /usr/lib /lib" for d in $dirs; do test -f "$d/libcallback.a" && ffcallarchive="$d/libcallback.a" done fi AC_ARG_WITH(libpcap, [ --with-libpcap[=DIR] libpcap.a/.so location], [ libpcapdir=$withval if ! test -f "$libpcapdir/libpcap.a"; then AC_MSG_ERROR(can't find libpcap.a in $libpcapdir) fi # check for libpcap >=0.8, set CFLAGS and camlp4 flag `which strings` "$libpcapdir/libpcap.a"|grep to_descr 2>&1 >/dev/null test $? && CFLAGS="$CFLAGS -DHAVE_PCAP08" && cp4flag="HAVE_PCAP08" ], [ #AC_MSG_ERROR(missing --with-libpcap) # try the default libpcapdir="/usr/lib" ]) AC_CHECKING(for pcap header files) AC_ARG_WITH(pcap-header, [ --with-pcap-header[=DIR] pcap header installation directory], [ pcapheaderdir=$withval AC_CHECK_HEADER($pcapheaderdir/pcap.h, [ CFLAGS="$CFLAGS -I$pcapheaderdir"; HAVE_PCAP_HEADER="yes" ]) ], [ AC_CHECK_HEADER(pcap.h, [HAVE_PCAP_HEADER="yes"]) ]) if test -z "$HAVE_PCAP_HEADER"; then AC_MSG_ERROR(can't find pcap.h) fi AC_CHECKING(for camlidl header) AC_ARG_WITH(camlidl, [ --with-camlidl[=DIR] camlidl installation directory], [ camlidldir=$withval AC_CHECK_HEADER($camlidldir/caml/camlidlruntime.h, [ CFLAGS="$CFLAGS -I$camlidldir"; HAVE_CAMLIDLRUNTIME_H="yes" ]) ], [ AC_CHECK_HEADER(caml/camlidlruntime.h, [HAVE_CAMLIDLRUNTIME_H="yes"]) ]) if test -z "$HAVE_CAMLIDLRUNTIME_H"; then AC_MSG_ERROR(can't find camlidlruntime.h) fi AC_CHECKING(for ffcall callback header) AC_ARG_WITH(ffcall, [ --with-ffcall[=DIR] ffcall installation directory], [ ffcalldir=$withval AC_CHECK_HEADER($ffcalldir/callback.h, [ CFLAGS="$CFLAGS -I$ffcalldir"; HAVE_CALLBACK_H="yes" ]) ], [ AC_CHECK_HEADER(callback.h,[HAVE_CALLBACK_H="yes"]) ]) if test -z "$HAVE_CALLBACK_H"; then AC_MSG_ERROR(can't find callback.h) fi AC_SUBST(camlidldir) AC_SUBST(camlidllibdir) AC_SUBST(ffcalldir) AC_SUBST(ffcallarchive) AC_SUBST(libpcapdir) AC_SUBST(cp4flag) if test "x$enable_examples" = "xyes"; then output="[Makefile tests/Makefile]" else output="Makefile" fi AC_OUTPUT($output) MLpcap-0.9/INSTALL0100644000175000017500000000142410056632521011407 0ustar x25x25You MUST provide the following flags to configure: --with-ffcall=: where ffcall's callback.h header is located --with-camlidl=: where camlidl's caml/camlidlruntime.h is found If you provide --with-examples then you must declare aswell --with-camlidl-lib=: where camlidl's libcamlidl.a is found If you have installed your libpcap library in a different path than /usr/lib you have to declare: --with-libpcap= where libpcap.a/libpcap.so is found Example configure options for a default system: ./configure --with-ffcall=/usr/local/include --with-camlidl=\ /usr/local/lib/ocaml --with-camlidl-lib=/usr/local/lib/ocaml/\ --with-examples MLpcap-0.9/tests/0040755000175000017500000000000010061426155011522 5ustar x25x25MLpcap-0.9/tests/pcap_dump_direct.ml0100644000175000017500000000143710057134412015355 0ustar x25x25open Pcap (* looking up suitable device *) let (a) = pcap_lookupdev ();; (* open it in promiscous mode *) let openlive = pcap_open_live a 1500 1 0;; Printf.printf "[+] opening interface %s ...\n" a ; flush_all ();; (* open dump.out and return pcap_dumper xx *) let xx = pcap_dump_open openlive "dump.out";; (* callback function, dumps t to xx *) let wrapdump (s:string) (h:pcap_pkthdr) (t:string) = pcap_dump_direct xx h t;; for i = 0 to 10 do let x = pcap_loop openlive 1 wrapdump "" in flush_all () done;; IFDEF HAVE_PCAP08 THEN let _ = pcap_dump_flush xx END;; let (_,aa) = pcap_stats openlive in Printf.printf "packets recv: %d\n" (aa.ps_recv); Printf.printf "packets drop: %d\n" (aa.ps_drop); Printf.printf "packets intf drop: %d\n" (aa.ps_ifdrop);; let () = pcap_close openlive MLpcap-0.9/tests/misc.ml0100644000175000017500000000163310057135530013006 0ustar x25x25open Pcap (* looking up suitable device *) let (a) = pcap_lookupdev ();; let (one,two,three) = pcap_lookupnet a;; Printf.printf "netmask ptr: %x\n" three;; (* open it in promiscous mode *) let openlive = pcap_open_live a 1500 1 0;; IFDEF HAVE_PCAP08 THEN let vers = pcap_lib_version () in Printf.printf "using %s\n" vers END;; (* dltbuf is an int array containing the supported datalinks *) IFDEF HAVE_PCAP08 THEN let (ret,dltbuf) = pcap_list_datalinks openlive in Printf.printf "datalinks supported on %s:\n" a; Array.iter (fun x -> Printf.printf "\t%s\n" (pcap_datalink_val_to_name x)) dltbuf END;; IFDEF HAVE_PCAP08 THEN let ret = pcap_datalink openlive in Printf.printf "my current datalink is %s\n" (pcap_datalink_val_to_description ret) END;; (* in nonblocking mode? *) let r = pcap_getnonblock openlive in Printf.printf "nonblocking mode is %d\n" r;; let () = pcap_close openlive MLpcap-0.9/tests/pcap_next.ml0100644000175000017500000000212310061426152014025 0ustar x25x25open Pcap (* looking up suitable device *) let (a) = pcap_lookupdev ();; (* open it in promiscous mode *) let openlive = pcap_open_live a 1500 1 0;; Printf.printf "[+] opening interface %s ...\n" a ; flush_all ();; let global_data = ref "";; let global_pkthdr = ref None;; (* pcap dispatch callback, set reference to t which contains the packet *) let dbkfun (s:string) (h:pcap_pkthdr) (t:string) = global_pkthdr := Some h; global_data := t;; (* example implementation of pcap_next, returning the next packet *) let pcap_next ol = let _ = pcap_dispatch ol 1 dbkfun "" in !global_data let pcap_next_ex ol = let ret = pcap_dispatch ol 1 dbkfun "" in (ret, !global_data, !global_pkthdr) let main () = (*while true do*) let data = pcap_next openlive in flush_all () (* do something, process the data *) (*done;;*) let () = main ();; (* print statistics *) let (_,aa) = pcap_stats openlive in Printf.printf "packets recv: %d\n" (aa.ps_recv); Printf.printf "packets drop: %d\n" (aa.ps_drop); Printf.printf "packets intf drop: %d\n" (aa.ps_ifdrop);; let () = pcap_close openlive MLpcap-0.9/tests/pcap_loop.ml0100644000175000017500000000144210056374011014023 0ustar x25x25open Pcap (* looking up suitable device *) let (a) = pcap_lookupdev ();; (* open it in promiscous mode *) let openlive = pcap_open_live a 1500 1 0;; Printf.printf "[+] opening interface %s ...\n" a ; flush_all ();; (* callback ... *) let callbkfun (s:string) (h:pcap_pkthdr) (t:string) = print_endline "[-] Entered callbkfun.\n"; Printf.printf "timestamp: %u\n" (h.ts.tv_sec); let proto = (int_of_char (String.unsafe_get t 23)) in match proto with | 6 -> Printf.printf "-> TCP\n" | 1 -> Printf.printf "-> ICMP\n" | 17 -> Printf.printf "-> UDP\n" | _ -> Printf.printf "-> Unknown\n";; let pcap_loop_test () = for i = 0 to 20 do begin let x = pcap_loop openlive 1 callbkfun "" in flush_all () end done;; let () = pcap_loop_test ();; let () = pcap_close openlive MLpcap-0.9/tests/pcap_datalink.ml0120777000175000017500000000000010053475546016140 2misc.mlustar x25x25MLpcap-0.9/tests/pcap_open_offline.ml0100644000175000017500000000103610053475546015530 0ustar x25x25open Pcap (* looking up suitable device *) let (a) = pcap_lookupdev ();; let openlive = pcap_open_offline "dump.out";; let minor = pcap_minor_version openlive;; let major = pcap_major_version openlive;; Printf.printf "Running with pcap %d.%d\n" major minor;; let (_,aa) = pcap_stats openlive in Printf.printf "packets recv: %d\n" (aa.ps_recv); Printf.printf "packets drop: %d\n" (aa.ps_drop); Printf.printf "packets intf drop: %d\n" (aa.ps_ifdrop);; (*let () = pcap_dump_close xx*) let () = pcap_close openlive MLpcap-0.9/tests/pcap_lookupnet.ml0120777000175000017500000000000010053475546016371 2misc.mlustar x25x25MLpcap-0.9/tests/pcap_stats.ml0120777000175000017500000000000010053475546020056 2pcap_dump_direct.mlustar x25x25MLpcap-0.9/tests/pcap_getnonblock.ml0120777000175000017500000000000010053475546016656 2misc.mlustar x25x25MLpcap-0.9/tests/pcap_findalldevs.ml0100644000175000017500000000032210053475546015355 0ustar x25x25open Pcap let ethdevs = pcap_findalldevs ();; Printf.printf "Available interfaces:\n";; for i = 0 to (Array.length ethdevs)-1 do let aa = Printf.printf "%s\n" ethdevs.(i).name in flush_all () done;; MLpcap-0.9/tests/pcap_lookupdev.ml0120777000175000017500000000000010053475546016361 2misc.mlustar x25x25MLpcap-0.9/tests/Makefile.in0100644000175000017500000000102510057135300013554 0ustar x25x25OCAMLC=ocamlc CAMLP4O=camlp4o OBJECTS = misc.cmo pcap_next.cmo pcap_loop.cmo \ pcap_dump_direct.cmo pcap_findalldevs.cmo \ pcap_open_offline.cmo TARGETS = misc pcap_next pcap_loop \ pcap_dump_direct pcap_findalldevs \ pcap_open_offline all: $(TARGETS) $(TARGETS): $(OBJECTS) $(OCAMLC) -g -o $@ $@.cmo -I .. pcap.cma -I @camlidllibdir@ -ccopt -L@libpcapdir@ -cclib -lpcap @ffcallarchive@ clean: rm -f *.cmo *.cmi $(TARGETS) .SUFFIXES: .ml .cmo .cmi .ml.cmo: $(OCAMLC) -pp '$(CAMLP4O) pa_macro.cmo -D@cp4flag@' -I .. -c $< MLpcap-0.9/tests/pcap_dump_flush.ml0120777000000000000000000000000010056134477021744 2pcap_dump_direct.mlustar rootrootMLpcap-0.9/tests/pcap_list_datalinks.ml0120777000000000000000000000000010056611562020227 2misc.mlustar rootrootMLpcap-0.9/BUGS0100644000175000017500000000034410053475546011052 0ustar x25x25Known bugs ---------- pcap_open_offline: used with pcap_stats returns wrong packet counts pcap_dump_direct: cant be called directly, only via callback wrapper function pcap_file: not sure if this is of any use in ocaml .. MLpcap-0.9/README0100644000175000017500000000367710057151347011255 0ustar x25x25MLpcap - 0.9 ------------ MLpcap implements ocaml stubs to libpcap. It is distributed under the Lesser GPL. Libpcap is available at www.tcpdump.org. tests/ contains code snippets showing the usage of MLpcap functions. Software requirements --------------------- libpcap 0.7-0.8.x: http://www.tcpdump.org/ CamlIDL: http://caml.inria.fr/camlidl/ Download: http://caml.inria.fr/distrib/bazar-ocaml/ FFCall: http://www.gnu.org/directory/libs/c/ffcall.html Download: ftp://ftp.santafe.edu/pub/gnu/ Building the library -------------------- Run the configure script with the appropriate paths to ffcall and camlidl (read INSTALL) and type 'make' afterwards. MLpcap vs. libpcap types ------------------------ pcap_handle <-> pcap_t* pcap_pkthdr <-> struct pcap_pkthdr pcap_stat <-> struct pcap_stat pcap_dumper <-> struct pcap_dumper* pcap_if <-> struct pcap_if bpf_program <-> struct bpf_program* Differences to the original libpcap ----------------------------------- - All functions which return values,structs etc as one of its arguments in the C version use N-tuple return values in ocaml. E.g. pcap_stats defined in C: int pcap_stats(pcap_t *p, struct pcap_stat *ps) and in OCaml: pcap_stats : pcap_handle -> int * pcap_stat - All functions containing an errbuf argument in its C version don't use errbuf as argument in MLpcap. If an error occurs the function raises an exception Failure with errbuf as argument. These functions are: pcap_open_live, pcap_open_offline, pcap_setnonblock, pcap_getnonblock, pcap_findalldevs, pcap_lookupnet - pcap_dump is called pcap_dump_direct and must be used as shown in tests/pcap_dump_direct.ml - pcap_next/pcap_next_ex has not been implemented since it's only a wrapper to pcap_dispatch and can be implemented as shown in tests/pcap_next.ml Comments and Bugreports ----------------------- Comments, Suggestions etc are welcome. Write me to: jonny@drugphish.ch MLpcap-0.9/TODO0100644000175000017500000000021210056646544011052 0ustar x25x25Todo for a next release: - improve Makefiles, examples - bugfixes - provide good decode/parsing functions for handling network data MLpcap-0.9/configure0100755000175000017500000042602510057136327012301 0ustar x25x25#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="pcap.idl" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION ARCH ocamlc ocamlopt ocamlfind INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA INSTALL CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP camlidldir camlidllibdir ffcalldir ffcallarchive libpcapdir cp4flag LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-examples build example programs default=no Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-camlidl-lib=DIR libcamlidl.a location --with-libpcap=DIR libpcap.a/.so location --with-pcap-header=DIR pcap header installation directory --with-camlidl=DIR camlidl installation directory --with-ffcall=DIR ffcall installation directory Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core core.* *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for version" >&5 echo $ECHO_N "checking for version... $ECHO_C" >&6 VERSION="`etc/shtool version -l txt -d short VERSION`" echo "$as_me:$LINENO: result: " >&5 echo "${ECHO_T}" >&6 "Configuring Version $VERSION" echo "$as_me:$LINENO: checking for platform" >&5 echo $ECHO_N "checking for platform... $ECHO_C" >&6 ARCH="`etc/shtool guessos`" echo "$as_me:$LINENO: result: " >&5 echo "${ECHO_T}" >&6 "$ARCH" { echo "$as_me:$LINENO: checking for ocaml compiler and tools..." >&5 echo "$as_me: checking for ocaml compiler and tools..." >&6;} # Extract the first word of "ocamlc", so it can be a program name with args. set dummy ocamlc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ocamlc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ocamlc"; then ac_cv_prog_ocamlc="$ocamlc" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ocamlc="ocamlc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ocamlc=$ac_cv_prog_ocamlc if test -n "$ocamlc"; then echo "$as_me:$LINENO: result: $ocamlc" >&5 echo "${ECHO_T}$ocamlc" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "ocamlopt", so it can be a program name with args. set dummy ocamlopt; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ocamlopt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ocamlopt"; then ac_cv_prog_ocamlopt="$ocamlopt" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ocamlopt="ocamlopt" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ocamlopt=$ac_cv_prog_ocamlopt if test -n "$ocamlopt"; then echo "$as_me:$LINENO: result: $ocamlopt" >&5 echo "${ECHO_T}$ocamlopt" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "ocamlfind", so it can be a program name with args. set dummy ocamlfind; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ocamlfind+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ocamlfind"; then ac_cv_prog_ocamlfind="$ocamlfind" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ocamlfind="ocamlfind" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ocamlfind" && ac_cv_prog_ocamlfind="ocamlidl" fi fi ocamlfind=$ac_cv_prog_ocamlfind if test -n "$ocamlfind"; then echo "$as_me:$LINENO: result: $ocamlfind" >&5 echo "${ECHO_T}$ocamlfind" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { echo "$as_me:$LINENO: checking for C compiler..." >&5 echo "$as_me: checking for C compiler..." >&6;} ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' \ '#include ' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for C header files..." >&5 echo "$as_me: checking for C header files..." >&6;} ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # camlidldir="" camlidllibdir="" ffcalldir="" ffcallarchive="" libpcapdir="" cp4flag="" # # Check whether --enable-examples or --disable-examples was given. if test "${enable_examples+set}" = set; then enableval="$enable_examples" else enable_examples="no" fi; # { echo "$as_me:$LINENO: checking libraries..." >&5 echo "$as_me: checking libraries..." >&6;} #AC_CHECKING(for pcap library) #if test "$ac_cv_lib_pcap" == "no"; then # #dirs="/usr/local/lib # # /usr/local/lib # # /usr/lib # # /lib" # dirs="/home/x25/code/MLpcap/libpcap-0.8.3" # for d in $dirs; do # test -f "$d/libpcap.a" && LDFLAGS="-L$d" # done # AC_CHECKING(in more locations) # unset ac_cv_lib_pcap #fi if test "x$enable_examples" = "xyes"; then # Check whether --with-camlidl-lib or --without-camlidl-lib was given. if test "${with_camlidl_lib+set}" = set; then withval="$with_camlidl_lib" camlidllibdir=$withval if ! test -f "$camlidllibdir/libcamlidl.a"; then { { echo "$as_me:$LINENO: error: can't find libcamlidl.a in $camlidllibdir" >&5 echo "$as_me: error: can't find libcamlidl.a in $camlidllibdir" >&2;} { (exit 1); exit 1; }; } fi else { { echo "$as_me:$LINENO: error: missing --with-camlidl-lib" >&5 echo "$as_me: error: missing --with-camlidl-lib" >&2;} { (exit 1); exit 1; }; } fi; { echo "$as_me:$LINENO: checking for ffcall callback library..." >&5 echo "$as_me: checking for ffcall callback library..." >&6;} dirs="/usr/local/lib /usr/lib /lib" for d in $dirs; do test -f "$d/libcallback.a" && ffcallarchive="$d/libcallback.a" done fi # Check whether --with-libpcap or --without-libpcap was given. if test "${with_libpcap+set}" = set; then withval="$with_libpcap" libpcapdir=$withval if ! test -f "$libpcapdir/libpcap.a"; then { { echo "$as_me:$LINENO: error: can't find libpcap.a in $libpcapdir" >&5 echo "$as_me: error: can't find libpcap.a in $libpcapdir" >&2;} { (exit 1); exit 1; }; } fi # check for libpcap >=0.8, set CFLAGS and camlp4 flag `which strings` "$libpcapdir/libpcap.a"|grep to_descr 2>&1 >/dev/null test $? && CFLAGS="$CFLAGS -DHAVE_PCAP08" && cp4flag="HAVE_PCAP08" else #AC_MSG_ERROR(missing --with-libpcap) # try the default libpcapdir="/usr/lib" fi; { echo "$as_me:$LINENO: checking for pcap header files..." >&5 echo "$as_me: checking for pcap header files..." >&6;} # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Check whether --with-pcap-header or --without-pcap-header was given. if test "${with_pcap_header+set}" = set; then withval="$with_pcap_header" pcapheaderdir=$withval as_ac_Header=`echo "ac_cv_header_$pcapheaderdir/pcap.h" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $pcapheaderdir/pcap.h" >&5 echo $ECHO_N "checking for $pcapheaderdir/pcap.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $pcapheaderdir/pcap.h usability" >&5 echo $ECHO_N "checking $pcapheaderdir/pcap.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$pcapheaderdir/pcap.h> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $pcapheaderdir/pcap.h presence" >&5 echo $ECHO_N "checking $pcapheaderdir/pcap.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$pcapheaderdir/pcap.h> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $pcapheaderdir/pcap.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $pcapheaderdir/pcap.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $pcapheaderdir/pcap.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $pcapheaderdir/pcap.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $pcapheaderdir/pcap.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: $pcapheaderdir/pcap.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $pcapheaderdir/pcap.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $pcapheaderdir/pcap.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $pcapheaderdir/pcap.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $pcapheaderdir/pcap.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $pcapheaderdir/pcap.h" >&5 echo $ECHO_N "checking for $pcapheaderdir/pcap.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then CFLAGS="$CFLAGS -I$pcapheaderdir"; HAVE_PCAP_HEADER="yes" fi else if test "${ac_cv_header_pcap_h+set}" = set; then echo "$as_me:$LINENO: checking for pcap.h" >&5 echo $ECHO_N "checking for pcap.h... $ECHO_C" >&6 if test "${ac_cv_header_pcap_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_pcap_h" >&5 echo "${ECHO_T}$ac_cv_header_pcap_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking pcap.h usability" >&5 echo $ECHO_N "checking pcap.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking pcap.h presence" >&5 echo $ECHO_N "checking pcap.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: pcap.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: pcap.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: pcap.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: pcap.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: pcap.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: pcap.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: pcap.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: pcap.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: pcap.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: pcap.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for pcap.h" >&5 echo $ECHO_N "checking for pcap.h... $ECHO_C" >&6 if test "${ac_cv_header_pcap_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_pcap_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_pcap_h" >&5 echo "${ECHO_T}$ac_cv_header_pcap_h" >&6 fi if test $ac_cv_header_pcap_h = yes; then HAVE_PCAP_HEADER="yes" fi fi; if test -z "$HAVE_PCAP_HEADER"; then { { echo "$as_me:$LINENO: error: can't find pcap.h" >&5 echo "$as_me: error: can't find pcap.h" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: checking for camlidl header..." >&5 echo "$as_me: checking for camlidl header..." >&6;} # Check whether --with-camlidl or --without-camlidl was given. if test "${with_camlidl+set}" = set; then withval="$with_camlidl" camlidldir=$withval as_ac_Header=`echo "ac_cv_header_$camlidldir/caml/camlidlruntime.h" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $camlidldir/caml/camlidlruntime.h" >&5 echo $ECHO_N "checking for $camlidldir/caml/camlidlruntime.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $camlidldir/caml/camlidlruntime.h usability" >&5 echo $ECHO_N "checking $camlidldir/caml/camlidlruntime.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$camlidldir/caml/camlidlruntime.h> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $camlidldir/caml/camlidlruntime.h presence" >&5 echo $ECHO_N "checking $camlidldir/caml/camlidlruntime.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$camlidldir/caml/camlidlruntime.h> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $camlidldir/caml/camlidlruntime.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $camlidldir/caml/camlidlruntime.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $camlidldir/caml/camlidlruntime.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $camlidldir/caml/camlidlruntime.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $camlidldir/caml/camlidlruntime.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: $camlidldir/caml/camlidlruntime.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $camlidldir/caml/camlidlruntime.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $camlidldir/caml/camlidlruntime.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $camlidldir/caml/camlidlruntime.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $camlidldir/caml/camlidlruntime.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $camlidldir/caml/camlidlruntime.h" >&5 echo $ECHO_N "checking for $camlidldir/caml/camlidlruntime.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then CFLAGS="$CFLAGS -I$camlidldir"; HAVE_CAMLIDLRUNTIME_H="yes" fi else if test "${ac_cv_header_caml_camlidlruntime_h+set}" = set; then echo "$as_me:$LINENO: checking for caml/camlidlruntime.h" >&5 echo $ECHO_N "checking for caml/camlidlruntime.h... $ECHO_C" >&6 if test "${ac_cv_header_caml_camlidlruntime_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_caml_camlidlruntime_h" >&5 echo "${ECHO_T}$ac_cv_header_caml_camlidlruntime_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking caml/camlidlruntime.h usability" >&5 echo $ECHO_N "checking caml/camlidlruntime.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking caml/camlidlruntime.h presence" >&5 echo $ECHO_N "checking caml/camlidlruntime.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: caml/camlidlruntime.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: caml/camlidlruntime.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: caml/camlidlruntime.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: caml/camlidlruntime.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: caml/camlidlruntime.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: caml/camlidlruntime.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: caml/camlidlruntime.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: caml/camlidlruntime.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: caml/camlidlruntime.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: caml/camlidlruntime.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for caml/camlidlruntime.h" >&5 echo $ECHO_N "checking for caml/camlidlruntime.h... $ECHO_C" >&6 if test "${ac_cv_header_caml_camlidlruntime_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_caml_camlidlruntime_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_caml_camlidlruntime_h" >&5 echo "${ECHO_T}$ac_cv_header_caml_camlidlruntime_h" >&6 fi if test $ac_cv_header_caml_camlidlruntime_h = yes; then HAVE_CAMLIDLRUNTIME_H="yes" fi fi; if test -z "$HAVE_CAMLIDLRUNTIME_H"; then { { echo "$as_me:$LINENO: error: can't find camlidlruntime.h" >&5 echo "$as_me: error: can't find camlidlruntime.h" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: checking for ffcall callback header..." >&5 echo "$as_me: checking for ffcall callback header..." >&6;} # Check whether --with-ffcall or --without-ffcall was given. if test "${with_ffcall+set}" = set; then withval="$with_ffcall" ffcalldir=$withval as_ac_Header=`echo "ac_cv_header_$ffcalldir/callback.h" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ffcalldir/callback.h" >&5 echo $ECHO_N "checking for $ffcalldir/callback.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ffcalldir/callback.h usability" >&5 echo $ECHO_N "checking $ffcalldir/callback.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ffcalldir/callback.h> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ffcalldir/callback.h presence" >&5 echo $ECHO_N "checking $ffcalldir/callback.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ffcalldir/callback.h> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $ffcalldir/callback.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ffcalldir/callback.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ffcalldir/callback.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ffcalldir/callback.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ffcalldir/callback.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ffcalldir/callback.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ffcalldir/callback.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ffcalldir/callback.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ffcalldir/callback.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ffcalldir/callback.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ffcalldir/callback.h" >&5 echo $ECHO_N "checking for $ffcalldir/callback.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then CFLAGS="$CFLAGS -I$ffcalldir"; HAVE_CALLBACK_H="yes" fi else if test "${ac_cv_header_callback_h+set}" = set; then echo "$as_me:$LINENO: checking for callback.h" >&5 echo $ECHO_N "checking for callback.h... $ECHO_C" >&6 if test "${ac_cv_header_callback_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_callback_h" >&5 echo "${ECHO_T}$ac_cv_header_callback_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking callback.h usability" >&5 echo $ECHO_N "checking callback.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking callback.h presence" >&5 echo $ECHO_N "checking callback.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: callback.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: callback.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: callback.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: callback.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: callback.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: callback.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: callback.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: callback.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: callback.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: callback.h: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for callback.h" >&5 echo $ECHO_N "checking for callback.h... $ECHO_C" >&6 if test "${ac_cv_header_callback_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_callback_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_callback_h" >&5 echo "${ECHO_T}$ac_cv_header_callback_h" >&6 fi if test $ac_cv_header_callback_h = yes; then HAVE_CALLBACK_H="yes" fi fi; if test -z "$HAVE_CALLBACK_H"; then { { echo "$as_me:$LINENO: error: can't find callback.h" >&5 echo "$as_me: error: can't find callback.h" >&2;} { (exit 1); exit 1; }; } fi if test "x$enable_examples" = "xyes"; then output="Makefile tests/Makefile" else output="Makefile" fi ac_config_files="$ac_config_files $output" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then we branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. cat >confdef2opt.sed <<\_ACEOF t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g p _ACEOF # We use echo to avoid assuming a particular line-breaking character. # The extra dot is to prevent the shell from consuming trailing # line-breaks from the sub-command output. A line-break within # single-quotes doesn't work because, if this script is created in a # platform that uses two characters for line-breaks (e.g., DOS), tr # would break. ac_LF_and_DOT=`echo; echo .` DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` rm -f confdef2opt.sed ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "$output" ) CONFIG_FILES="$CONFIG_FILES $output" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@VERSION@,$VERSION,;t t s,@ARCH@,$ARCH,;t t s,@ocamlc@,$ocamlc,;t t s,@ocamlopt@,$ocamlopt,;t t s,@ocamlfind@,$ocamlfind,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@INSTALL@,$INSTALL,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@camlidldir@,$camlidldir,;t t s,@camlidllibdir@,$camlidllibdir,;t t s,@ffcalldir@,$ffcalldir,;t t s,@ffcallarchive@,$ffcallarchive,;t t s,@libpcapdir@,$libpcapdir,;t t s,@cp4flag@,$cp4flag,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi MLpcap-0.9/utils.h0100644000175000017500000000105610053475546011701 0ustar x25x25typedef pcap_t *pcap_handle; typedef struct pcap_pkthdr pcap_pkthdr; typedef struct pcap_stat pcap_stat; typedef struct bpf_program *bpf_program; typedef struct pcap_dumper *pcap_dumper; typedef struct pcap_if pcap_if; typedef FILE *file_t; typedef void (*pcap_callback)(u_char *, const struct pcap_pkthdr *, const u_char *); void pcap_dump_direct(pcap_dumper,pcap_pkthdr *, unsigned char *); void _pcap_callback (void *, va_alist); value build_pcap_if_array (pcap_if *); value camlidl_pcap_pcap_findalldevs(value); MLpcap-0.9/utils.c0100644000175000017500000001064710056642373011677 0ustar x25x25/* MLpcap: pcap bindings for OCaml. * Copyright (C) 2003-2004 Jonathan Heusser * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include #include #include #include #ifdef Custom_tag #include #include #endif #include #include #include #include "utils.h" void _pcap_callback (void *cback, va_alist alist) { struct pcap_pkthdr *pkthdr; // data, packet char *p1, *p2; value hdr, tval; va_start_void (alist); p1 = va_arg_ptr (alist, char *); pkthdr = va_arg_ptr (alist, struct pcap_pkthdr *); // ts.tv_sec, ts.tv_usec from pcap_pkthdr tval = alloc_small (2, 0); Field (tval, 0) = Val_int (pkthdr->ts.tv_sec); Field (tval, 1) = Val_int (pkthdr->ts.tv_usec); // caplen, len from pcap_pkthdr hdr = alloc_small (3, 0); Field (hdr, 0) = tval; Field (hdr, 1) = Val_int (pkthdr->caplen); Field (hdr, 2) = Val_int (pkthdr->len); // packet pointer p2 = va_arg_ptr (alist, char *); callback3 (*(value *) cback, Val_bp (p1), hdr, Val_bp (p2)); va_return_void (alist); } /* used for pcap_findalldevs() */ value build_pcap_if_array (pcap_if * _c2) { int cnt = 0; value _v1; value _v3[3]; value _vres; pcap_if *dummy; _v3[0] = _v3[1] = _v3[2] = 0; /* count the entries in the linked list for latter camlidl_alloc() */ dummy = _c2; while ((*dummy).next) { dummy = (*dummy).next; cnt++; } _vres = camlidl_alloc (cnt, 0); cnt = 0; Begin_roots_block (_v3, 3); while ((*_c2).next) { _v3[0] = copy_string ((*_c2).name); if ((*_c2).description == NULL || (*_c2).description == "") { _v3[1] = copy_string("No description"); } else _v3[1] = copy_string((*_c2).description); _v3[2] = Val_int((*_c2).flags); _v1 = camlidl_alloc_small(3, 0); Field(_v1, 0) = _v3[0]; Field(_v1, 1) = _v3[1]; Field(_v1, 2) = _v3[2]; Field(_vres, cnt) = _v1; cnt++; _c2 = (*_c2).next; } End_roots(); return _vres; } #ifdef HAVE_PCAP08 /* used for pcap_list_datalinks() */ value build_pcap_int_array(int *_c2, int length) { int i; value _v1; value _vret; value _vres; _vret = 0; /* allocate array with length */ _vres = camlidl_alloc(length, 0); Begin_roots1(_vret); for(i=0; i < length; i++) { /* actual field value */ _vret = Val_int(_c2[i]); Field(_vres, i) = _vret; } End_roots(); return _vres; } #endif value camlidl_pcap_pcap_findalldevs(value _unit) { pcap_if **alldevsp; int _res; pcap_if *_c1; value _vres; alldevsp = &_c1; { char errbuf[256]; _res = pcap_findalldevs(alldevsp, errbuf); if(_res == -1) failwith(errbuf); } _vres = build_pcap_if_array(&**alldevsp); return _vres; } #ifdef HAVE_PCAP08 value camlidl_pcap_pcap_list_datalinks(value _v_p) { int *dlt_buf,ret; pcap_handle p; value _v1; value _vresult; value _vres[2] = { 0, 0, }; /* initialize pcap_handle p */ struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL }; camlidl_ctx _ctx = &_ctxs; camlidl_ml2c_pcap_pcap_handle(_v_p, &p, _ctx); /* call the actual function and build the int array */ ret = pcap_list_datalinks(p, &dlt_buf); _v1 = build_pcap_int_array(dlt_buf, ret); /* build the return values: int * int array */ Begin_roots_block(_vres, 2) _vres[0] = Val_int(ret); _vres[1] = _v1; _vresult = camlidl_alloc_small(2, 0); Field(_vresult, 0) = _vres[0]; Field(_vresult, 1) = _vres[1]; End_roots() return _vresult; } #endif MLpcap-0.9/OCamlMakefile0100644000175000017500000005652410053475546012756 0ustar x25x25########################################################################### # OCamlMakefile # Copyright (C) 1999-2003 Markus Mottl # # For updates see: # http://www.oefai.at/~markus/ocaml_sources # # $Id: OCamlMakefile 1.1 Tue, 27 Jan 2004 11:46:36 -0800 shawnw $ # ########################################################################### # Set these variables to the names of the sources to be processed and # the result variable. Order matters during linkage! ifndef SOURCES SOURCES := foo.ml endif export SOURCES ifndef RES_CLIB_SUF RES_CLIB_SUF := _stubs endif export RES_CLIB_SUF ifndef RESULT RESULT := foo endif export RESULT ifndef DOC_FILES DOC_FILES := $(filter %.mli, $(SOURCES)) endif export DOC_FILES export BCSUFFIX export NCSUFFIX ifndef TOPSUFFIX TOPSUFFIX := .top endif export TOPSUFFIX # Eventually set include- and library-paths, libraries to link, # additional compilation-, link- and ocamlyacc-flags # Path- and library information needs not be written with "-I" and such... # Define THREADS if you need it, otherwise leave it unset (same for # USE_CAMLP4)! export THREADS export USE_CAMLP4 export INCDIRS export LIBDIRS export EXTLIBDIRS export RESULTDEPS export OCAML_DEFAULT_DIRS export LIBS export CLIBS export OCAMLFLAGS export OCAMLNCFLAGS export OCAMLBCFLAGS export OCAMLLDFLAGS export OCAMLNLDFLAGS export OCAMLBLDFLAGS ifndef OCAMLCPFLAGS OCAMLCPFLAGS := a endif export OCAMLCPFLAGS export YFLAGS export IDLFLAGS export OCAMLDOCFLAGS export DVIPSFLAGS export STATIC # Add a list of optional trash files that should be deleted by "make clean" export TRASH #################### variables depending on your OCaml-installation ifdef MINGW export MINGW WIN32 := 1 endif ifdef MSVC export MSVC WIN32 := 1 EXT_OBJ := obj EXT_LIB := lib ifeq ($(CC),gcc) # work around GNU Make default value ifdef THREADS CC := cl /MT else CC := cl endif endif ifeq ($(CXX),g++) # work around GNU Make default value CXX := $(CC) endif CFLAG_O := -Fo endif ifdef WIN32 EXT_CXX := cpp EXE := .exe endif ifndef EXT_OBJ EXT_OBJ := o endif ifndef EXT_LIB EXT_LIB := a endif ifndef EXT_CXX EXT_CXX := cc endif ifndef EXE EXE := # empty endif ifndef CFLAG_O CFLAG_O := -o # do not delete this comment (preserves trailing whitespace)! endif export CC export CXX export CFLAGS export CXXFLAGS export LDFLAGS BCRESULT := $(addsuffix $(BCSUFFIX), $(RESULT)) NCRESULT := $(addsuffix $(NCSUFFIX), $(RESULT)) TOPRESULT := $(addsuffix $(TOPSUFFIX), $(RESULT)) ifndef OCAMLFIND OCAMLFIND := ocamlfind endif export OCAMLFIND ifndef OCAMLC OCAMLC := ocamlc endif export OCAMLC ifndef OCAMLOPT OCAMLOPT := ocamlopt endif export OCAMLOPT ifndef OCAMLMKTOP OCAMLMKTOP := ocamlmktop endif export OCAMLMKTOP ifndef OCAMLCP OCAMLCP := ocamlcp endif export OCAMLCP ifndef OCAMLDEP OCAMLDEP := ocamldep endif export OCAMLDEP ifndef OCAMLLEX OCAMLLEX := ocamllex endif export OCAMLLEX ifndef OCAMLYACC OCAMLYACC := ocamlyacc endif export OCAMLYACC ifndef CAMELEON_REPORT CAMELEON_REPORT := report endif ifndef CAMELEON_REPORT_FLAGS CAMELEON_REPORT_FLAGS := endif ifndef CAMELEON_ZOGGY CAMELEON_ZOGGY := camlp4o pa_zog.cma pr_o.cmo endif ifndef CAMELEON_ZOGGY_FLAGS CAMELEON_ZOGGY_FLAGS := endif ifndef CAMLIDL CAMLIDL := camlidl endif export CAMLIDL ifndef CAMLIDLDLL CAMLIDLDLL := camlidldll endif export CAMLIDLDLL ifndef NOIDLHEADER MAYBE_IDL_HEADER := -header endif export NOIDLHEADER ifndef CAMLP4 CAMLP4 := camlp4 endif export CAMLP4 ifdef PACKS empty := space := $(empty) $(empty) comma := , OCAML_FIND_PACKAGES := -package $(subst $(space),$(comma),$(PACKS)) OCAML_FIND_LINKPKG := -linkpkg REAL_OCAMLFIND := $(OCAMLFIND) endif export OCAML_FIND_PACKAGES export OCAML_FIND_LINKPKG export REAL_OCAMLFIND ifndef OCAMLDOC OCAMLDOC := ocamldoc endif export OCAMLDOC ifndef LATEX LATEX := latex endif export LATEX ifndef DVIPS DVIPS := dvips endif export DVIPS ifndef PS2PDF PS2PDF := ps2pdf endif export PS2PDF ifndef OCAMLMAKEFILE OCAMLMAKEFILE := OCamlMakefile endif export OCAMLMAKEFILE ifndef OCAMLLIBPATH OCAMLLIBPATH := \ $(shell $(OCAMLC) 2>/dev/null -where || echo /usr/local/lib/ocaml) endif export OCAMLLIBPATH ifndef OCAML_LIB_INSTALL OCAML_LIB_INSTALL := $(OCAMLLIBPATH)/contrib endif export OCAML_LIB_INSTALL ########################################################################### #################### change following sections only if #################### you know what you are doing! # delete target files when a build command fails .PHONY: .DELETE_ON_ERROR .DELETE_ON_ERROR: # for pedants using "--warn-undefined-variables" export MAYBE_IDL export REAL_RESULT export CAMLIDLFLAGS export THREAD_FLAG export RES_CLIB export MAKEDLL SHELL := /bin/sh MLDEPDIR := ._d BCDIDIR := ._bcdi NCDIDIR := ._ncdi FILTER_EXTNS := %.mli %.ml %.mll %.mly %.idl %.c %.$(EXT_CXX) %.rep %.zog FILTERED := $(filter $(FILTER_EXTNS), $(SOURCES)) SOURCE_DIRS := $(filter-out ./, $(sort $(dir $(FILTERED)))) FILTERED_REP := $(filter %.rep, $(FILTERED)) DEP_REP := $(FILTERED_REP:%.rep=$(MLDEPDIR)/%.d) AUTO_REP := $(FILTERED_REP:.rep=.ml) FILTERED_ZOG := $(filter %.zog, $(FILTERED)) DEP_ZOG := $(FILTERED_ZOG:%.zog=$(MLDEPDIR)/%.d) AUTO_ZOG := $(FILTERED_ZOG:.zog=.ml) FILTERED_ML := $(filter %.ml, $(FILTERED)) DEP_ML := $(FILTERED_ML:%.ml=$(MLDEPDIR)/%.d) FILTERED_MLI := $(filter %.mli, $(FILTERED)) DEP_MLI := $(FILTERED_MLI:.mli=.di) FILTERED_MLL := $(filter %.mll, $(FILTERED)) DEP_MLL := $(FILTERED_MLL:%.mll=$(MLDEPDIR)/%.d) AUTO_MLL := $(FILTERED_MLL:.mll=.ml) FILTERED_MLY := $(filter %.mly, $(FILTERED)) DEP_MLY := $(FILTERED_MLY:%.mly=$(MLDEPDIR)/%.d) $(FILTERED_MLY:.mly=.di) AUTO_MLY := $(FILTERED_MLY:.mly=.mli) $(FILTERED_MLY:.mly=.ml) FILTERED_IDL := $(filter %.idl, $(FILTERED)) DEP_IDL := $(FILTERED_IDL:%.idl=$(MLDEPDIR)/%.d) $(FILTERED_IDL:.idl=.di) C_IDL := $(FILTERED_IDL:%.idl=%_stubs.c) $(FILTERED_IDL:.idl=.h) OBJ_C_IDL := $(FILTERED_IDL:%.idl=%_stubs.$(EXT_OBJ)) AUTO_IDL := $(FILTERED_IDL:.idl=.mli) $(FILTERED_IDL:.idl=.ml) $(C_IDL) FILTERED_C_CXX := $(filter %.c %.$(EXT_CXX), $(FILTERED)) OBJ_C_CXX := $(FILTERED_C_CXX:.c=.$(EXT_OBJ)) OBJ_C_CXX := $(OBJ_C_CXX:.$(EXT_CXX)=.$(EXT_OBJ)) PRE_TARGETS += $(AUTO_MLL) $(AUTO_MLY) $(AUTO_IDL) $(AUTO_ZOG) $(AUTO_REP) ALL_DEPS := $(DEP_ML) $(DEP_MLI) $(DEP_MLL) $(DEP_MLY) $(DEP_IDL) $(DEP_ZOG) $(DEP_REP) MLDEPS := $(filter %.d, $(ALL_DEPS)) MLIDEPS := $(filter %.di, $(ALL_DEPS)) BCDEPIS := $(MLIDEPS:%.di=$(BCDIDIR)/%.di) NCDEPIS := $(MLIDEPS:%.di=$(NCDIDIR)/%.di) ALLML := $(filter %.mli %.ml %.mll %.mly %.idl %.rep %.zog, $(FILTERED)) IMPLO_INTF := $(ALLML:%.mli=%.mli.__) IMPLO_INTF := $(foreach file, $(IMPLO_INTF), \ $(basename $(file)).cmi $(basename $(file)).cmo) IMPLO_INTF := $(filter-out %.mli.cmo, $(IMPLO_INTF)) IMPLO_INTF := $(IMPLO_INTF:%.mli.cmi=%.cmi) IMPLX_INTF := $(IMPLO_INTF:.cmo=.cmx) INTF := $(filter %.cmi, $(IMPLO_INTF)) IMPL_CMO := $(filter %.cmo, $(IMPLO_INTF)) IMPL_CMX := $(IMPL_CMO:.cmo=.cmx) OBJ_LINK := $(OBJ_C_IDL) $(OBJ_C_CXX) OBJ_FILES := $(IMPL_CMO:.cmo=.$(EXT_OBJ)) $(OBJ_LINK) EXECS := $(addsuffix $(EXE), \ $(sort $(TOPRESULT) $(BCRESULT) $(NCRESULT))) ifdef WIN32 EXECS += $(BCRESULT).dll $(NCRESULT).dll endif CLIB_BASE := $(RESULT)$(RES_CLIB_SUF) ifneq ($(strip $(OBJ_LINK)),) RES_CLIB := lib$(CLIB_BASE).$(EXT_LIB) endif ifndef MSVC DLLSONAME := dll$(CLIB_BASE).so endif NONEXECS := $(INTF) $(IMPL_CMO) $(IMPL_CMX) $(OBJ_FILES) $(PRE_TARGETS) \ $(BCRESULT).cma $(NCRESULT).cmxa $(NCRESULT).$(EXT_LIB) \ $(BCRESULT).cmi $(BCRESULT).cmo \ $(NCRESULT).cmi $(NCRESULT).cmx $(NCRESULT).o \ $(RES_CLIB) ifndef MSVC ifndef STATIC NONEXECS += $(DLLSONAME) endif endif ifndef LIBINSTALL_FILES LIBINSTALL_FILES := $(RESULT).mli $(RESULT).cmi $(RESULT).cma \ $(RESULT).cmxa $(RESULT).$(EXT_LIB) $(RES_CLIB) ifndef MSVC ifndef STATIC ifneq ($(strip $(OBJ_LINK)),) LIBINSTALL_FILES += $(DLLSONAME) endif endif endif endif export LIBINSTALL_FILES ifdef WIN32 # some extra stuff is created while linking DLLs NONEXECS += $(BCRESULT).$(EXT_LIB) $(BCRESULT).exp $(NCRESULT).exp endif TARGETS := $(EXECS) $(NONEXECS) # handle ocamlfind ifdef REAL_OCAMLFIND PACKOPT := -pack else PACKOPT := -passopt "-pack" endif # If there are IDL-files ifneq ($(strip $(FILTERED_IDL)),) MAYBE_IDL := -cclib -lcamlidl endif ifdef USE_CAMLP4 CAMLP4PATH := \ $(shell $(CAMLP4) -where 2>/dev/null || echo /usr/local/lib/camlp4) INCFLAGS := -I $(CAMLP4PATH) CINCFLAGS := -I$(CAMLP4PATH) endif INCFLAGS += $(SOURCE_DIRS:%=-I %) $(INCDIRS:%=-I %) $(OCAML_DEFAULT_DIRS:%=-I %) CINCFLAGS += $(SOURCE_DIRS:%=-I%) $(INCDIRS:%=-I%) $(OCAML_DEFAULT_DIRS:%=-I%) CLIBFLAGS += $(SOURCE_DIRS:%=-L%) $(LIBDIRS:%=-L%) \ $(EXTLIBDIRS:%=-L%) $(EXTLIBDIRS:%=-R%) \ $(OCAML_DEFAULT_DIRS:%=-L%) $(LDFLAGS) ifndef PROFILING INTF_OCAMLC := $(OCAMLC) else ifndef THREADS INTF_OCAMLC := $(OCAMLCP) -p $(OCAMLCPFLAGS) else # OCaml does not support profiling byte code # with threads (yet), therefore we force an error. ifndef REAL_OCAMLC $(error Profiling of multithreaded byte code not yet supported by OCaml) endif endif endif ifndef MSVC COMMON_LDFLAGS := $(LDFLAGS:%=-ccopt %) $(SOURCE_DIRS:%=-ccopt -L%) \ $(LIBDIRS:%=-ccopt -L%) \ $(EXTLIBDIRS:%=-ccopt -L%) $(EXTLIBDIRS:%=-ccopt -R%) \ $(OCAML_DEFAULT_DIRS:%=-ccopt -L%) else # currenly MSVC-build ocamlc/ocamlopt cannot pass any option to C linker :-( COMMON_LDFLAGS := endif ifndef MSVC CLIBS_OPTS := $(CLIBS:%=-cclib -l%) else # MSVC libraries do not have 'lib' prefix CLIBS_OPTS := $(CLIBS:%=-ccopt %) endif ifneq ($(strip $(OBJ_LINK)),) ifdef CREATE_LIB OBJS_LIBS := -cclib -l$(CLIB_BASE) $(CLIBS_OPTS) $(MAYBE_IDL) else OBJS_LIBS := $(OBJ_LINK) $(CLIBS_OPTS) $(MAYBE_IDL) endif else OBJS_LIBS := $(CLIBS_OPTS) $(MAYBE_IDL) endif # If we have to make byte-code ifndef REAL_OCAMLC # EXTRADEPS is added dependencies we have to insert for all # executable files we generate. Ideally it should be all of the # libraries we use, but it's hard to find the ones that get searched on # the path since I don't know the paths built into the compiler, so # just include the ones with slashes in their names. EXTRADEPS := $(addsuffix .cma,$(foreach i,$(LIBS),$(if $(findstring /,$(i)),$(i)))) SPECIAL_OCAMLFLAGS := $(OCAMLBCFLAGS) REAL_OCAMLC := $(INTF_OCAMLC) REAL_IMPL := $(IMPL_CMO) REAL_IMPL_INTF := $(IMPLO_INTF) IMPL_SUF := .cmo DEPFLAGS := MAKE_DEPS := $(MLDEPS) $(BCDEPIS) ifdef CREATE_LIB ifndef STATIC ifneq ($(strip $(OBJ_LINK)),) MAKEDLL := $(DLLSONAME) ALL_LDFLAGS := -dllib $(DLLSONAME) endif endif endif ifndef NO_CUSTOM ifneq "$(strip $(OBJ_LINK) $(THREADS) $(MAYBE_IDL) $(CLIBS))" "" ALL_LDFLAGS += -custom endif endif ALL_LDFLAGS += $(INCFLAGS) $(OCAMLLDFLAGS) $(OCAMLBLDFLAGS) \ $(COMMON_LDFLAGS) $(LIBS:%=%.cma) CAMLIDLDLLFLAGS := ifdef THREADS ALL_LDFLAGS := -thread $(ALL_LDFLAGS) ifndef CREATE_LIB ALL_LDFLAGS := unix.cma threads.cma $(ALL_LDFLAGS) endif THREAD_FLAG := -thread endif # we have to make native-code else EXTRADEPS := $(addsuffix .cmxa,$(foreach i,$(LIBS),$(if $(findstring /,$(i)),$(i)))) ifndef PROFILING SPECIAL_OCAMLFLAGS := $(OCAMLNCFLAGS) PLDFLAGS := else SPECIAL_OCAMLFLAGS := -p $(OCAMLNCFLAGS) PLDFLAGS := -p endif REAL_IMPL := $(IMPL_CMX) REAL_IMPL_INTF := $(IMPLX_INTF) IMPL_SUF := .cmx CFLAGS := -DNATIVE_CODE $(CFLAGS) DEPFLAGS := -native MAKE_DEPS := $(MLDEPS) $(NCDEPIS) ALL_LDFLAGS := $(PLDFLAGS) $(INCFLAGS) $(OCAMLLDFLAGS) \ $(OCAMLNLDFLAGS) $(COMMON_LDFLAGS) CAMLIDLDLLFLAGS := -opt ifndef CREATE_LIB ALL_LDFLAGS += $(LIBS:%=%.cmxa) endif ifdef THREADS ALL_LDFLAGS := -thread $(ALL_LDFLAGS) ifndef CREATE_LIB ALL_LDFLAGS := unix.cmxa threads.cmxa $(ALL_LDFLAGS) endif THREAD_FLAG := -thread endif endif export MAKE_DEPS ALL_OCAMLCFLAGS := $(THREAD_FLAG) $(OCAMLFLAGS) \ $(INCFLAGS) $(SPECIAL_OCAMLFLAGS) ifdef make_deps -include $(MAKE_DEPS) PRE_TARGETS := endif ########################################################################### # USER RULES # Call "OCamlMakefile QUIET=" to get rid of all of the @'s. QUIET=@ # generates byte-code (default) byte-code: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(BCRESULT) \ REAL_RESULT="$(BCRESULT)" make_deps=yes bc: byte-code byte-code-nolink: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) nolink \ REAL_RESULT="$(BCRESULT)" make_deps=yes bcnl: byte-code-nolink top: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(TOPRESULT) \ REAL_RESULT="$(BCRESULT)" make_deps=yes # generates native-code native-code: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(NCRESULT) \ REAL_RESULT="$(NCRESULT)" \ REAL_OCAMLC="$(OCAMLOPT)" \ make_deps=yes nc: native-code native-code-nolink: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) nolink \ REAL_RESULT="$(NCRESULT)" \ REAL_OCAMLC="$(OCAMLOPT)" \ make_deps=yes ncnl: native-code-nolink # generates byte-code libraries byte-code-library: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ $(RES_CLIB) $(BCRESULT).cma \ REAL_RESULT="$(BCRESULT)" \ CREATE_LIB=yes \ make_deps=yes bcl: byte-code-library # generates native-code libraries native-code-library: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ $(RES_CLIB) $(NCRESULT).cmxa \ REAL_RESULT="$(NCRESULT)" \ REAL_OCAMLC="$(OCAMLOPT)" \ CREATE_LIB=yes \ make_deps=yes ncl: native-code-library ifdef WIN32 # generates byte-code dll byte-code-dll: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ $(RES_CLIB) $(BCRESULT).dll \ REAL_RESULT="$(BCRESULT)" \ make_deps=yes bcd: byte-code-dll # generates native-code dll native-code-dll: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ $(RES_CLIB) $(NCRESULT).dll \ REAL_RESULT="$(NCRESULT)" \ REAL_OCAMLC="$(OCAMLOPT)" \ make_deps=yes ncd: native-code-dll endif # generates byte-code with debugging information debug-code: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(BCRESULT) \ REAL_RESULT="$(BCRESULT)" make_deps=yes \ OCAMLFLAGS="-g $(OCAMLFLAGS)" \ OCAMLLDFLAGS="-g $(OCAMLLDFLAGS)" dc: debug-code # generates byte-code libraries with debugging information debug-code-library: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ $(RES_CLIB) $(BCRESULT).cma \ REAL_RESULT="$(BCRESULT)" make_deps=yes \ CREATE_LIB=yes \ OCAMLFLAGS="-g $(OCAMLFLAGS)" \ OCAMLLDFLAGS="-g $(OCAMLLDFLAGS)" dcl: debug-code-library # generates byte-code for profiling profiling-byte-code: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(BCRESULT) \ REAL_RESULT="$(BCRESULT)" PROFILING="y" \ make_deps=yes pbc: profiling-byte-code # generates native-code profiling-native-code: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(NCRESULT) \ REAL_RESULT="$(NCRESULT)" \ REAL_OCAMLC="$(OCAMLOPT)" \ PROFILING="y" \ make_deps=yes pnc: profiling-native-code # generates byte-code libraries profiling-byte-code-library: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ $(RES_CLIB) $(BCRESULT).cma \ REAL_RESULT="$(BCRESULT)" PROFILING="y" \ CREATE_LIB=yes \ make_deps=yes pbcl: profiling-byte-code-library # generates native-code libraries profiling-native-code-library: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ $(RES_CLIB) $(NCRESULT).cmxa \ REAL_RESULT="$(NCRESULT)" PROFILING="y" \ REAL_OCAMLC="$(OCAMLOPT)" \ CREATE_LIB=yes \ make_deps=yes pncl: profiling-native-code-library # packs byte-code objects pack-byte-code: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(BCRESULT).cmo \ REAL_RESULT="$(BCRESULT)" \ PACK_LIB=yes make_deps=yes pabc: pack-byte-code # packs native-code objects pack-native-code: $(PRE_TARGETS) $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ $(NCRESULT).cmx $(NCRESULT).o \ REAL_RESULT="$(NCRESULT)" \ REAL_OCAMLC="$(OCAMLOPT)" \ PACK_LIB=yes make_deps=yes panc: pack-native-code # generates HTML-documentation htdoc: doc/html # generates Latex-documentation ladoc: doc/latex # generates PostScript-documentation psdoc: doc/latex/doc.ps # generates PDF-documentation pdfdoc: doc/latex/doc.pdf # generates all supported forms of documentation doc: htdoc ladoc psdoc pdfdoc ########################################################################### # LOW LEVEL RULES $(REAL_RESULT): $(REAL_IMPL_INTF) $(OBJ_LINK) $(EXTRADEPS) $(RESULTDEPS) $(REAL_OCAMLFIND) $(REAL_OCAMLC) \ $(OCAML_FIND_PACKAGES) $(OCAML_FIND_LINKPKG) \ $(ALL_LDFLAGS) $(OBJS_LIBS) -o $@$(EXE) \ $(REAL_IMPL) ifdef MSVC # work around the bug in ocamlc -- it should delete this file itself rm -f camlprim?.$(EXT_OBJ) endif nolink: $(REAL_IMPL_INTF) $(OBJ_LINK) ifdef WIN32 $(REAL_RESULT).dll: $(REAL_IMPL_INTF) $(OBJ_LINK) $(CAMLIDLDLL) $(CAMLIDLDLLFLAGS) $(OBJ_LINK) $(CLIBS) \ -o $@ $(REAL_IMPL) endif %$(TOPSUFFIX): $(REAL_IMPL_INTF) $(OBJ_LINK) $(EXTRADEPS) $(REAL_OCAMLFIND) $(OCAMLMKTOP) \ $(OCAML_FIND_PACKAGES) $(OCAML_FIND_LINKPKG) \ $(ALL_LDFLAGS) $(OBJ_LIBS) -o $@$(EXE) \ $(REAL_IMPL) ifdef MSVC # work around the bug in ocamltop -- it should delete this file itself rm -f camlprim?.$(EXT_OBJ) endif .SUFFIXES: .mli .ml .cmi .cmo .cmx .cma .cmxa .$(EXT_OBJ) \ .mly .di .d .$(EXT_LIB) .idl .c .$(EXT_CXX) .h .so \ .rep .zog ifndef MSVC $(DLLSONAME): $(OBJ_LINK) $(CC) -shared $(CINCFLAGS) $(CLIBFLAGS) \ -o $@ $(OBJ_LINK) $(CLIBS:%=-l%) endif $(RESULT).cma: $(REAL_IMPL_INTF) $(MAKEDLL) $(EXTRADEPS) $(RESULTDEPS) $(REAL_OCAMLFIND) $(REAL_OCAMLC) -a $(ALL_LDFLAGS) \ $(OBJS_LIBS) -o $@ $(OCAMLBLDFLAGS) $(REAL_IMPL) $(RESULT).cmxa $(RESULT).$(EXT_LIB): $(REAL_IMPL_INTF) $(EXTRADEPS) $(RESULTDEPS) $(REAL_OCAMLFIND) $(OCAMLOPT) -a $(ALL_LDFLAGS) $(OBJS_LIBS) \ $(OCAMLNLDFLAGS) -o $@ $(REAL_IMPL) $(RES_CLIB): $(OBJ_LINK) ifndef MSVC ifneq ($(strip $(OBJ_LINK)),) ar rc $@ $(OBJ_LINK) ranlib $@ endif else ifneq ($(strip $(OBJ_LINK)),) lib /nologo /debugtype:cv /out:$(RES_CLIB) $(OBJ_LINK) endif endif .mli.cmi: $(EXTRADEPS) $(QUIET)pp=`sed -n -e '/^#/d' -e 's/(\*pp \([^*]*\) \*)/\1/p;q' $<`; \ if [ -z "$$pp" ]; then \ echo $(REAL_OCAMLFIND) $(INTF_OCAMLC) $(OCAML_FIND_PACKAGES) \ -c $(THREAD_FLAG) $(OCAMLFLAGS) $(INCFLAGS) $<; \ $(REAL_OCAMLFIND) $(INTF_OCAMLC) $(OCAML_FIND_PACKAGES) \ -c $(THREAD_FLAG) $(OCAMLFLAGS) $(INCFLAGS) $<; \ else \ echo $(REAL_OCAMLFIND) $(INTF_OCAMLC) $(OCAML_FIND_PACKAGES) \ -c -pp \"$$pp\" $(THREAD_FLAG) \ $(OCAMLFLAGS) $(INCFLAGS) $<; \ $(REAL_OCAMLFIND) $(INTF_OCAMLC) $(OCAML_FIND_PACKAGES) \ -c -pp "$$pp" $(THREAD_FLAG) \ $(OCAMLFLAGS) $(INCFLAGS) $<; \ fi .ml.cmi .ml.$(EXT_OBJ) .ml.cmx .ml.cmo: $(EXTRADEPS) $(QUIET)pp=`sed -n -e '/^#/d' -e 's/(\*pp \([^*]*\) \*)/\1/p;q' $<`; \ if [ -z "$$pp" ]; then \ echo $(REAL_OCAMLFIND) $(REAL_OCAMLC) $(OCAML_FIND_PACKAGES) \ -c $(ALL_OCAMLCFLAGS) $<; \ $(REAL_OCAMLFIND) $(REAL_OCAMLC) $(OCAML_FIND_PACKAGES) \ -c $(ALL_OCAMLCFLAGS) $<; \ else \ echo $(REAL_OCAMLFIND) $(REAL_OCAMLC) $(OCAML_FIND_PACKAGES) \ -c -pp \"$$pp\" $(ALL_OCAMLCFLAGS) $<; \ $(REAL_OCAMLFIND) $(REAL_OCAMLC) $(OCAML_FIND_PACKAGES) \ -c -pp "$$pp" $(ALL_OCAMLCFLAGS) $<; \ fi ifdef PACK_LIB $(REAL_RESULT).cmo $(REAL_RESULT).cmx $(REAL_RESULT).o: $(REAL_IMPL_INTF) $(OBJ_LINK) $(EXTRADEPS) $(REAL_OCAMLFIND) $(REAL_OCAMLC) $(PACKOPT) $(ALL_LDFLAGS) \ $(OBJS_LIBS) -o $@ $(REAL_IMPL) endif .PRECIOUS: %.ml %.ml: %.mll $(OCAMLLEX) $< .PRECIOUS: %.ml %.mli %.ml %.mli: %.mly $(OCAMLYACC) $(YFLAGS) $< .PRECIOUS: %.ml %.ml : %.rep $(CAMELEON_REPORT) $(CAMELEON_REPORT_FLAGS) -gen $< .PRECIOUS: %.ml %.ml : %.zog $(CAMELEON_ZOGGY) $(CAMELEON_ZOGGY_FLAGS) -impl $< > $@ .PRECIOUS: %.ml %.mli %_stubs.c %.h %.ml %.mli %_stubs.c %.h: %.idl $(CAMLIDL) $(MAYBE_IDL_HEADER) $(IDLFLAGS) \ $(CAMLIDLFLAGS) $< $(QUIET)if [ $(NOIDLHEADER) ]; then touch $*.h; fi .c.$(EXT_OBJ): $(CC) -c $(CFLAGS) $(CINCFLAGS) -I'$(OCAMLLIBPATH)' \ $< $(CFLAG_O)$@ .$(EXT_CXX).$(EXT_OBJ): $(CXX) -c $(CXXFLAGS) $(CINCFLAGS) -I'$(OCAMLLIBPATH)' \ $< $(CFLAG_O)$@ $(MLDEPDIR)/%.d: %.ml $(QUIET)echo making $@ from $< $(QUIET)if [ ! -d $(@D) ]; then mkdir -p $(@D); fi $(QUIET)pp=`sed -n -e '/^#/d' -e 's/(\*pp \([^*]*\) \*)/\1/p;q' $<`; \ if [ -z "$$pp" ]; then \ $(REAL_OCAMLFIND) $(OCAMLDEP) $(OCAML_FIND_PACKAGES) \ $(INCFLAGS) $< > $@; \ else \ $(REAL_OCAMLFIND) $(OCAMLDEP) $(OCAML_FIND_PACKAGES) \ -pp "$$pp" $(INCFLAGS) $< > $@; \ fi $(BCDIDIR)/%.di $(NCDIDIR)/%.di: %.mli $(QUIET)echo making $@ from $< $(QUIET)if [ ! -d $(@D) ]; then mkdir -p $(@D); fi $(QUIET)pp=`sed -n -e '/^#/d' -e 's/(\*pp \([^*]*\) \*)/\1/p;q' $<`; \ if [ -z "$$pp" ]; then \ $(REAL_OCAMLFIND) $(OCAMLDEP) $(DEPFLAGS) $(INCFLAGS) $< > $@; \ else \ $(REAL_OCAMLFIND) $(OCAMLDEP) $(DEPFLAGS) \ -pp "$$pp" $(INCFLAGS) $< > $@; \ fi doc/html: $(DOC_FILES) rm -rf $@ mkdir -p $@ $(OCAMLDOC) -html -d $@ $(OCAMLDOCFLAGS) $(DOC_FILES) doc/latex: $(DOC_FILES) rm -rf $@ mkdir -p $@ $(OCAMLDOC) -latex -d $@ $(OCAMLDOCFLAGS) $(DOC_FILES) -o doc.tex doc/latex/doc.ps: doc/latex cd doc/latex && \ $(LATEX) doc.tex && \ $(LATEX) doc.tex && \ $(DVIPS) $(DVIPSFLAGS) doc.dvi -o $(@F) doc/latex/doc.pdf: doc/latex/doc.ps cd doc/latex && $(PS2PDF) $( ## ## See http://www.gnu.org/software/shtool/ for more information. ## See ftp://ftp.gnu.org/gnu/shtool/ for latest version. ## ## Version 1.4.0 (02-Jul-1999) ## ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ## USA, or contact Ralf S. Engelschall . ## ## Notice: Given that you include this file verbatim into your own ## source tree, you are justified in saying that it remains separate ## from your package, and that this way you are simply just using GNU ## shtool. So, in this situation, there is no requirement that your ## package itself is licensed under the GNU General Public License in ## order to take advantage of GNU shtool. ## ## ## Usage: shtool [] [ [] []] ## ## Available commands: ## echo Print string with optional construct expansion ## mdate Pretty-print modification time of a file or dir ## table Pretty print a field-sperarated list as a table ## prop Display progress with a running propeller ## move Move files with simultan substitution ## install Install a program, script or datafile ## mkdir Make one or more directories ## mkln Make link with calculation of relative paths ## mkshadow Make a shadow tree ## fixperm Fix file permissions inside a source tree ## guessos Simple OS/platform guesser ## arx Extended archive command ## slo Separate linker options by library class ## scpp Sharing C Pre-Processor ## version Generate and maintain a version information file ## path Deal with program paths ## if [ $# -eq 0 ]; then echo "$0:ERROR: invalid command line" 1>&2 echo "$0:HINT: run \`$0 -h' for usage" 1>&2 exit 1 fi if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then echo "This is shtool, version 1.4.0 (02-Jul-1999)" echo "Copyright (c) 1994-1999 Ralf S. Engelschall " echo '' echo "Usage: shtool [] [ [] []]" echo '' echo 'Available global :' echo ' -v, --version display shtool version information' echo ' -h, --help display shtool usage help page (this one)' echo '' echo 'Available [] []:' echo ' echo [-n] [-e] [ ...]' echo ' mdate [-n] [-z] [-s] [-d] [-f] [-o] ' echo ' table [-F] [-w] [-c] [-s] ...' echo ' prop [-p]' echo ' move [-v] [-t] [-e] [-p] ' echo ' install [-v] [-t] [-c] [-C] [-s] [-m] [-o] [-g]' echo ' [-e] ' echo ' mkdir [-t] [-f] [-p] [-m] [ ...]' echo ' mkln [-t] [-f] [-s] [ ...] ' echo ' mkshadow [-v] [-t] [-a] ' echo ' fixperm [-v] [-t] [ ...]' echo ' guessos ' echo ' arx [-t] [-C] [ ...]' echo ' slo -- -L -l [ -L -l ... ]' echo ' scpp [-v] [-p] [-o] [-t] [-M] [-D]' echo ' [-C] [ ...]' echo ' version [-l] [-n] [-p] [-s] [-i]' echo ' [-d] ' echo ' path [-s] [-r] [-d] [-b] [-m] [-p] [ ...]' echo '' exit 0 fi if [ ".$1" = ".-v" -o ".$1" = ."--version" ]; then echo "shtool 1.4.0 (02-Jul-1999)" exit 0 fi tool="$1" shift arg_spec="" opt_spec="" gen_tmpfile=no ## ## DISPATCH INTO SCRIPT PROLOG ## case $tool in echo ) str_tool="echo" str_usage="[-n] [-e] [ ...]" arg_spec="0+" opt_spec="ne" ;; mdate ) str_tool="mdate" str_usage="[-n] [-z] [-s] [-d] [-f] [-o] " arg_spec="1" opt_spec="nzsdf:!o:!" opt_f=" " opt_o="dmy" ;; table ) str_tool="table" str_usage="[-F] [-w] [-c] [-s] ..." arg_spec="1+" opt_spec="F:!w:!c:!s:!" opt_F=":" opt_w=15 opt_c=3 opt_s=79 ;; prop ) str_tool="prop" str_usage="[-p]" arg_spec="0" opt_spec="p:" ;; move ) str_tool="move" str_usage="[-v] [-t] [-e] [-p] " arg_spec="2" opt_spec="vtep" ;; install ) str_tool="install" str_usage="[-v] [-t] [-c] [-C] [-s] [-m] [-o] [-g] [-e] " arg_spec="2" opt_spec="vtcCsm:o:g:e:" ;; mkdir ) str_tool="mkdir" str_usage="[-t] [-f] [-p] [-m] [ ...]" arg_spec="1+" opt_spec="tfpm:" ;; mkln ) str_tool="mkln" str_usage="[-t] [-f] [-s] [ ...] " arg_spec="2+" opt_spec="tfs" ;; mkshadow ) str_tool="mkshadow" str_usage="[-v] [-t] [-a] " arg_spec="2" opt_spec="vta" ;; fixperm ) str_tool="fixperm" str_usage="[-v] [-t] [ ...]" gen_tmpfile=yes arg_spec="1+" opt_spec="vt" ;; guessos ) str_tool="guessos" str_usage="" arg_spec="0" opt_spec="" ;; arx ) str_tool="arx" str_usage="[-t] [-C] [ ...]" arg_spec="2+" opt_spec="tC:!" opt_C="ar" ;; slo ) str_tool="slo" str_usage="-- -L -l [ -L -l ... ]" arg_spec="1+" opt_spec="" ;; scpp ) str_tool="scpp" str_usage="[-v] [-p] [-o] [-t] [-M] [-D] [-C] [ ...]" gen_tmpfile=yes arg_spec="1+" opt_spec="vpo:!t:!M:!D:!C:!" opt_o="lib.h" opt_t="lib.h.in" opt_M="%%MARK%%" opt_D="cpp" opt_C="intern" ;; version ) str_tool="version" str_usage="[-l] [-n] [-p] [-s] [-i] [-d] " arg_spec="1+" opt_spec="l:!n:!p:!s:!i:!d:!" opt_l="txt" opt_n="unknown" opt_p="unknown" opt_s="unknown" opt_i="P" opt_d="NO" gen_tmpfile=yes ;; path ) str_tool="path" str_usage="[-s] [-r] [-d] [-b] [-m] [-p] [ ...]" gen_tmpfile=yes arg_spec="1+" opt_spec="srdbmp:!" opt_p="$PATH" ;; * ) echo "$0:ERROR: unknown command \`$tool'" 2>&1 echo "$0:HINT: run \`$0 -h' for usage" 2>&1 exit 1 ;; esac ## ## COMMON UTILITY CODE ## # determine name of tool if [ ".$tool" != . ]; then # inside shtool toolcmd="$0 $tool" msgprefix="shtool:$tool" else # standalone toolcmd="$0" msgprefix="$str_tool" fi # parse argument specification string eval `echo $arg_spec | sed -e 's/^\([0-9]*\)\(.*\)/arg_NUMS="\1"; arg_MODE="\2"/'` test ".$arg_MODE" = . && arg_MODE="=" # parse option specification string for opt in `echo "h$opt_spec" | sed -e 's/\([a-zA-Z0-9][!:+]*\)/\1 /g'`; do opt_MODE="."; opt_INIT="." eval `echo $opt |\ sed -e 's/^\([a-zA-Z0-9]\)/opt_THIS="\1";/' \ -e 's/";\([:+]\)/"; opt_MODE="\1";/' \ -e 's/";\(!\)/"; opt_INIT="\1"/'` eval "opt_MODE_${opt_THIS}=${opt_MODE}" if [ ".$opt_INIT" != ".!" ]; then case "$opt_MODE" in "." ) eval "opt_${opt_THIS}=no" ;; ":"|"+" ) eval "opt_${opt_THIS}=\"\"" ;; esac fi done # interate over argument line opt_PREV='' while [ $# -gt 0 ]; do # special option stops processing if [ ".$1" = ".--" ]; then shift break fi # determine option and argument opt_ARG_OK=no if [ ".$opt_PREV" != . ]; then # merge previous seen option with argument opt_OPT="$opt_PREV" opt_ARG="$1" opt_ARG_OK=yes opt_PREV="" else # split argument into option and argument case "$1" in -[a-zA-Z0-9]*) eval `echo "x$1" |\ sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \ -e 's/";\(.*\)$/"; opt_ARG="\1"/'` ;; -[a-zA-Z0-9]) opt_OPT=`awk 'BEGIN { printf("%s", substr(OPT, 2)); }' \ "OPT=$1" &2 echo "$msgprefix:HINT: run \`$toolcmd -h' or \`man shtool' for details" 1>&2 exit 1 ;; esac done if [ ".$opt_PREV" != . ]; then echo "$msgprefix:ERROR: missing argument to option \`-$opt_PREV'" 1>&2 echo "$msgprefix:HINT: run \`$toolcmd -h' or \`man shtool' for details" 1>&2 exit 1 fi # process help option if [ .$opt_h = .yes ]; then echo "Usage: $toolcmd $str_usage" exit 0 fi # complain about incorrect number of arguments case $arg_MODE in "=" ) if [ $# -ne $arg_NUMS ]; then echo "$msgprefix:ERROR: invalid number of arguments (exactly $arg_NUMS expected)" 1>&2 echo "$msgprefix:HINT: run \`$toolcmd -h' or \`man shtool' for details" 1>&2 exit 1 fi ;; "+" ) if [ $# -lt $arg_NUMS ]; then echo "$msgprefix:ERROR: invalid number of arguments (at least $arg_NUMS expected)" 1>&2 echo "$msgprefix:HINT: run \`$toolcmd -h' or \`man shtool' for details" 1>&2 exit 1 fi ;; esac # establish a temporary file on request if [ ".$gen_tmpfile" = .yes ]; then tmpdir="/tmp" if [ ".$TMPDIR" != . ]; then tmpdir="$TMPDIR" else if [ ".$TEMPDIR" != . ]; then tmpdir="$TEMPDIR" fi fi tmpfile="$tmpdir/.shtool.$$" rm -f $tmpfile >/dev/null 2>&1 touch $tmpfile fi ## ## DISPATCH INTO SCRIPT BODY ## case $tool in echo ) ## ## echo -- Print string with optional construct expansion ## Copyright (c) 1998-1999 Ralf S. Engelschall ## Originally written for WML as buildinfo ## text="$*" # check for broken escape sequence expansion seo='' bytes=`echo '\1' | wc -c | awk '{ printf("%s", $1); }'` if [ ".$bytes" != .3 ]; then bytes=`echo -E '\1' | wc -c | awk '{ printf("%s", $1); }'` if [ ".$bytes" = .3 ]; then seo='-E' fi fi # check for existing -n option (to suppress newline) minusn='' bytes=`echo -n 123 2>/dev/null | wc -c | awk '{ printf("%s", $1); }'` if [ ".$bytes" = .3 ]; then minusn='-n' fi # determine terminal bold sequence term_bold='' term_norm='' if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[Bb]'`" != . ]; then # the most important terminals we directly know case $TERM in xterm|xterm*|vt220|vt220*) term_bold=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' /dev/null` term_norm=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' /dev/null` ;; vt100|vt100*) term_bold=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' /dev/null` term_norm=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' /dev/null` ;; esac # then try a possibly existing "tput" or "tcout" utility paths=`echo $PATH | sed -e 's/:/ /g'` for tool in tput tcout; do for dir in $paths; do if [ -r "$dir/$tool" ]; then for seq in bold md smso; do # smso is last bold="`$dir/$tool $seq 2>/dev/null`" if [ ".$bold" != . ]; then term_bold="$bold" break fi done if [ ".$term_bold" != . ]; then for seq in sgr0 me rmso reset; do # 'reset' is last norm="`$dir/$tool $seq 2>/dev/null`" if [ ".$norm" != . ]; then term_norm="$norm" break fi done fi break fi done if [ ".$term_bold" != . -a ".$term_norm" != . ]; then break; fi done if [ ".$term_bold" = . -o ".$term_norm" = . ]; then echo "$msgprefix:Warning: unable to determine terminal sequence for bold mode" 1>&2 fi fi # determine user name username='' if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[uU]'`" != . ]; then username="$LOGNAME" if [ ".$username" = . ]; then username="$USER" if [ ".$username" = . ]; then username="`(whoami) 2>/dev/null |\ awk '{ printf("%s", $1); }'`" if [ ".$username" = . ]; then username="`(who am i) 2>/dev/null |\ awk '{ printf("%s", $1); }'`" if [ ".$username" = . ]; then username='unknown' fi fi fi fi fi # determine user id userid='' if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%U'`" != . ]; then userid="`(id -u) 2>/dev/null`" if [ ".$userid" = . ]; then str="`(id) 2>/dev/null`" if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then userid=`echo $str | sed -e 's/^uid[ ]*=[ ]*//' -e 's/(.*//'` fi if [ ".$userid" = . ]; then userid=`egrep "^${username}:" /etc/passwd 2>/dev/null | \ sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'` if [ ".$userid" = . ]; then userid=`(ypcat passwd) 2>/dev/null | egrep "^${username}:" | \ sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'` if [ ".$userid" = . ]; then userid='?' fi fi fi fi fi # determine host name hostname='' if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%h'`" != . ]; then hostname="`(uname -n) 2>/dev/null |\ awk '{ printf("%s", $1); }'`" if [ ".$hostname" = . ]; then hostname="`(hostname) 2>/dev/null |\ awk '{ printf("%s", $1); }'`" if [ ".$hostname" = . ]; then hostname='unknown' fi fi case $hostname in *.* ) domainname=".`echo $hostname | cut -d. -f2-`" hostname="`echo $hostname | cut -d. -f1`" ;; esac fi # determine domain name domainname='' if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%d'`" != . ]; then if [ ".$domainname" = . ]; then if [ -f /etc/resolv.conf ]; then domainname="`egrep '^[ ]*domain' /etc/resolv.conf | head -1 |\ sed -e 's/.*domain//' \ -e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \ -e 's/^\.//' -e 's/^/./' |\ awk '{ printf("%s", $1); }'`" if [ ".$domainname" = . ]; then domainname="`egrep '^[ ]*search' /etc/resolv.conf | head -1 |\ sed -e 's/.*search//' \ -e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \ -e 's/ .*//' -e 's/ .*//' \ -e 's/^\.//' -e 's/^/./' |\ awk '{ printf("%s", $1); }'`" fi fi fi fi # determine current time time_day='' time_month='' time_year='' time_monthname='' if [ ".$opt_e" = .yes -a ".`echo $text | egrep '%[DMYm]'`" != . ]; then time_day=`date '+%d'` time_month=`date '+%m'` time_year=`date '+%Y' 2>/dev/null` if [ ".$time_year" = . ]; then time_year=`date '+%y'` case $time_year in [5-9][0-9]) time_year="19$time_year" ;; [0-4][0-9]) time_year="20$time_year" ;; esac fi case $time_month in 1|01) time_monthname='Jan' ;; 2|02) time_monthname='Feb' ;; 3|03) time_monthname='Mar' ;; 4|04) time_monthname='Apr' ;; 5|05) time_monthname='May' ;; 6|06) time_monthname='Jun' ;; 7|07) time_monthname='Jul' ;; 8|08) time_monthname='Aug' ;; 9|09) time_monthname='Sep' ;; 10) time_monthname='Oct' ;; 11) time_monthname='Nov' ;; 12) time_monthname='Dec' ;; esac fi # expand special ``%x'' constructs if [ ".$opt_e" = .yes ]; then text=`echo $seo "$text" |\ sed -e "s/%B/${term_bold}/g" \ -e "s/%b/${term_norm}/g" \ -e "s/%u/${username}/g" \ -e "s/%U/${userid}/g" \ -e "s/%h/${hostname}/g" \ -e "s/%d/${domainname}/g" \ -e "s/%D/${time_day}/g" \ -e "s/%M/${time_month}/g" \ -e "s/%Y/${time_year}/g" \ -e "s/%m/${time_monthname}/g" 2>/dev/null` fi # create output if [ .$opt_n = .no ]; then echo $seo $text else # the harder part: echo -n is best, because # awk complains about some \xx sequences. if [ ".$minusn" != . ]; then echo $seo $minusn $text else echo dummy | awk '{ printf("%s", TEXT); }' TEXT="$text" fi fi ;; mdate ) ## ## mdate -- Pretty-print modification time of a file or dir ## Copyright (c) 1995-1997 Free Software Foundation, Inc. ## Originally idea and basis code by Ulrich Drepper ## Enhanced by Ralf S. Engelschall for shtool ## fod="$1" case "$opt_o" in [dmy][dmy][dmy] ) ;; * ) echo "$msgprefix:Error: invalid argument to option \`-o': $opt_o" 1>&2 exit 1 ;; esac if [ ! -r "$fod" ]; then echo "$msgprefix:Error: file or directory not found: $fod" 1>&2 exit 1 fi # prevent "date" giving response in another language LANG=C; export LANG LC_ALL=C; export LC_ALL LC_TIME=C; export LC_TIME # get the extended ls output of the file or directory. if ls -L /dev/null >/dev/null 2>&1; then set - x`ls -L -l -d $fod` else set - x`ls -l -d $fod` fi # The month is at least the fourth argument # (3 shifts here, the next inside the loop). shift; shift; shift # Find the month. Next argument is day, followed by the year or time. month="" while [ ".$month" = . ]; do shift case $1 in Jan) month=January; nummonth=1 ;; Feb) month=February; nummonth=2 ;; Mar) month=March; nummonth=3 ;; Apr) month=April; nummonth=4 ;; May) month=May; nummonth=5 ;; Jun) month=June; nummonth=6 ;; Jul) month=July; nummonth=7 ;; Aug) month=August; nummonth=8 ;; Sep) month=September; nummonth=9 ;; Oct) month=October; nummonth=10 ;; Nov) month=November; nummonth=11 ;; Dec) month=December; nummonth=12 ;; esac done day="$2" year="$3" # We finally have to deal with the problem that the "ls" output # gives either the time of the day or the year. case $year in *:*) this_year=`date '+%Y' 2>/dev/null` if [ ".$this_year" = . ]; then this_year=`date '+%y'` case $this_year in [5-9][0-9]) this_year="19$this_year" ;; [0-4][0-9]) this_year="20$this_year" ;; esac fi # for the following months of the last year the time notation # is usually also used for files modified in the last year. this_month=`date '+%m'` if (expr $nummonth \> $this_month) >/dev/null; then this_year=`expr $this_year - 1` fi year="$this_year" ;; esac # Optionally fill day and month with leeding zeros if [ ".$opt_z" = .yes ]; then case $day in [0-9][0-9] ) ;; [0-9] ) day="0$day" ;; esac case $nummonth in [0-9][0-9] ) ;; [0-9] ) nummonth="0$nummonth" ;; esac fi # Optionally use digits for month if [ ".$opt_d" = .yes ]; then month="$nummonth" fi # Optionally shorten the month name to three characters if [ ".$opt_s" = .yes ]; then month=`echo $month | cut -c1-3` fi # Output the resulting date string echo dummy | awk '{ for (i = 0; i < 3; i++) { now = substr(order, 1, 1); order = substr(order, 2); if (now == "d") out = day; else if (now == "m") out = month; else if (now == "y") out = year; if (i < 2) printf("%s%s", out, field); else printf("%s", out); } if (newline != "yes") printf("\n"); }' "day=$day" "month=$month" "year=$year" \ "field=$opt_f" "order=$opt_o" "newline=$opt_n" ;; table ) ## ## table -- Pretty print a field-sperarated list as a table ## Copyright (c) 1998-1999 Ralf S. Engelschall ## Originally written for Apache ## if [ $opt_c -gt 4 ]; then echo "$msgprefix:Error: Invalid number of colums (1..4 allowed only)" 1>&2 exit 1 fi case "x$opt_F" in x? ) ;; * ) echo "$msgprefix:Error: Invalid seperator (one char allowed only)" 1>&2; exit 1 ;; esac # split the list into a table list=` IFS="$opt_F" for entry in $*; do if [ ".$entry" != . ]; then echo "$entry" fi done |\ awk " BEGIN { list = \"\"; n = 0; } { list = list \\$1; n = n + 1; if (n < $opt_c) { list = list \":\"; } if (n == $opt_c) { list = list \"\\n\"; n = 0; } } END { print list; } " ` # format table cells and make sure table # doesn't exceed maximum width OIFS="$IFS" IFS=' ' for entry in $list; do case $opt_c in 1 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s\\n\", \$1); }'" ;; 2 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s %-${opt_w}s\\n\", \$1, \$2); }'" ;; 3 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s %-${opt_w}s %-${opt_w}s\\n\", \$1, \$2, \$3); }'" ;; 4 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s %-${opt_w}s %-${opt_w}s %-${opt_w}s\\n\", \$1, \$2, \$3, \$4); }'" ;; esac done |\ awk "{ if (length(\$0) > $opt_s) { printf(\"%s\\n\", substr(\$0, 0, $opt_s-1)); } else { print \$0; } }" IFS="$OIFS" ;; prop ) ## ## prop -- Display progress with a running propeller ## Copyright (c) 1998-1999 Ralf S. Engelschall ## Originally written for mod_ssl ## perl='' for dir in `echo $PATH | sed -e 's/:/ /g'` .; do if [ -f "$dir/perl" ]; then perl="$dir/perl" break fi done if [ ".$perl" != . ]; then # Perl is preferred because writing to STDERR in # Perl really writes immediately as one would expect $perl -e ' @p = ("|","/","-","\\"); $i = 0; while () { printf(STDERR "\r%s...%s\b", $ARGV[0], $p[$i++]); $i = 0 if ($i > 3); } printf(STDERR "\r%s \n", $ARGV[0]); ' "$opt_p" else # But when Perl doesn't exists we use Awk even # some Awk's buffer even the /dev/stderr writing :-( awk ' BEGIN { split("|#/#-#\\", p, "#"); i = 1; } { printf("\r%s%c\b", prefix, p[i++]) > "/dev/stderr"; if (i > 4) { i = 1; } } END { printf("\r%s \n", prefix) > "/dev/stderr"; } ' "prefix=$opt_p" fi ;; move ) ## ## move -- Move files with simultan substitution ## Copyright (c) 1999 Ralf S. Engelschall ## Originally written for shtool ## src="$1" dst="$2" # consistency checks if [ ".$src" = . -o ".$dst" = . ]; then echo "$msgprefix:Error: Invalid arguments" 1>&2 exit 1 fi if [ ".$src" = ".$dst" ]; then echo "$msgprefix:Error: Source and destination files are the same" 1>&2 exit 1 fi expsrc="$src" if [ ".$opt_e" = .yes ]; then expsrc="`echo $expsrc`" fi if [ ".$opt_e" = .yes ]; then if [ ".`echo "$src" | sed -e 's;^.*\\*.*$;;'`" = ".$src" ]; then echo "$msgprefix:Error: Source doesn't contain wildcard ('*'): $dst" 1>&2 exit 1 fi if [ ".`echo "$dst" | sed -e 's;^.*%[1-9].*$;;'`" = ".$dst" ]; then echo "$msgprefix:Error: Destination doesn't contain substitution ('%N'): $dst" 1>&2 exit 1 fi if [ ".$expsrc" = ".$src" ]; then echo "$msgprefix:Error: Sources not found or no asterisk : $src" 1>&2 exit 1 fi else if [ ! -r "$src" ]; then echo "$msgprefix:Error: Source not found: $src" 1>&2 exit 1 fi fi # determine substitution patterns if [ ".$opt_e" = .yes ]; then srcpat=`echo "$src" | sed -e 's/\\./\\\\./g' -e 's/;/\\;/g' -e 's;\\*;\\\\(.*\\\\);g'` dstpat=`echo "$dst" | sed -e 's;%\([1-9]\);\\\\\1;g'` fi # iterate over source(s) for onesrc in $expsrc; do if [ .$opt_e = .yes ]; then onedst=`echo $onesrc | sed -e "s;$srcpat;$dstpat;"` else onedst="$dst" fi errorstatus=0 if [ ".$opt_v" = .yes ]; then echo "$onesrc -> $onedst" fi if [ ".$opt_p" = .yes ]; then if [ -r $onedst ]; then if cmp -s $onesrc $onedst; then if [ ".$opt_t" = .yes ]; then echo "rm -f $onesrc" 1>&2 fi rm -f $onesrc || errorstatus=$? else if [ ".$opt_t" = .yes ]; then echo "mv -f $onesrc $onedst" 1>&2 fi mv -f $onesrc $onedst || errorstatus=$? fi else if [ ".$opt_t" = .yes ]; then echo "mv -f $onesrc $onedst" 1>&2 fi mv -f $onesrc $onedst || errorstatus=$? fi else if [ ".$opt_t" = .yes ]; then echo "mv -f $onesrc $onedst" 1>&2 fi mv -f $onesrc $onedst || errorstatus=$? fi if [ $errorstatus -ne 0 ]; then break; fi done exit $errorstatus ;; install ) ## ## install -- Install a program, script or datafile ## Copyright (c) 1997-1999 Ralf S. Engelschall ## Originally written for shtool ## src="$1" dst="$2" # If destination is a directory, append the input filename if [ -d $dst ]; then dst=`echo "$dst" | sed -e 's:/$::'` dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'` dst="$dst/$dstfile" fi # Add a possible extension to src and dst if [ ".$opt_e" != . ]; then src="$src$opt_e" dst="$dst$opt_e" fi # Check for correct arguments if [ ".$src" = ".$dst" ]; then echo "$msgprefix:Error: source and destination are the same" 1>&2 exit 1 fi # Make a temp file name in the destination directory dstdir=`echo $dst | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;'` dsttmp="$dstdir/#INST@$$#" # Verbosity if [ ".$opt_v" = .yes ]; then echo "$src -> $dst" 1>&2 fi # Copy or move the file name to the temp name # (because we might be not allowed to change the source) if [ ".$opt_C" = .yes ]; then opt_c=yes fi if [ ".$opt_c" = .yes ]; then if [ ".$opt_t" = .yes ]; then echo "cp $src $dsttmp" 1>&2 fi cp $src $dsttmp || exit $? else if [ ".$opt_t" = .yes ]; then echo "mv $src $dsttmp" 1>&2 fi mv $src $dsttmp || exit $? fi # Adjust the target file # (we do chmod last to preserve setuid bits) if [ ".$opt_s" = .yes ]; then if [ ".$opt_t" = .yes ]; then echo "strip $dsttmp" 1>&2 fi strip $dsttmp || exit $? fi if [ ".$opt_o" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chown $opt_o $dsttmp" 1>&2 fi chown $opt_o $dsttmp || exit $? fi if [ ".$opt_g" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chgrp $opt_g $dsttmp" 1>&2 fi chgrp $opt_g $dsttmp || exit $? fi if [ ".$opt_m" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chmod $opt_m $dsttmp" 1>&2 fi chmod $opt_m $dsttmp || exit $? fi # Determine whether to do a quick install # (has to be done _after_ the strip was already done) quick=no if [ ".$opt_C" = .yes ]; then if [ -r $dst ]; then if cmp -s $src $dst; then quick=yes fi fi fi # Finally install the file to the real destination if [ $quick = yes ]; then if [ ".$opt_t" = .yes ]; then echo "rm -f $dsttmp" 1>&2 fi rm -f $dsttmp else if [ ".$opt_t" = .yes ]; then echo "rm -f $dst && mv $dsttmp $dst" 1>&2 fi rm -f $dst && mv $dsttmp $dst fi ;; mkdir ) ## ## mkdir -- Make one or more directories ## Copyright (c) 1996-1999 Ralf S. Engelschall ## Originally written for public domain by Noah Friedman ## Cleaned up and enhanced for shtool ## errstatus=0 for p in ${1+"$@"}; do # when the directory already exists... if [ -d "$p" ]; then if [ ".$opt_f" = .no ]; then echo "$msgprefix:Error: file exists: $p" 1>&2 errstatus=1 break else continue fi fi # when the directory has to be created if [ ".$opt_p" = .no ]; then if [ ".$opt_t" = .yes ]; then echo "mkdir $p" 1>&2 fi mkdir $p || errstatus=$? else # the smart situation set fnord `echo ":$p" |\ sed -e 's/^:\//%/' \ -e 's/^://' \ -e 's/\// /g' \ -e 's/^%/\//'` shift pathcomp= for d in ${1+"$@"}; do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp="./$pathcomp" ;; esac if [ ! -d "$pathcomp" ]; then if [ ".$opt_t" = .yes ]; then echo "mkdir $pathcomp" 1>&2 fi mkdir $pathcomp || errstatus=$? if [ ".$opt_m" != . ]; then if [ ".$opt_t" = .yes ]; then echo "chmod $opt_m $pathcomp" 1>&2 fi chmod $opt_m $pathcomp || errstatus=$? fi fi pathcomp="$pathcomp/" done fi done exit $errstatus ;; mkln ) ## ## mkln -- Make link with calculation of relative paths ## Copyright (c) 1999 Ralf S. Engelschall ## Originally written for shtool ## args=$? srcs="" while [ $# -gt 1 ]; do srcs="$srcs $1" shift done dst="$1" if [ ! -d $dst ]; then if [ $args -gt 2 ]; then echo "$msgprefix:Error: multiple sources not allowed when target isn't a directory" 1>&2 exit 1 fi fi # determine link options lnopt="" if [ ".$opt_f" = .yes ]; then lnopt="$lnopt -f" fi if [ ".$opt_s" = .yes ]; then lnopt="$lnopt -s" fi # iterate over sources for src in $srcs; do # determine if one of the paths is an absolute path, # because then we _have_ to use an absolute symlink oneisabs=0 srcisabs=0 dstisabs=0 case $src in /* ) oneisabs=1; srcisabs=1 ;; esac case $dst in /* ) oneisabs=1; dstisabs=1 ;; esac # split source and destination into dir and base name if [ -d $src ]; then srcdir=`echo $src | sed -e 's;/*$;;'` srcbase="" else srcdir=`echo $src | sed -e 's;^[^/]*$;;' -e 's;^\(.*/\)[^/]*$;\1;' -e 's;\(.\)/$;\1;'` srcbase=`echo $src | sed -e 's;.*/\([^/]*\)$;\1;'` fi if [ -d $dst ]; then dstdir=`echo $dst | sed -e 's;/*$;;'` dstbase="" else dstdir=`echo $dst | sed -e 's;^[^/]*$;;' -e 's;^\(.*/\)[^/]*$;\1;' -e 's;\(.\)/$;\1;'` dstbase=`echo $dst | sed -e 's;.*/\([^/]*\)$;\1;'` fi # consistency check if [ ".$dstdir" != . ]; then if [ ! -d $dstdir ]; then echo "$msgprefix:Error: destination directory not found: $dstdir" 1>&2 exit 1 fi fi # make sure the source is reachable from the destination if [ $dstisabs = 1 ]; then if [ $srcisabs = 0 ]; then if [ -d $srcdir ]; then srcdir="`cd $srcdir; pwd | sed -e 's;/*$;;'`" srcisabs=1 oneisabs=1 fi fi fi # split away a common prefix prefix="" if [ ".$srcdir" = ".$dstdir" ] && [ ".$srcdir" != . ]; then prefix="$srcdir/" srcdir="" dstdir="" else while [ ".$srcdir" != . ] && [ ".$dstdir" != . ]; do presrc=`echo $srcdir | sed -e 's;^\([^/]*\)/.*;\1;'` predst=`echo $dstdir | sed -e 's;^\([^/]*\)/.*;\1;'` if [ ".$presrc" != ".$predst" ]; then break fi prefix="$prefix$presrc/" srcdir=`echo $srcdir | sed -e 's;^[^/]*/*;;'` dstdir=`echo $dstdir | sed -e 's;^[^/]*/*;;'` done fi # destination prefix is just the common prefix dstpre="$prefix" # determine source prefix which is the reverse directory # step-up corresponding to the destination directory srcpre="" if [ $oneisabs = 0 ] || [ ".$prefix" != . -a ".$prefix" != ./ ]; then pl="$dstdir/" OIFS="$IFS"; IFS='/' for pe in $pl; do [ ".$pe" = . ] && continue srcpre="../$srcpre" done IFS="$OIFS" else if [ $srcisabs = 1 ]; then srcpre="$prefix" fi fi # determine destination symlink name if [ ".$dstbase" = . ]; then if [ ".$srcbase" != . ]; then dstbase="$srcbase" else dstbase=`echo "$prefix$srcdir" | sed -e 's;/*$;;' -e 's;.*/\([^/]*\)$;\1;'` fi fi # now finalize source and destination directory paths srcdir=`echo $srcdir | sed -e 's;\([^/]\)$;\1/;'` dstdir=`echo $dstdir | sed -e 's;\([^/]\)$;\1/;'` # run the final link command if [ ".$opt_t" = .yes ]; then echo "ln$lnopt $srcpre$srcdir$srcbase $dstpre$dstdir$dstbase" fi eval ln$lnopt $srcpre$srcdir$srcbase $dstpre$dstdir$dstbase done ;; mkshadow ) ## ## mkshadow -- Make a shadow tree ## Copyright (c) 1998-1999 Ralf S. Engelschall ## Originally written for Apache ## # source and destination directory src=`echo "$1" | sed -e 's:/$::'` dst=`echo "$2" | sed -e 's:/$::'` # check whether source exists if [ ! -d $src ]; then echo "$msgprefix:Error: source directory not found: \`$src'" 1>&2 exit 1 fi # determine if one of the paths is an absolute path, # because then we have to use an absolute symlink oneisabs=0 case $src in /* ) oneisabs=1 ;; esac case $dst in /* ) oneisabs=1 ;; esac # determine reverse directory for destination directory dstrevdir='' if [ $oneisabs = 0 ]; then # (inlined fp2rp) OIFS="$IFS"; IFS='/' for pe in $dst; do dstrevdir="../$dstrevdir" done IFS="$OIFS" else src="`cd $src; pwd`"; fi # create directory tree at destination if [ ! -d $dst ]; then if [ ".$opt_t" = .yes ]; then echo "mkdir $dst" 1>&2 fi mkdir $dst fi if [ ".$opt_a" = .yes ]; then DIRS=`cd $src; find . -type d -print |\ sed -e '/^\.$/d' -e 's:^\./::'` else DIRS=`cd $src; find . -type d -print |\ sed -e '/\/CVS/d' -e '/^\.$/d' -e 's:^\./::'` fi for dir in $DIRS; do if [ ".$opt_t" = .yes ]; then echo "mkdir $dst/$dir" 1>&2 fi mkdir $dst/$dir done # fill directory tree with symlinks to files if [ ".$opt_a" = .yes ]; then FILES="`cd $src; find . -depth -print |\ sed -e 's/^\.\///'`" else FILES="`cd $src; find . -depth -print |\ sed -e '/\.o$/d' -e '/\.a$/d' -e '/\.so$/d' \ -e '/\.cvsignore$/d' -e '/\/CVS/d' \ -e '/\/\.#/d' -e '/\.orig$/d' \ -e 's/^\.\///'`" fi for file in $FILES; do # don't use `-type f' above for find because of symlinks if [ -d "$src/$file" ]; then continue fi basename=`echo $file | sed -e 's:^.*/::'` dir=`echo $file | sed -e 's:[^/]*$::' -e 's:/$::' -e 's:$:/:' -e 's:^/$::'` from=`echo "$src/$file" | sed -e 's/^\.\///'` to="$dst/$dir$basename" if [ $oneisabs = 0 ]; then if [ ".$dir" != . ]; then subdir=`echo $dir | sed -e 's:/$::'` # (inlined fp2rp) revdir='' OIFS="$IFS"; IFS='/' for pe in $subdir; do revdir="../$revdir" done IFS="$OIFS" # finalize from from="$revdir$from" fi from="$dstrevdir$from" fi if [ ".$opt_v" = .yes ]; then echo " $to" 1>&2 fi if [ ".$opt_t" = .yes ]; then echo "ln -s $from $to" 1>&2 fi ln -s $from $to done ;; fixperm ) ## ## fixperm -- Fix file permissions inside a source tree ## Copyright (c) 1996-1999 Ralf S. Engelschall ## Originally written for ePerl ## paths="$*" # check whether the test command supports the -x option cat >$tmpfile </dev/null; then minusx="-x" else minusx="-r" fi rm -f $tmpfile # iterate over paths for p in $paths; do for file in `find $p -depth -print`; do if [ -f $file ]; then if [ $minusx $file ]; then if [ ".$opt_v" = .yes ]; then echo "-rwxrwxr-x $file" 2>&1 fi if [ ".$opt_t" = .yes ]; then echo "chmod 775 $file" 2>&1 fi chmod 775 $file else if [ ".$opt_v" = .yes ]; then echo "-rw-rw-r-- $file" 2>&1 fi if [ ".$opt_t" = .yes ]; then echo "chmod 664 $file" 2>&1 fi chmod 664 $file fi continue fi if [ -d $file ]; then if [ ".$opt_v" = .yes ]; then echo "drwxrwxr-x $file" 2>&1 fi if [ ".$opt_t" = .yes ]; then echo "chmod 775 $file" 2>&1 fi chmod 775 $file continue fi if [ ".$opt_v" = .yes ]; then echo "?????????? $file" 2>&1 fi done done ;; guessos ) ## ## guessos -- Simple OS/platform guesser ## Copyright (c) 1996-1999 The Apache Group, http://www.apache.org/ ## The Apache license applies (see http://www.apache.org/docs/LICENSE) ## Originally written for Apache ## MACHINE=`(uname -m) 2>/dev/null` || MACHINE="unknown" RELEASE=`(uname -r) 2>/dev/null` || RELEASE="unknown" SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown" VERSION=`(uname -v) 2>/dev/null` || VERSION="unknown" XREL=`(uname -X) 2>/dev/null | grep "^Release" | awk '{print $3}'` if [ "x$XREL" != "x" ]; then if [ -f /etc/kconfig ]; then case "$XREL" in 4.0|4.1) echo "${MACHINE}-whatever-isc4"; exit 0 ;; esac else case "$XREL" in 3.2v4.2) echo "whatever-whatever-sco3"; exit 0 ;; 3.2v5.0*) echo "whatever-whatever-sco5"; exit 0 ;; 4.2MP) if [ "x$VERSION" = "x2.1.1" ]; then echo "${MACHINE}-whatever-unixware211"; exit 0 elif [ "x$VERSION" = "x2.1.2" ]; then echo "${MACHINE}-whatever-unixware212"; exit 0 else echo "${MACHINE}-whatever-unixware2"; exit 0 fi ;; 4.2) echo "whatever-whatever-unixware1"; exit 0 ;; 5) case "$VERSION" in 7*) echo "${MACHINE}-whatever-unixware7"; exit 0 ;; esac ;; esac fi fi case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in MiNT:*) echo "m68k-atari-mint"; exit 0 ;; A/UX:*) echo "m68k-apple-aux3"; exit 0 ;; AIX:*) MACH=`echo $MACHINE | sed -e 's;[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F];;'` echo "${MACH}-ibm-aix${VERSION}.${RELEASE}"; exit 0 ;; dgux:*) echo "${MACHINE}-dg-dgux"; exit 0 ;; HI-UX:*) echo "${MACHINE}-hi-hiux"; exit 0 ;; HP-UX:*) HPUXVER=`echo ${RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo "${MACHINE}-hp-hpux${HPUXVER}"; exit 0 ;; IRIX:*) if [ -f /usr/lib32/mips4/libm.so ]; then echo "${MACHINE}/32-sgi-irix${RELEASE}"; exit 0 else echo "${MACHINE}-sgi-irix${RELEASE}"; exit 0 fi ;; IRIX64:*) echo "${MACHINE}-sgi-irix64"; exit 0 ;; Linux:[2-9].*) echo "${MACHINE}-whatever-linux2"; exit 0 ;; Linux:1.*) echo "${MACHINE}-whatever-linux1"; exit 0 ;; LynxOS:*) echo "${MACHINE}-lynx-lynxos"; exit 0 ;; BSD/386|BSD/OS:3.*) echo "${MACHINE}-whatever-bsdi3"; exit 0 ;; BSD/386:*:*:*486*|BSD/OS:*:*:*:*486*) echo "i486-whatever-bsdi"; exit 0 ;; BSD/386:*|BSD/OS:*) echo "${MACHINE}-whatever-bsdi"; exit 0 ;; FreeBSD:*) VERS=`echo ${RELEASE} | sed -e 's/[-(].*//'` MACH=`sysctl -n hw.model` ARCH='whatever' case ${MACH} in *386* ) MACH="i386" ;; *486* ) MACH="i486" ;; Pentium\ II*) MACH="i686" ;; Pentium* ) MACH="i586" ;; Alpha* ) MACH="alpha" ;; * ) MACH="$MACHINE" ;; esac case ${MACH} in i[0-9]86 ) ARCH="pc" ;; esac echo "${MACH}-${ARCH}-freebsd${VERS}"; exit 0 ;; NetBSD:*:*:*486*) echo "i486-whatever-netbsd${RELEASE}"; exit 0 ;; NetBSD:*) echo "${MACHINE}-whatever-netbsd${RELEASE}"; exit 0 ;; OpenBSD:*) echo "${MACHINE}-whatever-openbsd"; exit 0 ;; OSF1:*:*:*alpha*) VERS=`echo $RELEASE | sed -e 's;^V;;'` echo "${MACHINE}-dec-osf${VERS}"; exit 0 ;; QNX:*) if [ "$VERSION" -gt 422 ]; then echo "${MACHINE}-qssl-qnx32" else echo "${MACHINE}-qssl-qnx" fi exit 0 ;; Paragon*:*:*:*) echo "i860-intel-osf1"; exit 0 ;; SunOS:5.*) VERSION=`echo $RELEASE | sed -e 's;^5\.;;'` echo "${MACHINE}-sun-solaris2.${VERSION}"; exit 0 ;; SunOS:*) echo "${MACHINE}-sun-sunos4"; exit 0 ;; UNIX_System_V:4.*:*) echo "${MACHINE}-whatever-sysv4"; exit 0 ;; unix:3.0.9*:*:88k) echo "${MACHINE}-encore-sysv4"; exit 0 ;; *:4*:R4*:m88k) echo "${MACHINE}-whatever-sysv4"; exit 0 ;; UnixWare:5:99*:*) # Gemini, beta release of next rev of unixware echo "${MACHINE}-whatever-unixware212"; exit 0 ;; DYNIX/ptx:4*:*) echo "${MACHINE}-whatever-sysv4"; exit 0 ;; *:4.0:3.0:[345][0-9]?? | *:4.0:3.0:3[34]??[/,]* | library:*) echo "x86-ncr-sysv4"; exit 0 ;; ULTRIX:*) echo "${MACHINE}-unknown-ultrix"; exit 0 ;; SINIX-?:* | ReliantUNIX-?:*) echo "${MACHINE}-siemens-sysv4"; exit 0 ;; POSIX*BS2000) echo "${MACHINE}-siemens-sysv4"; exit 0 ;; machten:*) echo "${MACHINE}-tenon-${SYSTEM}"; exit 0; ;; ConvexOS:*:11.*:*) echo "${MACHINE}-v11-${SYSTEM}"; exit 0; ;; UNIX_SV:*:*:maxion) echo "${MACHINE}-ccur-sysv4"; exit 0; ;; PowerMAX_OS:*:*:Night_Hawk) MACHINE=`uname -p` echo "${MACHINE}-concurrent-powermax"; exit 0; ;; UNIX_SV:*) if [ -d /usr/nec ];then echo "mips-nec-sysv4"; exit 0; fi ;; NonStop-UX:4.[02]*:[BC]*:*) echo "${MACHINE}-tandem-sysv4"; exit 0; ;; Rhapsody:*:*:*) case "${MACHINE}" in "Power Macintosh") MACHINE=powerpc ;; esac echo "${MACHINE}-apple-rhapsody${RELEASE}"; exit 0 ;; "Mac OS":*:*:*) MACHINE=`uname -p` echo "${MACHINE}-apple-macos${RELEASE}"; exit 0 ;; "RISC iX":*) echo "arm-whatever-riscix"; exit 0; ;; *:4.0:2:*) echo "whatever-unisys-sysv4"; exit 0; ;; *:*:dcosx:NILE*) echo "pyramid-pyramid-svr4"; exit 0; ;; *:*:*:"DRS 6000") echo "drs6000-whatever-whatever"; exit 0; ;; esac # Now NeXT ISNEXT=`(hostinfo) 2>/dev/null` case "$ISNEXT" in *NeXT*) # Swiped from a friendly uname clone for NEXT/OPEN Step. NEXTOSVER="`hostinfo | sed -n 's/.*NeXT Mach \([0-9\.]*\).*/\1/p'`" if [ "$NEXTOSVER" -gt 3.3 ]; then NEXTOS="openstep" else NEXTOS="nextstep" fi NEXTREL="`hostinfo | sed -n 's/.*NeXT Mach \([0-9\.]*\).*/\1/p'`" NEXTARCH=`arch` echo "${NEXTARCH}-next-${NEXTOS}${NEXTREL}" ; exit 0 ;; esac # Fallback echo "${MACHINE}-whatever-${SYSTEM}|${RELEASE}|${VERSION}" ;; arx ) ## ## arx -- Extended archive command ## Copyright (c) 1999 Ralf S. Engelschall ## Originally written for shtool ## ar_prg="$opt_C" ar_cmd="$1"; shift archive="$1"; shift files="$*" # walk through the file list and expand archives members tmpdir=`echo $archive | sed -e 's;[^/]*$;.arx;'` nfiles='' if [ ".$files" != . ]; then for file in $files; do if [ ! -f $file ]; then echo "$msgprefix:Error: input file not found: $file" 1>&2 exit 1 fi case $file in *.a ) if [ ! -d $tmpdir ]; then if [ ".$opt_t" = .yes ]; then echo "mkdir $tmpdir" 1>&2 fi mkdir $tmpdir fi case $tmpdir in .arx ) from="../$file" ;; * ) dir=`echo $file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;'` base=`echo $file | sed -e 's;.*/\([^/]*\)$;\1;'` from="`cd $dir; pwd`/$base" ;; esac if [ ".$opt_t" = .yes ]; then echo "(cd $tmpdir && $ar_prg x $from)" 1>&2 fi (cd $tmpdir && eval $ar_prg x $from) if [ $? -ne 0 ]; then echo "$msgprefix:Error: member extraction failed for archive: $file" 1>&2 exit 1 fi for member in - `eval $ar_prg t $file`; do [ ".$member" = .- ] && continue nfiles="$nfiles $tmpdir/$member" done ;; * ) nfiles="$nfiles $file" ;; esac done fi # run the final archive command if [ ".$opt_t" = .yes ]; then echo "$ar_prg $ar_cmd $archive $nfiles" 1>&2 fi eval $ar_prg $ar_cmd $archive $nfiles if [ $? -ne 0 ]; then echo "$msgprefix:Error: archive command failed" 1>&2 exit $? fi # cleanup and die gracefully if [ -d $tmpdir ]; then if [ ".$opt_t" = .yes ]; then echo "rm -rf $tmpdir" 1>&2 fi rm -rf $tmpdir fi ;; slo ) ## ## slo -- Separate linker options by library class ## Copyright (c) 1998-1999 Ralf S. Engelschall ## Originally written for Apache ## DIFS="$IFS" # parse out -L and -l options from command line DIRS='' LIBS='' ARGV='' optprev='' for opt do # concatenate with previous option if exists if [ ".$optprev" != . ]; then opt="${optprev}${opt}"; optprev='' fi # remember options for arg when used stand-alone if [ ".$opt" = ".-L" -o ".$opt" = ".-l" ]; then optprev="$opt" continue; fi # split argument into option plus option argument arg="`echo $opt | cut -c3-`" opt="`echo $opt | cut -c1-2`" # store into containers case $opt in -L) DIRS="$DIRS:$arg" ;; -l) LIBS="$LIBS:$arg" ;; *) ARGV="$ARGV $opt" ;; esac done # set linker default directories DIRS_DEFAULT='/lib:/usr/lib' if [ ".$LD_LIBRARY_PATH" != . ]; then DIRS_DEFAULT="$DIRS_DEFAULT:$LD_LIBRARY_PATH" fi # sort options by class DIRS_OBJ='' LIBS_OBJ='' DIRS_PIC='' LIBS_PIC='' DIRS_DSO='' LIBS_DSO='' # for each library... OIFS="$IFS" IFS=':' for lib in $LIBS; do [ ".$lib" = . ] && continue found='no' found_indefdir='no' found_type='' found_dir='' # for each directory... OIFS2="$IFS" IFS=":$DIFS" for dir in ${DIRS} switch-to-defdirs ${DIRS_DEFAULT}; do [ ".$dir" = . ] && continue [ ".$dir" = .switch-to-defdirs ] && found_indefdir=yes [ ! -d $dir ] && continue # search the file OIFS3="$IFS" IFS="$DIFS" for file in '' `cd $dir && ls lib${lib}.* 2>/dev/null`; do [ ".$file" = . ] && continue case $file in *.so|*.so.[0-9]*|*.sl|*.sl.[0-9]* ) found=yes; found_type=DSO; break ;; *.lo|*.la ) found=yes; found_type=PIC ;; *.a ) if [ ".$found_type" = . ]; then found=yes found_type=OBJ fi ;; esac done IFS="$OIFS3" if [ ".$found" = .yes ]; then found_dir="$dir" break fi done IFS="$OIFS2" if [ ".$found" = .yes ]; then if [ ".$found_indefdir" != .yes ]; then eval "dirlist=\"\${DIRS_${found_type}}:\"" if [ ".`echo \"$dirlist\" | fgrep :$found_dir:`" = . ]; then eval "DIRS_${found_type}=\"\$DIRS_${found_type}:${found_dir}\"" fi eval "LIBS_${found_type}=\"\$LIBS_${found_type}:$lib\"" else eval "LIBS_${found_type}=\"\$LIBS_${found_type}:$lib\"" fi else LIBS_OBJ="$LIBS_OBJ:$lib" #dirlist="`echo $DIRS $DIRS_DEFAULT | sed -e 's/:/ /g'`" #echo "slo:Warning: library \"$lib\" not found in any of the following dirs:" 2>&1 #echo "slo:Warning: $dirlist" 1>&1 fi done IFS="$OIFS" # also pass-through unused dirs even if it's useless OIFS="$IFS" IFS=':' for dir in $DIRS; do dirlist="${DIRS_OBJ}:${DIRS_PIC}:${DIRS_DSO}:" if [ ".`echo \"$dirlist\" | fgrep :$dir:`" = . ]; then DIRS_OBJ="$DIRS_OBJ:$dir" fi done IFS="$OIFS" # reassemble the options but seperated by type for type in OBJ PIC DSO; do OIFS="$IFS" IFS=':' eval "libs=\"\$LIBS_${type}\"" opts='' for lib in $libs; do [ ".$lib" = . ] && continue opts="$opts -l$lib" done eval "LIBS_${type}=\"$opts\"" eval "dirs=\"\$DIRS_${type}\"" opts='' for dir in $dirs; do [ ".$dir" = . ] && continue opts="$opts -L$dir" done eval "DIRS_${type}=\"$opts\"" IFS="$OIFS" done # give back results for var in ARGV DIRS_OBJ LIBS_OBJ DIRS_PIC LIBS_PIC DIRS_DSO LIBS_DSO; do eval "val=\"\$${var}\"" val="`echo $val | sed -e 's/^ *//'`" echo "SLO_${var}=\"${val}\"" done ;; scpp ) ## ## scpp -- Sharing C Pre-Processor ## Copyright (c) 1999 Ralf S. Engelschall ## Originally written for NPS ## srcs="$*" output="${opt_o}.n" # parse source file(s) if [ ".$opt_v" = .yes ]; then echo "Parsing:" | awk '{ printf("%s", $0); }' 1>&2 fi for src in $srcs; do if [ ".$opt_v" = .yes ]; then echo $src | awk '{ printf(" %s", $0); }' 1>&2 fi awk <$src ' BEGIN { ln = 0; fln = 0; level = 0; mode = ""; store = ""; } { ln++; } /^#if.*/ { level++; } /^#if [a-zA-Z_][a-zA-Z0-9_]* *$/ { if ($2 == define) { mode = "D"; printf("D:#line %d \"%s\"\n", ln, src); next; } } /^#endif.*/ { level--; if (mode == "D" && level == 0) { mode = ""; next; } } /^[a-zA-Z_][a-zA-Z0-9_].*;.*/ || /^[a-zA-Z_][a-zA-Z0-9_].*=.*/ { if ($1 == class) { printf("V:#line %d \"%s\"\n", ln, src); printf("V:%s\n", $0); printf("J:%s\n", $0); next; } } /^[a-zA-Z_][a-zA-Z0-9_]*/ { if ($1 == class) { fln = ln; store = $0; mode = "F"; next; } } /^\{ *$/ { if (mode == "F") { printf("F:#line %d \"%s\"\n", fln, src); printf("F:%s;\n", store); printf("I:%s;\n", store); store = ""; mode = ""; next; } } { if (mode == "D") printf("D:%s\n", $0); else if (mode == "F") store = store " " $0; } ' "src=$src" "define=$opt_D" "class=$opt_C" >>$tmpfile done if [ ".$opt_v" = .yes ]; then echo "" 1>&2 fi # start generating output header echo "/* $opt_o -- autogenerated from $opt_t, DO NOT EDIT! */" >$output echo "#line 1 \"$opt_t\"" >>$output sed <$opt_t -e "1,/^${opt_M} *\$/p" -e 'd' |\ sed -e "/^${opt_M} *\$/d" >>$output # merge in the define blocks grep '^D:' $tmpfile | sed -e 's/^D://' >>$output # generate standard prolog echo "#line 1 \"_ON_THE_FLY_\"" >>$output echo "" >>$output echo "/* make sure the scpp source extensions are skipped */" >>$output echo "#define $opt_D 0" >>$output echo "#define $opt_C /**/" >>$output # generate namespace hiding for variables echo "" >>$output echo "/* move intern variables to hidden namespace */" >>$output grep '^J:' $tmpfile | sed >>$output \ -e 's/^J://' \ -e 's/ */ /g' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\)\[\];.*$/#define \1 __\1/' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\)\[\] =.*$/#define \1 __\1/' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\);.*$/#define \1 __\1/' \ -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\) =.*$/#define \1 __\1/' # generate namespace hiding for functions echo "" >>$output echo "/* move intern functions to hidden namespace */" >>$output grep '^I:' $tmpfile | sed >>$output \ -e 's/^I://' \ -e 's/\([ (]\) */\1/g' \ -e 's/ *\([),]\)/\1/g' \ -e 's/^[^(]*[ *]\([a-zA-Z0-9_]*\)(.*$/#define \1 __\1/' # generate prototypes for variables echo "" >>$output echo "/* prototypes for intern variables */" >>$output grep '^V:' $tmpfile | sed >>$output \ -e 's/^V://' \ -e 's/ */ /g' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\[\]\);.*$/\1;/' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\[\]\) =.*$/\1;/' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\);.*$/\1;/' \ -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\) =.*$/\1;/' \ -e 's/ ;/;/g' \ -e "s/^$opt_C /extern /" # generate prototypes for functions echo "" >>$output echo "/* prototypes for intern functions */" >>$output grep '^F:' $tmpfile | sed >>$output \ -e 's/^F://' \ -e 's/\([ (]\) */\1/g' \ -e 's/ *\([),]\)/\1/g' \ -e "s/^$opt_C /extern /" # finish generating output header n=`(echo ''; sed <$opt_t -e "1,/^${opt_M} *\$/p" -e 'd') |\ wc -l | sed -e 's;^ *\([0-9]*\) *$;\1;'` echo "#line $n \"$opt_t\"" >>$output sed <$opt_t -e "/^${opt_M} *\$/,\$p" -e 'd' |\ sed -e "/^${opt_M} *\$/d" >>$output # create final output file if [ -f $opt_o ]; then if [ ".$opt_p" = .yes ]; then grep -v '^#line' $opt_o >$tmpfile.o grep -v '^#line' $output >$tmpfile.n out_old="$tmpfile.o" out_new="$tmpfile.n" else out_old="$opt_o" out_new="$output" fi if cmp -s $out_old $out_new; then : else cp $output $opt_o fi else cp $output $opt_o fi rm -f $output rm -f $tmpfile $tmpfile.* >/dev/null 2>&1 ;; version ) ## ## version -- Generate and maintain a version information file ## Copyright (c) 1994-1999 Ralf S. Engelschall ## Originally written for ePerl ## LANGUAGE="$opt_l" NAME="$opt_n" PREFIX="$opt_p" FULLVERSION="$opt_s" INCREASE="$opt_i" REPORT="$opt_d" FILE="$1" # determine language if [ ".$LANGUAGE" = .unknown ]; then case $FILE in *.txt ) LANGUAGE=txt ;; *.c ) LANGUAGE=c ;; *.pl | *.pm ) LANGUAGE=perl ;; * ) echo "$tool:Error: unknown language type" 1>&2; exit 1 ;; esac fi # determine prefix from name and vice versa if [ ".$PREFIX" = . -o ".$PREFIX" = .unknown ]; then if [ ".$NAME" != . -a ".$NAME" != .unknown ]; then PREFIX="$NAME" fi fi if [ ".$NAME" = . -o ".$NAME" = .unknown ]; then if [ ".$PREFIX" != . -a ".$PREFIX" != .unknown ]; then NAME="$PREFIX" fi fi # determine version date=unknown version=0 revision=0 bplevel=0 if [ ".$FULLVERSION" = .unknown ]; then if [ -r "$FILE" ]; then # grep out current information id=`grep 'Version [0-9]*.[0-9]*[.abps][0-9]* ([0-9]*-[a-zA-Z]*-[0-9]*)' $FILE | \ head -1 | \ sed -e 's%.*Version \([0-9]*\)\.\([0-9]*\)\([.abps]\)\([0-9]*\) (\([0-9]*-[a-zA-Z]*-[0-9]*\)).*%\1:\2:\3:\4:\5%'` version=`echo $id | awk -F: '{ print $1 }'` revision=`echo $id | awk -F: '{ print $2 }'` bptype=`echo $id | awk -F: '{ print $3 }'` bplevel=`echo $id | awk -F: '{ print $4 }'` date=`echo $id | awk -F: '{ print $5 }'` if [ .$REPORT = .NO ]; then case $INCREASE in b ) bplevel=`expr $bplevel + 1` bptype=b ;; a ) bplevel=`expr $bplevel + 1` bptype=a ;; s ) bplevel=`expr $bplevel + 1` bptype=s ;; P ) bplevel=`expr $bplevel + 1` bptype=. ;; p ) bplevel=`expr $bplevel + 1` bptype=p ;; r ) revision=`expr $revision + 1` bptype=. bplevel=0 ;; v ) version=`expr $version + 1` revision=0 bptype=. bplevel=0 ;; esac date=calc fi FULLVERSION="$version.$revision$bptype$bplevel" else # intialise to first version version=0 revision=5 bptype=b bplevel=0 date=calc fi else # take given version V=`echo $FULLVERSION | sed -e 's%\([0-9]*\)\.\([0-9]*\)\([.abps]\)\([0-9]*\).*%\1:\2:\3:\4%'` version=`echo $V | awk -F: '{ print $1 }'` revision=`echo $V | awk -F: '{ print $2 }'` bptype=`echo $V | awk -F: '{ print $3 }'` bplevel=`echo $V | awk -F: '{ print $4 }'` date=calc fi # determine hex value of version case $FULLVERSION in *.*a* ) HEX=`echo "$FULLVERSION" | sed -e 's/a.*//' | awk -F. '{ printf("%d%02d", $1, $2); }' && echo "$FULLVERSION" | sed -e 's/.*a//' | awk '{ printf("0%02d", $1); }'` ;; *.*b* ) HEX=`echo "$FULLVERSION" | sed -e 's/b.*//' | awk -F. '{ printf("%d%02d", $1, $2); }' && echo "$FULLVERSION" | sed -e 's/.*b//' | awk '{ printf("1%02d", $1); }'` ;; *.*.* ) HEX=`echo "$FULLVERSION" | awk -F. '{ printf("%d%02d2%02d", $1, $2, $3); }'` ;; esac # determine libtool version case $FULLVERSION in *.*a* ) LTV=`echo "$FULLVERSION" | sed -e 's/a.*//' | awk -F. '{ printf("%d:0", $1*10+$2); }'` ;; *.*b* ) LTV=`echo "$FULLVERSION" | sed -e 's/b.*//' | awk -F. '{ printf("%d:0", $1*10+$2); }'` ;; *.*.* ) LTV=`echo "$FULLVERSION" | awk -F. '{ printf("%d:%d", $1*10+$2, $3); }'` ;; esac # determine string out of filename # (don't try to optimize this in any way - portability!) FILESTR=`echo "$FILE" |\ tr 'abcdefghijklmnopqrstuvwxyz./%+' \ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ____' | sed -e 's/-/_/g'` # determine date if [ ".$date" = .calc ]; then day=`date '+%d'` month=`date '+%m'` year=`date '+%Y' 2>/dev/null` if [ ".$time_year" = . ]; then year=`date '+%y'` case $year in [5-9][0-9]) year="19$year" ;; [0-4][0-9]) year="20$year" ;; esac fi case $month in 1|01) month='Jan' ;; 2|02) month='Feb' ;; 3|03) month='Mar' ;; 4|04) month='Apr' ;; 5|05) month='May' ;; 6|06) month='Jun' ;; 7|07) month='Jul' ;; 8|08) month='Aug' ;; 9|09) month='Sep' ;; 10) month='Oct' ;; 11) month='Nov' ;; 12) month='Dec' ;; esac date="${day}-${month}-${year}" fi if [ .$REPORT != .NO ]; then case $REPORT in long ) echo "$version.$revision$bptype$bplevel ($date)" ;; short ) echo "$version.$revision$bptype$bplevel" ;; libtool ) echo "$LTV" ;; hex ) echo "0x$HEX" ;; esac rm -f $tmpfile >/dev/null 2>&1 exit 0 fi # create the version file according the the selected language echo "new version: $version.$revision$bptype$bplevel ($date)" case $LANGUAGE in txt ) cat >$tmpfile <<'EOT' This is @NAME@, Version @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ (@DAY@-@MONTH@-@YEAR@) EOT ;; c ) cat >$tmpfile <<'EOT' /* ** @FILE@ -- Version Information ** [automatically generated and maintained by shtool] */ #ifdef _AS_HEADER #ifndef _@FILESTR@ #define _@FILESTR@ #define @PREFIX@_VERSION 0x@HEX@ extern const int @PREFIX@_Version; extern const char @PREFIX@_VersionStr[]; extern const char @PREFIX@_Hello[]; extern const char @PREFIX@_GNUVersion[]; extern const char @PREFIX@_WhatID[]; extern const char @PREFIX@_RCSIdentID[]; extern const char @PREFIX@_WebID[]; extern const char @PREFIX@_PlainID[]; #endif /* _@FILESTR@ */ #else const int @PREFIX@_Version = 0x@HEX@; const char @PREFIX@_VersionStr[] = "@VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ (@DAY@-@MONTH@-@YEAR@)"; const char @PREFIX@_Hello[] = "This is @NAME@, Version @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ (@DAY@-@MONTH@-@YEAR@)"; const char @PREFIX@_GNUVersion[] = "@NAME@ Version @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@"; const char @PREFIX@_WhatID[] = "@(#)@NAME@ Version @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ (@DAY@-@MONTH@-@YEAR@)"; const char @PREFIX@_RCSIdentID[] = "$Id: shtool 1.1 Tue, 27 Jan 2004 11:46:36 -0800 shawnw $"; const char @PREFIX@_WebID[] = "@NAME@/@VERSION@.@REVISION@@BPTYPE@@BPLEVEL@"; const char @PREFIX@_PlainID[] = "@VERSION@.@REVISION@@BPTYPE@@BPLEVEL@"; #endif EOT ;; perl ) cat >$tmpfile <<'EOT' ## ## @FILE@ -- Version Information ## [automatically generated and maintained by shtool] ## $@PREFIX@_Version = 0x@HEX@; $@PREFIX@_VersionStr = "@VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ (@DAY@-@MONTH@-@YEAR@)"; $@PREFIX@_Hello = "This is @NAME@, Version @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ (@DAY@-@MONTH@-@YEAR@)"; $@PREFIX@_GNUVersion = "@NAME@ Version @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@"; $@PREFIX@_WhatID = "@(#)@NAME@ Version @VERSION@.@REVISION@@BPTYPE@@BPLEVEL@ (@DAY@-@MONTH@-@YEAR@)"; $@PREFIX@_RCSIdentID = "\$Id: shtool 1.1 Tue, 27 Jan 2004 11:46:36 -0800 shawnw $/"; $@PREFIX@_WebID = "@NAME@/@VERSION@.@REVISION@@BPTYPE@@BPLEVEL@"; $@PREFIX@_PlainID = "@VERSION@.@REVISION@@BPTYPE@@BPLEVEL@"; 1; EOT ;; esac # now create the version file rm -f $FILE >/dev/null 2>&1 sed \ -e "s|@FILE@|$FILE|g" \ -e "s|@FILESTR@|$FILESTR|g" \ -e "s|@PREFIX@|$PREFIX|g" \ -e "s|@NAME@|$NAME|g" \ -e "s|@HEX@|$HEX|g" \ -e "s|@VERSION@|$version|g" \ -e "s|@REVISION@|$revision|g" \ -e "s|@BPTYPE@|$bptype|g" \ -e "s|@BPLEVEL@|$bplevel|g" \ -e "s|@YEAR@|$year|g" \ -e "s|@MONTH@|$month|g" \ -e "s|@DAY@|$day|g" <$tmpfile >$FILE rm -f $tmpfile >/dev/null 2>&1 exit 0 ;; path ) ## ## path -- Deal with program paths ## Copyright (c) 1998-1999 Ralf S. Engelschall ## Originally written for Apache ## namelist="$*" # check whether the test command supports the -x option cat >$tmpfile </dev/null; then minusx="-x" else minusx="-r" fi rm -f $tmpfile # split path string paths="`echo $opt_p |\ sed -e 's/^:/.:/' \ -e 's/::/:.:/g' \ -e 's/:$/:./' \ -e 's/:/ /g'`" # SPECIAL REQUEST # translate forward to reverse path if [ ".$opt_r" = .yes ]; then if [ "x$namelist" = "x." ]; then rp='.' else rp='' for pe in `IFS="$IFS/"; echo $namelist`; do rp="../$rp" done fi echo $rp | sed -e 's:/$::' exit 0 fi # SPECIAL REQUEST # strip out directory or base name if [ ".$opt_d" = .yes ]; then echo "$namelist" |\ sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' exit 0 fi if [ ".$opt_b" = .yes ]; then echo "$namelist" |\ sed -e 's;.*/\([^/]*\)$;\1;' exit 0 fi # MAGIC SITUATION # Perl Interpreter (perl) if [ ".$opt_m" = .yes ] && [ ".$namelist" = .perl ]; then rm -f $tmpfile touch $tmpfile c=0 found=0 for dir in $paths; do dir=`echo $dir | sed -e 's;/*$;;'` for perl in perl5 perl miniperl; do if [ $minusx "$dir/$perl" ]; then perl="$dir/$perl" version=`$perl -v | grep version |\ sed -e 's/.* version //' -e 's/ built.*//' -e 's/ with.*//'` versionnum="`echo $version | sed -e 's/\.//g' -e 's/_//g'`" versionnum=`expr $versionnum - $c` echo "$versionnum $perl" >>$tmpfile found=1 fi done c=`expr $c + 1` done if [ $found = 1 ]; then perl="`cat $tmpfile | sort -u | tail -1 | cut '-d ' -f2`" rm -f $tmpfile echo "$perl" exit 0 fi exit 1 fi # MAGIC SITUATION # C pre-processor (cpp) if [ ".$opt_m" = .yes ] && [ ".$namelist" = .cpp ]; then cat >$tmpfile.c < Syntax Error EOT # 1. try the standard cc -E approach cpp="${CC-cc} -E" (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out my_error=`grep -v '^ *+' $tmpfile.out` if [ ".$my_error" != . ]; then # 2. try the cc -E approach and GCC's -traditional-ccp option cpp="${CC-cc} -E -traditional-cpp" (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out my_error=`grep -v '^ *+' $tmpfile.out` if [ ".$my_error" != . ]; then # 3. try a standalone cpp command in path and lib dirs for path in $paths /lib /usr/lib /usr/local/lib; do path=`echo $path | sed -e 's;/*$;;'` if [ $minusx "$path/cpp" ] && [ ! -d "$path/cpp" ]; then cpp="$path/cpp" break fi done if [ ".$cpp" != . ]; then (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out my_error=`grep -v '^ *+' $tmpfile.out` if [ ".$my_error" != . ]; then # ok, we gave up... cpp='' fi fi fi fi rm -f $tmpfile.c $tmpfile.out if [ ".$cpp" != . ]; then echo "$cpp" exit 0 fi exit 1 fi # STANDARD SITUATION # iterate over names for name in $namelist; do # iterate over paths for path in $paths; do path=`echo $path | sed -e 's;/*$;;'` if [ $minusx "$path/$name" ] && [ ! -d "$path/$name" ]; then if [ ".$opt_s" != .yes ]; then echo "$path/$name" 2>&1 fi exit 0 fi done done exit 1 ;; esac exit 0 ##EOF## MLpcap-0.9/etc/shtool.10100644000175000017500000011327610053475546012545 0ustar x25x25.rn '' }` ''' $RCSfile: shtool.1,v $$Revision: 1.1 $$Date: Tue, 27 Jan 2004 11:46:36 -0800 $ ''' ''' $Log: shtool.1,v $ ''' Revision 1.1.1.1 1999/11/20 21:55:28 lindig ''' imported ''' ''' Revision 1.2 1999/07/24 19:22:15 lindig ''' ''' ''' D: Makefile Makefile.ocaml - now generated by Autoconf ''' A: *.in install-sh for GNU autoconf support ''' A: etc/shtool for portable make install ''' ''' Revision 1.1.2.1 1999/07/18 11:34:54 lindig ''' ''' ''' A: Configuation with GNU autoconf added ''' D: Makefile and Makefile.in are now generated from *.in files through autoconf ''' A: shtool for porable shell operations ''' ''' Revision 1.1 1999/07/18 08:08:30 lindig ''' ''' ''' A: GNU Shtool for portable shell operations ''' ''' .de Sh .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp .if t .sp .5v .if n .sp .. .de Ip .br .ie \\n(.$>=3 .ne \\$3 .el .ne 3 .IP "\\$1" \\$2 .. .de Vb .ft CW .nf .ne \\$1 .. .de Ve .ft R .fi .. ''' ''' ''' Set up \*(-- to give an unbreakable dash; ''' string Tr holds user defined translation string. ''' Bell System Logo is used as a dummy character. ''' .tr \(*W-|\(bv\*(Tr .ie n \{\ .ds -- \(*W- .ds PI pi .if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch .if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch .ds L" "" .ds R" "" ''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of ''' \*(L" and \*(R", except that they are used on ".xx" lines, ''' such as .IP and .SH, which do another additional levels of ''' double-quote interpretation .ds M" """ .ds S" """ .ds N" """"" .ds T" """"" .ds L' ' .ds R' ' .ds M' ' .ds S' ' .ds N' ' .ds T' ' 'br\} .el\{\ .ds -- \(em\| .tr \*(Tr .ds L" `` .ds R" '' .ds M" `` .ds S" '' .ds N" `` .ds T" '' .ds L' ` .ds R' ' .ds M' ` .ds S' ' .ds N' ` .ds T' ' .ds PI \(*p 'br\} .\" If the F register is turned on, we'll generate .\" index entries out stderr for the following things: .\" TH Title .\" SH Header .\" Sh Subsection .\" Ip Item .\" X<> Xref (embedded .\" Of course, you have to process the output yourself .\" in some meaninful fashion. .if \nF \{ .de IX .tm Index:\\$1\t\\n%\t"\\$2" .. .nr % 0 .rr F .\} .TH shtool 3 "02-Jul-1999" "shtool 1.4.0" "GNU Portable Shell Tool" .UC .if n .hy 0 .if n .na .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .de CQ \" put $1 in typewriter font .ft CW 'if n "\c 'if t \\&\\$1\c 'if n \\&\\$1\c 'if n \&" \\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 '.ft R .. .\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 . \" AM - accent mark definitions .bd B 3 . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds ? ? . ds ! ! . ds / . ds q .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' . ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' . ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] .ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' .ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' .ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E .ds oe o\h'-(\w'o'u*4/10)'e .ds Oe O\h'-(\w'O'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds v \h'-1'\o'\(aa\(ga' . ds _ \h'-1'^ . ds . \h'-1'. . ds 3 3 . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE . ds oe oe . ds Oe OE .\} .rm #[ #] #H #V #F C .SH "NAME" \fBGNU shtool\fR \- The GNU Portable Shell Tool .SH "VERSION" 1.4.0 (02-Jul-1999) .SH "SYNOPSIS" \fBshtool\fR [ \fIglobal_options\fR ] \fIcommand\fR [ \fIcommand_options\fR ] [ \fIcommand_args\fR ] .SH "DESCRIPTION" The \fBGNU shtool\fR program is a compilation of small but very stable and portable shell scripts into a single shell tool. All ingredients were in successful use over many years in various free software projects. The compiled \fBshtool\fR program is intended to be used inside the source tree of those free software packages. There it can take over various (usually non-portable) tasks related to the building and installation of such packages. .Sh "Context Background" For the configuration, build and installation environment of modern free software packages one nowadays uses \s-1GNU\s0 \fBautoconf\fR and friends (i.e. usually \fBautoconf\fR, \fBautomake\fR and \fBlibtool\fR). \fBAutoconf\fR covers the configuration, \fBautomake\fR covers the generation of the build environment and \fBlibtool\fR covers most of the build process itself. But at least when it comes to the installation step one usually have to use a few auxiliary scripts like \f(CWmkdir.sh\fR, \f(CWinstall.sh\fR, etc. And these things are usually all the time needed. The result is usually an \f(CWetc/\fR subdirectory in the source tree where over time a lot shell scripts accumulate. .Sh "Maintainance Problem" The problem with those \f(CWetc/\fR shell scripts starts when one has to maintain \fIlots\fR of free software packages as it's the case for the author of \fBshtool\fR. Then over time all \f(CWetc/\fR directories diverge and with every day it gets more and more nasty to always keep them in sync. Especially when some scripts were locally adjusted because no centralized maintainance location exists, of course. For \fBautoconf\fR no such problem exists, because the resulting \f(CWconfigure\fR script is generated on-the-fly. The same applies to \fBautomake\fR and the various \f(CWMakefiles\fR. .PP Only for \fBlibtool\fR one always has to grab the latest copy. But because it's just two files (\f(CWltmain.sh\fR and \f(CWltconfig\fR), keeping a source trees in sync is not too complicated (especially not when using \f(CWlibtoolize\fR). But the \f(CWetc/\fR shell script mess is nasty, especially because there is no master version on the net. Additionally everytime one starts a new project, one has to establish a new source tree. For a hacker it's immediately clear that \fBautoconf\fR and friends are part of the game. But which \f(CWetc/\fR shell scripts are needed this time? And from which existing source tree to copy them from? Hmmm... .Sh "The Aesthetic Problem" When a free software package has a large source tree (say, more than 50 files and especially with one or more subdirectories) it's usually no problem to have an additional \f(CWetc/\fR subdirectory with some scripts. They then totally go down. But for smaller packages, especially those living in a single source directory (a degenerated tree), some people like the author of \fBshtool\fR have aesthetic problems. Because it looks strange to them that 20% of the files in the source tree are just auxiliary scripts. Sure, the actual amount of script code even \fBshtool\fR cannot reduce, but \fBshtool\fR merges them together into a single file and this way they optically totally disappear from the source tree. .PP This is a pure aesthetical issue, of course. But hey, hacking is a piece of art. And a source tree is a piece of art for hackers, too. Oh, and those who insist on a technical reason: it's also easier to upgrade a single file than multiple files ;) .Sh "Filling the gap" So, wouldn't it be nice to have a fourth package (beside \fBautoconf\fR, \fBautomake\fR and \fBlibtool\fR) which fills the gap, i.e. which provides the functionality of the old files in \f(CWetc/\fR, is maintained externally and at a centralized location and even consists of just a single (perhaps large) script one can overtake as a black box the same way one already does this for \fBlibtool\fR? The author thought this \fIwould\fR be actually very useful and the result is the current \fBshtool\fR package which at least successfully solved the above problems of the author. .Sh "The goals in detail" To better understand the intentions behind \fBshtool\fR, here are the original goals of the \fBshtool\fR script: .Ip "\fB1. It has to be self-contained and reside in a single file\fR" 3 This was achieved by compiling the resulting \fBshtool\fR script out of the ingredient source scripts. The advantage is that \fBshtool\fR is still easily maintainable, because one can test each script seperately. But the final functionality then resides in an all-in-one script which can be easily spread over multiple source trees. .Ip "\fB2. It has to cover all functionality of the old scripts\fR" 3 This was achieved by (re)implementing really all functionality which experience showed is important in source trees of typical free software packages. .Ip "\fB3. It has to be maximum portable over all Unix flavors\fR" 3 This was achieved by using only well-proven shell code which already survived practice in other projects over more than a few months. Especially this means that a lot of complicated emulations are done to avoid the use of unportable Unix programs (like \f(CWfmt\fR, \f(CWtr\fR, etc) or unportable features of well-known Unix programs (like shell functions, special \f(CWsed\fR features, etc. pp). That's why \fBshtool\fR's code sometimes looks crazy and like overkill. But it's often this way mainly for portability reasons. .Ip "\fB4. It has to be clean and fully documented\fR" 3 This was achieved by reimplementing too ugly functionality from scratch and cleaning up old shell script code plus writing this manual page. .Ip "\fB5. It has to stay under a reasonable and common license\fR" 3 This was achieved by placing the \fBshtool\fR package under the \s-1GNU\s0 General Public License (\s-1GPL\s0). This way the \fBshtool\fR package itself is well protected and will always be free software, but the resulting \fBshtool\fR script can be nevertheless \fIused\fR in \fIall\fR types of source trees. Notice here: given that one includes \s-1GNU\s0 \fBshtool\fR verbatim into an own source tree, one is justified in saying that it remains separate from the own package, and that this way one is simply just \fIusing\fR \fBshtool\fR. So, in this situation, there is no requirement that the package itself is licensed under the \s-1GNU\s0 General Public License in order to take advantage of \fBshtool\fR. Keep this in mind ;) .SH "GLOBAL OPTIONS" The following \fIglobal options\fR are available for \fBshtool\fR. Any \fIcommand\fRs are ignored when one of them is present on the \fBshtool\fR command line. .Ip "\fB\-h\fR" 4 Displays a short help page describing the usage of \fBshtool\fR and it's ingredient \fIcommand\fRs in a compact way. .Ip "\fB\-v\fR" 4 Displays the version number of \fBshtool\fR. .SH "COMMANDS" The following \fIcommand\fRs are provided by \fBshtool\fR. They are all called via ``\f(CWshtool\fR \fIcommand\fR'\*(R'. Any trailing \fIcommand_options\fR are specific to the particular \fIcommand\fR. .Ip "\fBecho\fR" 12 \fIecho\fR\|(1) style print command providing special expansion constructs (terminal bold mode, environment details, date) and newline control. .Ip "\fBmdate\fR" 12 Pretty-prints the last modification time of a file or directory. .Ip "\fBtable\fR" 12 Pretty-print a field-sperarated list as a table. .Ip "\fBprop\fR " 12 Display a processing indication though a running propeller. .Ip "\fBmove\fR" 12 \fImv\fR\|(1) style command, but can rename/move multiple files at once and allows source files just to be deleted when contents doesn't change. .Ip "\fBinstall\fR" 12 Install a program, script or datafile in a portable way. .Ip "\fBmkdir\fR" 12 \fImkdir\fR\|(1) style command providing support for auto-parent-dir creation, directory permission control and smart skipping when directory already exists. .Ip "\fBmkln\fR" 12 \fIln\fR\|(1) style command providing automatic calculation and usage of relative links when possible. .Ip "\fBmkshadow\fR" 12 Create a shadow source tree by the help of symbolic links. .Ip "\fBfixperm\fR" 12 Fix file permissions inside a source tree by cleaning up the permission bits. .Ip "\fBguessos\fR" 12 Simple operating system and platform architecture guesser which determines a \s-1GNU\s0 \fIplatform-triple\fR style identification string. .Ip "\fBarx\fR" 12 Extended archive command which can even put existing archives into an archive. .Ip "\fBslo\fR" 12 Separate linker options by library class. .Ip "\fBscpp\fR" 12 An additional C source file pre-processor for sharing \fIcpp\fR\|(1) code, internal variables and internal functions. .Ip "\fBversion\fR" 12 Generate and maintain a version information file in either text, C or Perl format. .Ip "\fBpath\fR" 12 Deal with shell path variables. .SH "COMMAND DESCRIPTION" In the following the available \fIcommands\fR and their corresponding \fIcommand_options\fR are described in detail. .Ip "\fBecho\fR [\fB\-n\fR] [\fB\-e\fR] \fIstr\fR" 4 This is an \fIecho\fR\|(1) style print command which provides special expansion constructs (terminal bold mode, environment details, date) and newline control. Per default \fIstring\fR is written to \fIstdout\fR followed by a newline character (``\f(CW\en\fR''). When option ``\fB\-n\fR'\*(R' is used this newline character is left out. .Sp The \fIstr\fR can contain special ``\fB%\fR\fIx\fR'\*(R' constructs which which are expanded before the output is written when option ``\fB\-e\fR'\*(R' is used. Currently the following constructs are recognized: ``\fB%B\fR'\*(R' for switching to terminal bold mode, ``\fB%b\fR'\*(R' for switching terminal mode back to normal display mode, ``\fB%u\fR'\*(R' for the current user name, ``\fB%U\fR'\*(R' for the current user id (numerical), ``\fB%h\fR'\*(R' for the current hostname, ``\fB%d\fR'\*(R' for the current domain name, ``\fB%D\fR'\*(R' for the current day of the month, ``\fB%M\fR'\*(R' for the current month (numerical), ``\fB%m\fR'\*(R' for the current month name and ``\fB%Y\fR'\*(R' for the current year. .Sp The trick of this command is that it provides a portable ``\fB\-n\fR'\*(R' option and hides the gory details needed to find out the environment details. .Sp Examples: .Sp .Vb 4 \& # shell script \& shtool echo -n -e "Enter your name [%B%u%b]: "; read name \& shtool echo -e "Your Email address might be %u@%h%d" \& shtool echo -e "The current date is %D-%m-%Y" .Ve .Ip "\fBmdate\fR [\fB\-n\fR] [\fB\-z\fR] [\fB\-s\fR] [\fB\-d\fR] [\fB\-f\fR \fIstr\fR] [\fB\-o\fR \fIspec\fR] \fIpath\fR" 4 This command pretty-prints the last modification time of a file or directory \fIpath\fR. Option ``\fB\-n\fR'\*(R' suppresses the output of a trailing newline character, option ``\fB\-z\fR'\*(R' pads numeric day (and optionally month) with a leading zero, option ``\fB\-s\fR'\*(R' shortens the months name to an abbreviation of three characters, option ``\fB\-d\fR'\*(R' replaces the month name with the corresponding digits, option ``\fB\-f\fR'\*(R' uses \fIstr\fR as the field separator (default is a single space character) and option ``\fB\-o\fR'\*(R' specified the order in which the fields are printed. .Sp The default for \fIspec\fR is ``\f(CWdmy\fR'\*(R' which means an output of `` '\*(R'. Any combination of the chars ``\f(CWd\fR'\*(R', ``\f(CWm\fR'\*(R' and ``\f(CWy\fR'\*(R' or allowed for \fIspec\fR. .Sp The trick of this command is that it provides a portable way to find out the date of a file or directory while still allowing one to specify the format of the date display. .Sp Examples: .Sp .Vb 4 \& # shell script \& shtool mdate -n / \& shtool mdate -f '/' -z -d -o ymd foo.txt \& shtool mdate -f '-' -s foo.txt .Ve .Ip "\fBtable\fR [\fB\-F\fR \fIsep\fR] [\fB\-w\fR \fIwidth\fR] [\fB\-c\fR \fIcols\fR] [\fB\-s\fR \fIstrip\fR] \fIstr\fR\fBsep\fR\fIstr\fR..." 4 This pretty-prints a \fIsep\fR\-sperarated list of \fIstr\fRings as a table. Per default a colon-seperated list (\fIsep\fR=":") is pretty printed as a three-column (=3) table no longer than 79 chars (\fIstrip\fR=79) is generated where each column is 15 characters wide (\fIwidth\fR=15). .Sp The trick of this command is that it avoids to use the unportable \fItr\fR\|(1) and \fIfmt\fR\|(1) commands and instead is based entirely on \fIsh\fR\|(1), \fIawk\fR\|(1) and \fIsed\fR\|(1) functionality. .Sp Example: .Sp .Vb 2 \& # shell script \& shtool table -F , -w 5 -c 4 "1,2,3,4,5,6,7,8,9,10,11,12" .Ve .Ip "\fBprop\fR [\fB\-p\fR \fIstr\fR]" 4 This command displays a processing indication though a running propeller. The option ``\fB\-p\fR'\*(R' can be used to set a particular prefix \fIstr\fR which is displayed in front of the propeller. The default is no prefix string, i.e. the propeller is at the left border of the terminal. This command is intended to be run at the end of a pipe (``\f(CW|\fR'') sequence where on \f(CWstdin\fR logging/processing informations found. For every line on \f(CWstdin\fR the propeller cycles one step clock-wise. .Sp The trick of this command is that it provides a portable and easy to use way to display such nice and psychologically important process indicators. .Sp Example: .Sp .Vb 4 \& # shell script \& configure 2>&1 |\e \& tee logfile |\e \& shtool prop -p "Configuring sources" .Ve .Ip "\fBmove\fR [\-v] [\-t] [\-e] [\-p] \fIsrc-file\fR \fIdst-file\fR" 4 This is a \fImv\fR\|(1) style command, but with two special features: First when option ``\fB\-e\fR'\*(R' (`expand') is used and an asterisk occurs somewhere in \fIsrc\fR one can use ``\f(CW%\fR\fIn\fR'\*(R' (where \fIn\fR is \f(CW1\fR,\f(CW2\fR,...) in \fIdst-file\fR. This is useful for renaming multiple files at once. Second, when option ``\fB\-p\fR'\*(R' (for `preserve') is used and \fIsrc-file\fR and \fIdst-file\fR are byte-wise the same it just deletes \fIsrc-file\fR. The intention is that the permissions and time stamps on \fIdst\fR are't changed which is important when \fIdst-file\fR is used in conjunction with Makefiles. Option ``\fB\-v\fR'\*(R' (verbose) can be used to enable the output of extra processing information. Option ``\fB\-t\fR'\*(R' (trace) can be used to enable the output of the essential shell commands which are executed. .Sp The trick of this command is that it can rename multiple files at once and preserves the timestamps when the contents isn't changed. .Sp Examples: .Sp .Vb 2 \& # shell script \& shtool move -v -e *.txt %1.asc .Ve .Vb 4 \& # Makefile \& scanner.c: scanner.l \& lex scanner.l \& shtool move -t -p lex.yy.c scanner.c .Ve .Ip "\fBinstall\fR [\fB\-v\fR] [\fB\-t\fR] [\fB\-c\fR] [\fB\-C\fR] [\fB\-s\fR] [\fB\-m\fR \fImode\fR] [\fB\-o\fR \fIowner\fR] [\fB\-g\fR \fIgroup\fR] [\fB\-e\fR \fIext\fR] \fIpath\fR" 4 This command installs a program, script or datafile (dependent on \fImode\fR) in a portable way while providing all important options of the \s-1BSD\s0 \fIinstall\fR\|(1) command. Per default \fIfile\fR is moved to the target \fIpath\fR, but with option ``\fB\-c\fR'\*(R' \fIfile\fR is copied. The target file is created with owner/group set to the current active uid/gid, but when this script is called as root (uid 0) the options ``\fB\-o\fR'\*(R' and ``\fB\-g\fR'\*(R' can be used to override this. .Sp Additionally program executables is stripped with \fIstrip\fR\|(1) after installation when option ``\fB\-s\fR'\*(R' is used. Option ``\fB\-C\fR'\*(R' is like ``\fB\-c\fR'\*(R', except if the destination file already exists and the files are the same, the source is just removed. Option ``\fB\-e\fR'\*(R' can be used to set an implicit executable extension. Option ``\fB\-v\fR'\*(R' (verbose) can be used to enable the output of extra processing information. Option ``\fB\-t\fR'\*(R' (trace) can be used to enable the output of the essential shell commands which are executed. .Sp The trick of this command is that it provides the functionality of \s-1BSD\s0 \fIinstall\fR\|(1) in a portable emulated way. .Sp Example: .Sp .Vb 5 \& # Makefile \& install: \& : \& shtool install -c -s -m 4755 foo $(bindir)/ \& shtool install -c -m 644 foo.man $(mandir)/man1/foo.1 .Ve .Ip "\fBmkdir\fR [\fB\-t\fR] [\fB\-f\fR] [\fB\-p\fR] [\fB\-m\fR \fImode\fR] \fIdir\fR [\fIdir\fR ...]" 4 This is a \fImkdir\fR\|(1) style command providing support for auto-parent-dir creation (when option ``\fB\-p\fR'\*(R' is used), directory permission control (with option ``\fB\-m\fR \fImode\fR'\*(R' where \fImode\fR can be in any of the formats specified to the \fIchmod\fR\|(1) command) and smart skipping when \fIdir\fR already exists (triggered by the force option ``\fB\-f\fR''). Option ``\fB\-t\fR'\*(R' (trace) can be used to enable the output of the essential shell commands which are executed. .Sp The trick of this command is that it provides both a portable ``\fB\-p\fR'\*(R' functionality and the ability to be smart when the directory already exists which is important for installation procedures. .Sp Example: .Sp .Vb 5 \& # Makefile \& install: \& shtool mkdir -f -p -m 755 $(bindir) \& shtool mkdir -f -p -m 755 $(mandir)/man1 \& : .Ve .Ip "\fBmkln\fR [\fB\-t\fR] [\fB\-f\fR] [\fB\-s\fR] \fIsrc-path\fR [\fIsrc-path\fR ...] \fIdst-path\fR" 4 This is a \fIln\fR\|(1) style command which provides automatic calculation and usage of relative links when possible, i.e. usually when \fIsrc-path\fR and \fIdst-path\fR are not absolute paths or at least they share a common prefix except the root directory (``\f(CW/\fR''). When more than one \fIsrc-path\fR is specified, all of them are linked into \fIdst-path\fR. Options ``\fB\-f\fR'\*(R' and ``\fB\-s\fR'\*(R' are similar to \fIln\fR\|(1), i.e. they force the creation of the link (even when it exists) and create a symbolic link instead of a hard-link. Option ``\fB\-t\fR'\*(R' (trace) can be used to enable the output of the essential ``\f(CWln\fR'\*(R' command which is executed. .Sp The trick of this command is that it tried hard to calculate the paths to get the maximum possible relative paths. .Sp Example: .Sp .Vb 2 \& # shell script \& shtool mkln -s foo/bar baz/quux .Ve .Ip "\fBmkshadow\fR [\fB\-v\fR] [\fB\-t\fR] [\fB\-a\fR] \fIsrc-dir\fR \fIdst-dir\fR" 4 This command creates a shadow tree of \fIsrc-dir\fR under \fIdst-dir\fR by recreating the directory hierarchy of \fIsrc-dir\fR under \fIdst-dir\fR and by creating the files of \fIsrc-dir\fR by linking them into the corresponding directories under \fIdst-dir\fR via symbolic links. When \fIsrc-dir\fR can be reached via relative paths from \fIdst-dir\fR, relative symbolic links are used, too. .Sp Option ``\fB\-v\fR'\*(R' (verbose) can be used to enable some displaying of processing information. Option ``\fB\-t\fR'\*(R' (trace) can be used to display all commands which are executed in order to construct \fIdst-dir\fR. Option ``\fB\-a\fR'\*(R' (all) can be used to really shadow all files and directories in \fIsrc-dir\fR. Per default \s-1CVS\s0 related files and directories, backup files, object files, etc. are not shadowed. .Sp The trick of this is that is provides such a high-level functionality with a single command and hides all gory details. .Sp Example: .Sp .Vb 2 \& # shell script \& shtool mkshadow -v -a . /tmp/shadow .Ve .Ip "\fBfixperm\fR [\fB\-v\fR] [\fB\-t\fR] \fIpath\fR [ \fIpath\fR ... ]" 4 This command fixes file permissions inside a source tree under \fIpath\fR by cleaning up the permission bits. It determines the cleaned up permission from the already set bits. It's intended to be run before a tarball is rolled out of the source tree. Option ``\fB\-v\fR'\*(R' can be used to display some processing information. Option ``\fB\-t\fR'\*(R' (trace) can be used to enable the output of the essential shell commands which are executed. .Sp The trick is that this is more convinient that having to set the permissions manually or with a large file list. .Sp Example: .Sp .Vb 3 \& # Makefile.in \& dist: \& shtool fixperm -v * .Ve .Ip "\fBguessos\fR" 4 This command is a simple operating system and platform architecture guesser which determines a so-called ``\s-1GNU\s0 \fIplatform-triple\fR'\*(R' style identification string ``\fIarch\fR\-\fIhardware\fR\-\fIos\fR\fIosversion\fR'\*(R'. For instance a FreeBSD 3.1 running on a Pentium \s-1II\s0 is identified as ``\f(CWi686-pc-freebsd3.1\fR'\*(R'. When you need a more sophisticated platform guesser, use the \s-1GNU\s0 \f(CWconfig.guess\fR/\f(CWconfig.sub\fR scripts, please. .Sp .Vb 2 \& # configure.in \& OS=`shtool guessos` .Ve .Ip "\fBarx\fR [\fB\-t\fR] [\fB\-C\fR \fIcmd\fR] \fIop\fR \fIarchive\fR \fIfile\fR [\fIfile\fR ...]" 4 This is a wrapper around the archive (``\f(CWar\fR'') tool. It provides the ability to create archives out of existing archives, i.e. when one of \fIfile\fR matches ``\f(CW*.a\fR'\*(R' the archive member files of \fIfile\fR are used instead of \fIfile\fR itself. When option ``\fB\-t\fR'\*(R' (trace) is given \fBarx\fR shows the actually involved shell commands. Option ``\fB\-C\fR'\*(R' can be used to set the ``ar'\*(R' command to \fIcmd\fR. .Sp The trick of this command is the automatic handling of archive members which is especially interesting when one wants to construct a (usually top-level) library archive out of pre-build sub-library archives (usually staying inside subdirs) in a large source tree. .Sp Example: .Sp .Vb 10 \& # Makefile \& AR=ar \& RANLIB=ranlib \& : \& OBJS=foo.o bar.o \& LIBS=baz/libbaz.a quux/libquux.a \& : \& libfoo.a: $(OBJS) $(LIBS) \& shtool arx -C $(AR) rc libfoo.a $(OBJS) $(LIBS) \& $(RANLIB) libfoo.a .Ve .Ip "\fBslo\fR -- \fB\-L\fR\fIdir\fR \fB\-l\fR\fIlib\fR [ \fB\-L\fR\fIdir\fR \fB\-l\fR\fIlib\fR ... ]" 4 This command separates the linker options ``\fB\-L\fR'\*(R' and ``\fB\-l\fR'\*(R' by library class. It's argument line can actually be an abitrary command line where those options are contained. \fBslo\fR parses these two options only and ignores the remaining contents. The result is a trivial shell script on \f(CWstdout\fR which defines six variables containing the ``\fB\-L\fR'\*(R' and ``\fB\-l\fR'\*(R' options sorted by class: .Sp ``\f(CWSLO_DIRS_OBJ\fR'\*(R' and ``\f(CWSLO_LIBS_OBJ\fR'\*(R' contains the ``\fB\-L\fR'\*(R' and ``\fB\-l\fR'\*(R' options of static libraries, ``\f(CWSLO_DIRS_PIC\fR'\*(R' and ``\f(CWSLO_LIBS_PIC\fR'\*(R' contains the ``\fB\-L\fR'\*(R' and ``\fB\-l\fR'\*(R' options of static libraries containing \s-1PIC\s0 ("Position Independent Code") and ``\f(CWSLO_DIRS_DSO\fR'\*(R' and ``\f(CWSLO_LIBS_DSO\fR'\*(R' contains the ``\fB\-L\fR'\*(R' and ``\fB\-l\fR'\*(R' options of shared libraries. .Sp The intent of this seperation is to provide a way between static and shared libraries which is important when one wants to link custom DSOs against libraries, because not all platforms all one to link these DSOs against shared libraries. So one first has to separate out the shared libraries and link the \s-1DSO\s0 only against the static libraries. One can use this command also to just sort the options. .Sp Example: .Sp .Vb 5 \& # configure.in \& LINK_STD="$LDFLAGS $LIBS" \& eval `shtool slo $LINK_STD` \& LINK_DSO="$SLO_DIRS_OBJ $SLO_LIBS_OBJ $SLO_DIRS_PIC $SLO_LIBS_PIC" \& : .Ve .Ip "\fBscpp\fR [\fB\-v\fR] [\fB\-p\fR] [\fB\-o\fR \fIofile\fR] [\fB\-t\fR \fItfile\fR] [\fB\-M\fR \fImark\fR] [\fB\-D\fR \fIdname\fR] [\fB\-C\fR \fIcname\fR] \fIfile\fR [\fIfile\fR ...]" 4 This command is an additional \s-1ANSI\s0 C source file pre-processor for sharing \fIcpp\fR\|(1) code segments, internal variables and internal functions. The intention for this comes from writing libraries in \s-1ANSI\s0 C. Here a common shared internal header file is usually used for sharing information between the library source files. .Sp The operation is to parse special constructs in \fIfile\fRs, generate a few things out of these constructs and insert them at position \fImark\fR in \fItfile\fR by writing the output to \fIofile\fR. Additionally the \fIfile\fRs are never touched or modified. Instead the constructs are removed later by the \fIcpp\fR\|(1) phase of the build process. The only prerequisite is that every \fIfile\fR has a ``\f(CW#include "\fR\fIofile\fR\f(CW"\fR'\*(R' at the top. .Sp This command provides the following features: First it avoids namespace pollution and reduces prototyping efforts for internal symbols by recognizing functions and variables which are defined with the storage class identifier ``\fIcname\fR'\*(R'. For instance when \fIcname\fR is ``intern'\*(R', a function ``\f(CWintern void *foobar(int quux)\fR'\*(R' in one of the \fIfile\fRs is translated into both a ``\f(CW#define foobar __foobar\fR'\*(R' and a ``\f(CWextern void *foobar(int quux);\fR'\*(R' in \fIofile\fR. Additionally a global ``\f(CW#define\fR \fIcname\fR \f(CW/**/\fR'\*(R' is also created in \fIofile\fR to let the compiler silently ignore this additional storage class identifier. .Sp Second, the library source files usually want to share \f(CWtypedef\fRs, \f(CW#define\fRs, etc. over the source file boundaries. To achieve this one can either place this stuff manually into \fItfile\fR or use the second feature of \fBscpp\fR: All code in \fIfile\fRs encapsulated with ``\f(CW#if \fR\fIdname\fR ... \f(CW#endif\fR'\*(R' is automatically copied to \fIofile\fR. Additionally a global ``\f(CW#define\fR \fIdname\fR \f(CW0\fR'\*(R' is also created in \fIofile\fR to let the compiler silently skip this parts (because it was already found in the header). .Sp Option ``\fB\-v\fR'\*(R' can be used to enable some processing output. Option ``\fB\-p\fR'\*(R' can be used to make the decision whether to overwrite \fIofile\fR independent of the generated ``#line'\*(R' lines. This is useful for Makefiles when the real contents of \fIofile\fR will not change, just line numbers. .Sp Example: .Sp .Vb 5 \& # Makefile \& SRCS=foo_bar.c foo_quux.c \& foo_p.h: foo_p.h.in \& shtool scpp -o foo_p.h -t foo_p.h.in \e \& -M %%MARK%% -D cpp -C intern $(SRCS) .Ve .Vb 5 \& /* foo_p.h.in */ \& #ifndef FOO_P_H \& #define FOO_P_H \& %%MARK%% \& #endif /* FOO_P_H */ .Ve .Vb 11 \& /* foo_bar.c */ \& #include "foo_p.h" \& #if cpp \& #define OURS_INIT 4711 \& #endif \& intern int ours; \& static int myone = 0815; \& intern int bar(void) \& { \& ours += myone; \& } .Ve .Vb 12 \& /* foo_quux.c */ \& #include "foo_p.h" \& int main(int argc, char *argv[]) \& { \& int i; \& ours = OURS_INIT \& for (i = 0; i < 10; i++) { \& bar(); \& printf("ours now %d\en", ours); \& } \& return 0; \& } .Ve .Ip "\fBversion\fR [\fB\-l\fR \fIlang\fR] [\fB\-n\fR \fIname\fR] [\fB\-p\fR \fIprefix\fR] [\fB\-s\fR \fIversion\fR] [\fB\-i\fR \fIknob\fR] [\fB\-d\fR \fItype\fR] \fIfile\fR" 4 This command generates and maintains a version information file \fIfile\fR for program name \fIname\fR in either textual (\fIlang\fR="\f(CWtxt\fR"), \s-1ANSI\s0 C (\fIlang\fR="c") or Perl (\fIlang\fR="perl") language. The version is always described with a triple <\fIversion\fR,\fIrevision\fR,\fIpatch/alpha/beta-level\fR> and is represented by a string which always matches the regular expression ``\f(CW[0-9]+\e.[0-9]+[.abps][0-9]+\fR'\*(R'. When the option ``\fB\-s\fR'\*(R' is given, the contents of \fIfile\fR is overridden with the specified \fIversion\fR. .Sp When option ``\fB\-i\fR'\*(R' is used the version ingredients in \fIfile\fR are updated by adjusting one \fIknob\fR of the version where \fIknob\fR can be one of the following: ``\f(CWa\fR'\*(R', ``\f(CWb\fR'\*(R', ``\f(CWp\fR'\*(R', ``\f(CWP\fR'\*(R' and ``\f(CWs\fR'\*(R' just increase the alpha/beta/patch/snap level by 1 (and set the seperator character between version and the level position). ``\f(CWr\fR'\*(R' increases the revision by 1 and sets the alpha/beta/patch/snap level to 0. ``\f(CWv\fR'\*(R' increases the version by 1 and sets both the revision and alpha/beta/patch/snap level to 0. .Sp When option ``\fB\-d\fR'\*(R' is given the current version in \fIfile\fR is displayed either in short (\fItype\fR="short") or long (\fItype\fR="long") texual format or in a format suitable for use with \s-1GNU\s0 libtool (\fItype\fR="libtool") or in a hexadecimal format (\fItype\fR="hex"). .Sp When no option is given at all, ``\f(CW-i P\fR'\*(R' is assumed. .Sp Example: .Sp .Vb 2 \& # shell script \& shtool version -l c -n FooBar -p foobar -s 1.2b3 version.c .Ve .Vb 3 \& # configure.in \& V=`shtool version -l c -d long version.c` \& echo "Configuring FooBar, Version $V" .Ve .Ip "\fBpath\fR [\fB\-s\fR] [\fB\-r\fR] [\fB\-d\fR] [\fB\-b\fR] [\fB\-m\fR] [\-p \fIpath\fR] \fIstr\fR [\fIstr\fR ...]" 4 This command deals with shell \f(CW$PATH\fR variables. It can find a program executable in \f(CW$PATH\fR or \fIpath\fR through one or more filenames (given by one or more \fIstr\fR arguments). The result is the absolute filesystem path to the program displayed on \f(CWstdout\fR plus an exit code of 0 when it was really found. .Sp The option ``\fB\-s\fR'\*(R' can be used to suppress the output which is useful to just test whether a program exists with the help of the return code. The option ``\fB\-m\fR'\*(R' enables some magic where currently for the programs ``\f(CWperl\fR'\*(R' and ``\f(CWcpp\fR'\*(R' an advanced magic search is done. The option ``\fB\-r\fR'\*(R' can be used to transform a forward path to a subdirectory into a reverse path. Option ``\fB\-d\fR'\*(R' and ``\fB\-b\fR'\*(R' just output the directory or base name of \fIstr\fR. .Sp Examples: .Sp .Vb 5 \& # shell script \& awk=`shtool path -p "${PATH}:." gawk nawk awk` \& perl=`shtool path -m perl5 perl` \& cpp=`shtool path -m cpp` \& revpath=`shtool path -r path/to/subdir` .Ve .SH "SEE ALSO" \fIsh\fR\|(1), \fIcp\fR\|(1), \fIrm\fR\|(1), \fImkdir\fR\|(1), \fIawk\fR\|(1), \fIsed\fR\|(1). .SH "HISTORY" Some scripts contained in \fBshtool\fR were already written in 1994 by \fIRalf S. Engelschall\fR for use inside some private source trees. Then they evolved into more elaborated versions over the years and were used in various free software projects like ePerl, WML, iSelect, gFONT, etc. They were complemented with other scripts from the author which he wrote in March 1998 for the ``Apache Autoconf-style Interface'\*(R' (APACI). In April 1999 the \fBshtool\fR package was created out of the accumulated master versions of the scripts. In June 1999 it finally entered the status of an official GNU program. .SH "AUTHOR" .PP .Vb 3 \& Ralf S. Engelschall \& rse@engelschall.com \& www.engelschall.com .Ve .rn }` '' .IX Title "shtool 3" .IX Name "B - The GNU Portable Shell Tool" .IX Header "NAME" .IX Header "VERSION" .IX Header "SYNOPSIS" .IX Header "DESCRIPTION" .IX Subsection "Context Background" .IX Subsection "Maintainance Problem" .IX Subsection "The Aesthetic Problem" .IX Subsection "Filling the gap" .IX Subsection "The goals in detail" .IX Item "\fB1. It has to be self-contained and reside in a single file\fR" .IX Item "\fB2. It has to cover all functionality of the old scripts\fR" .IX Item "\fB3. It has to be maximum portable over all Unix flavors\fR" .IX Item "\fB4. It has to be clean and fully documented\fR" .IX Item "\fB5. It has to stay under a reasonable and common license\fR" .IX Header "GLOBAL OPTIONS" .IX Item "\fB\-h\fR" .IX Item "\fB\-v\fR" .IX Header "COMMANDS" .IX Item "\fBecho\fR" .IX Item "\fBmdate\fR" .IX Item "\fBtable\fR" .IX Item "\fBprop\fR " .IX Item "\fBmove\fR" .IX Item "\fBinstall\fR" .IX Item "\fBmkdir\fR" .IX Item "\fBmkln\fR" .IX Item "\fBmkshadow\fR" .IX Item "\fBfixperm\fR" .IX Item "\fBguessos\fR" .IX Item "\fBarx\fR" .IX Item "\fBslo\fR" .IX Item "\fBscpp\fR" .IX Item "\fBversion\fR" .IX Item "\fBpath\fR" .IX Header "COMMAND DESCRIPTION" .IX Item "\fBecho\fR [\fB\-n\fR] [\fB\-e\fR] \fIstr\fR" .IX Item "\fBmdate\fR [\fB\-n\fR] [\fB\-z\fR] [\fB\-s\fR] [\fB\-d\fR] [\fB\-f\fR \fIstr\fR] [\fB\-o\fR \fIspec\fR] \fIpath\fR" .IX Item "\fBtable\fR [\fB\-F\fR \fIsep\fR] [\fB\-w\fR \fIwidth\fR] [\fB\-c\fR \fIcols\fR] [\fB\-s\fR \fIstrip\fR] \fIstr\fR\fBsep\fR\fIstr\fR..." .IX Item "\fBprop\fR [\fB\-p\fR \fIstr\fR]" .IX Item "\fBmove\fR [\-v] [\-t] [\-e] [\-p] \fIsrc-file\fR \fIdst-file\fR" .IX Item "\fBinstall\fR [\fB\-v\fR] [\fB\-t\fR] [\fB\-c\fR] [\fB\-C\fR] [\fB\-s\fR] [\fB\-m\fR \fImode\fR] [\fB\-o\fR \fIowner\fR] [\fB\-g\fR \fIgroup\fR] [\fB\-e\fR \fIext\fR] \fIpath\fR" .IX Item "\fBmkdir\fR [\fB\-t\fR] [\fB\-f\fR] [\fB\-p\fR] [\fB\-m\fR \fImode\fR] \fIdir\fR [\fIdir\fR ...]" .IX Item "\fBmkln\fR [\fB\-t\fR] [\fB\-f\fR] [\fB\-s\fR] \fIsrc-path\fR [\fIsrc-path\fR ...] \fIdst-path\fR" .IX Item "\fBmkshadow\fR [\fB\-v\fR] [\fB\-t\fR] [\fB\-a\fR] \fIsrc-dir\fR \fIdst-dir\fR" .IX Item "\fBfixperm\fR [\fB\-v\fR] [\fB\-t\fR] \fIpath\fR [ \fIpath\fR ... ]" .IX Item "\fBguessos\fR" .IX Item "\fBarx\fR [\fB\-t\fR] [\fB\-C\fR \fIcmd\fR] \fIop\fR \fIarchive\fR \fIfile\fR [\fIfile\fR ...]" .IX Item "\fBslo\fR -- \fB\-L\fR\fIdir\fR \fB\-l\fR\fIlib\fR [ \fB\-L\fR\fIdir\fR \fB\-l\fR\fIlib\fR ... ]" .IX Item "\fBscpp\fR [\fB\-v\fR] [\fB\-p\fR] [\fB\-o\fR \fIofile\fR] [\fB\-t\fR \fItfile\fR] [\fB\-M\fR \fImark\fR] [\fB\-D\fR \fIdname\fR] [\fB\-C\fR \fIcname\fR] \fIfile\fR [\fIfile\fR ...]" .IX Item "\fBversion\fR [\fB\-l\fR \fIlang\fR] [\fB\-n\fR \fIname\fR] [\fB\-p\fR \fIprefix\fR] [\fB\-s\fR \fIversion\fR] [\fB\-i\fR \fIknob\fR] [\fB\-d\fR \fItype\fR] \fIfile\fR" .IX Item "\fBpath\fR [\fB\-s\fR] [\fB\-r\fR] [\fB\-d\fR] [\fB\-b\fR] [\fB\-m\fR] [\-p \fIpath\fR] \fIstr\fR [\fIstr\fR ...]" .IX Header "SEE ALSO" .IX Header "HISTORY" .IX Header "AUTHOR" MLpcap-0.9/META0100644000175000017500000000026110053475546011036 0ustar x25x25name="pcap" version="0.8" description="Ocaml bindings to libpcap" requires="" archive(byte) = "pcap.cma" archive(opt) = "pcap.cmxa" linkopts = "-cclib -lpcap -cclib -lcallback" MLpcap-0.9/doc/0040755000175000017500000000000010057151376011132 5ustar x25x25MLpcap-0.9/doc/html/0040755000175000017500000000000010053475546012102 5ustar x25x25MLpcap-0.9/doc/html/style.css0100644000175000017500000000231110053475546013746 0ustar x25x25a:visited {color : #416DFF; text-decoration : none; } a:link {color : #416DFF; text-decoration : none;} a:hover {color : Red; text-decoration : none; background-color: #5FFF88} a:active {color : Red; text-decoration : underline; } .keyword { font-weight : bold ; color : Red } .keywordsign { color : #C04600 } .superscript { font-size : 4 } .subscript { font-size : 4 } .comment { color : Green } .constructor { color : Blue } .type { color : #5C6585 } .string { color : Maroon } .warning { color : Red ; font-weight : bold } .info { margin-left : 3em; margin-right : 3em } .code { color : #465F91 ; } .title1 { font-size : 20pt ; background-color : #909DFF } .title2 { font-size : 20pt ; background-color : #90BDFF } .title3 { font-size : 20pt ; background-color : #90DDFF } .title4 { font-size : 20pt ; background-color : #90EDFF } .title5 { font-size : 20pt ; background-color : #90FDFF } .title6 { font-size : 20pt ; background-color : #C0FFFF } .typetable { border-style : hidden } .indextable { border-style : hidden } .paramstable { border-style : hidden ; padding: 5pt 5pt} body { background-color : White } tr { background-color : White } td.typefieldcomment { background-color : #FFFFFF } pre { margin-bottom: 4px }MLpcap-0.9/doc/html/Pcap.html0100644000175000017500000003204210053475546013651 0ustar x25x25 Pcap

Module Pcap


module Pcap: sig  end

type pcap_handle 
type bpf_program 
type pcap_dumper 
type file_t 

type dlink =
| DLT_NULL
| DLT_EN10MB
| DLT_EN3MB
| DLT_AX25
| DLT_PRONET
| DLT_CHAOS
| DLT_IEEE802
| DLT_ARCNET
| DLT_SLIP
| DLT_PPP
| DLT_FDDI

type timeval = {
   tv_sec : int;
   tv_usec : int;
}
type struct_3 = {
   ts : timeval;
   caplen : int;
   len : int;
}
type pcap_pkthdr = struct_3 

type struct_4 = {
   ps_recv : int;
   ps_drop : int;
   ps_ifdrop : int;
}
type pcap_stat = struct_4 

type struct_5 = {
   name : string;
   description : string;
   flags : int;
}
type pcap_if = struct_5 
type pcap_callback = string -> pcap_pkthdr -> string -> unit 
val pcap_findalldevs : unit -> pcap_if array
val pcap_open_live : string -> int -> int -> int -> pcap_handle
val pcap_close : pcap_handle -> unit
val pcap_lookupdev : unit -> string
val pcap_lookupnet : string -> int * int * int
val pcap_loop : pcap_handle -> int -> pcap_callback -> string -> int
val pcap_dispatch : pcap_handle -> int -> pcap_callback -> string -> int
val pcap_open_dead : int -> int -> pcap_handle
val pcap_open_offline : string -> pcap_handle
val pcap_dump_open : pcap_handle -> string -> pcap_dumper
val pcap_dump_direct : pcap_dumper -> pcap_pkthdr -> string -> unit
val pcap_dump_close : pcap_dumper -> unit
val pcap_compile : pcap_handle -> string -> int -> int -> int * bpf_program
val pcap_setfilter : pcap_handle -> bpf_program -> int
val pcap_freecode : bpf_program -> unit
val pcap_setnonblock : pcap_handle -> int -> int
val pcap_getnonblock : pcap_handle -> int
val pcap_datalink : pcap_handle -> dlink
val pcap_snapshot : pcap_handle -> int
val pcap_is_swapped : pcap_handle -> int
val pcap_major_version : pcap_handle -> int
val pcap_minor_version : pcap_handle -> int
val pcap_stats : pcap_handle -> int * pcap_stat
val pcap_file : pcap_handle -> file_t
val pcap_fileno : pcap_handle -> int
val pcap_perror : pcap_handle -> string -> unit
val pcap_geterr : pcap_handle -> string
val pcap_strerror : int -> string
MLpcap-0.9/doc/html/code_VALPcap.pcap_findalldevs.html0100644000175000017500000000131710053475546020504 0ustar x25x25 Pcap.pcap_findalldevs external pcap_findalldevs : unit -> pcap_if array
        = "camlidl_pcap_pcap_findalldevs"
MLpcap-0.9/doc/html/code_VALPcap.pcap_open_live.html0100644000175000017500000000154310053475546020172 0ustar x25x25 Pcap.pcap_open_live external pcap_open_live : string -> int -> int -> int -> pcap_handle
        = "camlidl_pcap_pcap_open_live"
MLpcap-0.9/doc/html/code_VALPcap.pcap_close.html0100644000175000017500000000126610053475546017321 0ustar x25x25 Pcap.pcap_close external pcap_close : pcap_handle -> unit
        = "camlidl_pcap_pcap_close"
MLpcap-0.9/doc/html/code_VALPcap.pcap_lookupdev.html0100644000175000017500000000127510053475546020224 0ustar x25x25 Pcap.pcap_lookupdev external pcap_lookupdev : unit -> string
        = "camlidl_pcap_pcap_lookupdev"
MLpcap-0.9/doc/html/code_VALPcap.pcap_lookupnet.html0100644000175000017500000000133410053475546020230 0ustar x25x25 Pcap.pcap_lookupnet external pcap_lookupnet : string -> int * int * int
        = "camlidl_pcap_pcap_lookupnet"
MLpcap-0.9/doc/html/code_VALPcap.pcap_loop.html0100644000175000017500000000153610053475546017165 0ustar x25x25 Pcap.pcap_loop external pcap_loop : pcap_handle -> int -> pcap_callback -> string -> int
        = "camlidl_pcap_pcap_loop"
MLpcap-0.9/doc/html/code_VALPcap.pcap_dispatch.html0100644000175000017500000000155210053475546020011 0ustar x25x25 Pcap.pcap_dispatch external pcap_dispatch : pcap_handle -> int -> pcap_callback -> string -> int
        = "camlidl_pcap_pcap_dispatch"
MLpcap-0.9/doc/html/code_VALPcap.pcap_open_dead.html0100644000175000017500000000136610053475546020133 0ustar x25x25 Pcap.pcap_open_dead external pcap_open_dead : int -> int -> pcap_handle
        = "camlidl_pcap_pcap_open_dead"
MLpcap-0.9/doc/html/code_VALPcap.pcap_open_offline.html0100644000175000017500000000131510053475546020652 0ustar x25x25 Pcap.pcap_open_offline external pcap_open_offline : string -> pcap_handle
        = "camlidl_pcap_pcap_open_offline"
MLpcap-0.9/doc/html/code_VALPcap.pcap_dump_open.html0100644000175000017500000000140110053475546020171 0ustar x25x25 Pcap.pcap_dump_open external pcap_dump_open : pcap_handle -> string -> pcap_dumper
        = "camlidl_pcap_pcap_dump_open"
MLpcap-0.9/doc/html/code_VALPcap.pcap_dump_direct.html0100644000175000017500000000147510053475546020515 0ustar x25x25 Pcap.pcap_dump_direct external pcap_dump_direct : pcap_dumper -> pcap_pkthdr -> string -> unit
        = "camlidl_pcap_pcap_dump_direct"
MLpcap-0.9/doc/html/code_VALPcap.pcap_dump_close.html0100644000175000017500000000130510053475546020340 0ustar x25x25 Pcap.pcap_dump_close external pcap_dump_close : pcap_dumper -> unit
        = "camlidl_pcap_pcap_dump_close"
MLpcap-0.9/doc/html/code_VALPcap.pcap_compile.html0100644000175000017500000000156510053475546017646 0ustar x25x25 Pcap.pcap_compile external pcap_compile : pcap_handle -> string -> int -> int -> int * bpf_program
        = "camlidl_pcap_pcap_compile"
MLpcap-0.9/doc/html/code_VALPcap.pcap_setfilter.html0100644000175000017500000000137610053475546020217 0ustar x25x25 Pcap.pcap_setfilter external pcap_setfilter : pcap_handle -> bpf_program -> int
        = "camlidl_pcap_pcap_setfilter"
MLpcap-0.9/doc/html/code_VALPcap.pcap_freecode.html0100644000175000017500000000127710053475546017772 0ustar x25x25 Pcap.pcap_freecode external pcap_freecode : bpf_program -> unit
        = "camlidl_pcap_pcap_freecode"
MLpcap-0.9/doc/html/code_VALPcap.pcap_setnonblock.html0100644000175000017500000000137410053475546020535 0ustar x25x25 Pcap.pcap_setnonblock external pcap_setnonblock : pcap_handle -> int -> int
        = "camlidl_pcap_pcap_setnonblock"
MLpcap-0.9/doc/html/code_VALPcap.pcap_getnonblock.html0100644000175000017500000000130710053475546020515 0ustar x25x25 Pcap.pcap_getnonblock external pcap_getnonblock : pcap_handle -> int
        = "camlidl_pcap_pcap_getnonblock"
MLpcap-0.9/doc/html/code_VALPcap.pcap_datalink.html0100644000175000017500000000130010053475546017770 0ustar x25x25 Pcap.pcap_datalink external pcap_datalink : pcap_handle -> dlink
        = "camlidl_pcap_pcap_datalink"
MLpcap-0.9/doc/html/code_VALPcap.pcap_snapshot.html0100644000175000017500000000127610053475546020054 0ustar x25x25 Pcap.pcap_snapshot external pcap_snapshot : pcap_handle -> int
        = "camlidl_pcap_pcap_snapshot"
MLpcap-0.9/doc/html/code_VALPcap.pcap_is_swapped.html0100644000175000017500000000130410053475546020343 0ustar x25x25 Pcap.pcap_is_swapped external pcap_is_swapped : pcap_handle -> int
        = "camlidl_pcap_pcap_is_swapped"
MLpcap-0.9/doc/html/code_VALPcap.pcap_major_version.html0100644000175000017500000000131510053475546021064 0ustar x25x25 Pcap.pcap_major_version external pcap_major_version : pcap_handle -> int
        = "camlidl_pcap_pcap_major_version"
MLpcap-0.9/doc/html/code_VALPcap.pcap_minor_version.html0100644000175000017500000000131510053475546021100 0ustar x25x25 Pcap.pcap_minor_version external pcap_minor_version : pcap_handle -> int
        = "camlidl_pcap_pcap_minor_version"
MLpcap-0.9/doc/html/code_VALPcap.pcap_stats.html0100644000175000017500000000131310053475546017343 0ustar x25x25 Pcap.pcap_stats external pcap_stats : pcap_handle -> int * pcap_stat
        = "camlidl_pcap_pcap_stats"
MLpcap-0.9/doc/html/code_VALPcap.pcap_file.html0100644000175000017500000000126510053475546017132 0ustar x25x25 Pcap.pcap_file external pcap_file : pcap_handle -> file_t
        = "camlidl_pcap_pcap_file"
MLpcap-0.9/doc/html/code_VALPcap.pcap_fileno.html0100644000175000017500000000127010053475546017463 0ustar x25x25 Pcap.pcap_fileno external pcap_fileno : pcap_handle -> int
        = "camlidl_pcap_pcap_fileno"
MLpcap-0.9/doc/html/code_VALPcap.pcap_perror.html0100644000175000017500000000136110053475546017521 0ustar x25x25 Pcap.pcap_perror external pcap_perror : pcap_handle -> string -> unit
        = "camlidl_pcap_pcap_perror"
MLpcap-0.9/doc/html/code_VALPcap.pcap_geterr.html0100644000175000017500000000127310053475546017502 0ustar x25x25 Pcap.pcap_geterr external pcap_geterr : pcap_handle -> string
        = "camlidl_pcap_pcap_geterr"
MLpcap-0.9/doc/html/code_VALPcap.pcap_strerror.html0100644000175000017500000000127110053475546020072 0ustar x25x25 Pcap.pcap_strerror external pcap_strerror : int -> string
        = "camlidl_pcap_pcap_strerror"
MLpcap-0.9/doc/html/type_Pcap.html0100644000175000017500000000100310053475546014703 0ustar x25x25 Pcap sig  endMLpcap-0.9/doc/html/index.html0100644000175000017500000000126310053475546014076 0ustar x25x25

Index of types
Index of values
Index of modules

Pcap
MLpcap-0.9/doc/html/index_values.html0100644000175000017500000000724410053475546015462 0ustar x25x25 Index of values

Index of values


P
pcap_close [Pcap]
pcap_compile [Pcap]
pcap_datalink [Pcap]
pcap_dispatch [Pcap]
pcap_dump_close [Pcap]
pcap_dump_direct [Pcap]
pcap_dump_open [Pcap]
pcap_file [Pcap]
pcap_fileno [Pcap]
pcap_findalldevs [Pcap]
pcap_freecode [Pcap]
pcap_geterr [Pcap]
pcap_getnonblock [Pcap]
pcap_is_swapped [Pcap]
pcap_lookupdev [Pcap]
pcap_lookupnet [Pcap]
pcap_loop [Pcap]
pcap_major_version [Pcap]
pcap_minor_version [Pcap]
pcap_open_dead [Pcap]
pcap_open_live [Pcap]
pcap_open_offline [Pcap]
pcap_perror [Pcap]
pcap_setfilter [Pcap]
pcap_setnonblock [Pcap]
pcap_snapshot [Pcap]
pcap_stats [Pcap]
pcap_strerror [Pcap]

MLpcap-0.9/doc/html/index_exceptions.html0100644000175000017500000000076110053475546016341 0ustar x25x25 Index of exceptions

Index of exceptions


MLpcap-0.9/doc/html/index_types.html0100644000175000017500000000406010053475546015320 0ustar x25x25 Index of types

Index of types


B
bpf_program [Pcap]

D
dlink [Pcap]

F
file_t [Pcap]

P
pcap_callback [Pcap]
pcap_dumper [Pcap]
pcap_handle [Pcap]
pcap_if [Pcap]
pcap_pkthdr [Pcap]
pcap_stat [Pcap]

S
struct_3 [Pcap]
struct_4 [Pcap]
struct_5 [Pcap]

T
timeval [Pcap]

MLpcap-0.9/doc/html/index_attributes.html0100644000175000017500000000077510053475546016353 0ustar x25x25 Index of class attributes

Index of class attributes


MLpcap-0.9/doc/html/index_methods.html0100644000175000017500000000076710053475546015631 0ustar x25x25 Index of class methods

Index of class methods


MLpcap-0.9/doc/html/index_classes.html0100644000175000017500000000075310053475546015616 0ustar x25x25 Index of classes

Index of classes


MLpcap-0.9/doc/html/index_class_types.html0100644000175000017500000000076310053475546016513 0ustar x25x25 Index of class types

Index of class types


MLpcap-0.9/doc/html/index_modules.html0100644000175000017500000000111210053475546015617 0ustar x25x25 Index of modules

Index of modules


P
Pcap

MLpcap-0.9/doc/html/index_module_types.html0100644000175000017500000000076510053475546016675 0ustar x25x25 Index of module types

Index of module types


MLpcap-0.9/LICENSE0100644000175000017500000006347410056707232011402 0ustar x25x25 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it!