summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 2b079f589638874f78e52e2d3f27e6698ca769c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
AC_INIT([terminal-media-launcher],[0.2])
AC_SUBST([PACKAGE_TITLE], ["Terminal Media Launcher"])
AC_SUBST([NSIS_PRODUCT_VERSION], ["$PACKAGE_VERSION.0.0"])
AC_CONFIG_SRCDIR([src/draw.c])
AC_CONFIG_HEADERS([config.h])

AM_INIT_AUTOMAKE([foreign])

# Checks for programs.
AC_PROG_CC
AX_PROG_LUA(,,,[AC_MSG_ERROR([requires lua])])

# Checks for libraries.
AC_CHECK_LIB([ncurses], [initscr])
AX_LUA_LIBS

# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
AX_LUA_HEADERS

# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL

# Checks for library functions.
AC_CHECK_FUNCS([malloc mkdir strrchr])

# Check for curses with color support
AX_WITH_CURSES
if test "x$ax_cv_curses" != xyes || test "x$ax_cv_curses_color" != xyes; then
	AC_MSG_ERROR([requires an X/Open-compatible Curses library with color])
fi

# Temporary fix for differentiating Unix and Windows builds
AC_CANONICAL_HOST

build_unix=no
build_windows=no

# Detect the target system
case "${host_os}" in
    cygwin*|mingw*)
        build_windows=yes
        ;;
    *)
        build_unix=yes
        ;;
esac

# Pass the conditionals to automake
AM_CONDITIONAL([UNIX], [test "$build_unix" = "yes"])
AM_CONDITIONAL([WINDOWS], [test "$build_windows" = "yes"])

# enable/disable options
AC_ARG_ENABLE([desktop-entry],
			  [AS_HELP_STRING([--enable-desktop-entry],
							  [install a desktop entry (default is no)])],
							  [desktop_entry=$enableval],
							  [desktop_entry=no])
AM_CONDITIONAL([DESKTOP_ENTRY], [test "$desktop_entry" = "yes"])

embed_icon=yes
AC_ARG_ENABLE([embed_icon],
			  [AS_HELP_STRING([--disable-embed-icon],
							  [embed icon in windows executable (default is yes)])],
							  [embed_icon=no])
if test "x$embed_icon" = "xyes"; then
	if test "x$build_windows" = "xyes"; then
		AC_CHECK_TOOL([WINDRES], [windres])
		AS_VAR_IF([WINDRES], [],
				  [AC_MSG_WARN([Cannot embed icon])
				  embed_icon=no])
	else
		embed_icon=no
	fi
fi
AM_CONDITIONAL([EMBED_ICON], [test "$embed_icon" = "yes"])

AC_CONFIG_FILES([Makefile
                 src/Makefile
                 actions/Makefile
			     docs/Makefile
				 data/Makefile
				 nsis/Makefile
				 nsis/installer.nsi
				 spec/Makefile
				 spec/terminal-media-launcher.spec])
AC_OUTPUT

# Print helpful message
cat << EOF

** Configuration summary for ${PACKAGE_NAME} ${PACKAGE_VERSION}

          Prefix: ${prefix}
        Compiler: ${CC} ${CFLAGS} ${CPPFLAGS}
       Libraries: ${LIBS}
   Desktop Entry: ${desktop_entry}
      Embed Icon: ${embed_icon}
EOF