Find the answer to your Linux question:
Results 1 to 4 of 4
hi everyone!!i'm very happy to be one of the most great linux forums in the world and thanks for all great work that u do here!! i'm new to linux ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2009
    Posts
    6

    gcc and xlc


    hi everyone!!i'm very happy to be one of the most great linux forums in the world and thanks for all great work that u do here!!
    i'm new to linux i have some basic but still newer!!i have a project that i work on!!it's a product that has been installed and compiled in AIX system with xlc compiler!!my job here is to migrate this one to red hat linux entreprise 5 and compile all the makefile with GCC
    i'l traying to do the max to find a similarity between xlc and gcc but i'm stuck in one or two option that i can't figure out the solution specially -D option
    there is one example of makefile that i do compile but with using the line that contains -D option:
    gcc -c -DAIX41_OPSYS -I/home/oracle/Open2/COMMON/inc -I/home/oracle/Open2/dbg -DSYSV -D_NO_LONGLONG -I../inc -g -g -c afp_dump.c
    iím gratful if someone help me resolve this !!

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,558
    These -D options are much as #define NAME so that conditional compiler instructions such as #ifdef NAME or #ifndef NAME will trigger appropriately. This one, -DAIX41_OPSYS is obviously (to me at least) a directive that tells the source code to include stuff for the AIX operating system. You need to find this string AIX41_OPSYS in the source code to determine if setting it to something like -DLINUX will result in the intended behavior. Since GCC also supports long long integer types, you probably want to remove the -D_NO_LONGLONG directive as well, and ditto -DSYSV since Linux is not a Unix System V implementation.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    May 2009
    Posts
    6
    thanks a lot man for this explanation!!it helps me a lot u are the best!!
    i searched for AIX41_OPSYS and i found it in one of the .c files :
    #if (defined(UNIX_OPSYS) && !defined(sun)) || defined(IRIX53_OPSYS) || defined(AIX41_OPSYS) || defined(AIX)
    /************************************************** **************************/
    /* Function: set_signal() - VERSIONE UNIX */
    /* Date L.M.: 26-May-1998 */
    /* Description: Assign sig_handler() for all signals */
    /************************************************** **************************/

    void set_signal()
    {
    struct sigaction act = { 0, 0, 0 };
    int sig;

    act.sa_handler = sig_handler;

    for (sig = 1; sig < SIGMAX; sig++)
    if (sig != SIGKILL && sig != 21 && sig != SIGCHLD)
    sigaction(sig, &act, 0);

    }

    #endif

    #ifdef sun
    /************************************************** **************************/
    /* Function: set_signal() */
    /* Date L.M.: 23-Nov-1998 */
    /* Description: Assign sig_handler() for all signals */
    /************************************************** **************************/

    void set_signal()
    {
    struct sigaction act = { 0, 0, 0 };
    int sig;

    act.sa_handler = sig_handler;

    for (sig = 1; sig < SIGRTMAX; sig++)
    if (sig != SIGKILL && sig != SIGTTIN && sig != SIGCHLD)
    sigaction(sig, &act, 0);

    }


    #endif /* ifdef sun */
    now i don't see what i have to do if this code is enable to port to linux or not!!!
    and just one thing i don't see the meaning of ditto -DSYSV since Linux is not a Unix System V implementation.

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,558
    You basically need an #ifdef LINUX block that defines the set_signal() function. It will look a lot like these, which seem to differ only in this set of lines (from the #ifdef sun section):
    Code:
    for (sig = 1; sig < SIGRTMAX; sig++)
    if (sig != SIGKILL && sig != SIGTTIN && sig != SIGCHLD)
    which are iterating thru the signal values and determining if the signal to set is valid to set. It shouldn't be difficult. In fact, after looking at the signals on my system, I'd implement it exactly like the #ifdef sun section.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •