Fedora Linux Support Community & Resources Center
  #1  
Old 12th April 2012, 03:45 AM
vertextao Offline
Registered User
 
Join Date: Sep 2010
Location: China
Posts: 75
linuxchrome
how to be compiled under different OS like sqlite.c

As some of you may know that sqlite.c can be compiled in different os like WIN/Linux/OS2... without any configuration.

how to detect which code segment(platform dependent) to be used? how can this be done? Can anyone give a solution to do this?
Just share your experience here!!!
Thanks!!!

---------- Post added at 10:45 AM ---------- Previous post was at 10:19 AM ----------

I do find the key macro definition here!!!

#if defined(SQLITE_OS_OTHER)
# if SQLITE_OS_OTHER==1
# undef SQLITE_OS_UNIX
# define SQLITE_OS_UNIX 0
# undef SQLITE_OS_WIN
# define SQLITE_OS_WIN 0
# undef SQLITE_OS_OS2
# define SQLITE_OS_OS2 0
# else
# undef SQLITE_OS_OTHER
# endif
#endif
#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER)
# define SQLITE_OS_OTHER 0
# ifndef SQLITE_OS_WIN
# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)
# define SQLITE_OS_WIN 1
# define SQLITE_OS_UNIX 0
# define SQLITE_OS_OS2 0
# elif defined(__EMX__) || defined(_OS2) || defined(OS2) || defined(_OS2_) || defined(__OS2__)
# define SQLITE_OS_WIN 0
# define SQLITE_OS_UNIX 0
# define SQLITE_OS_OS2 1
# else
# define SQLITE_OS_WIN 0
# define SQLITE_OS_UNIX 1
# define SQLITE_OS_OS2 0
# endif
# else
# define SQLITE_OS_UNIX 0
# define SQLITE_OS_OS2 0
# endif
#else
# ifndef SQLITE_OS_WIN
# define SQLITE_OS_WIN 0
# endif
#endif
__________________
[SIGPIC][/SIGPIC]
Reply With Quote
  #2  
Old 12th April 2012, 04:51 AM
stevea Online
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,848
linuxfirefox
Re: how to be compiled under different OS like sqlite.c

gcc will predefine "__linux" or similar for other OSes - but techincally that describes the compile or config environemnt - not necessarily the target environment.

cpp -dM </dev/null

lists the predefined macros.

=============

It's more ideal to use the ./configure script to identify the target environment.
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
Reply With Quote
Reply

Tags
compile, compiled, sqlite, sqlitec

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
LaTeX documents compiled in Fedora are different to those compiled on Mac joe.pelayo Using Fedora 2 18th June 2010 07:12 AM
FC5, PHP, and SQLite bkat EOL (End Of Life) Versions 6 11th July 2006 02:22 AM
FC4 PHP and SQLite bkat Using Fedora 9 14th March 2006 02:48 PM
using sqlite in PHP PurpleT Using Fedora 0 19th July 2005 06:47 PM


Current GMT-time: 20:16 (Monday, 22-09-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat