Fix build issues with MinGW
authorOlivier Gay <olivier.gay@gmail.com>
Sun, 27 Oct 2013 14:19:29 +0000 (15:19 +0100)
committerOlivier Gay <olivier.gay@gmail.com>
Sun, 27 Oct 2013 14:32:43 +0000 (15:32 +0100)
Remove st-term from the list of the targets for MinGW.
st-term uses termios and would require a rewrite to have
it compile on MinGW. Also remove cleanup signal handlers
in gdb-server for MinGW to compile.

Makefile.am
configure.ac
gdbserver/gdb-server.c

index ab3201f0310a27cb1ff970a8bb6bda162984795a..2ddbf475dc89ea77bab6147ee6577fb037a7165b 100644 (file)
@@ -4,7 +4,11 @@ SUBDIRS = . $(MAYBE_GUI)
 
 AUTOMAKE_OPTIONS = subdir-objects
 
+if MINGW
+bin_PROGRAMS = st-flash st-util st-info
+else
 bin_PROGRAMS = st-flash st-util st-term st-info
+endif
 
 noinst_LIBRARIES      = libstlink.a
 
@@ -18,9 +22,12 @@ CFILES = \
        src/stlink-usb.c \
        src/stlink-sg.c \
        src/uglylogging.c \
-        src/st-term.c \
        src/st-info.c
 
+if !MINGW
+CFILES += src/st-term.c
+endif
+
 HFILES = \
        src/stlink-common.h \
        src/stlink-usb.h \
index 53f827893bda37e5128344c841cf83455ac57f89..f1357b12165e276bf14a35b93b29db8eda84272e 100644 (file)
@@ -32,7 +32,11 @@ case "${host}" in
        *-mingw32*)
                LIBS="$LIBS -lws2_32"
                CPPFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $CPPFLAGS"
+               AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system])
+               AM_CONDITIONAL(MINGW, true)
        ;;
+       *)
+               AM_CONDITIONAL(MINGW, false)
 esac
 
 MAYBE_GUI=
index bf1478122a25db0832ef37805122345aad08da2f..a6de1b20d2db8f68fc6f2891e2b5e1f338ce809e 100644 (file)
@@ -57,6 +57,7 @@ typedef struct _st_state_t {
 int serve(stlink_t *sl, st_state_t *st);
 char* make_memory_map(stlink_t *sl);
 
+#ifndef __MINGW32__
 static void cleanup(int signal __attribute__((unused))) {
     if (connected_stlink) {
         /* Switch back to mass storage mode before closing. */
@@ -67,6 +68,7 @@ static void cleanup(int signal __attribute__((unused))) {
 
     exit(1);
 }
+#endif
 
 
 
@@ -196,8 +198,10 @@ int main(int argc, char** argv) {
     }
 
     connected_stlink = sl;
+#ifndef __MINGW32__
     signal(SIGINT, &cleanup);
     signal(SIGTERM, &cleanup);
+#endif
 
     if (state.reset) {
                stlink_reset(sl);