Changeset 2:b8c3435b818d in xplcommon


Ignore:
Timestamp:
12/27/12 12:36:41 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Using less ambiguous conditionals to decide between POSIX vs. Windows compilation

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    r1 r2  
    88AC_PROG_CXX
    99
    10 AC_CHECK_HEADERS([pthread.h])
    11 AC_CHECK_HEADERS([poll.h])
    12 AC_CHECK_HEADERS([windows.h])
     10AC_CHECK_HEADERS([windows.h winsock2.h])
     11
     12test "$ac_cv_header_windows_h" = "yes" -a "$ac_cv_header_winsock2_h" = "yes"
     13_target_win32=$?
     14
     15AM_CONDITIONAL([TARGET_API_WIN32], test $_target_win32 -eq 0)
     16AM_CONDITIONAL([TARGET_API_POSIX], test $_target_win32 -ne 0)
     17if test $_target_win32 -eq 0; then
     18   AC_DEFINE([TARGET_API_WIN32], [1], [Define if the target is the Win32 API.])
     19else
     20   AC_DEFINE([TARGET_API_POSIX], [1], [Define if the target is the POSIX API.])
     21fi
    1322
    1423AC_CONFIG_FILES([
  • src/xplcommon/Makefile.am

    r1 r2  
    11lib_LTLIBRARIES=libxplcommon.la
    22
    3 libxplcommon_la_SOURCES=\
     3libxplcommon_la_SOURCES=
     4
     5if TARGET_API_POSIX
     6libxplcommon_la_SOURCES +=      \
    47        POSIXThread.cc          \
    5         Win32Thread.cc          \
    68        POSIXWaitable.cc        \
    79        POSIXWaiter.cc
     10endif
     11
     12if TARGET_API_WIN32
     13libxplcommon_la_SOURCES +=      \
     14        Win32Thread.cc
     15endif
    816
    917include_xplcommondir=$(includedir)/xplcommon
  • src/xplcommon/config.h.in

    r1 r2  
    99/* Define to 1 if you have the <memory.h> header file. */
    1010#undef HAVE_MEMORY_H
    11 
    12 /* Define to 1 if you have the <poll.h> header file. */
    13 #undef HAVE_POLL_H
    14 
    15 /* Define to 1 if you have the <pthread.h> header file. */
    16 #undef HAVE_PTHREAD_H
    1711
    1812/* Define to 1 if you have the <stdint.h> header file. */
     
    3933/* Define to 1 if you have the <windows.h> header file. */
    4034#undef HAVE_WINDOWS_H
     35
     36/* Define to 1 if you have the <winsock2.h> header file. */
     37#undef HAVE_WINSOCK2_H
    4138
    4239/* Define to the sub-directory in which libtool stores uninstalled libraries.
     
    6865#undef STDC_HEADERS
    6966
     67/* Define if the target is the POSIX API. */
     68#undef TARGET_API_POSIX
     69
     70/* Define if the target is the Win32 API. */
     71#undef TARGET_API_WIN32
     72
    7073/* Version number of package */
    7174#undef VERSION
Note: See TracChangeset for help on using the changeset viewer.