File: configure.ac

package info (click to toggle)
lsmbox 2.0.0-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,796 kB
  • ctags: 1,327
  • sloc: ansic: 11,006; sh: 4,279; makefile: 494; yacc: 288; sed: 16
file content (167 lines) | stat: -rw-r--r-- 4,321 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
dnl Process this file with autoconf to produce a configure script.
AC_INIT([lsmbox],[2.0.0],[tao@acc.umu.se])
AC_PREREQ(2.59)

AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h])
AM_GNU_GETTEXT_VERSION(0.14.1)

dnl Check for programs.
AC_PROG_CC
AC_PROG_YACC
AC_PROG_MAKE_SET

dnl Check for UNIX variants.
AC_AIX
AC_GNU_SOURCE
AC_ISC_POSIX

AC_DEFUN([MP_CHECK_CURSES], [
if test "$with_curses" != no; then
  mp_save_LIBS="$LIBS"

  AC_CACHE_CHECK([for working ncurses], mp_cv_ncurses, [
    LIBS="$mp_save_LIBS -lncurses"
    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
      #include <ncurses.h>
    ]], [[
      chtype a;
      int b = A_STANDOUT, c = KEY_LEFT;
      initscr();
    ]])],[mp_cv_ncurses=yes],[mp_cv_ncurses=no])
  ])

  if test "$mp_cv_ncurses" = yes; then
    AC_DEFINE(HAVE_NCURSES_H, 1,
    	      [Define to 1 if you have ncurses installed])
    AC_DEFINE(HAVE_VW_PRINTW, 1,
    	      [Define to 1 if your curses supports vw_printw])
    USE_CURSES=1
  else
    AC_CACHE_CHECK([for working curses], mp_cv_curses, [
      LIBS="$mp_save_LIBS -lcurses -ltermcap"
      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
        #include <curses.h>
      ]], [[
        chtype a;
        int b = A_STANDOUT, c = KEY_LEFT;
        initscr();
      ]])],[mp_cv_curses=yes],[mp_cv_curses=no])
    ])

    if test "$mp_cv_curses" = yes; then
      AC_DEFINE(HAVE_CURSES_H, 1,
      		[Define to 1 if you have curses installed])
      USE_CURSES=1;
    else
      LIBS="$mp_save_LIBS"
    fi
  fi

  if test "$USE_CURSES" = 1; then
    AC_DEFINE(USE_CURSES, 1,
    	      [Define to 1 if you want to enable support for curses])
  fi
fi
])

dnl Options.
AC_ARG_WITH(curses,
	    [  --without-curses        do not build with curses support])

dnl Checks for header files.
AC_HEADER_STDC([])
AC_HEADER_TIME
AC_HEADER_DIRENT
AC_HEADER_STDBOOL
AC_HEADER_SYS_WAIT
dnl Only used by intl.
AC_CHECK_HEADERS([argz.h fcntl.h float.h inttypes.h langinfo.h libintl.h locale.h stdint.h stdio_ext.h])
dnl Important headers.
AC_CHECK_HEADERS([limits.h malloc.h stddef.h stdlib.h string.h strings.h sys/time.h unistd.h utime.h wchar.h])

dnl typedefs, structures, compiler specifics.
AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_TYPES([ptrdiff_t],, [AC_DEFINE_UNQUOTED(ptrdiff_t, int)])

dnl Check for library functions.
dnl These have work-arounds in lsmbox.c, or does not need workarounds.
AC_FUNC_FORK
AC_FUNC_UTIME_NULL
AC_FUNC_CLOSEDIR_VOID

dnl These have libobj-replacements.
AC_FUNC_STAT
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_REPLACE_FUNCS([strspn strcspn])

dnl These have work-arounds in lsmbox.h.
AC_CHECK_FUNCS([atexit memmove strchr strrchr utime])

dnl If any of these are missing, we're screwed,
dnl since these haven't been worked around in the code
AC_FUNC_VPRINTF
if test "$ac_cv_func_vprintf" != yes; then
  AC_MSG_ERROR([working vprintf() is needed to compile])
fi

AC_CHECK_FUNCS([memset strdup strerror strstr strtoul])
if test "$ac_cv_func_memset" != yes; then
  AC_MSG_ERROR(memset is needed to compile)
fi
if test "$ac_cv_func_strdup" != yes; then
  AC_MSG_ERROR(strdup is needed to compile)
fi
if test "$ac_cv_func_strerror" != yes; then
  AC_MSG_ERROR(strerror is needed to compile)
fi
if test "$ac_cv_func_strstr" != yes; then
  AC_MSG_ERROR(strstr is needed to compile)
fi
if test "$ac_cv_func_strtoul" != yes; then
  AC_MSG_ERROR(strtoul is needed to compile)
fi

dnl These are only used by intl and should thus be modified to just disable
dnl gettext-support if missing
AC_FUNC_MMAP
if test "$ac_cv_func_mmap_fixed_mapped" != yes; then
  AC_MSG_ERROR([working mmap() is needed to compile])
fi

AC_FUNC_ALLOCA
if test "$ac_cv_func_alloca_works" != yes; then
  AC_MSG_ERROR([working alloca() is needed to compile])
fi

AC_CHECK_FUNCS([nl_langinfo setlocale])
if test "$ac_cv_func_nl_langinfo" != yes; then
  AC_MSG_ERROR([working nl_langinfo() is needed to compile])
fi
if test "$ac_cv_func_setlocale" != yes; then
  AC_MSG_ERROR([working setlocale() is needed to compile])
fi

dnl Check for availability of curses/ncurses.
MP_CHECK_CURSES

dnl Internationalization macros.
AM_GNU_GETTEXT()

dnl Create makefiles.
AC_CONFIG_FILES([  intl/Makefile \
	Makefile \
	po/Makefile.in \
	man/Makefile \
	man/sv/Makefile \
	m4/Makefile \
	src/Makefile])
AC_OUTPUT

dnl configure.ac ends here.