98f9adb56fe5a80e86b4abd4c045b3c7a643a1ef
[openafs.git] / src / cf / sysname.m4
1 AC_DEFUN([OPENAFS_SYSNAME],[
2 if test "x$with_afs_sysname" != "x"; then
3         AFS_SYSNAME="$with_afs_sysname"
4 else
5         AC_MSG_CHECKING(your AFS sysname)
6         case $host in
7                 i?86-*-openbsd?.?)
8                         v=${host#*openbsd}
9                         vM=${v%.*}
10                         vm=${v#*.}
11                         AFS_SYSNAME="i386_obsd${vM}${vm}"
12                         ;;
13                 sparc64-*-openbsd?.?)
14                         v=${host#*openbsd}
15                         vM=${v%.*}
16                         vm=${v#*.}
17                         AFS_SYSNAME="sparc64_obsd${vM}${vm}"
18                         ;;
19                 x86_64-*-openbsd?.?)
20                         v=${host#*openbsd}
21                         vM=${v%.*}
22                         vm=${v#*.}
23                         AFS_SYSNAME="amd64_obsd${vM}${vm}"
24                         ;;
25                 i?86-*-freebsd*.*)
26                         v=${host#*freebsd}
27                         vM=${v%.*}
28                         vm=${v#*.}
29                         AFS_SYSNAME="i386_fbsd_${vM}${vm}"
30                         ;;
31                 x86_64-*-freebsd*.*)
32                         v=${host#*freebsd}
33                         vM=${v%.*}
34                         vm=${v#*.}
35                         AFS_SYSNAME="amd64_fbsd_${vM}${vm}"
36                         ;;
37                 i386-*-dragonfly?.*)
38                         v=${host#*dragonfly}
39                         vM=${v%.*}
40                         vm=${v#*.}
41                         AFS_SYSNAME="i386_dfbsd_${vM}${vm}"
42                         ;;
43                 i?86-*-netbsd*1.6[[M-Z]]*)
44                         AFS_SYSNAME="i386_nbsd20"
45                         ;;
46                 powerpc-*-netbsd*1.6[[M-Z]]*)
47                         AFS_SYSNAME="ppc_nbsd20"
48                         ;;
49                 *-*-netbsd*)
50                         arch=${host%%-unknown*}
51                         arch=$(echo $arch |sed -e 's/x86_64/amd64/g' \
52                                                -e 's/powerpc/ppc/g')
53                         v=${host#*netbsd}
54                         v=${v#*aout}
55                         v=${v#*ecoff}
56                         v=${v#*elf}
57                         vM=${v%%.*}
58                         vM=${vM%.*}
59                         v=${v#*.}
60                         vm=${v%%.*}
61                         vm=${vm%.*}
62                         vm=${vm%%[[_A-Z]]*}
63                         if test $vm -eq 99 ; then
64                                 vM=$((vM+1))
65                         fi
66                         if test $vM -gt 1 ; then
67                                 vm=0
68                         fi
69                         AFS_SYSNAME="${arch}_nbsd${vM}${vm}"
70                         ;;
71                 hppa*-hp-hpux11.0*)
72                         AFS_SYSNAME="hp_ux110"
73                         ;;
74                 hppa*-hp-hpux11.11)
75                         AFS_SYSNAME="hp_ux11i"
76                         ;;
77                 hppa*-hp-hpux11.23)
78                         AFS_SYSNAME="hp_ux1123"
79                         ;;
80                 ia64-hp-hpux11.22)
81                         AFS_SYSNAME="ia64_hpux1122"
82                         ;;
83                 ia64-hp-hpux*)
84                         AFS_SYSNAME="ia64_hpux1123"
85                         ;;
86                 hppa*-hp-hpux10*)
87                         AFS_SYSNAME="hp_ux102"
88                         ;;
89                 powerpc-apple-darwin7*)
90                         AFS_SYSNAME="ppc_darwin_70"
91                         OSXSDK="macosx10.3"
92                         ;;
93                 powerpc-apple-darwin8.*)
94                         AFS_SYSNAME="ppc_darwin_80"
95                         OSXSDK="macosx10.4"
96                         ;;
97                 i386-apple-darwin8.*)
98                         AFS_SYSNAME="x86_darwin_80"
99                         OSXSDK="macosx10.4"
100                         ;;
101                 powerpc-apple-darwin9.*)
102                         AFS_SYSNAME="ppc_darwin_90"
103                         OSXSDK="macosx10.5"
104                         ;;
105                 i386-apple-darwin9.*)
106                         AFS_SYSNAME="x86_darwin_90"
107                         OSXSDK="macosx10.5"
108                         ;;
109                 i?86-apple-darwin10.*)
110                         AFS_SYSNAME="x86_darwin_100"
111                         OSXSDK="macosx10.6"
112                         ;;
113                 x86_64-apple-darwin10.*)
114                         AFS_SYSNAME="x86_darwin_100"
115                         OSXSDK="macosx10.6"
116                         ;;
117                 arm-apple-darwin10.*)
118                         AFS_SYSNAME="arm_darwin_100"
119                         OSXSDK="iphoneos4.0"
120                         ;;
121                 x86_64-apple-darwin11.*)
122                         AFS_SYSNAME="x86_darwin_110"
123                         OSXSDK="macosx10.7"
124                         ;;
125                 i?86-apple-darwin11.*)
126                         AFS_SYSNAME="x86_darwin_110"
127                         OSXSDK="macosx10.7"
128                         ;;
129                 x86_64-apple-darwin12.*)
130                         AFS_SYSNAME="x86_darwin_120"
131                         OSXSDK="macosx10.8"
132                         ;;
133                 i?86-apple-darwin12.*)
134                         AFS_SYSNAME="x86_darwin_120"
135                         OSXSDK="macosx10.8"
136                         ;;
137                 x86_64-apple-darwin13.*)
138                         AFS_SYSNAME="x86_darwin_130"
139                         OSXSDK="macosx10.9"
140                         ;;
141                 i?86-apple-darwin13.*)
142                         AFS_SYSNAME="x86_darwin_130"
143                         OSXSDK="macosx10.9"
144                         ;;
145                 x86_64-apple-darwin14.*)
146                         AFS_SYSNAME="x86_darwin_140"
147                         OSXSDK="macosx10.10"
148                         ;;
149                 i?86-apple-darwin14.*)
150                         AFS_SYSNAME="x86_darwin_140"
151                         OSXSDK="macosx10.10"
152                         ;;
153                 x86_64-apple-darwin15.*)
154                         AFS_SYSNAME="x86_darwin_150"
155                         OSXSDK="macosx10.11"
156                         ;;
157                 i?86-apple-darwin15.*)
158                         AFS_SYSNAME="x86_darwin_150"
159                         OSXSDK="macosx10.11"
160                         ;;
161                 x86_64-apple-darwin16.*)
162                         AFS_SYSNAME="x86_darwin_160"
163                         OSXSDK="macosx10.12"
164                         ;;
165                 i?86-apple-darwin16.*)
166                         AFS_SYSNAME="x86_darwin_160"
167                         OSXSDK="macosx10.12"
168                         ;;
169                 x86_64-apple-darwin17.*)
170                         AFS_SYSNAME="x86_darwin_170"
171                         OSXSDK="macosx10.13"
172                         ;;
173                 i?86-apple-darwin17.*)
174                         AFS_SYSNAME="x86_darwin_170"
175                         OSXSDK="macosx10.13"
176                         ;;
177                 x86_64-apple-darwin18.*)
178                         AFS_SYSNAME="x86_darwin_180"
179                         OSXSDK="macosx10.14"
180                         ;;
181                 i?86-apple-darwin18.*)
182                         AFS_SYSNAME="x86_darwin_180"
183                         OSXSDK="macosx10.14"
184                         ;;
185                 sparc-sun-solaris2.8)
186                         AFS_SYSNAME="sun4x_58"
187                         ;;
188                 sparc-sun-solaris2.9)
189                         AFS_SYSNAME="sun4x_59"
190                         ;;
191                 sparc-sun-solaris2.10)
192                         AFS_SYSNAME="sun4x_510"
193                         ;;
194                 sparc-sun-solaris2.11)
195                         AFS_SYSNAME="sun4x_511"
196                         ;;
197                 i386-pc-solaris2.8)
198                         AFS_SYSNAME="sunx86_58"
199                         ;;
200                 i386-pc-solaris2.9)
201                         AFS_SYSNAME="sunx86_59"
202                         ;;
203                 i386-pc-solaris2.10)
204                         AFS_SYSNAME="sunx86_510"
205                         ;;
206                 i386-pc-solaris2.11)
207                         AFS_SYSNAME="sunx86_511"
208                         ;;
209                 mips-sgi-irix6.5)
210                         AFS_SYSNAME="sgi_65"
211                         enable_pam="no"
212                         ;;
213                 ia64-*-linux*)
214                         AFS_SYSNAME="ia64_linuxXX"
215                         ;;
216                 powerpc-*-linux*)
217                         AFS_SYSNAME="`/bin/arch`_linuxXX"
218                         ;;
219                 powerpc64-*-linux*)
220                         AFS_SYSNAME="ppc64_linuxXX"
221                         ;;
222                 alpha*-linux*)
223                         AFS_SYSNAME="alpha_linux_XX"
224                         ;;
225                 s390-*-linux*)
226                         AFS_SYSNAME="s390_linuxXX"
227                         ;;
228                 s390x-*-linux*)
229                         AFS_SYSNAME="s390x_linuxXX"
230                         ;;
231                 sparc-*-linux*)
232                         AFS_SYSNAME="`/bin/arch`_linuxXX"
233                         ;;
234                 sparc64-*-linux*)
235                         AFS_SYSNAME="sparc64_linuxXX"
236                         ;;
237                 i?86-*-linux*)
238                         AFS_SYSNAME="i386_linuxXX"
239                         ;;
240                 arm*-linux*)
241                         AFS_SYSNAME="arm_linuxXX"
242                         ;;
243                 aarch64*-linux*)
244                         AFS_SYSNAME="arm64_linuxXX"
245                         ;;
246                 parisc-*-linux-gnu|hppa-*-linux-gnu)
247                         AFS_SYSNAME="parisc_linuxXX"
248                         enable_pam="no"
249                         ;;
250                 power*-ibm-aix4.2*)
251                         AFS_SYSNAME="rs_aix42"
252                         enable_pam="no"
253                         ;;
254                 power*-ibm-aix4.3*)
255                         AFS_SYSNAME="rs_aix42"
256                         enable_pam="no"
257                         ;;
258                 power*-ibm-aix5.1*)
259                         AFS_SYSNAME="rs_aix51"
260                         enable_pam="no"
261                         ;;
262                 power*-ibm-aix5.2*)
263                         AFS_SYSNAME="rs_aix52"
264                         enable_pam="no"
265                         ;;
266                 power*-ibm-aix5.3*)
267                         AFS_SYSNAME="rs_aix53"
268                         enable_pam="no"
269                         ;;
270                 power*-ibm-aix6.1*)
271                         AFS_SYSNAME="rs_aix61"
272                         enable_pam="no"
273                         ;;
274                 x86_64-*-linux-gnu)
275                         AFS_SYSNAME="amd64_linuxXX"
276                         enable_pam="yes"
277                         ;;
278                 *)
279                         AC_MSG_ERROR(An AFS sysname is required)
280                         exit 1
281                         ;;
282         esac
283         case $AFS_SYSNAME in
284                 *_linux* | *_umlinux*)
285                         if test "x${AFS_SYSKVERS}" = "x"; then
286                          AC_MSG_ERROR(Couldn't guess your Linux version. Please use the --with-afs-sysname option to configure an AFS sysname.)
287                         fi
288                         if test "x${AFS_SYSKVERS}" = "x24" ||
289                                 test "x${AFS_SYSKVERS}" = "x22"; then
290                             AC_MSG_ERROR([Linux 2.4.x and older are no longer supported by OpenAFS.  Please use an OpenAFS 1.6.x release on those systems.])
291                         fi
292                         _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
293                         AFS_SYSNAME="$_AFS_SYSNAME"
294                         AC_TRY_KBUILD(
295                          [],
296                          [#ifndef CONFIG_USERMODE
297                           #error not UML
298                           #endif],
299                          ac_cv_linux_is_uml=yes,)
300                         if test "${ac_cv_linux_is_uml}" = yes; then
301                          _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/linux/umlinux/`
302                         fi
303                         AFS_SYSNAME="$_AFS_SYSNAME"
304                         ;;
305         esac
306         AC_MSG_RESULT($AFS_SYSNAME)
307 fi
308
309 case $AFS_SYSNAME in
310         *_darwin*)
311                 AC_CHECK_HEADERS(crt_externs.h)
312                 DARWIN_PLIST=src/libafs/afs.${AFS_SYSNAME}.plist
313                 DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
314                 AC_SUBST(OSXSDK)
315                 ;;
316 esac
317
318 dnl Some hosts have a separate common param file they should include.  Figure
319 dnl out if we're on one of them now that we know the sysname.
320 case $AFS_SYSNAME in
321     *_nbsd15)   AFS_PARAM_COMMON=param.nbsd15.h  ;;
322     *_nbsd16)   AFS_PARAM_COMMON=param.nbsd16.h  ;;
323     *_nbsd20)   AFS_PARAM_COMMON=param.nbsd20.h  ;;
324     *_nbsd21)   AFS_PARAM_COMMON=param.nbsd21.h  ;;
325     *_nbsd30)   AFS_PARAM_COMMON=param.nbsd30.h  ;;
326     *_nbsd40)   AFS_PARAM_COMMON=param.nbsd40.h  ;;
327     *_nbsd50)   AFS_PARAM_COMMON=param.nbsd50.h  ;;
328     *_nbsd60)   AFS_PARAM_COMMON=param.nbsd60.h  ;;
329     *_nbsd70)   AFS_PARAM_COMMON=param.nbsd70.h  ;;
330     *_obsd31)   AFS_PARAM_COMMON=param.obsd31.h  ;;
331     *_obsd32)   AFS_PARAM_COMMON=param.obsd32.h  ;;
332     *_obsd33)   AFS_PARAM_COMMON=param.obsd33.h  ;;
333     *_obsd34)   AFS_PARAM_COMMON=param.obsd34.h  ;;
334     *_obsd35)   AFS_PARAM_COMMON=param.obsd35.h  ;;
335     *_obsd36)   AFS_PARAM_COMMON=param.obsd36.h  ;;
336     *_obsd37)   AFS_PARAM_COMMON=param.obsd37.h  ;;
337     *_obsd38)   AFS_PARAM_COMMON=param.obsd38.h  ;;
338     *_obsd39)   AFS_PARAM_COMMON=param.obsd39.h  ;;
339     *_obsd40)   AFS_PARAM_COMMON=param.obsd40.h  ;;
340     *_obsd41)   AFS_PARAM_COMMON=param.obsd41.h  ;;
341     *_obsd42)   AFS_PARAM_COMMON=param.obsd42.h  ;;
342     *_obsd43)   AFS_PARAM_COMMON=param.obsd43.h  ;;
343     *_obsd44)   AFS_PARAM_COMMON=param.obsd44.h  ;;
344     *_obsd45)   AFS_PARAM_COMMON=param.obsd45.h  ;;
345     *_obsd46)   AFS_PARAM_COMMON=param.obsd46.h  ;;
346     *_obsd47)   AFS_PARAM_COMMON=param.obsd47.h  ;;
347     *_obsd48)   AFS_PARAM_COMMON=param.obsd48.h  ;;
348     *_obsd49)   AFS_PARAM_COMMON=param.obsd49.h  ;;
349     *_obsd50)   AFS_PARAM_COMMON=param.obsd50.h  ;;
350     *_obsd51)   AFS_PARAM_COMMON=param.obsd51.h  ;;
351     *_obsd52)   AFS_PARAM_COMMON=param.obsd52.h  ;;
352     *_obsd53)   AFS_PARAM_COMMON=param.obsd53.h  ;;
353     *_obsd54)   AFS_PARAM_COMMON=param.obsd54.h  ;;
354     *_linux26)  AFS_PARAM_COMMON=param.linux26.h ;;
355 # Linux alpha adds an extra underscore for no good reason.
356     *_linux_26) AFS_PARAM_COMMON=param.linux26.h ;;
357     *_fbsd_*)   AFS_PARAM_COMMON=param.generic_fbsd.h ;;
358 esac
359 ])