Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / libio / stdio / configure.in
1 # This file is a shell script fragment that supplies the information
2 # necessary for a configure script to process the program in
3 # this directory.  For more information, look at ../configure.
4
5 configdirs=
6 srctrigger=stdio.h
7 srcname="libio/stdio"
8 package_makefile_frag=../Make.pack
9 package_makefile_rules_frag=../Make.pack.r
10
11 # per-host:
12
13 # per-target:
14
15 LIBDIR=yes
16 TO_TOPDIR=../../
17 ALL=nothing
18 MOSTLYCLEAN='*.o pic stamp-picdir core stdio.list'
19 (. ${srcdir}/../config.shared) >${package_makefile_frag} 2>${package_makefile_rules_frag}
20
21 # post-target:
22
23 # Certain files that are used to build a C library (such as fprintf.o)
24 # are compled from the same sources as the ioXXX versions (such as ioprintf.c).
25 # These lines add the appropriate rules.
26 # NOTE: We assume a C compiler that where -o with -c works.
27 # But these files are not built by default anyway ...
28
29 # TODO: remove rename tmpfile tmpnam
30
31 stdio_renames="fclose fflush fgetpos fgets fopen fprintf fputs fread \
32   fscanf fsetpos ftell fwrite getdelim gets perror printf puts \
33   scanf setbuffer setvbuf sprintf sscanf ungetc vsprintf vsscanf"
34 stdio_objects=""
35
36 for file in $stdio_renames ; do
37   cat >>Makefile <<EOF
38 $file.o: \$(srcdir)/../io$file.c
39         if [ -n "\$(PICFLAG)" ]; then \\
40           \$(CC_FOR_STDIO) \$(CFLAGS) \$(CINCLUDES) \$(PICFLAG) -c \\
41           \$(srcdir)/../io$file.c -D_IO_$file=$file -o pic/$file.o; \\
42         fi
43         \$(CC_FOR_STDIO) \$(CFLAGS) \$(CINCLUDES) -c \\
44           \$(srcdir)/../io$file.c -D_IO_$file=$file -o $file.o
45 EOF
46   stdio_objects="$stdio_objects $file.o"
47 done
48 sed -e "/STDIO_RENAMED_OBJECTS =/s/=.*/=${stdio_objects}/" <Makefile >tmp
49 mv -f tmp Makefile