1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(src/main.c)
3
4PACKAGE=gnuitar
5
6dnl version number
7MAJOR_VERSION=0
8MINOR_VERSION=3
9MICRO_VERSION=2
10dnl INTERFACE_AGE=1
11dnl BINARY_AGE=1
12EXTRA_VERSION=
13VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
14
15AM_INIT_AUTOMAKE($PACKAGE,$VERSION,no-define)
16AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
17AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
18
19dnl Specify a header configuration file
20dnl AM_CONFIG_HEADER(config.h)
21
22dnl Checks for programs.
23AC_ARG_PROGRAM
24AC_PROG_AWK
25AC_PROG_LN_S
26AC_PROG_CC
27AC_PROG_INSTALL
28
29AC_ARG_WITH(gtk2,
30    [  --with-gtk2	          Use GTK2 instead GTK (disabled by default)],
31    [
32	if test "$withval" != "no"; then
33	    AM_PATH_GLIB_2_0(2.2.0,
34		[
35		    CONFIG_DEFS="$CONFIG_DEFS -DHAVE_GLIB2"
36		],
37		AC_MSG_ERROR(Test for GLIB2 failed. See the file 'INSTALL' for help.),
38		gthread)
39	    AM_PATH_GTK_2_0(2.0.0,
40		[
41		    CONFIG_DEFS="$CONFIG_DEFS -DHAVE_GTK2"
42		],
43		AC_MSG_ERROR(Test for GTK2 failed. See the file 'INSTALL' for help.))
44	else
45	    AM_PATH_GLIB(1.2.6,
46		[
47		    CONFIG_DEFS="$CONFIG_DEFS -DHAVE_GLIB"
48		],
49		AC_MSG_ERROR(Test for GLIB failed. See the file 'INSTALL' for help.),
50		gthread)
51	    AM_PATH_GTK(1.2.6,
52		[
53		    CONFIG_DEFS="$CONFIG_DEFS -DHAVE_GTK"
54		],
55		AC_MSG_ERROR(Test for GTK failed. See the file 'INSTALL' for help.))
56	fi
57    ],
58    [
59dnl By default, prefer GTK1 over GTK2, GLIB1 over GLIB2
60	AM_PATH_GLIB(1.2.6,
61	    [
62		CONFIG_DEFS="$CONFIG_DEFS -DHAVE_GLIB"
63	    ],
64	    [
65		AM_PATH_GLIB_2_0(2.2.0,
66		    [
67			CONFIG_DEFS="$CONFIG_DEFS -DHAVE_GLIB2"
68		    ],
69		    AC_MSG_ERROR(Test for GLIB2 failed. See the file 'INSTALL' for help.),
70		    gthread)
71	    ],
72	    gthread)
73	AM_PATH_GTK(1.2.6,
74	    [
75		CONFIG_DEFS="$CONFIG_DEFS -DHAVE_GTK"
76	    ],
77	    [
78	        AM_PATH_GTK_2_0(2.0.0,
79		    [
80			CONFIG_DEFS="$CONFIG_DEFS -DHAVE_GTK2"
81		    ],
82		    AC_MSG_ERROR(Test for GTK2 failed. See the file 'INSTALL' for help.))
83	    ])
84    ]
85)
86
87AC_ARG_ENABLE(float,
88    [  --enable-float          Do DSP processing in floats rather in int's],
89    [ CONFIG_DEFS="$CONFIG_DEFS -DFLOAT_DSP"]
90)
91
92AC_ARG_ENABLE(clip-everywhere,
93    [  --enable-clip-everywhere    Clip sound to min/max possible value in every effect (by default only on output)],
94    [ CONFIG_DEFS="$CONFIG_DEFS -DCLIP_EVERYWHERE"]
95)
96
97AC_ARG_ENABLE(debug,
98    [  --enable-debug          Add debug code (disabled by default)],
99    [
100	if test "$enableval" != "no"; then
101	    CONFIG_DEFS="$CONFIG_DEFS -DDEBUG -ggdb"
102	else
103	    CONFIG_DEFS="$CONFIG_DEFS -UDEBUG"
104	fi
105    ],
106    [
107	CONFIG_DEFS="$CONFIG_DEFS -UDEBUG"
108    ]
109)
110
111
112dnl Replace `main' with a function in -lm:
113AC_CHECK_LIB(m, main)
114dnl Replace `main' with a function in -lpthread:
115AC_CHECK_LIB(pthread, main)
116
117dnl Checks for header files.
118AC_HEADER_DIRENT
119AC_HEADER_STDC
120AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h sys/stat.h)
121
122dnl Checks for typedefs, structures, and compiler characteristics.
123AC_C_CONST
124AC_TYPE_PID_T
125
126dnl Checks for library functions.
127AC_PROG_GCC_TRADITIONAL
128AC_CHECK_FUNCS(getcwd isascii memset pow sqrt)
129AC_FUNC_FORK
130AC_FUNC_MALLOC
131
132AC_SUBST(CONFIG_DEFS)
133
134AC_OUTPUT(src/Makefile Makefile)
135