summaryrefslogblamecommitdiff
path: root/configure.ac
blob: 2a798ef4418ba66555322779c9df99f697297f0f (plain) (tree)
1
2
3
4
                                   
                                                                          
 
                 











                                
                        
 
                                                                             

                                                     

                





                                                                

                                                                              
                           
 

















                                                                                                          
                                                                              




                            

                                    









                                                                                     




                                                                                     
                                     

















                                                                          















                                                                               
                    


                                                                     
                            
                      



                        




                                             






                        
       




                                                                            
 






                                                           
                          
                               
                                    
                                        
                                           
 

                   




                           


                              
                             
 

                 
                                                                  




                                                                         
                     
                       



                        
                                 

                       
           
                                 

                       
     
                                 
                      


     




                           
                     














                                
                                                         





                       
                             


     





                      
                       


                                                                                       
                                                                    


                                                                  
                                                          

 






                                          
                                    
                                            
        
 

           
                              
 

                            
                             
                                                  


             


                             
                                                  


             

            
  
                     

                         






                                                        

             
          
           
            
          
              
              
           
 

                                                                        
                                              
                                                      
  



                                                           
                                                         
                                                                           
  


                


                   

                                                                                                                             





                                                      

      
                                         






                                                                       
                                                          
        
       
                                       


     
                                                                        
 

                         

                            



                                                                  
 
 


                                     
                          
                                                             
 



                                                                                    


           
                                                    

        

                                                                           
 


















                                                                                 

                            





                                                    
          
             
               
                
             

             
              

  


                                                                  
                                 


                                                


                                                                            

                  


                     




                                         


                        

                            







                                   




                                        

              
                                                                                                                                                        
                                                                                                                                                                               

                          








                                                                                         







           
 


                           

                          
 






                                     










                                                                                     

                 
              




























































                                                                                       



                                                          
                                                     













                                                          


      

                          
                       
 

                                      


                                 


                   
        


                    
         
        
          
         
         
        
       

  
              
 
                                                          
 




                                                   
 
 
                                                   











                                                                                     
 

                                      
                                                           





                                           

                     
     
 




























                                                                                            
                                                                                 
                                                                                     

                            




                                                                           


                                                                
 

                       
                   
 
         
                                                                
 








                                   
                  
                                      

                                
    

                                                            
  
 



                           





                                       
                                                              
                                             

                                                                                                          
                                

                                        

                                                                              

  
                               
                           





                                     
                           
                                    

                            
 

                           


                
           
                                                              







                                   
                                                              












                                       
                              
                  
 



                                   
                   
                            

                              
 

         
                     
 
                  
 

                        
                          
       

                                
                         

                            
                              
                        

       
         

                                 
                         

                             
                               
                         






                                
                            
                              
                        

       
 
                                                                          
                                                                      
                                                                          
 
                                        



                                                                                                                      


                                                
 
                                   











                                                                                                              
 
                       
 
                        
                                  
 

                           


          
















                                                                                                                                                  
                                       
                                                            


                                                               

  
                                 
                                                                                                
                                                
 



                                         

                                                                                   
                     
 

           










                                                      
                           
 





                                                                                         

                                                                          
                    
 
                                                               

                                                                  
 
                         
 
                                       

                                                                   


                                                
 
                                     
 
                                
 

                        
                                                                                   

               
                                                                              





                                                          
                                                           

                 


                                            
 
                                                  

                                               

                                                                                   

                                                                                         
 
           
 


                                                           
 
                                                             
 
                   

                
 


                         
                                






                                                                  




                  
                                                              
 
                                           
                                                   

                         


                       
        
 
                    

                  
 
                                   
 
                       
 
                        

                       
                                  
 

                          
                      
                                        
                                                                    
                                                                          
                           

  
                                     
 
                                      
 
                    
 
                           
 
                    
 
                         
 
                                       
 
                                     
 

                                

                      
                  
               
 









                                              

       
 
                   






                                   
                       
                                 
 
                        
                                     


                    

                                                                                   









                                                                       


                                     
                               


                      
                 

              







                       






                                   
                                                 







                                         

















                                       









                                   

                                             














                                       
 
         
                                                               


                                   
     



                                                            

                                                                         
                                    


                  



                  
                     






                        
                         


                        






                                                             



                                                              

                                                                         
                                       


                     







                                                                      







                                          


                                      
                                                                   








                                           
                                       
                                                  

  


                                 
                                                                   








                                           


                                  
                                                        








                                           
                                   


                                       


                                                                          
                



                                                                                                                              


                    
       

















































                                                                 
 












                                                       

                             










                                                                      
 








                                                                         
                           












                                                                       
                           



                        








                                                           
                           



                      

                         

                                                                                       






                                           
                        
 












                                                          






                                                                          
                           



                       
                      















































































                                                                                  
                           





                            
 







                                             
                                        







                                           
                                         


                  

                                               
                                         
                                 
                                                                                                     

                                     
 


                                     


                                   
 







                                                      
                               
 

                                                                             

  




                        



                                       
 

                           
          
                                                        



                        
                                                     
                                       

                 
                                                  
                                  

                  
                     
                                                   
                                   

        
                                                                       




                                                               

                                                                


                                                               

                                                                


                                                               

                                                                


                                                               

                                                                


                                                                 

                                                                  


                                                                                             
                                                                                



          










                                                                        

           
                                                                                   
                                                                 

                                                                                                      
                                                                                        
                                                                        
                                                    
 
 


                                  
                                    
                                                                             










                                                            

                                                                                

                                                        
                                                             







                                                                
                                                                                                                                                                                                                                  




                                                                                                
                                                                                                                      

                                                                                                            
                                                                                                                                                                 






                                          

                                                                                                        


        
                                      





                                                             

                                                                            











                                                      
                                                                               










                                                              
                                                                                                                                                                                                          




                                                                                    
                                                                                                          

                                                                                                    
                                                                                                                                               







                                    
                                                                                                   




                                                                                            
                                     












                                                                                  




                                                       

                                   




                                                          















                                                                                                      
 







                                                                       
                                                                    


                                                                     




                                                                    
                                                                   
 
                     














                                                                      


                                                        




                         
                                                


                                                        



                                        
                                                             


                            












                                          




                                                              
 









                                                                         
                           



                             
                                                                                                     
                                                   



                                     
                                              


                         


                                                                                                                                                          
       
                                                                                    
                                         
     

  


                                           









                                                                       


                 























                                                                                                                 





                                                                   
 





































































                                                                


                                          

                






                         
 

           
                       







                                   

                                         
 

                             





















                                                     
                     


                  
          
 
                      
 
                                   
 























                                                                                 
                           





                            
                          

                                                                               
    
                                           
                           
                           
        
                          

      









                                                                              
                           


                           


                                     
 
























                                                                                                               

                  


                                       

              
                                                                           


                  
                          
                                                                                        






                                                                                  


                                        
 

                            

      
                                                                                
                                     


                        
                                                                                   
 
                                                             


                                       









                                                                                        
                                                                         




                                                                                     
                                                 
  


                                                  
                                                                                                    
 
                      
 



                           

                                
                    
             
            
            

               
             
                
               
          




                         

  














                                    
































                                                                                              
                                                                        



                                                        
                                     



                                                                    
                                     
 












































                                                                                  

                      
                    

                 











                                                


              
                          
 

                  

                                     
 
                                     













                                        
                  
  
 





                                                         


                       
                        
                                       


                                        



                                             
 

                                
                                                     
                                

                                                              

                                      
                                               




                             
                                                                                       
 



                                                                                      
                                                                 
 
                          


                           
                                      
 
                                                                                   





                                                                     



                                  
                       


                      
   
 


                                      





                                                            



                                     
                        




                     
                          






                                   
                       
                                        
 
                        

                                                 
                                          
                                            
 

                                













                                       
                        




                     
                           


                                   

                  

                       
                       
                                         
 
                        


                                                  
                                           
                                             


                           









                                       
                         



                      
                                                                      






                                   
                       
                                          
 
                        
                                               
                                            








                                              
 



                                     
                                   
                       
 
 
                     
                                                                           
 





                                   
                       
                                               
 



                                                          
                                                 
                                                   












                                       
                                        
                            


                
                                                                     




                                   


                        

                                                     
                                            
                                              


                           
                                               










                                       
                                   


                       
             
                                                               

                                   
                      
                                     






                                                 
                         


                  


                        
                                            

                                                  
                                           
 
                                                                      
                                    
 
                         




                             



                                                             










                                       
                                



                    
                                                                     







                                   

                                              

                                                       
                                              
                                                
 
                                                                      












                                       
                                     



                         
                                                                 







                                   


                                                   
                                          
                                            
 
                                                  
 

                                                                   
 
                          












                                       
                                 



                     
                                                                         







                                   

                                                       
                                              
                                                
 
                                          
                                                                        
 
                              











                                       
                                     

                         


















                                                                 
                                                                                     

















                                       
 









                                                          
                           



                      



                                     
                                                                     


                                   

                                                             













                                                                     
                           








                           
                       
                                          
 
                        

                                               
                                            
                                              
 

                                  


                                                                                 
 
                            
 



                                            











                                       
                                   


                                                                               
                       
 







                                
                
                                                                     







                                   


                                                     
                                            
                                              
 
                                              













                                       
                                   

                       
























                                                          


                                          




                                               
                                                                                                                   







                                                               
                            















                                       

                
                                                                     







                                   


                                                     
                                            
                                              












                                       
                                   



                       
                                                                   


                                   
                        
                                                                                







                                           
 










                                                                                  
                        
                                                                            




                                           
                           



                        










                                                                            






                                                                
                           



                    






                                                       
                           














                                                       

                  


                        

                                                 
                                        
                                          

       












































                                                                                                           
                                          
























                                                                      
                                          



                                                       

                                                                 




                                                        

  
                                           











                                                                                                  
                                                                                         
 




                                                                                             

                                                                                            
     

                                        
                                          
                                                                        
     

                                        

                                                                            
     
                                         
 
                                                                          
                                           


                                             



      

                                                      
                                           
                                                                                                                                                                                                                                                                                     















                                                                               





                                                                               
                                                                             



                                                                       

                                        






                                                                          
 
                           
                                             

                                          

  
                                          
 
                                
 

                               

                                                                      



                   
                                                                    








                                   
                           
 





                                                                         



                               


                                             

     


                       
                       
                                        
 
                        

                                             

                                                   
                                            
 



                                                        




                        
                                                                                                                   
                            
                                 




                                                                       


                                                                                 
                                                              


      

                                                                                  
                            
             







                                                                                 
                                                              



                       
                                                                                







                                                          


                                                                               
                                   
 


                                                    
                                









                                                                                       











                                       






                                                     


                     
                   
                                                                         






                                   
                       
                                             
 




                                                      
                                               













                                                 
                                      


                          







































                                                                                 
                           








                                                         

                                           



                                                       

                                           



                                          

                                           
                                                           












































                                                                                  
                                                       






                                                                        
               
                                                                     




                                   



                                                                   
                          
                                             
 


                                            

                            


                       
                       
                                         
 
                        


                                                         
                                            
                                             
                                           
                                             

          
                                                    

                                     


                                                                                
                                           
 
                                                                













                                                                             
                                                                  









                                                                                     

                                                                        
 
                           

                                                            
                               

                                                                                 

                                              
 
 

                          
                                                    



                                                        
                                                                  


                                                                
                                                             

                                                                                           
                                                                


                                                             
                                                          



                                                                                         
                                 
 
                                                         


                                
                                                                                                             
                                                          




                                                                                     
                                                        


                                                             
                                                          














                                                                                          
                         


                                                       
                                                                                       
                             
  
                                                                                
 
                           












                                       





















                                                             

                      
        
                    






                                   
                       
                                  
 
                        

                                       
                                    
                                      
 
                          
 

                           








                                       
 
                  

                                              

               



                                             
 

                       






                                   
                       
                                     
 
                        


                                          
 
                                          
 
                       












                                       

                     

 
           
                       








                                                       
                       
                                     
 
                        


                                               
                                           
                                       
                                         












                                       
                     

                  








                                                                        
                           


                        
                        
 



                                     













                                                                    
                                         




















                                                      
         
                                                               



                                   
                     

                                         
                                                              







                                           
 



                                     
                                       
                            





















                                                                       
                                                                             
 

                                     



                                       
                            

                                                      
                                                      
  
 
                           
                                 


                     
                                                                               





                                                                         

                                                                        

                         
                           
                        


                           



                    









                                       





                                                        

                
 







                         
            
                                                                  
 


                                      











                                                                     
                                           









                                                             
                                           
















                                           
                                                                               
                                  






                                                
                                                  

                                                    

                                       
                                        

                                                                






















                                                                                       











                                                             


                   
           
                                                                 






                                   
                       
                                     
 



                                         
                                        
                                         
                                       


                                               
                                              



















                                         
                              


                  
                                                                        





                                   
                       
                                            
 

                                                
                                              
                                               
                                                 
                                                
                                                  
                                                  
                                                
















                                       
                                     

                         












































                                                             
 












                                                                                       

             
                                                                                                                                       









                                            
 




                 
                     
            

                            
                            
                          
                              


                          
                           
                                 
                         
                            
                              
                          
                             
                                   
                          
                                
                          
                                 
                        

             
            
          
              
         
             
        
            
            
                











                          
              
          
              
           
               





                      
               
              
                   
               
                   





                    
                 
                     
                 
            
         
            


                  
          
              
          
              
             

                   
                                              
                                              

                               
               
            
                            
                                                                         

                                                                         
                          
                                                                       

                                                                           











                                                                              
                           
                                                                        
                            
                                                                         
                             
                                                                          
                            
                                                                         

                                                                           
                              
                                                                           



                                                                                 

                                                                            



         

                                               
                                                                                                                                                                                                                                           
 



                                                                                                                                                                                                                                                                                             


         

                                               

                    

                                                       

                  
                                                             

       
                                                       

      
 




                                             
  




                                                                            
 






                                                                               
 

                                               
    



                                                                                          
                                   





                                                                 
                                      

                                                                    




                                                
                                             
                                                 
                                               


                                                    
                                                                              













                                                                                  
                                                      
                                                                                

                                                                    



                                                                          
                                   
                                       
                           

                                                          
                                            
                                   

                                             
  
                                                              
                                      
                                 
    






                                        




                                               



                                                  



                                                  

                                                

  
         

                                                                              



                                                    
    














                                                                           
 
 



























































                                                                                

                                                                              
                                                                            


                                                                          



                                                                                





                                                                        



                                                                                




                                                                          



                                                                                

                                                                       



                                                                                






                                                                            



                                                                                



                                                                              



                                                                                


                                                                              



                                                                                
                                                                      




                                                                             



                                                                                



                                                                        



                                                                                


                                                                          



                                                                                


                                                                             



                                                                                


                                                                             



                                                                                

                                                                               
                                                                              

                                                                             



                                                                                




                                                                             



                                                                                


                                                                         








                                                                                
                                                                                                                                            




                                                                                
  

                                   






                                    









                                                                                                     






                                    





                                                                                                                                                                 
                                                                                       












                                                                                                                                                                                    
                                                                                           

















































                                                                                                                                                
  











                                                                              
EFL_VERSION([1], [10], [99], [dev])
AC_INIT([efl], [efl_version], [enlightenment-devel@lists.sourceforge.net])

