Build xorg-x11-drv-keyboard using Intel compiler


Problem : 
    When building xorg-x11-drv-keyboard-1.3.2 application using icc compiler on Linux or Moblin system, an error is reported during compilation. It complains that "struct kbd_repeat" has no field "rate". To produce the bug, set the icc build environment and go to xf86-input-keyboard source folder:
     export CC=icc
     ./configure
     make
    The gcc build works fine.

Environment : 
xorg-x11-drv-keyboard-1.3.2
icc 11.x for linux
gcc 4.x
Linux or Moblin system

Root Cause : 
    The icc build error is due to the incorrect check during xorg-x11-drv-keyboard confguration. In the application source folder, open file "configure", around line 11926, you will find the code like below:
    int main()
   {
         int main()
        {
             ....;
             return 0;
        }
      ;
      return 0;
   }
The above code can be compiled successfully with gcc while icc will report error.

Resolution : 
    You can workaround the issue by disable the outer 'main' function. Change the code like below:
// int main()
// {
int main()
{
....;
return 0;
}
// ;
// return 0;
// }

Then you can run 'configure' again and rebuild the application with icc. The build should run successfully.
For more complete information about compiler optimizations, see our Optimization Notice.