Debian Codegraph @

configure.ac

raw ◀ ▶
Source reconstructed at patch state 0 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1 dnl preserve initial CFLAGS
2 CFLAGS_OLD="$CFLAGS"
3
4 dnl initialize
5 AC_INIT(main.c)
6 VER=`head -1 $srcdir/README |sed 's/ *netrik \([[^ ]]*\).*/\1/'`
7 AM_INIT_AUTOMAKE(netrik, $VER)
8
9 dnl initialize config header
10 AM_CONFIG_HEADER(config.h)
11
12 dnl check for some essential programs
13 AC_PROG_CC
14 AC_PROG_INSTALL
15 AC_PROG_MAKE_SET
16
17 dnl check for standard headers
18 AC_HEADER_STDC
19
20 dnl check for ncurses
21 AC_CHECK_LIB(ncursesw,
22 tparm,
23 [NCURSES="yes"],
24 AC_MSG_ERROR([ncursesw is absolutely required!]))
25
26 LIBS="-lncursesw $LIBS"
27
28 dnl check for readline
29 AC_CHECK_LIB(readline,
30 readline,
31 [READLINE="yes"])
32 AC_CHECK_LIB(history,
33 add_history,
34 [HISTORY="yes"])
35
36 if test x"$READLINE" = "xyes" -a x"$HISTORY" = "xyes"; then
37 AC_DEFINE(READLINE, 1, [Define if GNU Readline is present.])
38 LIBS="-lreadline -lhistory $LIBS"
39 else
40 AC_MSG_WARN([Having GNU Readline is recommended.])
41 fi
42
43 dnl check for getopt_long
44 AC_CHECK_FUNC([getopt_long],
45 [GETOPT="y"],
46 [AC_MSG_ERROR(netrik requires getopt_long()!)])
47
48 dnl some options
49 AC_ARG_WITH(wget-call,
50 [AC_HELP_STRING([--with-wget-call="wget ..."],
51 [specify the command to call wget])],
52 [AC_DEFINE_UNQUOTED(WGET_CMD, ["$withval"], [Your command to call wget])],
53 [AC_DEFINE(WGET_CMD, ["wget -nv -O- '%s'"], [Default command to call wget])])
54
55 AC_ARG_ENABLE(debug,
56 [AC_HELP_STRING([--disable-debug],
57 [do not include debug options and sanity checks])])
58
59 AC_ARG_ENABLE(optimization,
60 [AC_HELP_STRING([[--enable-optimization[[[=LEVEL]]]]],
61 [use compiler optimization with -OLEVEL (default: -O2 if CFLAGS not set)])])
62
63 dnl process results
64 dnl define
65 if test x"$enable_debug" != "xno"; then
66 AC_DEFINE(DEBUG, 1,
67 [Define if debug options and sanity checks are desired.])
68 fi
69
70 dnl restore CFLAGS
71 CFLAGS="$CFLAGS_OLD"
72
73 dnl set default CFLAGS
74 if test -z "$CFLAGS_OLD" ; then
75 CFLAGS="$CFLAGS -g"
76
77 dnl set warning options for GCC
78 if test x"$GCC" = "xyes"; then
79 CFLAGS="$CFLAGS -W -Wall -Wstrict-prototypes -Wmissing-prototypes"
80 fi
81 fi
82
83 dnl adjust optimization options
84 case x"$enable_optimization" in
85 dnl option given but no argument specified
86 xyes)
87 CFLAGS="$CFLAGS -O2"
88 ;;
89
90 dnl chosen not to optimize
91 xno)
92 dnl use -O0 to make sure no optimization is performed
93 CFLAGS="$CFLAGS -O0"
94 ;;
95
96 dnl option not given
97 x)
98 dnl optimize if CFLAGS not specified
99 if test -z "$CFLAGS_OLD"; then
100 CFLAGS="$CFLAGS -O2"
101 fi
102 ;;
103
104 dnl argument given
105 *)
106 dnl use argument to optimize
107 CFLAGS="$CFLAGS -O${enable_optimization}"
108 ;;
109 esac
110
111 dnl generate Makefiles
112 AC_OUTPUT(Makefile doc/Makefile debian/Makefile)