AC_PREREQ([2.60])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])

AC_CONFIG_HEADERS([config.h])
AH_TOP([
#ifndef EFL_CONFIG_H__
#define EFL_CONFIG_H__
])
AH_BOTTOM([
#endif /* EFL_CONFIG_H__ */
])

AC_USE_SYSTEM_EXTENSIONS

AM_INIT_AUTOMAKE([1.6 dist-bzip2 dist-xz -Wall -Wno-portability color-tests])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

CFOPT_WARNING=""

#### Apply configuring with legacy api's only, eo api's or both.

EFL_API_LEGACY_DEF="#define EFL_NOLEGACY_API_SUPPORT"
EFL_API_EO_DEF="#define EFL_EO_API_SUPPORT"
efl_api="both"

#### For the moment the Eo EFL API is not ready you need to explicitely optin.
EFL_ENABLE_EO_API_SUPPORT
EFL_ENABLE_BETA_API_SUPPORT

AC_ARG_WITH([api],
   [AC_HELP_STRING([--with-api=@<:@eo/legacy/both@:>@], [Select the EFL API Model @<:@default=both@:>@])],
   [efl_api=${withval}],
   [efl_api="both"])

case "$efl_api" in
    eo)
        EFL_API_LEGACY_DEF="#define EFL_NOLEGACY_API_SUPPORT"
        EFL_API_EO_DEF="#define EFL_EO_API_SUPPORT"
        ;;
    legacy)
        EFL_API_LEGACY_DEF=""
        EFL_API_EO_DEF=""
        ;;
    both)
        EFL_API_LEGACY_DEF=""
        EFL_API_EO_DEF="#define EFL_EO_API_SUPPORT"
        ;;
    *) AC_MSG_ERROR([Invalid api (${efl_api}): must be eo, legacy or both]) ;;
esac

AC_SUBST(EFL_API_LEGACY_DEF)
AC_SUBST(EFL_API_EO_DEF)

#### Additional options to configure

# string to identify the build
AC_ARG_WITH([id],
   [AC_HELP_STRING([--with-id=BUILD_ID],
                   [Specify a string to identify the build (vendor, maintainer, etc).
                     @<:@default=none@:>@])],
   [EFL_BUILD_ID="${withval}"],
   [EFL_BUILD_ID="none"])
AC_SUBST(EFL_BUILD_ID)

# profile
AC_ARG_WITH([profile],
   [AC_HELP_STRING([--with-profile=PROFILE],
                   [use the predefined build profile, one of: dev, debug and release.
                    @<:@default=dev@:>@])],
   [build_profile=${withval}],
   [build_profile=def_build_profile])

case "${build_profile}" in
   dev|debug|release)
     ;;
   *)
     AC_MSG_ERROR([Unknown build profile --with-profile=${build_profile}])
     ;;
esac

prefer_assert="no"
case "${build_profile}" in
   dev|debug)
     prefer_assert="yes"
     ;;
esac

# TODO: add some build "profile" (server, full, etc...)

AC_ARG_WITH([crypto],
   [AC_HELP_STRING([--with-crypto=CRYPTO],
                   [use the predefined build crypto, one of:
                    openssl, gnutls or none.
                    @<:@default=openssl@:>@])],
   [build_crypto=${withval}],
   [build_crypto=openssl])

case "${build_crypto}" in
   openssl|gnutls|none)
     ;;
   *)
     AC_MSG_ERROR([Unknown build crypto option: --with-crypto=${build_crypto}])
     ;;
esac

AC_ARG_WITH([tests],
   [AC_HELP_STRING([--with-tests=none|regular|coverage],
                   [choose testing method: regular, coverage or none.
                    @<:@default=none@:>@])],
   [build_tests=${withval}],
   [build_tests=auto])

want_coverage="no"
want_tests="no"
case "${build_tests}" in
   auto)
     if test "${build_profile}" = "dev"; then
        want_tests="yes"
     fi
     ;;
   regular)
     want_tests="yes"
     ;;
   coverage)
     want_tests="yes"
     want_coverage="yes"
     ;;
   no*)
     ;;
   *)
     AC_MSG_ERROR([Unknown build tests option: --with-tests=${build_tests}])
     ;;
esac

dbusservicedir="${datadir}/dbus-1/services"
AC_ARG_WITH([dbus-services],
   [AC_HELP_STRING([--with-dbus-services=DBUS_SERVICES],
      [specify a directory to store dbus service files.])],
   [dbusservicedir=$withval])
AC_SUBST(dbusservicedir)

efl_deprecated_option="no"
EFL_WITH_BIN([edje], [edje-cc])
EFL_WITH_BIN([eolian], [eolian-gen])
EFL_WITH_BIN([eolian_cxx], [eolian-cxx])
EFL_WITH_BIN_SUFFIX([elua], [elua], [_bin])

#### Default values

requirements_pc_efl=""
requirements_pc_deps_efl=""
requirements_libs_efl=""
requirements_cflags_efl=""

requirements_pc_crypto=""
requirements_pc_deps_crypto=""
requirements_libs_crypto=""
requirements_cflags_crypto=""

AC_CANONICAL_HOST

# TODO: move me to m4 file that setups module/so related variables
case "$host_os" in
   cegcc*)
      AC_MSG_ERROR([ceGCC compiler is not supported anymore. Exiting...])
   ;;
   mingw32ce*)
      MODULE_ARCH="v"
      MODULE_EXT=".dll"
   ;;
   mingw*)
      have_win32="yes"
      have_windows="yes"
      MODULE_ARCH="v-v_maj.v_min"
      MODULE_EXT=".dll"
   ;;
   cygwin*)
      MODULE_ARCH="v-v_maj.v_min"
      MODULE_EXT=".dll"
   ;;
   *)
      MODULE_ARCH="v-v_maj.v_min"
      MODULE_EXT=".so"
   ;;
esac

EFL_VERSION_MAJOR="v_maj"
EFL_VERSION_MINOR="v_min"
AC_SUBST(EFL_VERSION_MAJOR)
AC_SUBST(EFL_VERSION_MINOR)

have_systemd_pkg="no"
have_wince="no"
have_win32="no"
have_windows="no"
have_darwin="no"
have_linux="no"
have_ps3="no"
case "$host_os" in
   mingw32ce*)
      have_wince="yes"
      have_windows="yes"
   ;;
   mingw*|cygwin*)
      # TODO: check cygwin* here
      have_win32="yes"
      have_windows="yes"
      EFL_CFLAGS="${EFL_CFLAGS} -D__USE_MINGW_ANSI_STDIO"
   ;;
   darwin*)
      have_darwin="yes"
   ;;
   linux*)
      have_linux="yes"
      have_systemd_pkg="auto"
   ;;
esac

case "$host_vendor" in
   ps3*)
      have_ps3="yes"
   ;;
esac

AC_SUBST([MODULE_ARCH])
AC_DEFINE_UNQUOTED([MODULE_ARCH], ["${MODULE_ARCH}"], ["Module architecture"])
AC_DEFINE_UNQUOTED([SHARED_LIB_SUFFIX], ["${MODULE_EXT}"], [Suffix for shared objects])

# TODO: move me to m4 file that setups the windows related variables
AM_CONDITIONAL([HAVE_WINCE], [test "x${have_wince}" = "xyes"])
AM_CONDITIONAL([HAVE_WIN32], [test "x${have_win32}" = "xyes"])
AM_CONDITIONAL([HAVE_WINDOWS], [test "x${have_windows}" = "xyes"])
AM_CONDITIONAL([HAVE_PS3], [test "x${have_ps3}" = "xyes"])


#### Checks for programs

### libtool

if test "x${have_windows}" = "xyes" ; then
   lt_cv_deplibs_check_method='pass_all'
fi
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
LT_INIT([win32-dll disable-static pic-only])
EFL_INIT

### gettext

AM_GNU_GETTEXT_VERSION([0.17])

