Re: C macro processor - supply exteranl values - emulating CMake
On Mon, Sep 17, 2018 at 10:52 PM Ze'ev Atlas < 004b34e7c98a-dmarc-requ...@listserv.ua.edu> wrote: > Gil, I do NOT use make! I use JCL for this particular port, as it is > designed to be used without Unix Services. > > The fact that your product is designed to work without z/OS Unix is irrelevant. IMO, you are much better off putting your source in zFS and using z/OS make (or even better gmake), makedepend. For a C/C++ project of any size, incremental builds will save you lots of time. The z/OS Unix c89 command can be used as a front end to the z/OS binder and you and target z/OS PDS/PDSE libraries directly, or just "cp -X" the program objects from zFS to PDS/Es. Bonus: this will feel more like your day job on Unix/Windows. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: C macro processor - supply exteranl values - emulating CMake
Gil, I do NOT use make! I use JCL for this particular port, as it is designed to be used without Unix Services. In my day job, I use Solaris, Windows and perhaps Linux and I am well aware about these tools (make, gcc, etc.) although usually I do not use them because I do not use compiled languages that much any more. ZA -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: C macro processor - supply exteranl values - emulating CMake
On Sun, 16 Sep 2018 11:58:14 +, Ze'ev Atlas wrote: >Hi allI am using IBM C compiler via good ol' JCL. I already know how to >supply external macro definitions by supplying://OPTFILE DD >DSN=MY.LIB(OPTFILE),...and an OPTFILE member that contains lines >like:DEF(HAVE_STDINT_H)or evenDEF(HAVE_STDINT_H=1) >I have a new challenge, something like:#define HAVE_STDINT_H >@HAVE_STDINT_H@which means that I should not define the macro externally, but >get only the value from CMake… I do not have CMake and I do not use it since I >run with good ol' JCL. >Is there a way to supply the value only? > On a Linux system, I downloaded and unpacked: curl -fOD - https://ftp.pcre.org/pub/pcre/pcre2-10.32.tar.gz In src/config.h.in I read about several options. In environments that support the GNU autotools, config.h.in is converted into config.h by the "configure" script. In environments that use CMake, config-cmake.in is converted into config.h. If you are going to build PCRE2 "by hand" without using "configure" or CMake, you should copy the distributed config.h.generic to config.h, and edit the macro definitions to be the way you need them. You must then add -DHAVE_CONFIG_H to all of your compile commands, so that config.h is included at the start of every source. Note that CMake is one of the three options, not required. With other products on z/OS, I have had good success using the "autotools" scheme. When I run configure, the line: ../pcre2-10.32/Makefile.in:PCRE2_HAVE_STDINT_H = @PCRE2_HAVE_STDINT_H@ Is transformed to: ../bunsen/Makefile:PCRE2_HAVE_STDINT_H = 1 No need to do a bunch of DEF() or hand editing. Just Read the Instructions, gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: C macro processor - supply exteranl values - emulating CMake
On Sun, 16 Sep 2018 22:33:19 -0500, Ze'ev Atlas wrote: >Thank you Gil >You have confirmed what I suspected since I've seen the code. The developer >has introduced a non-standard code that is compatible only with GNU make. I >have already complained about the issue as introduction of non-standard code >would definitely hamper any port to a non 'make' environment. > We could discuss whether standards, like grammars, should be regarded as prescriptive or descriptive. >What I will probably do is, in my port scripts (I have a whole system to >automate the port, resolve dependencies, etc.), I will add some logic to >replace these values with known external values (from a config file), or spit >an error message when a new, yet unseed such value is introduced. Basically, >mimic the 'make' action in that regard. > That's what configure, not gmake, is supposed to do. Did you run configure? Configure tailors Makefile and one or more header flles to work in a multitude of environments, both standard and nonstandard. The gmake construct that caused me the most problem is VPATH. I simply used gmake which is available from Rocket Ported Tools, I believe. -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: C macro processor - supply exteranl values - emulating CMake
Thank you Gil You have confirmed what I suspected since I've seen the code. The developer has introduced a non-standard code that is compatible only with GNU make. I have already complained about the issue as introduction of non-standard code would definitely hamper any port to a non 'make' environment. What I will probably do is, in my port scripts (I have a whole system to automate the port, resolve dependencies, etc.), I will add some logic to replace these values with known external values (from a config file), or spit an error message when a new, yet unseed such value is introduced. Basically, mimic the 'make' action in that regard. ZA -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: C macro processor - supply exteranl values - emulating CMake
On Sun, 16 Sep 2018 10:39:20 -0700, Charles Mills wrote: >Otherwise I guess you need the classic solution with some character legal in C >macro names: > >#ifdef __MVS__ > #define MACRONAME __macroname__ >#else > #define MACRONAME @macroname@ >#endif > >Looks to me like @ is legal in symbol names, but I could easily be wrong. > Doesn't seem that way: 556 $ gcc --version gcc (Debian 4.9.2-10+deb8u1) 4.9.2 Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 557 $ make foo cc foo.c -o foo foo.c:2:19: error: stray ‘@’ in program #define MACRONAME @macroname@ ^ foo.c:4:5: note: in expansion of macro ‘MACRONAME’ int MACRONAME; ^ foo.c:2:29: error: stray ‘@’ in program #define MACRONAME @macroname@ ^ foo.c:4:5: note: in expansion of macro ‘MACRONAME’ int MACRONAME; ^ However, in an arbitrary "makefile.in": # $LynxId: makefile.in,v 1.118 2011/06/12 18:36:28 tom Exp $ ##makefile for lynx SHELL = @CONFIG_SHELL@ CDPATH = . .SUFFIXES: @SET_MAKE@ prefix = @prefix@ exec_prefix = @exec_prefix@ top_srcdir = @top_srcdir@ srcdir = @srcdir@ builddir= . VPATH = $(srcdir) These "@...@" are replaced when GNU configure filters makefile.in to makefile. Did the OP bypass a configure step? (I'd hate do do all that from JCL.) Mr. Natural sez, Use the right tool for the job. -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: C macro processor - supply exteranl values - emulating CMake
Otherwise I guess you need the classic solution with some character legal in C macro names: #ifdef __MVS__ #define MACRONAME __macroname__ #else #define MACRONAME @macroname@ #endif Looks to me like @ is legal in symbol names, but I could easily be wrong. Charles -Original Message- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Ze'ev Atlas Sent: Sunday, September 16, 2018 10:06 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: C macro processor - supply exteranl values - emulating CMake This seems to be a good idea I will try to do: DEF(@xxx@=1) and see if it works As for Gil's question, yeah it is an open source (PCRE2) that is usually dealt with by gcc and make. If the idea above worls themn I am done ZA -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: C macro processor - supply exteranl values - emulating CMake
I did DEF(@macroname@=1) and it seems not to work. i.e. #define MACRONAME @macroname@ #if MACRONAME ... #else ... #endif did not yield the desired results -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: C macro processor - supply exteranl values - emulating CMake
This seems to be a good idea I will try to do: DEF(@xxx@=1) and see if it works As for Gil's question, yeah it is an open source (PCRE2) that is usually dealt with by gcc and make. If the idea above worls themn I am done ZA -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: C macro processor - supply exteranl values - emulating CMake
What exactly is the problem? Is there some reason you cannot DEF(@macroname@=newvalue) ? Is @ legal is C macro names? Is there an IBM extension to allow it? Charles -Original Message- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Ze'ev Atlas Sent: Sunday, September 16, 2018 7:35 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: C macro processor - supply exteranl values - emulating CMake Unfortunately, this is NOT the case I do have several cases were a macro is not defined in the source code but supplied, macro and value by the mechanism: DEF(MACRONAME=somevalue) Here I encountered something else (I assume it is a CMake and gcc construct). The macro is not defined externally, but in the source code: #DEFINE MACRONAME @macroname@ and the make process would supply the value to substitute the @macroname@. My question is whether IBM C run via JCL has a mechanism to supply the value only. I believe that this is a non-standard feature that the GNU guys are pushing on us. ZA -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: C macro processor - supply exteranl values - emulating CMake
On Sun, 16 Sep 2018 11:58:14 +, Ze'ev Atlas wrote: >... >I have a new challenge, something like: >#define HAVE_STDINT_H @HAVE_STDINT_H@ >which means that I should not define the macro externally, but get only the >value from CMake > This looks like something to be substituted by a preprocessor such as GNU configure. Where did you get this code? >… I run with good ol' JCL. > Why? But it might be discourteous of someone to distribute code which depends on YA "commercially supported" product. -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: C macro processor - supply exteranl values - emulating CMake
Unfortunately, this is NOT the case I do have several cases were a macro is not defined in the source code but supplied, macro and value by the mechanism: DEF(MACRONAME=somevalue) Here I encountered something else (I assume it is a CMake and gcc construct). The macro is not defined externally, but in the source code: #DEFINE MACRONAME @macroname@ and the make process would supply the value to substitute the @macroname@. My question is whether IBM C run via JCL has a mechanism to supply the value only. I believe that this is a non-standard feature that the GNU guys are pushing on us. ZA -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: C macro processor - supply exteranl values - emulating CMake
I'm not sure I follow. Is this right? The macro HAVE_STDINT_H is defined somewhere already in the source code, so defining it in OPTFILE would cause an error. However, you want it set to a value that would be supplied from OPTFILE? Is that right? Could you DEF(HAVE_STDINT_H_VALUE=1) in OPTFILE and then #define HAVE_STDINT_H HAVE_STDINT_H_VALUE in the source code? Possibly preceded by an #undef? Charles -Original Message- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Ze'ev Atlas Sent: Sunday, September 16, 2018 4:58 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: C macro processor - supply exteranl values - emulating CMake Hi allI am using IBM C compiler via good ol' JCL. I already know how to supply external macro definitions by supplying://OPTFILE DD DSN=MY.LIB(OPTFILE),...and an OPTFILE member that contains lines like:DEF(HAVE_STDINT_H)or evenDEF(HAVE_STDINT_H=1) I have a new challenge, something like:#define HAVE_STDINT_H @HAVE_STDINT_H@which means that I should not define the macro externally, but get only the value from CMake… I do not have CMake and I do not use it since I run with good ol' JCL. Is there a way to supply the value only? Thank you Ze'ev Atlas -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
C macro processor - supply exteranl values - emulating CMake
Hi allI am using IBM C compiler via good ol' JCL. I already know how to supply external macro definitions by supplying://OPTFILE DD DSN=MY.LIB(OPTFILE),...and an OPTFILE member that contains lines like:DEF(HAVE_STDINT_H)or evenDEF(HAVE_STDINT_H=1) I have a new challenge, something like:#define HAVE_STDINT_H @HAVE_STDINT_H@which means that I should not define the macro externally, but get only the value from CMake… I do not have CMake and I do not use it since I run with good ol' JCL. Is there a way to supply the value only? Thank you Ze'ev Atlas -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN