Skip to content

Commit

Permalink
Don't link with msrdriver.c on non-Windows platform. (#159)
Browse files Browse the repository at this point in the history
This simplify the procedure of sanitizing unneeded blob in source.
  • Loading branch information
cireu committed Jan 14, 2022
1 parent 7a580fd commit 2e61160
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ if test "x$GCC" = "xyes"; then
AM_LDFLAGS="$AM_LDFLAGS -g -Wall"
fi

AC_CANONICAL_HOST

build_windows=no

case "${host_os}" in
cygwin*|mingw*)
build_windows=yes
;;
esac

AM_CONDITIONAL([WINDOWS], [test "$build_windows" = "yes"])

AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_LDFLAGS)
Expand Down
5 changes: 4 additions & 1 deletion libcpuid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ set(cpuid_sources
rdtsc.c
libcpuid_util.c
rdmsr.c
msrdriver.c
asm-bits.c)

if(WIN32)
list(APPEND cpuid_sources msrdriver.c)
endif()

if("${MSVC_CXX_ARCHITECTURE_ID}" MATCHES "x64")
list(APPEND cpuid_sources masm-x64.asm)
endif()
Expand Down
7 changes: 5 additions & 2 deletions libcpuid/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ libcpuid_la_SOURCES = \
rdtsc.c \
asm-bits.c \
libcpuid_util.c \
rdmsr.c \
msrdriver.c
rdmsr.c

if WINDOWS
libcpuid_la_SOURCES += msrdriver.c
endif

libcpuid_la_DEPENDENCIES = \
$(srcdir)/libcpuid.sym
Expand Down

0 comments on commit 2e61160

Please sign in to comment.