m4_ifdef([AC_GNU_GETTEXT], [
AC_GNU_GETTEXT([external])
po_makefile_in=po/Makefile.in
po_makevars="${srcdir}/po/Makevars:po/Makevars.in"
have_po="yes"
],
[
m4_ifdef([AM_GNU_GETTEXT], [
AM_GNU_GETTEXT([external])
po_makefile_in=po/Makefile.in
po_makevars="${srcdir}/po/Makevars:po/Makevars.in"
have_po="yes"
],
[
have_po="no"
])
])
AC_SUBST([LTLIBINTL])
LOCALE_DIR="${localedir}"
AC_SUBST(LOCALE_DIR)

if test "x${POSUB}" = "x" ; then
   have_po="no"
fi

AM_CONDITIONAL([HAVE_PO], [test "x${have_po}" = "xyes"])

### compilers

AM_PROG_AS
AC_PROG_CXX
AC_PROG_OBJC
AC_LANG(C)
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_SED

AM_CONDITIONAL([BUILD_EFL_NATIVE], [test "x${cross_compiling}" = "xno"])

if test "x${ac_cv_prog_cc_c99}" = "xno" ; then
   AC_MSG_ERROR([efl requires a c99-capable compiler])
fi
# We should be using ${CXX} here, but there is a bug in
# autotools macro and CXX is always set to g++ even if
# it's not found. So we are using an internal variable
# that does the work for now, may get broken in the future.
if test "x${ac_ct_CXX}" = "x" -a "x${CXX}" = "xg++"; then
   AC_MSG_ERROR([efl requires a C++ compiler got ${ac_ct_CXX} and ${CXX}.])
fi

AC_SYS_LARGEFILE

# pkg-config

PKG_PROG_PKG_CONFIG
if test "x${PKG_CONFIG}" = "x" ; then
   AC_MSG_ERROR([pkg-config tool not found. Install it or set PKG_CONFIG environment variable to that path tool. Exiting...])
fi

# doxygen program for documentation building

EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])

# lcov

if test "${want_coverage}" = "yes" ; then
   AC_CHECK_PROG([have_lcov], [lcov], [yes], [no])
   if test "x${have_lcov}" = "xyes" ; then
      EFL_COV_CFLAGS="${EFL_COV_CFLAGS} -fprofile-arcs -ftest-coverage"
      EFL_COV_LIBS="${EFL_COV_LIBS} -lgcov"
      if test "x${prefer_assert}" = "xno"; then
         EFL_COV_CFLAGS="${EFL_COV_CFLAGS} -DNDEBUG"
      else
         EFL_COV_CFLAGS="${EFL_COV_CFLAGS} -g -O0 -DDEBUG"
      fi
   else
      AC_MSG_ERROR([lcov is not found])
   fi
fi

AM_CONDITIONAL([EFL_ENABLE_COVERAGE], [test "${want_coverage}" = "yes"])

#### Checks for libraries

# check unit testing library

if test "${want_tests}" = "yes"; then
   PKG_CHECK_MODULES([CHECK], [check >= 0.9.5])
fi
AM_CONDITIONAL([EFL_ENABLE_TESTS], [test "${want_tests}" = "yes"])


# check for crypto/tls library to use
case "$build_crypto" in
   gnutls)
      CFOPT_WARNING="xyes"
      EFL_DEPEND_PKG([crypto], [GNUTLS], [gnutls >= 2.12.16])

      AM_PATH_LIBGCRYPT([], [:],
         [AC_MSG_ERROR([libgcrypt required but not found])])
      requirements_libs_crypto="${LIBGCRYPT_LIBS} ${requirements_libs_crypto}"
      requirements_cflags_crypto="${LIBGCRYPT_CFLAGS} ${requirements_cflags_crypto}"
      ;;

   openssl)
      EFL_DEPEND_PKG([crypto], [OPENSSL], [openssl])
      ;;
esac
AM_CONDITIONAL([HAVE_CRYPTO_GNUTLS], [test "${build_crypto}" = "gnutls"])
AM_CONDITIONAL([HAVE_CRYPTO_OPENSSL], [test "${build_crypto}" = "openssl"])

# check for lua old
want_lua_old="no"
AC_ARG_ENABLE([lua-old],
   [AC_HELP_STRING([--enable-lua-old],
       [Enable interpreted Lua support (5.1 or 5.2). @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_lua_old="yes"
    else
       want_lua_old="no"
    fi
   ],
   [want_lua_old="no"])

AM_CONDITIONAL([ENABLE_LUA_OLD], [test "${want_lua_old}" = "yes"])
AC_DEFINE_IF([ENABLE_LUA_OLD], [test "${want_lua_old}" = "yes"],
  [1], [Use interpreted Lua (5.1 or 5.2)])
AC_SUBST([want_lua_old])

#### Checks for header files

# Common Checks (keep names sorted for ease of use):
AC_HEADER_DIRENT
AC_HEADER_TIME

AC_CHECK_HEADERS([ \
execinfo.h \
mcheck.h \
sys/epoll.h \
sys/inotify.h \
sys/signalfd.h \
sys/types.h \
sys/param.h \
sys/mman.h \
netinet/in.h \
])

have_inotify="${ac_cv_header_sys_inotify_h}"
AM_CONDITIONAL([HAVE_INOTIFY], [test "x${have_inotify}" = "xyes"])

have_notify_win32="${have_win32}"
AC_DEFINE_IF([HAVE_NOTIFY_WIN32],
   [test "x${have_notify_win32}" = "xyes"], [1],
   [File monitoring with Windows notification])
AM_CONDITIONAL([HAVE_NOTIFY_WIN32], [test "x${have_notify_win32}" = "xyes"])


EFL_CHECK_PATH_MAX


#### Checks for types

# wchar_t
AC_CHECK_SIZEOF([wchar_t])
EINA_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t
AC_SUBST([EINA_SIZEOF_WCHAR_T])

AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)

AC_CHECK_SIZEOF([uintptr_t])

AC_CHECK_TYPES([siginfo_t], [], [],
   [[
#include <signal.h>
#if HAVE_SIGINFO_H
# include <siginfo.h>
#endif
   ]])

#### Checks for structures


#### Checks for compiler characteristics

AC_C_BIGENDIAN
AC_C_INLINE
EFL_CHECK_COMPILER_FLAGS([EFL], [-Wall -Wextra -Wpointer-arith -Wno-missing-field-initializers -fvisibility=hidden -fdata-sections -ffunction-sections])
EFL_CHECK_LINKER_FLAGS([EFL], [-fvisibility=hidden -fdata-sections -ffunction-sections -Wl,--gc-sections -fno-strict-aliasing -Wl,--as-needed -Wl,--no-copy-dt-needed-entries])
case "${build_profile}" in
   dev)
     dnl Check if compiler has a dodgy -Wshadow that emits errors when shadowing a global
     AC_MSG_CHECKING([whether -Wshadow generates spurious warnings])
     CFLAGS_save="${CFLAGS}"
     CFLAGS="${CFLAGS} -Werror -Wshadow"
     AC_TRY_COMPILE([int x;], [int x = 0; (void)x;],
       [AC_MSG_RESULT([no])
        EFL_CHECK_COMPILER_FLAGS([EFL], [-Wshadow])],
       [AC_MSG_RESULT([yes])])
     CFLAGS="${CFLAGS_save}"
     ;;

   debug)
     ;;

   release)
     ;;
esac

EFL_ATTRIBUTE_VECTOR
EFL_ATTRIBUTE_ALWAYS_INLINE

EFL_LIBS="${EFL_LIBS}"
EFL_CFLAGS="${EFL_CFLAGS}"

## CPU architecture specific assembly

build_cpu_mmx="no"
build_cpu_sse3="no"
build_cpu_altivec="no"
build_cpu_neon="no"

want_neon="yes"
AC_ARG_ENABLE([neon],
   [AC_HELP_STRING([--disable-neon], [disable neon support @<:@default=enable@:>@])],
   [
    if test "x${enableval}" = "xyes"; then
       want_neon="yes"
    else
       want_neon="no"
    fi
   ])

SSE3_CFLAGS=""
ALTIVEC_CFLAGS=""
NEON_CFLAGS=""

