More tweaks to build system
This commit is contained in:
parent
43539ba773
commit
6925a043fe
3 changed files with 69 additions and 48 deletions
20
Makefile.am
20
Makefile.am
|
|
@ -3,7 +3,7 @@ bin_PROGRAMS = tg-timer
|
||||||
EXTRA_PROGRAMS = tg-timer-dbg \
|
EXTRA_PROGRAMS = tg-timer-dbg \
|
||||||
tg-timer-prf \
|
tg-timer-prf \
|
||||||
tg-timer-vlg
|
tg-timer-vlg
|
||||||
MOSTLYCLEANFILES := $(EXTRA_PROGRAMS)
|
MOSTLYCLEANFILES = $(EXTRA_PROGRAMS)
|
||||||
|
|
||||||
tg_timer_SOURCES = src/algo.c \
|
tg_timer_SOURCES = src/algo.c \
|
||||||
src/audio.c \
|
src/audio.c \
|
||||||
|
|
@ -28,10 +28,10 @@ LIBS = $(GTK_LIBS) \
|
||||||
AM_CPPFLAGS = -DPROGRAM_NAME=\"Tg\" -DVERSION=\"$(PACKAGE_VERSION)\"
|
AM_CPPFLAGS = -DPROGRAM_NAME=\"Tg\" -DVERSION=\"$(PACKAGE_VERSION)\"
|
||||||
tg_timer_dbg_CPPFLAGS = $(AM_CPPFLAGS) -DDEBUG
|
tg_timer_dbg_CPPFLAGS = $(AM_CPPFLAGS) -DDEBUG
|
||||||
|
|
||||||
AM_CFLAGS = $(GTK_CFLAGS) \
|
AM_CFLAGS += $(GTK_CFLAGS) \
|
||||||
$(GTHREAD_CFLAGS) \
|
$(GTHREAD_CFLAGS) \
|
||||||
$(PORTAUDIO_CFLAGS) \
|
$(PORTAUDIO_CFLAGS) \
|
||||||
$(FFTW_CFLAGS)
|
$(FFTW_CFLAGS)
|
||||||
tg_timer_dbg_CFLAGS = $(AM_CFLAGS) -ggdb
|
tg_timer_dbg_CFLAGS = $(AM_CFLAGS) -ggdb
|
||||||
tg_timer_prf_CFLAGS = $(AM_CFLAGS) -pg
|
tg_timer_prf_CFLAGS = $(AM_CFLAGS) -pg
|
||||||
tg_timer_vlg_CFLAGS = $(AM_CFLAGS) -g
|
tg_timer_vlg_CFLAGS = $(AM_CFLAGS) -g
|
||||||
|
|
@ -57,11 +57,11 @@ dist_desktop_DATA = icons/tg-timer.desktop \
|
||||||
|
|
||||||
dist_man_MANS = docs/tg-timer.1
|
dist_man_MANS = docs/tg-timer.1
|
||||||
|
|
||||||
EXTRA_DIST := autogen.sh \
|
EXTRA_DIST = autogen.sh \
|
||||||
icons \
|
icons \
|
||||||
packaging \
|
packaging \
|
||||||
LICENSE \
|
LICENSE \
|
||||||
README.md
|
README.md
|
||||||
|
|
||||||
.rc.o:
|
.rc.o:
|
||||||
$(WINDRES) $< -O coff -o $@
|
$(WINDRES) $< -O coff -o $@
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ define([tg_version], m4_normalize(m4_include([version])))
|
||||||
AC_CONFIG_MACRO_DIRS([m4])
|
AC_CONFIG_MACRO_DIRS([m4])
|
||||||
|
|
||||||
AC_INIT([Tg], [tg_version], [vacaboja@gmail.com], [tg-timer], [https://github.com/vacaboja/tg])
|
AC_INIT([Tg], [tg_version], [vacaboja@gmail.com], [tg-timer], [https://github.com/vacaboja/tg])
|
||||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
|
||||||
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_CHECK_LIB([pthread], [pthread_mutex_init], [], [AC_MSG_ERROR([pthread not found])])
|
AC_CHECK_LIB([pthread], [pthread_mutex_init], [], [AC_MSG_ERROR([pthread not found])])
|
||||||
|
|
@ -18,6 +18,8 @@ AM_CONDITIONAL([BE_WINDOWS], [test x$OS = xWindows_NT])
|
||||||
AM_COND_IF([BE_WINDOWS], [AC_CONFIG_LINKS([icons/tg-timer.ico:icons/tg-timer.ico])]);
|
AM_COND_IF([BE_WINDOWS], [AC_CONFIG_LINKS([icons/tg-timer.ico:icons/tg-timer.ico])]);
|
||||||
|
|
||||||
CC_CHECK_LDFLAGS([-Wl,--as-needed], [AC_SUBST([AM_LDFLAGS], [-Wl,--as-needed])], [])
|
CC_CHECK_LDFLAGS([-Wl,--as-needed], [AC_SUBST([AM_LDFLAGS], [-Wl,--as-needed])], [])
|
||||||
|
CC_CHECK_CFLAGS([-Wall], [AC_SUBST([AM_CFLAGS], [-Wall])], [])
|
||||||
|
CC_CHECK_CFLAGS([-Wextra], [AC_SUBST([AM_CFLAGS], [-Wextra])], [])
|
||||||
|
|
||||||
AC_OUTPUT([Makefile icons/Makefile])
|
AC_OUTPUT([Makefile icons/Makefile])
|
||||||
|
|
||||||
|
|
@ -28,6 +30,6 @@ AC_MSG_RESULT([
|
||||||
prefix: ${prefix}
|
prefix: ${prefix}
|
||||||
|
|
||||||
compiler: ${CC}
|
compiler: ${CC}
|
||||||
cflags: ${CFLAGS}${AM_CFLAGS}
|
cflags: ${CFLAGS} ${AM_CFLAGS}
|
||||||
ldflags: ${LDFLAGS}${AM_LDFLAGS}
|
ldflags: ${LDFLAGS} ${AM_LDFLAGS}
|
||||||
])
|
])
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
dnl Macros to check the presence of generic (non-typed) symbols.
|
dnl Macros to check the presence of generic (non-typed) symbols.
|
||||||
dnl Copyright (c) 2006-2008 Diego Pettenò <flameeyes@gmail.com>
|
dnl Copyright (c) 2006-2008 Diego Pettenò <flameeyes@gmail.com>
|
||||||
dnl Copyright (c) 2006-2008 xine project
|
dnl Copyright (c) 2006-2008 xine project
|
||||||
dnl Copyright (c) 2012 Lucas De Marchi <lucas.de.marchi@gmail.com>
|
|
||||||
dnl
|
dnl
|
||||||
dnl This program is free software; you can redistribute it and/or modify
|
dnl This program is free software; you can redistribute it and/or modify
|
||||||
dnl it under the terms of the GNU General Public License as published by
|
dnl it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -33,32 +32,52 @@ dnl distribute a modified version of the Autoconf Macro, you may extend
|
||||||
dnl this special exception to the GPL to apply to your modified version as
|
dnl this special exception to the GPL to apply to your modified version as
|
||||||
dnl well.
|
dnl well.
|
||||||
|
|
||||||
dnl Check if FLAG in ENV-VAR is supported by compiler and append it
|
dnl Check if the flag is supported by compiler
|
||||||
dnl to WHERE-TO-APPEND variable. Note that we invert -Wno-* checks to
|
dnl CC_CHECK_CFLAGS_SILENT([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
|
||||||
dnl -W* as gcc cannot test for negated warnings. If a C snippet is passed,
|
|
||||||
dnl use it, otherwise use a simple main() definition that just returns 0.
|
|
||||||
dnl CC_CHECK_FLAG_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG], [C-SNIPPET])
|
|
||||||
|
|
||||||
AC_DEFUN([CC_CHECK_FLAG_APPEND], [
|
AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [
|
||||||
AC_CACHE_CHECK([if $CC supports flag $3 in envvar $2],
|
AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]),
|
||||||
AS_TR_SH([cc_cv_$2_$3]),
|
[ac_save_CFLAGS="$CFLAGS"
|
||||||
[eval "AS_TR_SH([cc_save_$2])='${$2}'"
|
CFLAGS="$CFLAGS $1"
|
||||||
eval "AS_TR_SH([$2])='${cc_save_$2} -Werror `echo "$3" | sed 's/^-Wno-/-W/'`'"
|
AC_COMPILE_IFELSE([int a;],
|
||||||
AC_LINK_IFELSE([AC_LANG_SOURCE(ifelse([$4], [],
|
[eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"],
|
||||||
[int main(void) { return 0; } ],
|
[eval "AS_TR_SH([cc_cv_cflags_$1])='no'"])
|
||||||
[$4]))],
|
CFLAGS="$ac_save_CFLAGS"
|
||||||
[eval "AS_TR_SH([cc_cv_$2_$3])='yes'"],
|
])
|
||||||
[eval "AS_TR_SH([cc_cv_$2_$3])='no'"])
|
|
||||||
eval "AS_TR_SH([$2])='$cc_save_$2'"])
|
|
||||||
|
|
||||||
AS_IF([eval test x$]AS_TR_SH([cc_cv_$2_$3])[ = xyes],
|
AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
|
||||||
[eval "$1='${$1} $3'"])
|
[$2], [$3])
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl CC_CHECK_FLAGS_APPEND([WHERE-TO-APPEND], [ENV-VAR], [FLAG1 FLAG2], [C-SNIPPET])
|
dnl Check if the flag is supported by compiler (cacheable)
|
||||||
AC_DEFUN([CC_CHECK_FLAGS_APPEND], [
|
dnl CC_CHECK_CFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
|
||||||
for flag in [$3]; do
|
|
||||||
CC_CHECK_FLAG_APPEND([$1], [$2], $flag, [$4])
|
AC_DEFUN([CC_CHECK_CFLAGS], [
|
||||||
|
AC_CACHE_CHECK([if $CC supports $1 flag],
|
||||||
|
AS_TR_SH([cc_cv_cflags_$1]),
|
||||||
|
CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
|
||||||
|
)
|
||||||
|
|
||||||
|
AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
|
||||||
|
[$2], [$3])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl CC_CHECK_CFLAG_APPEND(FLAG, [action-if-found], [action-if-not-found])
|
||||||
|
dnl Check for CFLAG and appends them to CFLAGS if supported
|
||||||
|
AC_DEFUN([CC_CHECK_CFLAG_APPEND], [
|
||||||
|
AC_CACHE_CHECK([if $CC supports $1 flag],
|
||||||
|
AS_TR_SH([cc_cv_cflags_$1]),
|
||||||
|
CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
|
||||||
|
)
|
||||||
|
|
||||||
|
AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
|
||||||
|
[CFLAGS="$CFLAGS $1"; DEBUG_CFLAGS="$DEBUG_CFLAGS $1"; $2], [$3])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl CC_CHECK_CFLAGS_APPEND([FLAG1 FLAG2], [action-if-found], [action-if-not])
|
||||||
|
AC_DEFUN([CC_CHECK_CFLAGS_APPEND], [
|
||||||
|
for flag in $1; do
|
||||||
|
CC_CHECK_CFLAG_APPEND($flag, [$2], [$3])
|
||||||
done
|
done
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
@ -93,13 +112,13 @@ AC_DEFUN([CC_NOUNDEFINED], [
|
||||||
*-freebsd* | *-openbsd*) ;;
|
*-freebsd* | *-openbsd*) ;;
|
||||||
*)
|
*)
|
||||||
dnl First of all check for the --no-undefined variant of GNU ld. This allows
|
dnl First of all check for the --no-undefined variant of GNU ld. This allows
|
||||||
dnl for a much more readable command line, so that people can understand what
|
dnl for a much more readable commandline, so that people can understand what
|
||||||
dnl it does without going to look for what the heck -z defs does.
|
dnl it does without going to look for what the heck -z defs does.
|
||||||
for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do
|
for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do
|
||||||
CC_CHECK_LDFLAGS([$possible_flags], [LDFLAGS_NOUNDEFINED="$possible_flags"])
|
CC_CHECK_LDFLAGS([$possible_flags], [LDFLAGS_NOUNDEFINED="$possible_flags"])
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AC_SUBST([LDFLAGS_NOUNDEFINED])
|
AC_SUBST([LDFLAGS_NOUNDEFINED])
|
||||||
|
|
@ -128,7 +147,7 @@ AC_DEFUN([CC_CHECK_ATTRIBUTE], [
|
||||||
AS_TR_SH([cc_cv_attribute_$1]),
|
AS_TR_SH([cc_cv_attribute_$1]),
|
||||||
[ac_save_CFLAGS="$CFLAGS"
|
[ac_save_CFLAGS="$CFLAGS"
|
||||||
CFLAGS="$CFLAGS $cc_cv_werror"
|
CFLAGS="$CFLAGS $cc_cv_werror"
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])],
|
AC_COMPILE_IFELSE([$3],
|
||||||
[eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"],
|
[eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"],
|
||||||
[eval "AS_TR_SH([cc_cv_attribute_$1])='no'"])
|
[eval "AS_TR_SH([cc_cv_attribute_$1])='no'"])
|
||||||
CFLAGS="$ac_save_CFLAGS"
|
CFLAGS="$ac_save_CFLAGS"
|
||||||
|
|
@ -235,8 +254,8 @@ AC_DEFUN([CC_FLAG_VISIBILITY], [
|
||||||
[cc_flag_visibility_save_CFLAGS="$CFLAGS"
|
[cc_flag_visibility_save_CFLAGS="$CFLAGS"
|
||||||
CFLAGS="$CFLAGS $cc_cv_werror"
|
CFLAGS="$CFLAGS $cc_cv_werror"
|
||||||
CC_CHECK_CFLAGS_SILENT([-fvisibility=hidden],
|
CC_CHECK_CFLAGS_SILENT([-fvisibility=hidden],
|
||||||
cc_cv_flag_visibility='yes',
|
cc_cv_flag_visibility='yes',
|
||||||
cc_cv_flag_visibility='no')
|
cc_cv_flag_visibility='no')
|
||||||
CFLAGS="$cc_flag_visibility_save_CFLAGS"])
|
CFLAGS="$cc_flag_visibility_save_CFLAGS"])
|
||||||
|
|
||||||
AS_IF([test "x$cc_cv_flag_visibility" = "xyes"],
|
AS_IF([test "x$cc_cv_flag_visibility" = "xyes"],
|
||||||
|
|
@ -252,11 +271,11 @@ AC_DEFUN([CC_FUNC_EXPECT], [
|
||||||
[cc_cv_func_expect],
|
[cc_cv_func_expect],
|
||||||
[ac_save_CFLAGS="$CFLAGS"
|
[ac_save_CFLAGS="$CFLAGS"
|
||||||
CFLAGS="$CFLAGS $cc_cv_werror"
|
CFLAGS="$CFLAGS $cc_cv_werror"
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
|
AC_COMPILE_IFELSE(
|
||||||
[int some_function() {
|
[int some_function() {
|
||||||
int a = 3;
|
int a = 3;
|
||||||
return (int)__builtin_expect(a, 3);
|
return (int)__builtin_expect(a, 3);
|
||||||
}])],
|
}],
|
||||||
[cc_cv_func_expect=yes],
|
[cc_cv_func_expect=yes],
|
||||||
[cc_cv_func_expect=no])
|
[cc_cv_func_expect=no])
|
||||||
CFLAGS="$ac_save_CFLAGS"
|
CFLAGS="$ac_save_CFLAGS"
|
||||||
|
|
@ -276,11 +295,11 @@ AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [
|
||||||
[ac_save_CFLAGS="$CFLAGS"
|
[ac_save_CFLAGS="$CFLAGS"
|
||||||
CFLAGS="$CFLAGS $cc_cv_werror"
|
CFLAGS="$CFLAGS $cc_cv_werror"
|
||||||
for cc_attribute_align_try in 64 32 16 8 4 2; do
|
for cc_attribute_align_try in 64 32 16 8 4 2; do
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
AC_COMPILE_IFELSE([
|
||||||
int main() {
|
int main() {
|
||||||
static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0;
|
static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0;
|
||||||
return c;
|
return c;
|
||||||
}])], [cc_cv_attribute_aligned=$cc_attribute_align_try; break])
|
}], [cc_cv_attribute_aligned=$cc_attribute_align_try; break])
|
||||||
done
|
done
|
||||||
CFLAGS="$ac_save_CFLAGS"
|
CFLAGS="$ac_save_CFLAGS"
|
||||||
])
|
])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue