summaryrefslogtreecommitdiff
path: root/autoconf/configure.in
blob: b82ff6aef599070db85bde6df7888489157331ca (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
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
dnl Process this file with autoconf to produce a configure script.

AC_INIT(src/main/version.c)

dnl We're using C.
dnl
AC_LANG_C

dnl Output a header file.
dnl
AC_CONFIG_HEADER(src/include/config.h:autoconf/header.in)

dnl Set directory to check for Configure scripts in.
dnl
AC_CONFIG_AUX_DIR(autoconf/scripts)

dnl Read in package details.
dnl
PACKAGE=`cat $srcdir/doc/PACKAGE`
VERSION=`cat $srcdir/doc/VERSION`
UCPACKAGE=`tr a-z A-Z < $srcdir/doc/PACKAGE`
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(UCPACKAGE)
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
AC_DEFINE_UNQUOTED(PROGRAM_NAME, "$PACKAGE")
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")

dnl Check for compile-time options.
dnl
AC_ARG_ENABLE(debugging,
  [  --enable-debugging      compile with debugging symbols],
  if test "$enable_debugging" = "yes"; then
  	CFLAGS="-g -Wall"
  fi
)
AC_ARG_ENABLE(profiling,
  [  --enable-profiling      compile with profiling support],
  if test "$enable_profiling" = "yes"; then
  	CFLAGS="-pg $CFLAGS"
  fi
)
LFS_SUPPORT="no"
AC_ARG_ENABLE(lfs, [  --disable-lfs           disable LFS support],
  if test "$enable_lfs" = "yes"; then
    LFS_SUPPORT="yes"
  fi,
  LFS_SUPPORT="yes"
)
STATIC_NLS="no"
AC_ARG_ENABLE(static-nls, [  --enable-static-nls     hardcode NLS with no support files],
  if test "$enable_static_nls" = "yes"; then
    STATIC_NLS="yes"
  fi,
  STATIC_NLS="no"
)
NLS_SUPPORT="no"
AC_ARG_ENABLE(nls, [  --disable-nls           do not use Native Language Support],
  if test "$enable_nls" = "yes"; then
    NLS_SUPPORT="yes"
  fi,
  NLS_SUPPORT="yes"
)
SPLICE_SUPPORT="no"
AC_ARG_ENABLE(splice, [  --disable-splice        do not use splice system call],
  if test "$enable_splice" = "yes"; then
    SPLICE_SUPPORT="yes"
  fi,
  SPLICE_SUPPORT="yes"
)

dnl Check for various programs.
dnl
CFLAGS=${CFLAGS:-"-O"}
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_CHECK_PROG(DO_GZIP, gzip, gzip -f9, touch)

dnl NLS stuff.
dnl
ALL_LINGUAS="de fr pl pt"
if test "$NLS_SUPPORT" = "yes"; then
  AC_DEFINE(ENABLE_NLS)
  AC_PATH_PROG(MSGFMT, msgfmt, NOMSGFMT)
  AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  AC_PATH_PROG(XGETTEXT, xgettext, xgettext)
  if test "x$MSGFMT" = "xNOMSGFMT"; then
    MSGFMT=""
    STATIC_NLS="yes"
  fi
  if test "$STATIC_NLS" = "yes"; then
    CATALOGS=""
    NLSOBJ="src/nls/table.o"
  else
    AC_CHECK_LIB(intl, main)
    AC_CHECK_LIB(i, main)
  fi
  CATOBJEXT=.mo
  INSTOBJEXT=.mo
  for lang in $ALL_LINGUAS; do
    GMOFILES="$GMOFILES $lang.gmo"
    POFILES="$POFILES \$(srcdir)/src/nls/$lang.po"
    CATALOGS="$CATALOGS src/nls/$lang$CATOBJEXT";
  done
  if test "$STATIC_NLS" = "yes"; then
    CATALOGS=""
  else
    AC_CHECK_FUNC(gettext,
     [AC_DEFINE(HAVE_GETTEXT)
      NLSOBJ=""
     ], [CATALOGS=""; NLSOBJ="src/nls/table.o"
     ]
    )
  fi
fi
AC_CHECK_HEADERS(libintl.h)
AC_CHECK_HEADERS(locale.h)
AC_SUBST(MSGFMT)
AC_SUBST(GMSGFMT)
AC_SUBST(XGETTEXT)
AC_SUBST(CATOBJEXT)
AC_SUBST(INSTOBJEXT)
AC_SUBST(GMOFILES)
AC_SUBST(POFILES)
AC_SUBST(CATALOGS)
AC_SUBST(NLSOBJ)

dnl Getopt checks.
dnl
AC_CHECK_FUNCS(getopt_long getopt)
AC_CHECK_HEADERS(getopt.h)

dnl LFS checks.
dnl
if test "$LFS_SUPPORT" = "yes"; then
  AC_CHECK_FUNCS(open64, AC_DEFINE(ENABLE_LARGEFILE))
fi

dnl Check for various header files and set various other macros.
dnl
AC_DEFINE(HAVE_CONFIG_H)
AC_HEADER_STDC
AC_CHECK_FUNCS(memcpy basename snprintf stat64)
AC_CHECK_HEADERS(limits.h sys/ipc.h sys/param.h libgen.h)

if test "$SPLICE_SUPPORT" = "yes"; then
  AC_CHECK_FUNCS(splice)
fi

test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
AC_SUBST(INSTALL_DATA)

dnl Fudging for separate build directories.
dnl
subdirs=""
for i in `find $srcdir/src -type d -print | sed s,$srcdir/,,`; do
  subdirs="$subdirs $i"
done

dnl Stitch together the Makefile fragments.
dnl
mk_segments="autoconf/Makefile.in"
for i in vars.mk package.mk filelist.mk~ unreal.mk modules.mk~ \
         rules.mk link.mk depend.mk~; do
  mk_segments="$mk_segments:autoconf/make/$i"
done

dnl Output files (and create build directory structure too).
dnl
AC_OUTPUT(Makefile:$mk_segments doc/lsm:doc/lsm.in
          doc/quickref.1:doc/quickref.1.in
          doc/$PACKAGE.spec:doc/spec.in
          src/.dummy:doc/NEWS,
  rm -f src/.dummy
  for i in $subdirs; do
    test -d $i || mkdir $i
  done
, subdirs="$subdirs")

dnl EOF