case $host_cpu in
  i*86|x86_64|amd64)
    AC_DEFINE([BUILD_MMX], [1], [Build MMX Code])
    build_cpu_mmx="yes"
    AC_CHECK_HEADER([immintrin.h],
       [
        AC_DEFINE(BUILD_SSE3, 1, [Build SSE3 Code])
        build_cpu_sse3="yes"
       ],
       [build_cpu_sse3="no"])
    AC_MSG_CHECKING([whether to build SSE3 code])
    AC_MSG_RESULT([${build_cpu_sse3}])

    if test "x$build_cpu_sse3" = "xyes" ; then
       SSE3_CFLAGS="-msse3"
    fi
    ;;
  *power* | *ppc*)
    build_cpu_altivec="yes"
    AC_CHECK_HEADER([altivec.h],
       [
        AC_DEFINE([BUILD_ALTIVEC], [1], [Build Altivec Code])
        AC_DEFINE([HAVE_ALTIVEC_H], [1], [Have altivec.h header file])
        build_cpu_altivec="yes"
       ],
       [
        save_CFLAGS=$CFLAGS
        save_CPPFLAGS=$CPPFLAGS
        CFLAGS=$CFLAGS" -maltivec"
        CPPFLAGS=$CPPFLAGS" -maltivec"
        unset ac_cv_header_altivec_h
        AC_CHECK_HEADER([altivec.h],
          [
            AC_DEFINE([BUILD_ALTIVEC], [1], [Build Altivec Code])
            AC_DEFINE([HAVE_ALTIVEC_H], [1], [Have altivec.h header file])
            build_cpu_altivec="yes"
          ],
          [build_cpu_altivec="no"]
        )
        CFLAGS=$save_CFLAGS
        CPPFLAGS=$save_CPPFLAGS
       ]
    )
    if test "x${build_cpu_altivec}" = "xyes"; then
       AC_MSG_CHECKING([whether to use altivec compiler flag])
       if test "x$GCC" = "xyes"; then
          if echo "int main(){return 0;}" | ${CPP} -faltivec - > /dev/null 2>&1; then
             altivec_cflags="-faltivec"
             AC_DEFINE([BUILD_ALTIVEC], [1], [Build Altivec Code])
          elif echo "int main(){return 0;}" | ${CPP} -maltivec - > /dev/null 2>&1; then
             altivec_cflags="-maltivec"
             AC_DEFINE([BUILD_ALTIVEC], [1], [Build Altivec Code])
          fi
       fi
       AC_MSG_RESULT([${altivec_cflags}])
       CFLAGS="$CFLAGS ${altivec_cflags}"
       ALTIVEC_CFLAGS="-maltivec"
    fi
    ;;
  arm*)
    if test "x${want_neon}" = "xyes"; then
       build_cpu_neon="yes"
       AC_MSG_CHECKING([whether to use NEON instructions])
       CFLAGS_save="${CFLAGS}"
       CFLAGS="${CFLAGS} -mfpu=neon -ftree-vectorize"
       AC_TRY_COMPILE([#include <arm_neon.h>],
         [asm volatile ("vqadd.u8 d0, d1, d0\n")],
       	 [
           AC_MSG_RESULT([yes])
           AC_DEFINE([BUILD_NEON], [1], [Build NEON Code])
           build_cpu_neon="yes"
           NEON_CFLAGS="-mfpu=neon"
       	 ],
       	 [
	   AC_MSG_RESULT([no])
           build_cpu_neon="no"
       	 ])
       CFLAGS="${CFLAGS_save}"
    fi
    ;;
esac

AC_SUBST([ALTIVEC_CFLAGS])
AC_SUBST([SSE3_CFLAGS])
AC_SUBST([NEON_CFLAGS])

#### Checks for linker characteristics


#### Checks for library functions

AC_CHECK_FUNCS([\
backtrace \
backtrace_symbols \
execvp \
fpathconf \
fstatat \
malloc_usable_size \
mkdirat \
mtrace \
realpath \
strlcpy \
geteuid \
getuid \
pause \
])

AC_FUNC_ALLOCA

EFL_CHECK_FUNCS([EFL], [fnmatch gettimeofday dirfd fcntl])

have_atfile_source="${ac_cv_func_fstatat}"
AC_DEFINE_IF([HAVE_ATFILE_SOURCE],
   [test "x${have_atfile_source}" = "xyes"],
   [1], [Use fstatat and other -at file functions])



######################  EFL  ######################
build_gui="yes"
AC_ARG_ENABLE([gui],
   [AC_HELP_STRING([--disable-gui], [disable GUI libraries @<:@default=enable@:>@])],
   [
    if test "x${enableval}" = "xyes"; then
       build_gui="yes"
       CFOPT_WARNING="yes"
    else
       build_gui="no"
    fi
   ])
AM_CONDITIONAL([BUILD_GUI], [test "x${build_gui}" = "xyes"])

AC_ARG_ENABLE([systemd],
   [AC_HELP_STRING([--enable-systemd],
      [Enable systemd support. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_systemd="yes"
    else
       want_systemd="no"
    fi
   ], [
    want_systemd="no"
   ])

systemd_dbus_prefix="# "
if test "${want_systemd}" = "yes"; then
   systemd_dbus_prefix=""
fi
AC_SUBST(systemd_dbus_prefix)

AC_ARG_WITH([systemdunitdir],
         AC_HELP_STRING([--with-systemdunitdir=DIR],
                [path to systemd user services directory]),
         [USER_SESSION_DIR=${withval}])
if test "$want_systemd" == "no"; then
  have_systemd_user_session="no"
elif test -n "${USER_SESSION_DIR}"; then
  have_systemd_user_session="yes"
  AC_MSG_NOTICE([Using systemd user services directory as ${USER_SESSION_DIR}])
else
  # Detect systemd user session directory properly
  EFL_PKG_CHECK_VAR([USER_SESSION_DIR], [systemd >= 192], [systemduserunitdir],
	[have_systemd_user_session="yes"], [have_systemd_user_session="no"])

  if test "$want_systemd" = "yes" -a "$have_systemd_user_session" = "no"; then
     AC_MSG_ERROR([systemd support wanted, but systemd was not found.])
  fi
fi

AM_CONDITIONAL([HAVE_SYSTEMD_USER_SESSION], [test "x${have_systemd_user_session}" = "xyes"])
AC_SUBST([USER_SESSION_DIR])


if test "x${have_systemd_pkg}" = "xauto" -o "x${have_systemd_pkg}" = "xyes"; then
   PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon >= 192 libsystemd-journal >= 192],
   [have_systemd_pkg="yes"],
   [have_systemd_pkg="no"])
fi

# check for systemd library if requested
if test "x${want_systemd}" = "xyes" -a "x${have_systemd_pkg}" = "xno"; then
   AC_MSG_ERROR([Systemd dependencie requested but not found])
fi

AM_CONDITIONAL([WANT_SYSTEMD], [test "${want_systemd}" = "yes"])

#### Platform-dependent
DL_LIBS=""
DL_INTERNAL_LIBS=""

#### Evil
EFL_LIB_START_OPTIONAL([Evil], [test "${have_windows}" = "yes"])

### Default values

### Additional options to configure
EFL_SELECT_WINDOWS_VERSION

### Checks for programs

### Checks for libraries

EVIL_DLFCN_LIBS=""
if test "${have_wince}" = "xyes"; then
   EFL_ADD_LIBS([EVIL], [-lws2])
   EVIL_DLFCN_LIBS="-ltoolhelp"
else
   EFL_ADD_LIBS([EVIL], [-lole32 -lws2_32 -lsecur32 -luuid])
   EVIL_DLFCN_LIBS="-lpsapi"
fi

AC_SUBST([EVIL_DLFCN_LIBS])

### Checks for header files

### Checks for types

### Checks for structures

### Checks for compiler characteristics

EVIL_DLFCN_CPPFLAGS="-DEFL_EVIL_DLFCN_BUILD -DPSAPI_VERSION=1"
# TODO: should we have these at EFL (global?)
# Note: these warnings should not be used with C++ code
EVIL_CFLAGS_WRN="-Wdeclaration-after-statement -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
EVIL_CXXFLAGS="${EVIL_CXXFLAGS}"

if test "x${have_win32}" = "xyes" ; then
   EVIL_CFLAGS="-DSECURITY_WIN32 ${EVIL_CFLAGS}"
   EVIL_CXXFLAGS="-fno-rtti -fno-exceptions -DSECURITY_WIN32 ${EVIL_CXXFLAGS}"
fi

AC_SUBST([EVIL_DLFCN_CPPFLAGS])
AC_SUBST([EVIL_CFLAGS_WRN])
AC_SUBST([EVIL_CXXFLAGS])

### Checks for linker characteristics

### Checks for library functions

DL_LIBS="lib/evil/libdl.la"
DL_INTERNAL_LIBS="lib/evil/libdl.la"

EFL_LIB_END_OPTIONAL([Evil])

AC_SUBST([USE_EVIL_CFLAGS])
AC_SUBST([USE_EVIL_LIBS])
#### End of Evil


#### Escape
EFL_LIB_START_OPTIONAL([Escape], [test "${have_ps3}" = "yes"])

### Additional options to configure

### Default values

### Checks for programs

### Checks for libraries
EFL_ADD_LIBS([ESCAPE], [-llv2 -lm -lnet -lsysmodule -liberty])

### Checks for header files

### Checks for types

### Checks for structures

### Checks for compiler characteristics

### Checks for linker characteristics

### Checks for library functions

EFL_LIB_END_OPTIONAL([Escape])
#### End of Escape

EFL_CHECK_FUNC([SHM], [shm_open])
SHM_LIBS="${requirements_libs_shm}"
AC_SUBST([SHM_LIBS])

AC_SUBST([DL_LIBS])
AC_SUBST([DL_INTERNAL_LIBS])
#### End of Platform-dependent


#### Eina

EFL_LIB_START([Eina])

### Default values

have_safety_checks="yes"
want_log="yes"
case "${build_profile}" in
   dev)
     with_max_log_level=""
     have_stringshare_usage="no"
     want_valgrind="auto"
     want_debug_malloc="no"
     want_debug_threads="no"
     want_default_mempool="no"
     want_cow_magic="no"
     ;;

   debug)
     with_max_log_level=""
     have_stringshare_usage="yes"
     want_valgrind="auto"
     want_debug_malloc="yes"
     want_debug_threads="yes"
     want_default_mempool="yes"
     want_cow_magic="yes"
     ;;

   release)
     with_max_log_level="3"
     have_stringshare_usage="no"
     want_valgrind="no"
     want_debug_malloc="no"
     want_debug_threads="no"
     want_default_mempool="no"
     want_cow_magic="no"
     ;;
esac

EINA_CONFIG([HAVE_ALLOCA_H], [test "x${ac_cv_working_alloca_h}" = "xyes"])
EINA_CONFIG([SAFETY_CHECKS], [test "x${have_safety_checks}" = "xyes"])
EINA_CONFIG([DEFAULT_MEMPOOL], [test "x${want_default_mempool}" = "xyes"])

if test -n "${with_max_log_level}"; then
   AC_MSG_NOTICE([ignoring any EINA_LOG() with level greater than ${with_max_log_level}])
   AC_DEFINE_UNQUOTED([EINA_LOG_LEVEL_MAXIMUM], [${with_max_log_level}], [if set, logging is limited to this amount.])
fi

AC_DEFINE_IF([EINA_STRINGSHARE_USAGE],
   [test "x${have_stringshare_usage}" = "xyes"],
   [1], [Report Eina stringshare usage pattern])

