cross compilation using mingw32-w64
This commit is contained in:
parent
804e00350c
commit
37d1324443
207
configure
vendored
207
configure
vendored
@ -2530,197 +2530,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}gcc; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_prog_CC+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -n "$CC"; then
|
||||
ac_cv_prog_CC="$CC" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_CC="${ac_tool_prefix}gcc"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
CC=$ac_cv_prog_CC
|
||||
if test -n "$CC"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
|
||||
$as_echo "$CC" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
if test -z "$ac_cv_prog_CC"; then
|
||||
ac_ct_CC=$CC
|
||||
# Extract the first word of "gcc", so it can be a program name with args.
|
||||
set dummy gcc; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_prog_ac_ct_CC+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -n "$ac_ct_CC"; then
|
||||
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_ac_ct_CC="gcc"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
ac_ct_CC=$ac_cv_prog_ac_ct_CC
|
||||
if test -n "$ac_ct_CC"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
|
||||
$as_echo "$ac_ct_CC" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
if test "x$ac_ct_CC" = x; then
|
||||
CC=""
|
||||
else
|
||||
case $cross_compiling:$ac_tool_warned in
|
||||
yes:)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
|
||||
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
|
||||
ac_tool_warned=yes ;;
|
||||
esac
|
||||
CC=$ac_ct_CC
|
||||
fi
|
||||
else
|
||||
CC="$ac_cv_prog_CC"
|
||||
fi
|
||||
|
||||
if test -z "$CC"; then
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
|
||||
set dummy ${ac_tool_prefix}cc; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_prog_CC+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -n "$CC"; then
|
||||
ac_cv_prog_CC="$CC" # Let the user override the test.
|
||||
else
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
ac_cv_prog_CC="${ac_tool_prefix}cc"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
fi
|
||||
fi
|
||||
CC=$ac_cv_prog_CC
|
||||
if test -n "$CC"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
|
||||
$as_echo "$CC" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
fi
|
||||
if test -z "$CC"; then
|
||||
# Extract the first word of "cc", so it can be a program name with args.
|
||||
set dummy cc; ac_word=$2
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_prog_CC+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test -n "$CC"; then
|
||||
ac_cv_prog_CC="$CC" # Let the user override the test.
|
||||
else
|
||||
ac_prog_rejected=no
|
||||
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||
for as_dir in $PATH
|
||||
do
|
||||
IFS=$as_save_IFS
|
||||
test -z "$as_dir" && as_dir=.
|
||||
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
|
||||
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
|
||||
ac_prog_rejected=yes
|
||||
continue
|
||||
fi
|
||||
ac_cv_prog_CC="cc"
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
|
||||
if test $ac_prog_rejected = yes; then
|
||||
# We found a bogon in the path, so make sure we never use it.
|
||||
set dummy $ac_cv_prog_CC
|
||||
shift
|
||||
if test $# != 0; then
|
||||
# We chose a different compiler from the bogus one.
|
||||
# However, it has the same basename, so the bogon will be chosen
|
||||
# first if we set CC to just the basename; use the full file name.
|
||||
shift
|
||||
ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
CC=$ac_cv_prog_CC
|
||||
if test -n "$CC"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
|
||||
$as_echo "$CC" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
if test -z "$CC"; then
|
||||
if test -n "$ac_tool_prefix"; then
|
||||
for ac_prog in cl.exe
|
||||
for ac_prog in gcc
|
||||
do
|
||||
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
|
||||
@ -2764,7 +2574,7 @@ fi
|
||||
fi
|
||||
if test -z "$CC"; then
|
||||
ac_ct_CC=$CC
|
||||
for ac_prog in cl.exe
|
||||
for ac_prog in gcc
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
set dummy $ac_prog; ac_word=$2
|
||||
@ -2819,8 +2629,6 @@ esac
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
@ -4157,6 +3965,17 @@ $as_echo "yes" >&6; }
|
||||
|
||||
fi
|
||||
|
||||
case "$host" in
|
||||
*mingw*)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: OS Detected: $host" >&5
|
||||
$as_echo "OS Detected: $host" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Adding iconv flag for mingw..." >&5
|
||||
$as_echo "Adding iconv flag for mingw..." >&6; }
|
||||
LDFLAGS="-liconv $AM_LDFLAGS $LDFLAGS"
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
ac_config_files="$ac_config_files Makefile src/Makefile"
|
||||
|
||||
|
||||
|
11
configure.ac
11
configure.ac
@ -5,7 +5,7 @@ AM_INIT_AUTOMAKE([foreign])
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CC([gcc])
|
||||
|
||||
AX_CHECK_COMPILE_FLAG([-std=c11], [
|
||||
CFLAGS+=" -std=c11"
|
||||
@ -46,6 +46,15 @@ AM_CFLAGS=(`xml2-config --cflags --libs`)
|
||||
|
||||
PKG_CHECK_MODULES([libxml2], [libxml-2.0])
|
||||
|
||||
case "$host" in
|
||||
*mingw*)
|
||||
AC_MSG_RESULT(OS Detected: $host)
|
||||
AC_MSG_RESULT(Adding iconv flag for mingw...)
|
||||
LDFLAGS="-liconv $AM_LDFLAGS $LDFLAGS"
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
src/Makefile
|
||||
])
|
||||
|
@ -13,4 +13,5 @@ generarxml_SOURCES = main.c \
|
||||
encoding.h
|
||||
generarxml_CPPFLAGS = $(XML_CPPFLAGS)
|
||||
generarxml_LDFLAGS= $(XML_LIBS)
|
||||
generarxml_LDADD = ${libxml2_LIBS}
|
||||
generarxml_LDADD = $(libxml2_LIBS) $(LDFLAGS)
|
||||
# -liconv
|
||||
|
@ -103,7 +103,7 @@ am_generarxml_OBJECTS = generarxml-main.$(OBJEXT) \
|
||||
generarxml-makexml.$(OBJEXT) generarxml-encoding.$(OBJEXT)
|
||||
generarxml_OBJECTS = $(am_generarxml_OBJECTS)
|
||||
am__DEPENDENCIES_1 =
|
||||
generarxml_DEPENDENCIES = $(am__DEPENDENCIES_1)
|
||||
generarxml_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
generarxml_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(generarxml_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
@ -273,7 +273,7 @@ generarxml_SOURCES = main.c \
|
||||
|
||||
generarxml_CPPFLAGS = $(XML_CPPFLAGS)
|
||||
generarxml_LDFLAGS = $(XML_LIBS)
|
||||
generarxml_LDADD = ${libxml2_LIBS}
|
||||
generarxml_LDADD = $(libxml2_LIBS) $(LDFLAGS)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
@ -656,6 +656,7 @@ uninstall-am: uninstall-binPROGRAMS
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
# -liconv
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
@ -83,6 +83,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
status = read_config(config_file);
|
||||
if (status != 0) {
|
||||
free(config_file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,78 @@
|
||||
#include "readfile.h"
|
||||
#include "encoding.h"
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#define GET_LINE_MAX_MEM 128
|
||||
size_t getline(char **lineptr, size_t *n, FILE *stream) {
|
||||
int ch;
|
||||
size_t chars = 0;
|
||||
char *line = *lineptr;
|
||||
|
||||
/* why even call this if you don't have a stream to read? */
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ch = fgetc(stream);
|
||||
if (ch == EOF) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (line == NULL) {
|
||||
if (*n == 0) {
|
||||
line = (char *) calloc(GET_LINE_MAX_MEM, sizeof(char));
|
||||
*n = GET_LINE_MAX_MEM;
|
||||
}
|
||||
else {
|
||||
line = (char *) calloc(*n, sizeof(char));
|
||||
}
|
||||
|
||||
/* out of memory */
|
||||
if (line == NULL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
free(line);
|
||||
*n = GET_LINE_MAX_MEM;
|
||||
line = (char *) calloc(GET_LINE_MAX_MEM, sizeof(char));
|
||||
}
|
||||
|
||||
while(ch != EOF) {
|
||||
if (chars == *n) {
|
||||
/* not enough memory for more chars, add more */
|
||||
*n = *n + GET_LINE_MAX_MEM;
|
||||
line = (char *) realloc(line, *n * sizeof(char));
|
||||
}
|
||||
if (ch == '\n') {
|
||||
if (chars == *n - 1) {
|
||||
/* add space for the null terminator */
|
||||
*n = *n + 1;
|
||||
line = (char *) realloc(line, *n * sizeof(char));
|
||||
}
|
||||
line[chars] = '\n';
|
||||
line[chars + 1] = '\0';
|
||||
break;
|
||||
}
|
||||
line[chars] = ch;
|
||||
ch = fgetc(stream);
|
||||
chars++;
|
||||
}
|
||||
if (ch == EOF) {
|
||||
if (chars == *n) {
|
||||
/* add space for the null terminator */
|
||||
*n = *n + 1;
|
||||
line = (char *) realloc(line, *n * sizeof(char));
|
||||
}
|
||||
line[chars] = '\0';
|
||||
}
|
||||
|
||||
*lineptr = line;
|
||||
|
||||
return chars + 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This function reads Biblia.txt, searches for the information in config,
|
||||
* and stores it into an array of strings to be used later to create the xml.
|
||||
|
Loading…
Reference in New Issue
Block a user