From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bart Veer To: andrew.lunn@ascom.ch Cc: jld@redhat.com, ecos-discuss@sourceware.cygnus.com Subject: Re: [ECOS] serial_devio renamaed to cyg_serial_devio Date: Wed, 14 Jun 2000 04:58:00 -0000 Message-id: <200006141158.MAA16390@sheesh.cygnus.co.uk> References: <200006140925.LAA01558@biferten.ma.tech.ascom.ch> X-SW-Source: 2000-06/msg00140.html >>>>> "Andrew" == Andrew Lunn writes: Andrew> Unfortunally this only works for 1.3.x. 1.2.x does not have the Andrew> version info, just a #define if the package is included. Andrew> My problem is 1.2.x defines Andrew> #define CYGPKG_IO_SERIAL Andrew> and 1.3.x defines Andrew> #define CYGPKG_IO_SERIAL v1_3_5 Andrew> #define CYGPKG_IO_SERIAL_v1_3_5 Andrew> and i want something which says Andrew> #if CYGPKG_IO_SERIAL > v1.2 Andrew> new serial code fragment Andrew> #else Andrew> old serial code fragment Andrew> #endif Andrew> Any ideas anyone? I do not think there is any easy way of achieving this at present. The C preprocessor can only do numerical comparisons. Version numbers can be much more complicated than just a simple number, so trying to use the > or < operators is not going to work. What might be possible is for the configuration tools to generate additional #define's along the lines of: #define CYGPKG_IO_SERIAL v1_3_5 #define CYGPKG_IO_SERIAL_VERSION_MAJOR 1 #define CYGPKG_IO_SERIAL_VERSION_MINOR 3 ... Some other systems like Tcl already do this, updating the exported header file by hand for every release and every snapshot. In the CDL world this could be automated. I am not quite sure what to call the versioning levels after major or minor, there could be any number of these. Also versions may include letters or text, e.g. 1.3.5beta, and attempting to use C preprocessor operators on 5beta will probably give a strange compiler error message. There could also be problems if packages try to define options with those names. Arguably the correct solution is a more powerful C preprocessor, but that is not likely to happen any time soon. Bart