### Additional options to configure
AC_ARG_ENABLE([magic-debug],
   [AC_HELP_STRING([--disable-magic-debug], [disable magic debug of eina structure @<:@default=enabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       have_magic_debug="yes"
    else
       have_magic_debug="no"
    fi
   ],
   [have_magic_debug="yes"])

EINA_CONFIG([MAGIC_DEBUG], [test "x${have_magic_debug}" = "xyes"])

### Checks for programs

### Checks for libraries
EFL_PLATFORM_DEPEND([EINA], [all])

EFL_ADD_LIBS([EINA], [-lm])

## Options

# Valgrind
AC_ARG_ENABLE([valgrind],
   [AC_HELP_STRING([--disable-valgrind],
       [enable valgrind mempool declaration. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_valgrind="yes"
    else
       want_valgrind="no"
    fi
   ])

if test "${want_valgrind}" = "auto"; then
   PKG_CHECK_EXISTS([valgrind >= 2.4.0], [want_valgrind="yes"],
      [want_valgrind="no"
       AC_MSG_WARN([valgrind support desired by --with-profile=${build_profile} but not found. If your platform supports it, install valgrind.])])
fi

if test "${want_valgrind}" = "no"; then
    AC_DEFINE([NVALGRIND], [1], [Valgrind support disabled])
else
    PKG_CHECK_MODULES([VALGRIND], [valgrind >= 2.4.0])
    AC_DEFINE([HAVE_VALGRIND], [1], [Valgrind support enabled])
fi

AC_DEFINE_IF([EINA_DEBUG_MALLOC],
   [test "x${ac_cv_func_malloc_usable_size}" = "xyes" && test "x${want_debug_malloc}" = "xyes"],
   [1], [Turn on debugging overhead in mempool])

AC_DEFINE_IF([EINA_COW_MAGIC_ON],
   [test "x${want_cow_magic}" = "xyes" ],
   [1], [Turn on Eina_Magic in Eina_Cow])

EFL_OPTIONAL_DEPEND_PKG([EINA], [${want_systemd}], [SYSTEMD], [libsystemd-journal])

EFL_EVAL_PKGS([EINA])

## Examples

## Benchmarks

PKG_CHECK_MODULES([GLIB],
   [glib-2.0],
   [have_glib="yes"],
   [have_glib="no"])

if test "x${have_glib}" = "xyes" ; then
   GLIB_CFLAGS="${GLIB_CFLAGS} -DEINA_BENCH_HAVE_GLIB"
fi

### Checks for header files

# sys/mman.h could be provided by evil/escape/exotic so we need to set CFLAGS accordingly
CFLAGS_save="${CFLAGS}"
CFLAGS="${CFLAGS} ${EINA_CFLAGS}"
AC_CHECK_HEADERS([sys/mman.h])
CFLAGS="${CFLAGS_save}"

AC_CHECK_HEADER([byteswap.h], [have_byteswap="yes"], [have_byteswap="no"])

### Checks for types

EINA_CONFIG([HAVE_DIRENT_H], [test "x${have_dirent}" = "xyes"])
AC_DEFINE_IF([HAVE_DIRENT_H], [test "x${have_dirent}" = "xyes"],
   [1], [Define to 1 if you have a valid <dirent.h> header file.])

### Checks for structures

### Checks for compiler characteristics
EINA_CONFIG([HAVE_BYTESWAP_H], [test "x${have_byteswap}" = "xyes"])

EFL_CHECK_GCC_BUILTIN([bswap16], [HAVE_BSWAP16])
EFL_CHECK_GCC_BUILTIN([bswap32], [HAVE_BSWAP32])
EFL_CHECK_GCC_BUILTIN([bswap64], [HAVE_BSWAP64])

### Checks for linker characteristics

### Checks for library functions

AC_CHECK_FUNCS([fchmod])

EFL_CHECK_FUNCS([EINA], [dlopen dladdr iconv shm_open splice setxattr getpagesize])

enable_log="no"
if test "x${efl_func_fnmatch}" = "xyes" && test "x${want_log}" = "xyes" ; then
   enable_log="yes"
fi

AC_MSG_CHECKING([wether to build Eina_Log infrastructure])
AC_MSG_RESULT([${enable_log}])

EINA_CONFIG([ENABLE_LOG], [test "x${enable_log}" = "xyes"])

EFL_CHECK_THREADS
if test "x${efl_have_threads}" = "xno"; then
   CFOPT_WARNING="xyes"
fi

EFL_ADD_PUBLIC_LIBS([EINA], [${EFL_PTHREAD_LIBS}])
EFL_ADD_CFLAGS([EINA], [${EFL_PTHREAD_CFLAGS}])

EINA_CONFIG([HAVE_PTHREAD_BARRIER], [test "x${efl_have_pthread_barrier}" = "xyes"])
EINA_CONFIG([HAVE_PTHREAD_AFFINITY], [test "x${efl_have_setaffinity}" = "xyes"])
EINA_CONFIG([HAVE_DEBUG_THREADS], [test "x${want_debug_threads}" = "xyes"])
EINA_CONFIG([HAVE_POSIX_SPINLOCK], [test "x${efl_have_posix_threads_spinlock}" = "xyes"])

### Modules

EINA_CHECK_MODULE([chained-pool], [static], [chained pool])
EINA_CHECK_MODULE([pass-through], [static], [pass through])
EINA_CHECK_MODULE([one-big],      [static], [one big])

EFL_ADD_FEATURE([EINA], [systemd-journal], [${want_systemd}])

EFL_LIB_END([Eina])
#### End of Eina


#### Eina CXX
EFL_LIB_START([Eina_Cxx])

EFL_CXX_COMPILE_STDCXX_11([ext])
want_cxx11="yes"
AC_ARG_ENABLE([c++11],
   [AC_HELP_STRING([--disable-c++11],
       [disable C++11 bindings. @<:@default=enabled@:>@])],
   [want_cxx11="${enableval}"])

if test "x${HAVE_CXX11}" = "x1" -a "x${want_cxx11}" = "xyes"; then
  have_cxx11="yes"
else
  have_cxx11="no"
fi

AM_CONDITIONAL([HAVE_CXX11], [test "x${have_cxx11}" = "xyes"])

EFL_INTERNAL_DEPEND_PKG([EINA_CXX], [Eina])
EFL_ADD_CFLAGS([EINA_CXX], [${EFL_PTHREAD_CFLAGS}])
EFL_EVAL_PKGS([EINA_CXX])

EFL_LIB_END([Eina_Cxx])
#### End of Eina CXX

#### Eet

EFL_LIB_START([Eet])

### Default values

### Additional options to configure

### Checks for programs

### Checks for libraries

## Compatibility layers
EFL_PLATFORM_DEPEND([EET], [evil])

EFL_ADD_LIBS([EET], [-lm])

# Cryptography support
if test "$build_crypto" != "none" ; then
   AC_DEFINE([HAVE_CIPHER], [1], [Have cipher support built in eet])
   AC_DEFINE([HAVE_SIGNATURE], [1], [Have signature support for eet file])
   EFL_CRYPTO_DEPEND([EET])
fi

EFL_CHECK_LIBS([EET], [libjpeg zlib])

EFL_INTERNAL_DEPEND_PKG([EET], [eina])

EFL_EVAL_PKGS([EET])

### Checks for header files

### Checks for types

### Checks for structures

### Checks for compiler characteristics

### Checks for linker characteristics

### Checks for library functions

### Check availability

EFL_LIB_END([Eet])
#### End of Eet

#### Eet CXX
EFL_LIB_START([Eet_Cxx])

EFL_INTERNAL_DEPEND_PKG([EET_CXX], [Eina_Cxx])
EFL_INTERNAL_DEPEND_PKG([EET_CXX], [Eet])

EFL_EVAL_PKGS([EET_CXX])

EFL_LIB_END([Eet_Cxx])
#### End of Eet CXX

#### Eo

EFL_LIB_START([Eo])

### Default values

### Additional options to configure

### Checks for programs

## Compatibility layers
EFL_PLATFORM_DEPEND([EO], [evil])

### Checks for libraries
EFL_INTERNAL_DEPEND_PKG([EO], [eina])

# Example (evas one)

# TODO: add once elementary is merged
#PKG_CHECK_MODULES([ELM], [elementary >= 1.7.0], [have_elm="yes"], [have_elm="no"])
AM_CONDITIONAL([EO_BUILD_EXAMPLE_EVAS], [test "x${have_elm}" = "xyes"])

### Checks for header files

### Checks for types

### Checks for structures

### Checks for compiler characteristics

### Checks for linker characteristics

### Checks for library functions
EFL_CHECK_FUNCS([EO], [dladdr])

### Check availability

EFL_LIB_END([Eo])
#### End of Eo

#### Eo CXX
EFL_LIB_START([Eo_Cxx])

EFL_EVAL_PKGS([EO_CXX])

EFL_LIB_END([Eo_Cxx])
#### End of Eo CXX

#### Eolian

EFL_LIB_START([Eolian])

### Default values

### Additional options to configure
EFL_ADD_FEATURE([EOLIAN], [cxx], [${have_cxx11}])

### Checks for programs

## Compatibility layers
EFL_PLATFORM_DEPEND([EOLIAN], [evil])

### Checks for libraries
EFL_INTERNAL_DEPEND_PKG([EOLIAN], [eina])

### Checks for header files

### Checks for types

### Checks for structures

### Checks for compiler characteristics

### Checks for linker characteristics

### Checks for library functions

### Check availability

EFL_LIB_END([Eolian])
#### End of Eolian

EFL_LIB_START([Eolian_Cxx])
### Default values

### Additional options to configure

### Checks for programs

## Compatibility layers

### Checks for libraries
EFL_INTERNAL_DEPEND_PKG([EOLIAN_CXX], [eina])
EFL_INTERNAL_DEPEND_PKG([EOLIAN_CXX], [eo])

### Checks for header files

### Checks for types

### Checks for structures

### Checks for compiler characteristics

### Checks for linker characteristics

### Checks for library functions

### Check availability
EFL_LIB_END([Eolian_Cxx])

#### Evas
EFL_LIB_START_OPTIONAL([Evas], [test "x${build_gui}" = "xyes"])

### Additional options to configure

# X11
AC_ARG_WITH([x11],
   [AC_HELP_STRING([--with-x11=xlib|xcb|none],
                   [X11 method to use: xlib, xcb or none])])

if test "x${have_windows}" = "xyes" || test "x${have_ps3}" = "xyes"; then
   with_x11="none"
elif test "x${with_x11}" = "x"; then
   with_x11="xlib"
fi

want_x11_xlib="no"
want_x11_xcb="no"
want_x11_none="no"
want_x11_any="no"
case "${with_x11}" in
   xlib)
     want_x11_xlib="yes"
     want_x11_any="yes"
     ;;
   xcb)
     want_x11_xcb="yes"
     want_x11_any="yes"
     CFOPT_WARNING="xyes"
     ;;
   none)
     want_x11_none="yes"
     ;;
   *)
     AC_MSG_ERROR([Unknown build x11 --with-x11=${with_x11}])
     ;;
esac

# OpenGL
AC_ARG_WITH([opengl],
   [AC_HELP_STRING([--with-opengl=full|es|none],
                   [OpenGL method to use: full, es or none])])

if test "x${have_windows}" = "xyes" || test "x${have_ps3}" = "xyes"; then
   with_opengl="none"
elif test "x${with_opengl}" = "x"; then
   with_opengl="full"
fi

case "${with_opengl}" in
   full|es|none)
     ;;
   *)
     AC_MSG_ERROR([Unknown build opengl --with-opengl=${with_opengl}])
     ;;
esac

want_x11_xlib_opengl="no"
want_x11_xcb_opengl="no"
if test "${with_opengl}" != "none"; then
   want_x11_xlib_opengl="${want_x11_xlib}"
   want_x11_xcb_opengl="${want_x11_xcb}"
   want_x11_any_opengl="${want_x11_any}"
fi

