File: configure.ac

package info (click to toggle)
netrik 1.16.1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 3,272 kB
  • ctags: 729
  • sloc: ansic: 6,657; sh: 994; makefile: 114
file content (113 lines) | stat: -rw-r--r-- 2,698 bytes parent folder | download
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
dnl initialize
AC_INIT(main.c)

dnl preserve initial CFLAGS - must come after AC_INIT or it isn't run!
CFLAGS_OLD="$CFLAGS"

VER=`head -1 $srcdir/README |sed 's/ *netrik \([[^ ]]*\).*/\1/'`
AM_INIT_AUTOMAKE(netrik, $VER)

dnl initialize config header
AM_CONFIG_HEADER(config.h)

dnl check for some essential programs
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET

dnl check for standard headers
AC_HEADER_STDC

dnl check for ncurses
AC_CHECK_LIB(ncursesw,
	     tparm,
	     [NCURSES="yes"],
	     AC_MSG_ERROR([ncursesw is absolutely required!]))

LIBS="-lncursesw $LIBS"

dnl check for readline
AC_CHECK_LIB(readline,
	    readline,
	    [READLINE="yes"])
AC_CHECK_LIB(history,
	    add_history,
	    [HISTORY="yes"])

if test x"$READLINE" = "xyes" -a x"$HISTORY" = "xyes"; then
  AC_DEFINE(READLINE, 1, [Define if GNU Readline is present.])
  LIBS="-lreadline -lhistory $LIBS"
else
  AC_MSG_WARN([Having GNU Readline is recommended.])
fi

dnl check for getopt_long
AC_CHECK_FUNC([getopt_long],
	      [GETOPT="y"],
	      [AC_MSG_ERROR(netrik requires getopt_long()!)])

dnl some options
AC_ARG_WITH(wget-call,
	    [AC_HELP_STRING([--with-wget-call="wget ..."],
			    [specify the command to call wget])],
	    [AC_DEFINE_UNQUOTED(WGET_CMD, ["$withval"], [Your command to call wget])],
	    [AC_DEFINE(WGET_CMD, ["wget -nv -O- '%s'"], [Default command to call wget])])

AC_ARG_ENABLE(debug,
	      [AC_HELP_STRING([--disable-debug],
			      [do not include debug options and sanity checks])])

AC_ARG_ENABLE(optimization,
	      [AC_HELP_STRING([[--enable-optimization[[[=LEVEL]]]]],
			      [use compiler optimization with -OLEVEL (default: -O2 if CFLAGS not set)])])

dnl process results
dnl define
if test x"$enable_debug" != "xno"; then
  AC_DEFINE(DEBUG, 1,
	    [Define if debug options and sanity checks are desired.])
fi

dnl restore CFLAGS
CFLAGS="$CFLAGS_OLD"

dnl set default CFLAGS
if test -z "$CFLAGS_OLD" ; then
  CFLAGS="$CFLAGS -g"

  dnl set warning options for GCC
  if test x"$GCC" = "xyes"; then
    CFLAGS="$CFLAGS -W -Wall -Wstrict-prototypes -Wmissing-prototypes"
  fi
fi

dnl adjust optimization options
case x"$enable_optimization" in
  dnl option given but no argument specified
  xyes)
    CFLAGS="$CFLAGS -O2"
    ;;

  dnl chosen not to optimize
  xno)
    dnl use -O0 to make sure no optimization is performed
    CFLAGS="$CFLAGS -O0"
    ;;

  dnl option not given
  x)
    dnl optimize if CFLAGS not specified
    if test -z "$CFLAGS_OLD"; then
      CFLAGS="$CFLAGS -O2"
    fi
    ;;

  dnl argument given
  *)
    dnl use argument to optimize
    CFLAGS="$CFLAGS -O${enable_optimization}"
    ;;
esac

dnl generate Makefiles
AC_OUTPUT(Makefile doc/Makefile)