# Wayland
AC_ARG_ENABLE([wayland],
   [AC_HELP_STRING([--enable-wayland],
       [enable wayland display server. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_wayland="yes"
    else
       want_wayland="no"
    fi
   ],
   [want_wayland="no"])

if test "${want_wayland}" = "yes"; then
   EFL_PKG_CHECK_STRICT([wayland-client >= 1.3.0])
fi

# Fb
AC_ARG_ENABLE([fb],
   [AC_HELP_STRING([--enable-fb],
       [enable raw Framebuffer access. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_fb="yes"
    else
       want_fb="no"
    fi
   ],
   [want_fb="no"])

# SDL
AC_ARG_ENABLE([sdl],
   [AC_HELP_STRING([--enable-sdl],
       [enable SDL support. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_sdl="yes"
    else
       want_sdl="no"
    fi
   ],
   [want_sdl="no"])

if test "${want_sdl}" = "yes"; then
   EFL_PKG_CHECK_STRICT([sdl >= 1.2.0])
fi

# We only enable SDL with opengl if it is not the full version and not ES
# This can be changed if we ported our SDL code over to SDL 2.0. For older
# versions the SDL_opengles.h has never been released.
want_gl_sdl="no"
if test "${want_sdl}" = "yes" && test "${with_opengl}" = "es"; then
   AC_MSG_ERROR([We currently do not support SDL with OpenGL ES. Please consider full OpenGL if you want to use it with SDL.])
fi
if test "${want_sdl}" = "yes" && test "${with_opengl}" = "full"; then
   want_gl_sdl="yes"
fi

# Cocoa
AC_ARG_ENABLE([cocoa],
    [AC_HELP_STRING([--enable-cocoa],
        [enable MacOS X Cocoa . @<:@default=disabled@:>@])],
    [
     if test "x${enableval}" = "xyes" ; then
        want_cocoa="yes"
     else
        want_cocoa="no"
     fi
    ],
    [want_cocoa="no"])

 if test "${want_cocoa}" = "yes"; then
    #test cocoa requirements (objc and Cocoa/Cocoa.h)
 	cocoa_ldflags=""
   have_cocoa="no"
   m4_ifdef([AC_PROG_OBJC],
      [
       if test "x${have_gnu_objc}" = "xyes" ; then
          AC_LANG_PUSH([Objective C])
          LIBS_save="$LIBS"
          LIBS="$LIBS -framework Cocoa"
          AC_LINK_IFELSE(
             [AC_LANG_PROGRAM(
                 [[
#include <Cocoa/Cocoa.h>
                 ]],
                 [[
NSWindow *window;
window = [[NSWindow alloc]
           initWithContentRect:NSMakeRect(0, 0, 1, 1)
           styleMask:(NSTitledWindowMask)
           backing:NSBackingStoreBuffered
           defer:NO
           screen:nil
         ];
                 ]])],
             [
              have_cocoa="yes"
              cocoa_ldflags="-framework Cocoa"
             ],
             [have_cocoa="no"])
          LIBS="$LIBS_save"
          AC_MSG_CHECKING([whether Cocoa framework is supported])
          AC_MSG_RESULT([${have_cocoa}])
          AC_LANG_POP([Objective C])
       fi
   ])
fi
AC_SUBST(cocoa_ldflags)

# Drm
AC_ARG_ENABLE([drm],
   [AC_HELP_STRING([--enable-drm],
       [enable drm engine. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_drm="yes"
    else
       want_drm="no"
    fi
   ],
   [want_drm="no"])

want_drm_hw_accel="no"
AC_ARG_ENABLE([drm-hw-accel],
   [AC_HELP_STRING([--enable-drm-hw-accel],
       [enable drm hardware acceleration. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_drm_hw_accel="yes"
    else
       want_drm_hw_accel="no"
    fi
   ],
   [want_drm_hw_accel="no"])


# Fontconfig
AC_ARG_ENABLE([fontconfig],
   [AC_HELP_STRING([--disable-fontconfig],
       [disable fontconfig for finding fonts. @<:@default=enabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_fontconfig="yes"
    else
       want_fontconfig="no"
       CFOPT_WARNING="xyes"
    fi
   ],
   [want_fontconfig="yes"])

# Fribidi
AC_ARG_ENABLE([fribidi],
   [AC_HELP_STRING([--disable-fribidi],
       [disable bidirectional text support. @<:@default=enabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_fribidi="yes"
    else
       want_fribidi="no"
       CFOPT_WARNING="xyes"
    fi
   ],
   [want_fribidi="yes"])

# Eo Id
AC_ARG_ENABLE([eo_id],
   [AC_HELP_STRING([--disable-eo-id],
       [disable Eo indirection. @<:@default=enabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_eo_id="yes"
    else
       want_eo_id="no"
       CFOPT_WARNING="xyes"
    fi
   ],
   [want_eo_id="yes"])

# Harfbuzz
AC_ARG_ENABLE([harfbuzz],
   [AC_HELP_STRING([--enable-harfbuzz],
       [enable complex text shaping and layouting support. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_harfbuzz="yes"
    else
       want_harfbuzz="no"
    fi
   ],
   [want_harfbuzz="no"])

# Egl
AC_ARG_ENABLE([egl],
   [AC_HELP_STRING([--enable-egl],
       [enable EGL rendering. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_egl="yes"
    else
       want_egl="no"
    fi
   ],
   [want_egl="no"])

# Pixman
AC_ARG_ENABLE([pixman],
   [AC_HELP_STRING([--enable-pixman],
       [enable pixman for software rendering. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_pixman="yes"
       CFOPT_WARNING="xyes"
    else
       want_pixman="no"
    fi
   ],
   [want_pixman="no"])

AC_ARG_ENABLE([pixman-font],
   [AC_HELP_STRING([--enable-pixman-font],
       [Allow pixman to render fonts. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       have_pixman_font="yes"
    else
       have_pixman_font="no"
    fi
   ],
   [have_pixman_font="no"])

AC_ARG_ENABLE([pixman-rect],
   [AC_HELP_STRING([--enable-pixman-rect],
       [Allow pixman to render rects. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       have_pixman_rect="yes"
    else
       have_pixman_rect="no"
    fi
   ],
   [have_pixman_rect="no"])

AC_ARG_ENABLE([pixman-line],
   [AC_HELP_STRING([--enable-pixman-line],
       [Allow pixman to render lines. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       have_pixman_line="yes"
    else
       have_pixman_line="no"
    fi
   ],
   [have_pixman_line="no"])

AC_ARG_ENABLE(pixman-poly,
   AC_HELP_STRING([--enable-pixman-poly],
      [Allow pixman to render polys. @<:@default=disabled@:>@]),
   [
    if test "x${enableval}" = "xyes" ; then
       have_pixman_poly="yes"
    else
       have_pixman_poly="no"
    fi
   ],
   [have_pixman_poly="no"])

AC_ARG_ENABLE([pixman-image],
   [AC_HELP_STRING([--enable-pixman-image],
       [Allow pixman to render images. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       have_pixman_image="yes"
    else
       have_pixman_image="no"
    fi
   ],
   [have_pixman_image="no"])

AC_ARG_ENABLE([pixman-image-scale-sample],
   [AC_HELP_STRING([--enable-pixman-image-scale-sample],
       [Allow pixman to render sampled scaled images. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       have_pixman_image_scale_sample="yes"
    else
       have_pixman_image_scale_sample="no"
    fi
   ],
   [have_pixman_image_scale_sample="no"])

# Tile rotate
AC_ARG_ENABLE([tile-rotate],
   [AC_HELP_STRING([--enable-tile-rotate],
       [Enable tiled rotate algorithm. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       have_tile_rotate="yes"
       CFOPT_WARNING="xyes"
    else
       have_tile_rotate="no"
    fi
  ],
  [have_tile_rotate="no"])


# Image Loaders

ARG_ENABLE_EVAS_IMAGE_LOADER(BMP, static)
ARG_ENABLE_EVAS_IMAGE_LOADER(Eet, static)
ARG_ENABLE_EVAS_IMAGE_LOADER(Generic, static)
ARG_ENABLE_EVAS_IMAGE_LOADER(Gif, yes)
ARG_ENABLE_EVAS_IMAGE_LOADER(ICO, static)
ARG_ENABLE_EVAS_IMAGE_LOADER(JPEG, static)
ARG_ENABLE_EVAS_IMAGE_LOADER(JP2K, auto)
ARG_ENABLE_EVAS_IMAGE_LOADER(PMAPS, static)
ARG_ENABLE_EVAS_IMAGE_LOADER(PNG, static)
ARG_ENABLE_EVAS_IMAGE_LOADER(PSD, static)
ARG_ENABLE_EVAS_IMAGE_LOADER(Tga, static)
ARG_ENABLE_EVAS_IMAGE_LOADER(Tiff, yes)
ARG_ENABLE_EVAS_IMAGE_LOADER(WBMP, static)
ARG_ENABLE_EVAS_IMAGE_LOADER(WEBP, no)
ARG_ENABLE_EVAS_IMAGE_LOADER(XPM, static)
ARG_ENABLE_EVAS_IMAGE_LOADER(TGV, static)

### Default values

want_evas_engine_software_gdi="${have_win32}"
want_evas_engine_software_ddraw="${have_win32}"
want_evas_engine_gl_cocoa="${want_cocoa}"
want_evas_engine_wayland_egl="no"
if test "${want_wayland}" = "yes" && test "${want_egl}" = "yes" && test "${with_opengl}" = "es"; then
   want_evas_engine_wayland_egl="yes"
fi

if test "${have_wince}" = "yes"; then
   want_fontconfig="no"
   want_evas_image_loader_gif="no"
   want_evas_image_loader_tiff="no"
   want_evas_image_loader_webp="no"
fi

if test "${want_lua_old}" = "yes"; then
   EFL_CHECK_LUA_OLD([EVAS])
else
   EFL_DEPEND_PKG([EVAS], [LUAJIT], [luajit >= 2.0.0])
fi

EFL_ADD_FEATURE([EVAS], [lua-old])

EFL_CHECK_FUNC([EVAS], [dlsym])

if test "x${efl_func_dlsym}" = "xno" && test "${with_opengl}" != "none"; then
   AC_MSG_ERROR([OpenGL cannot work without dlsym()])
fi

### Checks for programs

### Checks for libraries

## Compatibility layers
EFL_PLATFORM_DEPEND([EVAS], [all])
EFL_INTERNAL_DEPEND_PKG([EVAS], [eo])
EFL_INTERNAL_DEPEND_PKG([EVAS], [eet])
EFL_INTERNAL_DEPEND_PKG([EVAS], [eina])

EFL_ADD_LIBS([EVAS], [-lm])

# Freetype
EFL_DEPEND_PKG([EVAS], [FREETYPE], [freetype2 >= 9.3.0])

## optional dependencies

# FontConfig
EFL_OPTIONAL_DEPEND_PKG([EVAS], [${want_fontconfig}],
   [FONTCONFIG], [fontconfig >= 2.5.0])

# fribidi support
EFL_OPTIONAL_DEPEND_PKG([EVAS], [${want_fribidi}],
   [FRIBIDI], [fribidi >= 0.19.2])

# harfbuzz support
have_harfbuzz_ft="no"
EFL_OPTIONAL_DEPEND_PKG([EVAS], [${want_harfbuzz}],
   [HARFBUZZ], [harfbuzz >= 0.9.0])

# Pixman
EFL_OPTIONAL_DEPEND_PKG([EVAS], [${want_pixman}], [PIXMAN], [pixman-1])

if test "x${have_pixman}" = "xyes" ; then
   if test "x${have_pixman_font}" = "xyes" ; then
      AC_DEFINE(PIXMAN_FONT, 1, [Allow pixman to render fonts])
   fi
   EFL_ADD_FEATURE([EVAS_PIXMAN], [font], [${have_pixman_font}])

   if test "x${have_pixman_rect}" = "xyes" ; then
      AC_DEFINE(PIXMAN_RECT, 1, [Allow pixman to render rects])
   fi
   EFL_ADD_FEATURE([EVAS_PIXMAN], [rect], [${have_pixman_rect}])

   if test "x${have_pixman_line}" = "xyes" ; then
      AC_DEFINE(PIXMAN_LINE, 1, [Allow pixman to render lines])
   fi
   EFL_ADD_FEATURE([EVAS_PIXMAN], [line], [${have_pixman_line}])

   if test "x${have_pixman_poly}" = "xyes" ; then
      AC_DEFINE(PIXMAN_POLY, 1, [Allow pixman to render polys])
   fi
   EFL_ADD_FEATURE([EVAS_PIXMAN], [poly], [${have_pixman_poly}])

   if test "x${have_pixman_image}" = "xyes" ; then
      AC_DEFINE(PIXMAN_IMAGE, 1, [Allow pixman to render images])
   fi
   EFL_ADD_FEATURE([EVAS_PIXMAN], [image], [${have_pixman_image}])

   if test "x${have_pixman_image_scale_sample}" = "xyes" ; then
      AC_DEFINE(PIXMAN_IMAGE_SCALE_SAMPLE, 1, [Allow pixman to render image sampled scaling])
   fi
   EFL_ADD_FEATURE([EVAS_PIXMAN], [scale_sample], [${have_pixman_scale_sample}])
fi

## Engines

define([EVAS_ENGINE_DEP_CHECK_FB], [
AC_CHECK_HEADER([linux/fb.h], [:], [AC_MSG_ERROR([Missing linux/fb.h])])
])

define([EVAS_ENGINE_DEP_CHECK_PSL1GHT], [
AC_CHECK_HEADER([rsx/rsx.h], [:], [AC_MSG_ERROR([Missing rsx/rsx.h])])
])

EVAS_ENGINE([buffer], [static])
EVAS_ENGINE([fb], [${want_fb}], [EVAS_ENGINE_DEP_CHECK_FB])
EVAS_ENGINE([psl1ght], [${have_ps3}], [EVAS_ENGINE_DEP_CHECK_PSL1GHT])

# XXX TODO:
EVAS_CHECK_ENGINE([gl-cocoa], [${want_evas_engine_gl_cocoa}], [no], [OpenGL Cocoa])
EVAS_CHECK_ENGINE([gl-sdl], [${want_gl_sdl}], [no], [OpenGL SDL])
EVAS_CHECK_ENGINE([software-gdi], [${want_evas_engine_software_gdi}], [no], [Software GDI])
EVAS_CHECK_ENGINE([software-ddraw], [${want_evas_engine_software_ddraw}], [no], [Software DirectDraw])
EVAS_CHECK_ENGINE([wayland-egl], [${want_evas_engine_wayland_egl}], [no], [Wayland Egl])
EVAS_CHECK_ENGINE([wayland-shm], [${want_wayland}], [no], [Wayland Shm])
EVAS_CHECK_ENGINE([drm], [${want_drm}], [no], [Drm])


# Software XCB

have_evas_engine_software_xcb="no"
if test "${with_x11}" = "xcb" ; then
   EVAS_CHECK_ENGINE([software-xcb], [${want_x11_xcb}], [no], [Software XCB])
else
   AM_CONDITIONAL([BUILD_ENGINE_SOFTWARE_XCB], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_SOFTWARE_XCB], [false])
fi

AC_MSG_CHECKING([whether to build Software XCB Engine])
AC_MSG_RESULT([${have_evas_engine_software_xcb}])

# No Software XCB ? Then try Software Xlib

have_evas_engine_software_xlib="no"
if test "x${want_x11_xcb}" = "xno" ; then
   EVAS_CHECK_ENGINE([software-xlib], [${want_x11_xlib}], [no], [Software Xlib])
else
   AM_CONDITIONAL([BUILD_ENGINE_SOFTWARE_XLIB], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_SOFTWARE_XLIB], [false])
fi

AC_MSG_CHECKING([whether to build Software Xlib Engine])
AC_MSG_RESULT([${have_evas_engine_software_xlib}])

# If software_x11 is available, define everything needed for X11

have_evas_engine_software_x11="no"
if test "x${have_evas_engine_software_xlib}" = "xyes" || test "x${have_evas_engine_software_xlib}" = "xstatic" || test "x${have_evas_engine_software_xcb}" = "xyes" || test "x${have_evas_engine_software_xcb}" = "xstatic" ; then
   have_evas_engine_software_x11="yes"
   AC_DEFINE_UNQUOTED([BUILD_ENGINE_SOFTWARE_X11], [1], [Build software X11 engine])
fi
AM_CONDITIONAL([BUILD_ENGINE_SOFTWARE_X11], [test "x${have_evas_engine_software_x11}" = "xyes"])

if test "x${have_evas_engine_software_xlib}" = "xstatic" || test "x${have_evas_engine_software_xcb}" = "xstatic"; then
   AC_DEFINE_UNQUOTED([EVAS_STATIC_BUILD_SOFTWARE_X11], [1], [Build software X11 engine as part of libevas])
fi
AM_CONDITIONAL([EVAS_STATIC_BUILD_SOFTWARE_X11], [test "x${have_evas_engine_software_xcb}" = "xstatic" || test "x${have_evas_engine_software_xlib}" = "xstatic"])

# Needed for evas-software-x11.pc

AC_SUBST([have_evas_engine_software_xlib])
AC_SUBST([have_evas_engine_software_xcb])

# Software generic
AC_DEFINE([EVAS_STATIC_BUILD_SOFTWARE_GENERIC], [1], [Build software generic engine as part of libevas])
AM_CONDITIONAL([EVAS_STATIC_BUILD_SOFTWARE_GENERIC], [true])

# OpenGL

if test "${with_opengl}" = "es" ; then
   AC_DEFINE(GL_GLES, 1, [GLSL runtime shader GLES2 support])
fi

# OpenGL XCB

have_evas_engine_gl_xcb="no"
if test "${want_x11_xcb_opengl}" = "yes"; then
   EVAS_CHECK_ENGINE([gl-xcb], [${want_x11_xcb_opengl}], [no], [OpenGL XCB])
else
   AM_CONDITIONAL([BUILD_ENGINE_GL_XCB], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_XCB], [false])
fi

AC_MSG_CHECKING([whether to build OpenGL XCB Engine])
AC_MSG_RESULT([${have_evas_engine_gl_xcb}])

# No openGL XCB ? Then try OpenGL Xlib

have_evas_engine_gl_xlib="no"
if test "x${have_evas_engine_gl_xcb}" = "xno" ; then
   EVAS_CHECK_ENGINE([gl-xlib], [${want_x11_xlib_opengl}], [no], [OpenGL XLib])
else
   AM_CONDITIONAL([BUILD_ENGINE_GL_XLIB], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_XLIB], [false])
fi

AC_MSG_CHECKING([whether to build OpenGL Xlib Engine])
AC_MSG_RESULT([${have_evas_engine_gl_xlib}])

# If opengl_x11 is available, define everything needed for X11

have_evas_engine_gl_x11="no"
if test "x${have_evas_engine_gl_xlib}" = "xyes" || test "x${have_evas_engine_gl_xlib}" = "xstatic" || test "x${have_evas_engine_gl_xcb}" = "xyes" || test "x${have_evas_engine_gl_xcb}" = "xstatic" ; then
   have_evas_engine_gl_x11="yes"
   AC_DEFINE_UNQUOTED([BUILD_ENGINE_GL_X11], [1], [Build OpenGL X11 engine])
fi
AM_CONDITIONAL([BUILD_ENGINE_GL_X11], [test "x${have_evas_engine_gl_x11}" = "xyes"])

if test "x${have_evas_engine_gl_xlib}" = "xstatic" || test "x${have_evas_engine_gl_xcb}" = "xstatic"; then
   AC_DEFINE_UNQUOTED([EVAS_STATIC_BUILD_GL_X11], [1], [Build OpenGL X11 engine as part of libevas])
fi
AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_X11], [test "x${have_evas_engine_gl_xcb}" = "xstatic" || test "x${have_evas_engine_gl_xlib}" = "xstatic"])

# Needed for evas-opengl-x11.pc

AC_SUBST([have_evas_engine_gl_xlib])
AC_SUBST([have_evas_engine_gl_xcb])

# OpenGL SDL

if test "x$have_evas_engine_gl_sdl" = "xyes" || test "x$have_evas_engine_gl_sdl" = "xstatic" ; then
   AC_CHECK_DECL([SDL_GL_CONTEXT_MAJOR_VERSION],
      [AC_DEFINE([HAVE_SDL_GL_CONTEXT_VERSION], [1], [SDL_GL version attributes present])],,
      [#include <SDL/SDL_video.h>])
fi

if test "${with_opengl}" = "es"; then
   AC_CHECK_DECL([SDL_OPENGLES],
      [AC_DEFINE([HAVE_SDL_FLAG_OPENGLES], [1], [SDL_OPENGLES flag is present])],,
      [#include <SDL/SDL_video.h>])
fi

# OpenGL common
evas_engine_gl_common_cflags=""
evas_engine_gl_common_libs=""
AC_SUBST([evas_engine_gl_common_cflags])
AC_SUBST([evas_engine_gl_common_libs])

have_evas_engine_gl_common="no"
have_static_evas_engine_gl_common="no"
if test "x$have_evas_engine_gl_xlib" = "xyes" || \
   test "x$have_evas_engine_gl_xcb" = "xyes" || \
   test "x$have_evas_engine_gl_sdl" = "xyes" || \
   test "x$have_evas_engine_gl_cocoa" = "xyes" || \
   test "x$have_evas_engine_wayland_egl" = "xyes"; then
   have_evas_engine_gl_common="yes"
fi
if test "x$have_evas_engine_gl_xlib" = "xstatic" || \
   test "x$have_evas_engine_gl_xcb" = "xstatic" || \
   test "x$have_evas_engine_gl_sdl" = "xstatic" || \
   test "x$have_evas_engine_gl_cocoa" = "xstatic" || \
   test "x$have_evas_engine_wayland_egl" = "xstatic"; then
   have_evas_engine_gl_common="yes"
   have_static_evas_engine_gl_common="yes"
fi

if test "x${have_evas_engine_gl_common}" = "xyes"; then
   AC_DEFINE([BUILD_ENGINE_GL_COMMON], [1], [Generic OpenGL Rendering Support])
fi

AM_CONDITIONAL([BUILD_ENGINE_GL_COMMON], [test "x$have_evas_engine_gl_common" = "xyes"])

if test "x${have_static_evas_engine_gl_common}" = "xyes"; then
   AC_DEFINE([EVAS_STATIC_BUILD_GL_COMMON], [1], [Build GL generic engine as part of libevas])
fi

AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_COMMON], [test "x${have_static_evas_engine_gl_common}" = "xyes"])


## Image Loaders

EVAS_CHECK_IMAGE_LOADER([BMP],     [${want_evas_image_loader_bmp}])
EVAS_CHECK_IMAGE_LOADER([Eet],     [${want_evas_image_loader_eet}])
EVAS_CHECK_IMAGE_LOADER([Generic], [${want_evas_image_loader_generic}])
EVAS_CHECK_IMAGE_LOADER([Gif],     [${want_evas_image_loader_gif}])
EVAS_CHECK_IMAGE_LOADER([ICO],     [${want_evas_image_loader_ico}])
EVAS_CHECK_IMAGE_LOADER([JPEG],    [${want_evas_image_loader_jpeg}])
EVAS_CHECK_IMAGE_LOADER([JP2K],    [${want_evas_image_loader_jp2k}])
EVAS_CHECK_IMAGE_LOADER([PMAPS],   [${want_evas_image_loader_pmaps}])
EVAS_CHECK_IMAGE_LOADER([PNG],     [${want_evas_image_loader_png}])
EVAS_CHECK_IMAGE_LOADER([PSD],     [${want_evas_image_loader_psd}])
EVAS_CHECK_IMAGE_LOADER([Tga],     [${want_evas_image_loader_tga}])
EVAS_CHECK_IMAGE_LOADER([Tiff],    [${want_evas_image_loader_tiff}])
EVAS_CHECK_IMAGE_LOADER([WBMP],    [${want_evas_image_loader_wbmp}])
EVAS_CHECK_IMAGE_LOADER([WEBP],    [${want_evas_image_loader_webp}])
EVAS_CHECK_IMAGE_LOADER([XPM],     [${want_evas_image_loader_xpm}])
EVAS_CHECK_IMAGE_LOADER([TGV],     [${want_evas_image_loader_tgv}])

EFL_EVAL_PKGS([EVAS])

### Checks for header files

if test "x$have_harfbuzz" = "xyes" ; then

   CPPFLAGS_SAVE="$CPPFLAGS"
   CPPFLAGS="$CPPFLAGS $EVAS_CFLAGS"
# must have for usage with harfbuzz although harfbuzz may not have it.

   AC_CHECK_HEADER([hb-ft.h],
      [
       have_harfbuzz_ft="yes"
       #Depend on harfbuzz ft for harfbuzz support
       AC_DEFINE([HAVE_HARFBUZZ], [1], [have harfbuzz support])
      ],
      [AC_MSG_ERROR([Harfbuzz-ft (hb-ft.h) not found])])

   CPPFLAGS="$CPPFLAGS_SAVE"
fi

### Checks for types

CPPFLAGS_SAVE="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $EVAS_CFLAGS -Isrc/lib/eina"
AC_CHECK_SIZEOF([Eina_Unicode], [], [#include <Eina.h>])
CPPFLAGS="$CPPFLAGS_SAVE"


if test "x$have_fribidi" = "xyes" ; then
   CPPFLAGS_SAVE="$CPPFLAGS"
   CPPFLAGS="$CPPFLAGS $EVAS_CFLAGS"
   AC_CHECK_SIZEOF([FriBidiChar], [], [#include <fribidi.h>])
   CPPFLAGS="$CPPFLAGS_SAVE"
fi

### Checks for structures

AC_CHECK_TYPES([struct sigaction], [], [],
               [[#include <signal.h>]])

### Checks for compiler characteristics

### Checks for linker characteristics

### Checks for library functions

AC_CHECK_FUNCS([siglongjmp])

AC_CHECK_LIB([m], [lround],
[AC_DEFINE([HAVE_LROUND], [1], [C99 lround function exists])],
[EFL_CHECK_GCC_BUILTIN([lround], [HAVE_LROUND])]
)


# Evas cserve2

AC_ARG_ENABLE([cserve],
   [AC_HELP_STRING([--enable-cserve],
       [enable shared cache server (cserve2). @<:@default=enabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_evas_cserve2="yes"
    else
       want_evas_cserve2="no"
       CFOPT_WARNING="xyes"
    fi
   ],
   [want_evas_cserve2="yes"])

if test "x${want_evas_image_loader_generic}" = "xyes" || test "x${want_evas_cserve2}" = "xyes" ; then
   EFL_ADD_LIBS([EVAS], [${requirements_libs_shm}])
fi

# cserve2 only works on Linux so far.

if test "x${efl_func_shm_open}" = "xno" ; then
   want_evas_cserve2="no"
fi

if test "x${want_evas_cserve2}" = "xyes"; then
   if test "x${ac_cv_header_sys_epoll_h}" = "xno" || test "x${ac_cv_header_sys_inotify_h}" = "xno" || test "x${ac_cv_header_sys_signalfd_h}" = "xno"; then
      want_evas_cserve2="no"
   else
      EVAS_CSERVE2_SLAVE_LIBS="${EFL_COV_LIBS} ${EFL_LIBS} ${requirements_libs_shm}"
      AC_SUBST([EVAS_CSERVE2_SLAVE_LIBS])
   fi
fi

AC_DEFINE_IF([EVAS_CSERVE2],
   [test "x${want_evas_cserve2}" = "xyes"],
   [1], [Shared cache server.])
AM_CONDITIONAL([EVAS_CSERVE2], [test "x${want_evas_cserve2}" = "xyes"])

### Configuration

## Tile rotation

if test "x${have_tile_rotate}" = "xyes" ; then
   AC_DEFINE(TILE_ROTATE, 1, [Enable tiled rotate algorithm])
fi


## dither options

AC_ARG_WITH([evas-dither-mask],
   [AC_HELP_STRING([--with-evas-dither-mask=TYPE],
                   [use the specified dither mask to convert bitdepths in Evas, one of: big, small, line or none.
                    @<:@default=big@:>@])],
   [build_evas_dither_mask=${withval}],
   [build_evas_dither_mask=big])

case "${build_evas_dither_mask}" in
   big)
     AC_DEFINE([BUILD_BIG_DITHER_MASK], [1], [Use biggest dither mask while converting in Evas])
     ;;
   small)
     AC_DEFINE([BUILD_SMALL_DITHER_MASK], [1], [Use smaller dither mask while converting in Evas])
     ;;
   line)
     AC_DEFINE([BUILD_LINE_DITHER_MASK], [1], [Use simpler line-only dither mask while converting in Evas])
     ;;
   none)
     AC_DEFINE([BUILD_NO_DITHER_MASK], [1], [Do not use dither masks while converting in Evas])
     ;;
   *)
     AC_MSG_ERROR([Unknown Evas dither mask --with-evas-dither-mask=${build_evas_dither_mask}])
     ;;
esac
EFL_ADD_FEATURE([EVAS], [fontconfig])
EFL_ADD_FEATURE([EVAS], [fribidi])
EFL_ADD_FEATURE([EVAS], [harfbuzz])
EFL_ADD_FEATURE([EVAS], [cserve], [${want_evas_cserve2}])
EFL_ADD_FEATURE([EVAS], [tile-rotate])
EFL_ADD_FEATURE([EVAS], [dither-mask], [${build_evas_dither_mask}])

EFL_LIB_END_OPTIONAL([Evas])

if test "x${build_gui}" = "xno"; then
   AM_CONDITIONAL([BUILD_ENGINE_BUFFER], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_BUFFER], [false])
   AM_CONDITIONAL([BUILD_ENGINE_FB], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_FB], [false])
   AM_CONDITIONAL([BUILD_ENGINE_PSL1GHT], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_PSL1GHT], [false])
   AM_CONDITIONAL([BUILD_ENGINE_GL_COCOA], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_COCOA], [false])
   AM_CONDITIONAL([BUILD_ENGINE_GL_SDL], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_SDL], [false])
   AM_CONDITIONAL([BUILD_ENGINE_SOFTWARE_GDI], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_SOFTWARE_GDI], [false])
   AM_CONDITIONAL([BUILD_ENGINE_SOFTWARE_DDRAW], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_SOFTWARE_DDRAW], [false])
   AM_CONDITIONAL([BUILD_ENGINE_WAYLAND_EGL], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_WAYLAND_EGL], [false])
   AM_CONDITIONAL([BUILD_ENGINE_WAYLAND_SHM], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_WAYLAND_SHM], [false])
   AM_CONDITIONAL([BUILD_ENGINE_DRM], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_DRM], [false])
   AM_CONDITIONAL([BUILD_ENGINE_SOFTWARE_XCB], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_SOFTWARE_XCB], [false])
   AM_CONDITIONAL([BUILD_ENGINE_SOFTWARE_XLIB], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_SOFTWARE_XLIB], [false])
   AM_CONDITIONAL([BUILD_ENGINE_SOFTWARE_X11], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_SOFTWARE_X11], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_SOFTWARE_GENERIC], [false])
   AM_CONDITIONAL([BUILD_ENGINE_GL_XCB], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_XCB], [false])
   AM_CONDITIONAL([BUILD_ENGINE_GL_XLIB], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_XLIB], [false])
   AM_CONDITIONAL([BUILD_ENGINE_GL_X11], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_X11], [false])
   AM_CONDITIONAL([BUILD_ENGINE_GL_COMMON], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_COMMON], [false])
   AM_CONDITIONAL([BUILD_LOADER_BMP], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_BMP], [false])
   AM_CONDITIONAL([BUILD_LOADER_EET], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_EET], [false])
   AM_CONDITIONAL([BUILD_LOADER_GENERIC], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_GENERIC], [false])
   AM_CONDITIONAL([BUILD_LOADER_GIF], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_GIF], [false])
   AM_CONDITIONAL([BUILD_LOADER_ICO], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_ICO], [false])
   AM_CONDITIONAL([BUILD_LOADER_JPEG], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_JPEG], [false])
   AM_CONDITIONAL([BUILD_LOADER_JP2K], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_JP2K], [false])
   AM_CONDITIONAL([BUILD_LOADER_PMAPS], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_PMAPS], [false])
   AM_CONDITIONAL([BUILD_LOADER_PNG], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_PNG], [false])
   AM_CONDITIONAL([BUILD_LOADER_PSD], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_PSD], [false])
   AM_CONDITIONAL([BUILD_LOADER_TGA], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_TGA], [false])
   AM_CONDITIONAL([BUILD_LOADER_TIFF], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_TIFF], [false])
   AM_CONDITIONAL([BUILD_LOADER_WBMP], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_WBMP], [false])
   AM_CONDITIONAL([BUILD_LOADER_WEBP], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_WEBP], [false])
   AM_CONDITIONAL([BUILD_LOADER_XPM], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_XPM], [false])
   AM_CONDITIONAL([BUILD_LOADER_TGV], [false])
   AM_CONDITIONAL([EVAS_STATIC_BUILD_TGV], [false])
   AM_CONDITIONAL([EVAS_CSERVE2], [false])
fi

#### End of Evas

#### Edje CXX
EFL_LIB_START([Evas_Cxx])

EFL_EVAL_PKGS([EVAS_CXX])

EFL_LIB_END([Evas_Cxx])
#### End of Edje CXX

#### Embryo

EFL_LIB_START([Embryo])

### Default values

### Additional options to configure

### Checks for programs

### Checks for libraries
EFL_PLATFORM_DEPEND([EMBRYO], [all])
EFL_INTERNAL_DEPEND_PKG([EMBRYO], [eina])

EFL_ADD_LIBS([EMBRYO], [-lm])

### Checks for header files

### Checks for types

### Checks for structures

### Checks for compiler characteristics

### Checks for linker characteristics

### Checks for library functions

if ! test "x${efl_func_fnmatch}" = "xyes" ; then
   AC_MSG_ERROR([Cannot find fnmatch()])
fi

if ! test "x${efl_func_gettimeofday}" = "xyes" ; then
   AC_MSG_ERROR([Cannot find gettimeofday()])
fi

### Check availability

EFL_LIB_END([Embryo])
#### End of Embryo


#### Ecore

EFL_LIB_START([Ecore])

### Additional options to configure

# glib

AC_ARG_WITH([glib],
   [AC_HELP_STRING([--with-glib=yes|no|always],
                   [add glib support. @<:@default=enabled@:>@])],
   [
    if test "x${withval}" = "xyes" ; then
       with_glib="yes"
    else
       if test "x${withval}" = "xalways" ; then
          with_glib="always"
       else
          with_glib="no"
       fi
    fi
   ],
   [with_glib="yes"])

AC_ARG_ENABLE([g-main-loop],
   [AC_HELP_STRING([--enable-g-main-loop],
       [enable ecore_main_loop based on g_main_loop. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_g_main_loop="yes"
       CFOPT_WARNING="xyes"
    else
       want_g_main_loop="no"
    fi
   ],
   [want_g_main_loop="no"])

AC_ARG_ENABLE([gstreamer],
   [AC_HELP_STRING([--enable-gstreamer],
                   [enable gstreamer 0.10 support. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_gstreamer="yes"
       CFOPT_WARNING="xyes"
    else
       want_gstreamer="no"
    fi
   ],
   [want_gstreamer="no"])

AC_ARG_ENABLE([gstreamer1],
   [AC_HELP_STRING([--disable-gstreamer1],
                   [disable gstreamer 1.0 support. @<:@default=enabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_gstreamer1="yes"
    else
       want_gstreamer1="no"
       CFOPT_WARNING="xyes"
    fi
   ],
   [want_gstreamer1="yes"])
if test "x${build_gui}" = "xno"; then
   want_gstreamer1="no"
fi

AC_ARG_ENABLE([tizen],
   [AC_HELP_STRING([--enable-tizen],
       [enable tizen support. @<:@default=disabled@:>@])],
   [
    if test "x${enableval}" = "xyes" ; then
       want_tizen="yes"
    else
       want_tizen="no"
    fi
   ],
   [want_tizen="no"])

if test "${want_tizen}" = "yes"; then
     PKG_CHECK_MODULES([TIZEN_CONFIGURATION_MANAGER],
      [vconf],
      [have_tizen_vconf="yes"],
      [have_tizen_vconf="no"])
  PKG_CHECK_MODULES([TIZEN_CONFIGURATION_MANAGER], [vconf])
fi

AM_CONDITIONAL([HAVE_TIZEN_CONFIGURATION_MANAGER], [test "${have_tizen_vconf}" = "yes"])
if test "${have_tizen_vconf}"  = "yes"; then
  AC_DEFINE(HAVE_TIZEN_CONFIGURATION_MANAGER, 1, [Define to 1 if you have Tizen configuration manager(vconf).])
fi

### Default values

if test "${have_windows}" = "yes"; then
   with_glib="no"
fi

want_glib="no"
if test "x${with_glib}" = "xyes" || test "x${with_glib}" = "xalways" ; then
   want_glib="yes"
fi

want_ecore_timer_dump="no"
if test "x${build_profile}" = "xdebug" && test "x${ac_cv_func_backtrace}" = "xyes"; then
   want_ecore_timer_dump="yes"
   AC_DEFINE([WANT_ECORE_TIMER_DUMP], [1], [Want Ecore_Timer dump infrastructure])
fi

### Checks for programs

### Checks for libraries
EFL_PLATFORM_DEPEND([ECORE], [all])
EFL_INTERNAL_DEPEND_PKG([ECORE], [eo])
EFL_INTERNAL_DEPEND_PKG([ECORE], [eina])

EFL_ADD_LIBS([ECORE], [-lm])

# glib

EFL_OPTIONAL_DEPEND_PKG([ECORE], [${want_gli